Skip to main content
Glama
ext-sakamoro

Aseprite MCP Tools

by ext-sakamoro

draw_circle

Draw circles on Aseprite canvas by specifying center coordinates, radius, color, and fill options for pixel art creation.

Instructions

Draw a circle on the canvas.

Args: filename: Name of the Aseprite file to modify center_x: X coordinate of circle center center_y: Y coordinate of circle center radius: Radius of the circle in pixels color: Hex color code (default: "#000000") fill: Whether to fill the circle (default: False)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameYes
center_xYes
center_yYes
radiusYes
colorNo#000000
fillNo

Implementation Reference

  • The `draw_circle` function acts as the MCP tool handler, validating inputs and invoking the `LuaBuilder` to generate and execute the Lua script for Aseprite.
    async def draw_circle(filename: str, center_x: int, center_y: int, radius: int, color: str = "#000000", fill: bool = False) -> str:
        """Draw a circle on the canvas.
    
        Args:
            filename: Name of the Aseprite file to modify
            center_x: X coordinate of circle center
            center_y: Y coordinate of circle center
            radius: Radius of the circle in pixels
            color: Hex color code (default: "#000000")
            fill: Whether to fill the circle (default: False)
        """
        try:
            # Validate inputs
            file_path = validate_file_path(filename, must_exist=True)
            color = validate_color(color)
            
            if radius < 1:
                raise ValidationError("radius", radius, "Radius must be at least 1")
            
            # 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.draw_circle(center_x, center_y, radius, color, fill)
            builder.end_transaction()
            builder.save_sprite()
            
            # Execute script
            cmd = get_command()
            success, output = cmd.execute_lua_script(builder.build(), str(file_path))
            
            return f"Circle drawn successfully in {file_path}"
            
        except (ValidationError, AsepriteError) as e:
            return f"Failed to draw circle: {e}"
        except Exception as e:
            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