run_lua

Run a Lua 5.4 script against a document (sandboxed: io / os / app.fs / file loading and saving only inside allow_paths, everything else is denied; 128 MB memory, 10 s by default, timeout_seconds 1-120 raises the time and the instruction budget with it; source up to 16 MiB) as ONE undo step; if it...

SERVERPixmith SOURCEpixmith-mcp
High RISK CLASS
Category Execute
Parameters 70 required
Recommended Rate-limitedsee the rule below
Registry record Grade F, identity unverified Pull the record →

This record as markdown: /tools/pixmith-mcp/run-lua.md

What run_lua does on Pixmith

AI agents invoke run_lua to trigger actions in Pixmith. What it does depends on the arguments the agent supplies, and its effects often reach beyond the immediate call: builds kicked off, notifications sent, workflows started.

ParameterTypeRequiredDescription
doc string — Document id (see doc_list); optional when only one document is open.
code string — Alias of `source`.
path string — A .lua file to run instead of `source`.
script string — Alias of `source`.
source string — Lua source code (up to 16 MiB).
allow_paths array — Folders (or files) the script may read and write with io / os / app.fs / Image{fromFile} / app.open / saveAs. Everything else is denied (there is nobody to ask)
timeout_seconds integer — Time limit in seconds, 1-120 (default 10). The instruction budget grows in proportion.

Parameters from the server's own tool schema.

Why run_lua is rated High

run_lua triggers real processes with real consequences. An agent gone sideways doesn't fire it once. It starts dozens of builds, sends mass notifications, or burns through compute before anyone looks up.

Risk signalsAccepts freeform code/query input (script) · Accepts file system path (path) · Bulk/mass operation — affects multiple targets · Admin/system-level operation

Questions about run_lua

What does the run_lua tool do? +

Run a Lua 5.4 script against a document (sandboxed: io / os / app.fs / file loading and saving only inside allow_paths, everything else is denied; 128 MB memory, 10 s by default, timeout_seconds 1-120 raises the time and the instruction budget with it; source up to 16 MiB) as ONE undo step; if it raises an error the document is left unchanged. The script sees sprite (pixels, layers, frames, cels, tags, slices, tilesets, selection, palette, user data), app and color; print() and app.alert() output is returned. NOTE: in Lua, layers/frames/tags are 1-based (layer 1 = bottom) while pixel coordinates and palette indices are 0-based; sprite.activeLayer/activeFrame are the document's active layer/frame. Files: with allow_paths (folders inside --root or an --allow-dir) a script can read images and sprites (Image{ fromFile=... }, Sprite{ fromFile=... }, app.open(path)) and write files; the script can see only ITS document plus the sprites it opens or creates itself (app.sprites lists exactly those): documents open in this server or in the Pixmith app are NOT visible to it, so doc_save (copy=true) the other document into an allowed folder and app.open it, or move pixels with clipboard / cel copy. Sprites a script creates or opens come back as new headless documents. Read the full API with the help tool (topic lua_api) or the pixmith://docs/lua-api resource. Give source (aliases: script, code) or a .lua path. It is categorised as a Execute tool in the Pixmith MCP Server, which means it can trigger actions or run processes. Use rate limits and argument validation.

What parameters does run_lua accept? +

run_lua accepts 7 parameters: doc, code, path, script, source, allow_paths, timeout_seconds. The full parameter table on this page comes from the server's own tool schema.

How do I enforce a policy on run_lua? +

Register the Pixmith MCP server in PolicyLayer and add a rule for run_lua: allow, deny, rate-limit, or require approval. Point your MCP client at the PolicyLayer proxy URL and the rule is enforced on every call, before it reaches Pixmith. Nothing to install.

What risk level is run_lua? +

run_lua is a Execute tool with high risk. Execute tools should be rate-limited and have argument validation enabled.

Can I rate-limit run_lua? +

Yes. Add a rate_limit block to the run_lua rule in your PolicyLayer policy. For example, setting max: 10 and window: 60 limits the tool to 10 calls per minute. Rate limits are tracked per agent session and reset automatically.

How do I block run_lua completely? +

Set action: deny in the PolicyLayer policy for run_lua. The AI agent will receive a policy violation error and cannot call the tool. You can also include a reason field to explain why the tool is blocked.

What MCP server provides run_lua? +

run_lua is provided by the Pixmith MCP server (pixmith-mcp). PolicyLayer sits as a proxy in front of this server to enforce policies before tool calls reach the server.

More on Pixmith, and thousands of servers like it.

// THE MCP REGISTRY

PolicyLayer tracks 44,603 MCP servers and 515,000+ tools.

Every server has a live record: who publishes it, whether it answers without auth, its risk grade, every tool classified, the recommended policy. This page is one line of Pixmith's. Pull the full record:

Teams ship this data inside their own products. See what a licence covers →

// GET IN TOUCH

Have a question or want to learn more? Send us a message.

Message sent.

We'll get back to you soon.