Skip to main content
Glama
ext-sakamoro

Aseprite MCP Tools

by ext-sakamoro

batch_process_custom

Apply custom Lua scripts to multiple Aseprite files for automated pixel art processing and manipulation in batch operations.

Instructions

Apply a custom Lua script to multiple Aseprite files.

Args: input_dir: Directory containing input files lua_script: Lua script to execute on each file output_dir: Optional output directory for modified files file_pattern: File pattern to match (default: "*.aseprite")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
input_dirYes
lua_scriptYes
output_dirNo
file_patternNo*.aseprite

Implementation Reference

  • The tool handler `batch_process_custom` implementation.
    async def batch_process_custom(
        input_dir: str,
        lua_script: str,
        output_dir: Optional[str] = None,
        file_pattern: str = "*.aseprite"
    ) -> str:
        """Apply a custom Lua script to multiple Aseprite files.
    
        Args:
            input_dir: Directory containing input files
            lua_script: Lua script to execute on each file
            output_dir: Optional output directory for modified files
            file_pattern: File pattern to match (default: "*.aseprite")
        """
        try:
            # Validate inputs
            input_path = validate_file_path(input_dir, must_exist=True)
            
            if not input_path.is_dir():
                raise ValidationError("input_dir", str(input_path), "Must be a directory")
            
            if output_dir:
                output_path = validate_file_path(output_dir, must_exist=True)
                if not output_path.is_dir():
                    raise ValidationError("output_dir", str(output_path), "Must be a directory")
            else:
                output_path = None
            
            # Find all matching files
            files = list(input_path.glob(file_pattern))
            if not files:
                return f"No files matching '{file_pattern}' found in {input_path}"
            
            # Process each file
            results = []
            errors = []
            
            for file in files:
                try:
                    # Build complete script
                    builder = LuaBuilder()
                    builder.add_comment(f"Processing {file.name}")
                    builder.add_line()
                    
                    # User script (wrapped in safety checks)
                    builder.add_line("-- User script begins --")
                    builder.add_line(lua_script)
                    builder.add_line("-- User script ends --")
                    builder.add_line()
                    
                    # Save to output if specified
                    if output_path:
                        output_file = output_path / file.name
                        builder.save_sprite(str(output_file))
                    else:
                        builder.save_sprite()
                    
                    # Execute
                    cmd = get_command()
                    success, output = cmd.execute_lua_script(builder.build(), str(file))
                    
                    results.append(f"Processed: {file.name}")
                    
                except Exception as e:
                    errors.append(f"Failed {file.name}: {e}")
                    if not get_config().batch.continue_on_error:
                        break
            
            # Summary
            summary = f"Batch custom processing completed:\n"
            summary += f"- Processed: {len(results)} files\n"
            summary += f"- Failed: {len(errors)} files\n"
            
            if output_path:
                summary += f"- Output directory: {output_path}\n"
            
            if results:
                summary += "\nSuccessful:\n" + "\n".join(results[:10])
                if len(results) > 10:
                    summary += f"\n... and {len(results) - 10} more"
            
            if errors:
                summary += "\n\nErrors:\n" + "\n".join(errors[:5])
                if len(errors) > 5:
                    summary += f"\n... and {len(errors) - 5} more"
            
            return summary
            
        except (ValidationError, AsepriteError) as e:
            return f"Failed to batch process: {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 the tool applies scripts to files, implying mutation, but doesn't describe what happens to original files, whether changes are reversible, execution order, error handling, or output behavior when output_dir is null. This leaves significant gaps for a batch processing tool.

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 a well-organized parameter explanation. Every sentence earns its place, though the parameter explanations could be slightly more detailed about expected formats or constraints.

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 batch processing tool with 4 parameters, 0% schema coverage, no annotations, and no output schema, the description provides adequate parameter semantics but lacks crucial behavioral context about mutation effects, error handling, and output behavior. It's minimally viable but has clear gaps given the tool's 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?

With 0% schema description coverage, the description compensates well by explaining all 4 parameters in the Args section. It clarifies input_dir contains source files, lua_script executes on each file, output_dir is optional for modified files, and file_pattern defaults to '*.aseprite'. This adds substantial meaning 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 action ('Apply a custom Lua script') and target resource ('multiple Aseprite files'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like batch_export or batch_resize, which also process multiple files but with different operations.

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. With sibling tools like batch_export and batch_resize available, there's no indication of when custom Lua scripting is preferred over those specific operations, nor any prerequisites or constraints mentioned.

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