Skip to main content
Glama
ext-sakamoro

Aseprite MCP Tools

by ext-sakamoro

add_layer

Create a new layer in an Aseprite file to organize pixel art elements, enabling structured editing and composition.

Instructions

Add a new layer to the Aseprite file.

Args: filename: Name of the Aseprite file to modify layer_name: Name of the new layer

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameYes
layer_nameYes

Implementation Reference

  • The 'add_layer' function is defined as an MCP tool, handling the logic of adding a layer to an Aseprite file using LuaBuilder.
    async def add_layer(filename: str, layer_name: str) -> str:
        """Add a new layer to the Aseprite file.
    
        Args:
            filename: Name of the Aseprite file to modify
            layer_name: Name of the new layer
        """
        try:
            log_operation("add_layer", filename, layer_name=layer_name)
            
            # Validate inputs
            file_path = validate_file_path(filename, must_exist=True)
            layer_name = validate_layer_name(layer_name)
            
            # 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.create_layer(layer_name)
            builder.end_transaction()
            builder.save_sprite()
            
            # Execute script
            cmd = get_command()
            success, output = cmd.execute_lua_script(builder.build(), str(file_path))
            
            logger.info(f"Layer added successfully", file=str(file_path), layer=layer_name)
            return f"Layer '{layer_name}' added successfully to {file_path}"
            
        except (ValidationError, AsepriteError) as e:
            log_error(f"Failed to add layer", e, "add_layer", filename=filename, layer_name=layer_name)
            return f"Failed to add layer: {e}"
        except Exception as e:
            log_error(f"Unexpected error in add_layer", e, "add_layer", filename=filename)
            return f"Unexpected error: {e}"
  • The 'add_layer' function is registered as an MCP tool using the @mcp.tool() decorator.
    @mcp.tool()
    async def add_layer(filename: str, layer_name: str) -> str:
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states this is a modification ('modify'), implying mutation, but doesn't disclose behavioral traits like whether it overwrites existing layers, requires specific file formats, handles errors, or returns confirmation. For a mutation tool with zero annotation coverage, this is a significant 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?

The description is appropriately sized and front-loaded: the first sentence states the purpose clearly, followed by a structured 'Args:' section. Every sentence earns its place, though the parameter explanations could be slightly more informative without losing conciseness.

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

Completeness2/5

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

Given the tool's complexity (mutation with 2 parameters), lack of annotations, and no output schema, the description is incomplete. It doesn't explain what happens after adding the layer (e.g., success confirmation, error handling), nor does it cover edge cases or dependencies, making it inadequate for safe use.

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 0%, so the description must compensate. It lists both parameters ('filename' and 'layer_name') with brief explanations, adding meaning beyond the schema's bare titles. However, it doesn't provide details like file path formats, layer name constraints, or examples, leaving gaps in understanding.

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

Purpose4/5

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

The description clearly states the action ('Add a new layer') and the target resource ('to the Aseprite file'), making the purpose immediately understandable. It distinguishes from siblings like 'add_frame' by specifying the layer resource type. However, it doesn't explicitly contrast with other layer-related tools (none in the sibling list), so it's not a perfect 5.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., file must exist), exclusions, or comparisons with sibling tools like 'create_canvas' or 'export_layers'. The user must infer usage from the purpose alone.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ext-sakamoro/AsepriteMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server