Skip to main content
Glama
ext-sakamoro

Aseprite MCP Tools

by ext-sakamoro

remap_colors

Modify color schemes in Aseprite pixel art files by mapping specific colors to new values for consistent palette adjustments.

Instructions

Remap colors in an Aseprite file.

Args: filename: Name of the Aseprite file to modify color_map: Dictionary mapping old colors to new colors (e.g., {"FF0000": "00FF00"})

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameYes
color_mapYes

Implementation Reference

  • The remap_colors tool implementation which performs color mapping using Aseprite scripting.
    async def remap_colors(
        filename: str,
        color_map: Dict[str, str]
    ) -> str:
        """Remap colors in an Aseprite file.
    
        Args:
            filename: Name of the Aseprite file to modify
            color_map: Dictionary mapping old colors to new colors (e.g., {"FF0000": "00FF00"})
        """
        try:
            # Validate inputs
            file_path = validate_file_path(filename, must_exist=True)
            
            if not color_map:
                raise ValidationError("color_map", color_map, "Color map cannot be empty")
            
            # Validate all colors
            validated_map = {}
            for old_color, new_color in color_map.items():
                old_validated = validate_color(old_color)
                new_validated = validate_color(new_color)
                validated_map[old_validated] = new_validated
            
            # Build Lua script
            builder = LuaBuilder()
            builder.open_sprite(str(file_path))
            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()
            
            # Create color mapping table
            builder.add_line('local colorMap = {}')
            for old_color, new_color in validated_map.items():
                old_r, old_g, old_b = int(old_color[0:2], 16), int(old_color[2:4], 16), int(old_color[4:6], 16)
                new_r, new_g, new_b = int(new_color[0:2], 16), int(new_color[2:4], 16), int(new_color[4:6], 16)
                builder.add_line(f'colorMap[Color{{r={old_r}, g={old_g}, b={old_b}, a=255}}.rgbaPixel] = Color{{r={new_r}, g={new_g}, b={new_b}, a=255}}')
            builder.add_line()
            
            # Remap colors in all cels
            builder.begin_transaction()
            builder.for_loop('_, cel', 'ipairs(spr.cels)')
            builder.add_line('local img = cel.image:clone()')
            builder.add_line('local changed = false')
            builder.for_loop('y', 0, 'img.height - 1')
            builder.for_loop('x', 0, 'img.width - 1')
            builder.add_line('local pixel = img:getPixel(x, y)')
            builder.add_line('local newColor = colorMap[pixel]')
            builder.if_condition('newColor')
            builder.add_line('img:putPixel(x, y, newColor.rgbaPixel)')
            builder.add_line('changed = true')
            builder.end_if()
            builder.end_loop()
            builder.end_loop()
            builder.if_condition('changed')
            builder.add_line('cel.image = img')
            builder.end_if()
            builder.end_loop()
            builder.end_transaction()
            
            builder.save_sprite()
            
            # Execute script
            cmd = get_command()
            success, output = cmd.execute_lua_script(builder.build())
            
            return f"Successfully remapped {len(validated_map)} colors in {file_path}"
            
        except (ValidationError, AsepriteError) as e:
            return f"Failed to remap colors: {e}"
        except Exception as e:
            return f"Unexpected error: {e}"
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions modification ('Remap colors') which implies mutation, but doesn't specify permissions needed, whether changes are reversible, file format constraints, or error handling. This leaves significant gaps for a tool that modifies files.

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 efficiently structured with a clear purpose statement followed by parameter explanations. The example for 'color_map' is helpful and concise. However, the formatting with 'Args:' could be slightly more polished.

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 mutation tool with no annotations and no output schema, the description provides basic purpose and parameter semantics but lacks important behavioral context like error conditions, file format requirements, or what constitutes success. It's minimally adequate but has clear gaps.

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?

The description provides clear semantic information about both parameters: 'filename' identifies the target file, and 'color_map' is explained with an example dictionary format. Since schema description coverage is 0%, this description effectively compensates by adding meaningful context beyond the bare schema.

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 verb ('Remap') and resource ('colors in an Aseprite file'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'apply_preset_palette' or 'batch_apply_palette', which also involve palette/color modifications.

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 is provided on when to use this tool versus alternatives like 'apply_preset_palette' or 'batch_apply_palette'. The description only states what the tool does, without context about prerequisites, use cases, or exclusions.

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