Skip to main content
Glama

run_lua

Execute Lua code within Aseprite to automate sprite editing and animation tasks with full API access. Returns results as JSON.

Instructions

Runs Lua code inside Aseprite with the full scripting API (app, Sprite, Image, Layer, Color, ...). Globals: args (your args object), sprite (resolved sprite or app.sprite), MCP (helper runtime: MCP.color(), MCP.layer(spr, ref), MCP.sprite_info(spr) ...). print output is captured. The return value is sent back as JSON. Use api_docs for the API reference.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argsNoValues available to the code as `args`
codeYesLua source. Use `return` to send a value back.
saveNoBatch mode: write changes back to the sprite file (default true)
spriteNoFile path, open tab title, or sprite id. Defaults to the active sprite (live). Batch mode needs a file path.
backendNoauto (default): live Aseprite if connected, else headless batch
mutatesNoBatch mode: false skips saving the sprite afterwards (default true)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.1

TDQS

A3.9/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations are thin (readOnlyHint=false, destructiveHint=false), and the description adds real behavioral context beyond them: globals injected into the sandbox (`args`, `sprite`, `MCP`), that `print` is captured, and that the `return` value is serialized back as JSON. It does not warn about the safety profile of executing arbitrary code that can persist changes to sprite files, which is the one gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Dense and front-loaded: the core action leads, followed by a compact enumeration of injected globals and output behavior. Every sentence earns its place, though the parenthetical '(...) ' style elision slightly reduces precision.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description correctly compensates by explaining that `print` output is captured and the `return` value is sent back as JSON. Given the tool's complexity and the schema's own coverage of backends and save semantics, this is close to complete, missing only guidance on live vs batch pitfalls.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already explains code, args, save, sprite, backend, and mutates in detail; the description adds only the mapping between the `args` parameter and the `args` global. That is a marginal addition over structured data, which is the baseline for a fully documented schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb+resource ('Runs Lua code inside Aseprite') and immediately scopes it by naming the scripting surface (app, Sprite, Image, Layer, Color) so an agent can distinguish it from dedicated siblings like draw_pixels or add_layer. It also names the companion tool api_docs, making its place in the toolset unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It explicitly routes the agent to api_docs for the API reference, which is a useful pointer, but it never says when to reach for run_lua versus run_command, use_tool, or cli, nor does it say to prefer dedicated tools where they exist. Usage is implied by the 'full scripting API' framing rather than stated as guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.