Skip to main content
Glama
ext-sakamoro

Aseprite MCP Tools

by ext-sakamoro

create_palette

Create or replace color palettes in Aseprite files by specifying hex color codes and optional palette names for pixel art projects.

Instructions

Create or replace a palette in an Aseprite file.

Args: filename: Name of the Aseprite file to modify colors: List of hex color codes (e.g., ["FF0000", "00FF00", "0000FF"]) palette_name: Optional name for the palette

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameYes
colorsYes
palette_nameNo

Implementation Reference

  • The main handler function for creating/replacing a palette in an Aseprite file using Lua script generation.
    async def create_palette(
        filename: str,
        colors: List[str],
        palette_name: Optional[str] = None
    ) -> str:
        """Create or replace a palette in an Aseprite file.
    
        Args:
            filename: Name of the Aseprite file to modify
            colors: List of hex color codes (e.g., ["FF0000", "00FF00", "0000FF"])
            palette_name: Optional name for the palette
        """
        try:
            # Validate inputs
            file_path = validate_file_path(filename, must_exist=True)
            
            if not colors:
                raise ValidationError("colors", colors, "Color list cannot be empty")
            
            if len(colors) > 256:
                raise ValidationError("colors", len(colors), "Palette cannot have more than 256 colors")
            
            # Validate all colors
            validated_colors = [validate_color(color) for color in colors]
            
            # 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 new palette
            builder.add_line('local palette = Palette(#spr.palettes > 0 and spr.palettes[1] or ' + str(len(validated_colors)) + ')')
            
            # Set colors
            for i, color in enumerate(validated_colors):
                r = int(color[0:2], 16)
                g = int(color[2:4], 16)
                b = int(color[4:6], 16)
                builder.add_line(f'palette:setColor({i}, Color{{r={r}, g={g}, b={b}, a=255}})')
            
            # Resize palette if needed
            builder.if_condition(f'#palette < {len(validated_colors)}')
            builder.add_line(f'palette:resize({len(validated_colors)})')
            builder.end_if()
            
            # Set palette
            builder.add_line('spr:setPalette(palette)')
            
            builder.save_sprite()
            
            # Execute script
            cmd = get_command()
            success, output = cmd.execute_lua_script(builder.build())
            
            return f"Palette with {len(validated_colors)} colors created successfully in {file_path}"
            
        except (ValidationError, AsepriteError) as e:
            return f"Failed to create palette: {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 full burden for behavioral disclosure. It states 'Create or replace' which implies mutation but doesn't clarify permissions needed, whether it overwrites existing palettes, error conditions, or what happens on success/failure. This leaves significant gaps for a write operation.

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?

The description is efficiently structured with a clear purpose statement followed by parameter explanations. Every sentence adds value, and it's appropriately sized for a tool with three parameters. No wasted words or redundancy.

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 covers parameters well but lacks behavioral context (e.g., what happens when palette_name is null, error handling, or return values). It's minimally adequate but has clear gaps given the complexity.

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 explanations for all three parameters beyond the schema's 0% coverage: 'filename' as the file to modify, 'colors' as a list of hex codes with an example, and 'palette_name' as optional. This compensates well for the schema's lack of descriptions.

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 ('Create or replace a palette') and target resource ('in an Aseprite file'), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like 'apply_preset_palette' or 'extract_palette_from_image', but the core functionality is well-defined.

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 like 'apply_preset_palette' or 'batch_apply_palette'. It also doesn't mention prerequisites (e.g., file must exist) or when not to use it (e.g., for reading palettes). The context is implied but not explicit.

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