Skip to main content
Glama
ext-sakamoro

Aseprite MCP Tools

by ext-sakamoro

draw_pixels

Modify Aseprite files by drawing individual pixels with specific colors using hex codes, enabling precise pixel art creation and editing.

Instructions

Draw pixels on the canvas with specified colors.

Args: filename: Name of the Aseprite file to modify pixels: List of pixel data, each containing: {"x": int, "y": int, "color": str} where color is a hex code like "#FF0000"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameYes
pixelsYes

Implementation Reference

  • The `draw_pixels` handler function, which validates inputs, builds a Lua script using `LuaBuilder`, and executes it on an Aseprite file.
    @mcp.tool()
    async def draw_pixels(filename: str, pixels: List[Dict[str, Any]]) -> str:
        """Draw pixels on the canvas with specified colors.
    
        Args:
            filename: Name of the Aseprite file to modify
            pixels: List of pixel data, each containing:
                {"x": int, "y": int, "color": str}
                where color is a hex code like "#FF0000"
        """
        try:
            # Validate inputs
            file_path = validate_file_path(filename, must_exist=True)
            
            if not pixels:
                raise ValidationError("pixels", pixels, "Pixel list cannot be empty")
            
            # Build Lua script
            builder = LuaBuilder()
            builder.add_line('local spr = app.activeSprite')
            builder.if_condition('not spr')
            builder.add_line('error("No active sprite")')
            builder.end_if()
            builder.add_line()
            
            builder.begin_transaction()
            builder.add_line('local cel = app.activeCel')
            builder.if_condition('not cel')
            builder.add_comment('If no active cel, create one')
            builder.add_line('app.activeLayer = spr.layers[1]')
            builder.add_line('app.activeFrame = spr.frames[1]')
            builder.add_line('cel = app.activeCel')
            builder.if_condition('not cel')
            builder.add_line('error("No active cel and couldn\'t create one")')
            builder.end_if()
            builder.end_if()
            builder.add_line()
            
            # Use the efficient batch pixel drawing
            builder.draw_pixels(pixels)
            builder.end_transaction()
            builder.save_sprite()
            
            # Execute script
            cmd = get_command()
            success, output = cmd.execute_lua_script(builder.build(), str(file_path))
            
            return f"Pixels drawn successfully in {file_path}"
            
        except (ValidationError, AsepriteError) as e:
            return f"Failed to draw pixels: {e}"
        except Exception as e:
            return f"Unexpected error: {e}"

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.5/5.0
Behavior2/5

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

No annotations provided, so description must carry full burden. It fails to disclose whether pixels overwrite or blend, what happens with out-of-bounds coordinates, or if any prerequisites exist. The description is too minimal for a mutation tool.

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

Conciseness5/5

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

Extremely concise: one sentence for purpose followed by a clean Args list. No unnecessary words, and the structure is front-loaded and scannable.

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

Completeness3/5

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

For a simple 2-parameter tool with no output schema, the description covers parameter usage adequately. However, it lacks behavioral context (e.g., layer interaction, result feedback) that would help an agent use it correctly in complex workflows.

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

Parameters4/5

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

Despite 0% schema coverage, the description clearly documents both parameters, including the expected structure for pixels (x, y, color with hex format). This adds significant value beyond the schema's bare titles.

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?

The description clearly states it draws pixels on a canvas with specified colors, using a verb and resource. It distinguishes from siblings like draw_circle or draw_line by specifying it draws individual pixels from a list.

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus alternatives like draw_pixels_at or draw_line. Missing context on when it's appropriate to use pixel-level drawing.

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