Skip to main content
Glama
ext-sakamoro

Aseprite MCP Tools

by ext-sakamoro

create_canvas

Create a new Aseprite canvas by specifying width and height in pixels to start pixel art projects with custom dimensions.

Instructions

Create a new Aseprite canvas with specified dimensions.

Args: width: Width of the canvas in pixels height: Height of the canvas in pixels filename: Name of the output file (default: canvas.aseprite)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
widthYes
heightYes
filenameNocanvas.aseprite

Implementation Reference

  • The create_canvas tool is registered with the @mcp.tool() decorator and implemented as an async function that validates dimensions, constructs a Lua script using LuaBuilder, and executes it via the command interface.
    @mcp.tool()
    async def create_canvas(width: int, height: int, filename: str = "canvas.aseprite") -> str:
        """Create a new Aseprite canvas with specified dimensions.
    
        Args:
            width: Width of the canvas in pixels
            height: Height of the canvas in pixels
            filename: Name of the output file (default: canvas.aseprite)
        """
        try:
            log_operation("create_canvas", filename, width=width, height=height)
            
            # Validate inputs
            width, height = validate_dimensions(width, height)
            file_path = validate_file_path(filename, must_exist=False)
            
            # Build Lua script
            builder = LuaBuilder()
            builder.create_sprite(width, height)
            builder.save_sprite(str(file_path))
            
            # Execute script
            cmd = get_command()
            success, output = cmd.execute_lua_script(builder.build())
            
            logger.info(f"Canvas created successfully", file=str(file_path), dimensions=f"{width}x{height}")
            return f"Canvas created successfully: {file_path}"
            
        except (ValidationError, AsepriteError) as e:
            log_error(f"Failed to create canvas", e, "create_canvas", filename=filename)
            return f"Failed to create canvas: {e}"
        except Exception as e:
            log_error(f"Unexpected error in create_canvas", e, "create_canvas", filename=filename)
            return f"Unexpected error: {e}"

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