Skip to main content
Glama
Aseprite MCP Pro Max

Aseprite MCP Pro Max

run_lua_script

Execute custom Aseprite Lua scripts in batch mode for tasks no dedicated tool covers, such as procedural effects; print output to verify and call saveAs to persist changes.

Instructions

Execute arbitrary Aseprite Lua code in batch mode (last resort).

Reach for a dedicated tool first: draw_rows / read_rows to place and read pixels as text, draw_text for numbers and labels, replace_color or remap_colors_in_cel_range to recolour, export_animation or export_tag for GIFs, compare_frames and get_bounds to measure motion, view_sprite to look. Use Lua only for what none of them covers, such as a custom procedural effect. The full API is documented at https://www.aseprite.org/api/.

Essentials for batch-mode scripts:

  • When filename is given, it is opened first and available as app.activeSprite.

  • Changes are NOT saved automatically; call spr:saveAs(spr.filename) at the end if you modified the sprite.

  • print() is the only way to return data; a clean exit does not mean your logic succeeded, so print what you need to verify.

  • Coordinates on cel images are cel-local: offset sprite-global coordinates by cel.position before getPixel/putPixel.

WARNING: this executes unrestricted code (including io/os access) on the host running Aseprite. Only pass scripts you trust.

Args: script: Lua source code to execute filename: Optional Aseprite file to open before running

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "script": "<script>"
    },
    "name": "run_lua_script"
  }
}

Input Schema

NameRequiredDescriptionDefault
scriptYes
filenameNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.1.0

TDQS

A4.9/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden and does so: it discloses unrestricted code execution including io/os host access, that changes are not auto-saved and require spr:saveAs, that print() is the only return channel and clean exit does not imply success, and that cel coordinates are cel-local. These are exactly the non-obvious behavioral traits an agent would otherwise get wrong.

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?

The safety warning and the routing list are front-loaded, and the bulleted 'Essentials' block is scannable rather than prose. The closing 'Args:' section restates parameter names already present in the schema, a minor duplication, but the added semantics there justify its presence.

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

Completeness5/5

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

For a 2-param escape-hatch tool with no output schema, the description covers invocation, return-data mechanism (print), persistence semantics (saveAs), coordinate semantics, and security posture. Nothing an agent needs to call it safely and correctly is missing.

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

Parameters5/5

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

Schema coverage is 0% (both params have only bare titles), so the description must compensate and does: 'script' is defined as Lua source to execute, and 'filename' is explained as an optional file opened first and exposed as app.activeSprite. That second detail is behaviorally significant and appears nowhere in the 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 and resource ('Execute arbitrary Aseprite Lua code in batch mode') and immediately positions it as a last resort against named siblings such as draw_rows, replace_color, and export_animation. An agent can distinguish it from every listed alternative without opening a schema.

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

Usage Guidelines5/5

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

Explicit when-to-use routing is given: 'Reach for a dedicated tool first' followed by a mapping of tasks to alternative tools (pixels, text, recolour, export, measurement, viewing). It also states the positive condition for using this tool — 'only for what none of them covers, such as a custom procedural effect' — leaving nothing to inference.

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

Deploy Server

Other Tools