Skip to main content
Glama
ext-sakamoro

Aseprite MCP Tools

by ext-sakamoro

export_sprite

Convert Aseprite files to various image formats like PNG, GIF, or JPG with customizable scale and frame range options.

Instructions

Export the Aseprite file to another format.

Args: filename: Name of the Aseprite file to export output_filename: Name of the output file format: Output format (default: inferred from extension, can be "png", "gif", "jpg", etc.) scale: Export scale factor (default: 1.0) frame_range: Frame range to export (e.g., "1-5" or "2,4,6")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameYes
output_filenameYes
formatNo
scaleNo
frame_rangeNo

Implementation Reference

  • The 'export_sprite' tool handler function that executes Aseprite export via command line arguments.
    @mcp.tool()
    async def export_sprite(
        filename: str, 
        output_filename: str, 
        format: Optional[str] = None,
        scale: float = 1.0,
        frame_range: Optional[str] = None
    ) -> str:
        """Export the Aseprite file to another format.
    
        Args:
            filename: Name of the Aseprite file to export
            output_filename: Name of the output file
            format: Output format (default: inferred from extension, can be "png", "gif", "jpg", etc.)
            scale: Export scale factor (default: 1.0)
            frame_range: Frame range to export (e.g., "1-5" or "2,4,6")
        """
        try:
            # Validate inputs
            file_path = validate_file_path(filename, must_exist=True)
            output_path = validate_file_path(output_filename, must_exist=False)
            
            # Determine format from extension if not provided
            if format is None:
                format = output_path.suffix.lstrip('.')
                if not format:
                    format = 'png'
            
            format = validate_export_format(format)
            
            # Ensure output filename has the correct extension
            if not output_path.suffix.lower() == f".{format}":
                output_path = output_path.with_suffix(f".{format}")
            
            # Validate scale
            if scale <= 0:
                raise ValidationError("scale", scale, "Scale must be positive")
            
            cmd = get_command()
            
            # Use command line for exports (more reliable than Lua for this)
            args = ["--batch", str(file_path)]
            
            # Add frame range if specified
            if frame_range:
                args.extend(["--frame-range", frame_range])
            
            # Add scale if not 1.0
            if scale != 1.0:
                args.extend(["--scale", str(scale)])
            
            # Add output
            args.extend(["--save-as", str(output_path)])
            
            success, output = cmd.run_command(args)
            
            return f"Sprite exported successfully to {output_path}"
            
        except (ValidationError, AsepriteError) as e:
            return f"Failed to export sprite: {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