Skip to main content
Glama
Fervoyush

Plotnine MCP Server

by Fervoyush

batch_create_plots

Generate multiple publication-quality statistical graphics in a single batch operation for data visualization tasks like pairwise comparisons, categorical analysis, and numeric column plotting.

Instructions

Create multiple plots in one batch operation.

Useful for:

  • Creating plots for all numeric columns in a dataset

  • Generating pairwise scatter plots

  • Creating plots for each category separately

  • Comparing different plot types

Each plot configuration is processed independently, and all plots are created in sequence.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
plotsYesArray of plot configurations (same structure as create_plot)

Implementation Reference

  • Registration of the batch_create_plots tool, including name, description, and input schema defining an array of plot configurations.
            Tool(
                name="batch_create_plots",
                description="""Create multiple plots in one batch operation.
    
    Useful for:
    - Creating plots for all numeric columns in a dataset
    - Generating pairwise scatter plots
    - Creating plots for each category separately
    - Comparing different plot types
    
    Each plot configuration is processed independently, and all plots are created in sequence.""",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "plots": {
                            "type": "array",
                            "description": "Array of plot configurations (same structure as create_plot)",
                            "items": {"type": "object"},
                        },
                    },
                    "required": ["plots"],
                },
            ),
  • The handler function that implements batch_create_plots by iterating over the provided list of plot configurations and delegating to create_plot_handler for each, collecting results and providing a summary.
    async def batch_create_plots_handler(arguments: dict[str, Any]) -> list[TextContent]:
        """Handle batch_create_plots tool calls."""
        try:
            plots = arguments.get("plots", [])
    
            if not plots:
                return [
                    TextContent(
                        type="text",
                        text="No plots provided. Please include an array of plot configurations in the 'plots' parameter.",
                    )
                ]
    
            message = f"Batch Plot Creation\n" + "=" * 60 + "\n\n"
            message += f"Creating {len(plots)} plot(s)...\n\n"
    
            results = []
            successful = 0
            failed = 0
    
            for i, plot_config in enumerate(plots, 1):
                try:
                    # Create plot using existing handler
                    result = await create_plot_handler(plot_config)
    
                    if result and "successfully" in result[0].text:
                        successful += 1
                        # Extract filename from result
                        result_text = result[0].text
                        if "Output file:" in result_text:
                            filename_line = [
                                line for line in result_text.split("\n") if "Output file:" in line
                            ][0]
                            filename = filename_line.split(": ")[1]
                            message += f"{i}. ✓ {filename}\n"
                        else:
                            message += f"{i}. ✓ Plot created\n"
                    else:
                        failed += 1
                        error_msg = result[0].text if result else "Unknown error"
                        message += f"{i}. ✗ Failed: {error_msg[:100]}...\n"
    
                    results.append({"index": i, "success": successful > failed, "result": result})
    
                except Exception as e:
                    failed += 1
                    message += f"{i}. ✗ Error: {str(e)[:100]}...\n"
                    results.append({"index": i, "success": False, "error": str(e)})
    
            message += "\n" + "=" * 60 + "\n"
            message += f"Summary:\n"
            message += f"  • Total: {len(plots)}\n"
            message += f"  • Successful: {successful}\n"
            message += f"  • Failed: {failed}\n"
    
            if successful > 0:
                message += f"\n✓ {successful} plot(s) created successfully!"
    
            return [TextContent(type="text", text=message)]
    
        except Exception as e:
            return [
                TextContent(
                    type="text",
                    text=f"Batch creation error: {str(e)}\n\nPlease check your plot configurations.",
                )
            ]
  • Input schema definition for batch_create_plots, specifying an array of plot configuration objects.
    inputSchema={
        "type": "object",
        "properties": {
            "plots": {
                "type": "array",
                "description": "Array of plot configurations (same structure as create_plot)",
                "items": {"type": "object"},
            },
        },
        "required": ["plots"],
    },
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It adds some context: it describes the batch nature ('multiple plots in one batch operation'), processing behavior ('Each plot configuration is processed independently, and all plots are created in sequence'), and hints at use cases. However, it doesn't cover critical aspects like error handling, performance implications, or output format, leaving gaps for a mutation 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 appropriately sized and front-loaded, starting with the core purpose. The bulleted list is efficient for listing use cases, and the final sentence adds behavioral context without redundancy. However, some bullets could be more concise (e.g., 'Creating plots for each category separately' is slightly wordy), preventing a perfect score.

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?

Given the tool's complexity (batch mutation with no annotations and no output schema), the description is moderately complete. It covers purpose, usage examples, and processing behavior, but lacks details on error handling, output format, or performance considerations. This makes it adequate but with clear gaps for an agent to rely on.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the 'plots' parameter documented as 'Array of plot configurations (same structure as create_plot).' The description adds no additional parameter semantics beyond this, so it meets the baseline of 3 where the schema does the heavy lifting, but doesn't compensate with extra details like format examples or constraints.

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 tool's purpose: 'Create multiple plots in one batch operation.' This specifies the verb ('create') and resource ('plots') with the distinguishing feature of batch processing. However, it doesn't explicitly differentiate from sibling tools like 'create_plot' beyond the batch aspect, which is why it doesn't reach a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides a bulleted list of use cases (e.g., 'Creating plots for all numeric columns in a dataset'), which implies when to use this tool. However, it lacks explicit guidance on when NOT to use it or when to prefer alternatives like 'create_plot' for single plots, and it doesn't mention prerequisites or constraints, keeping it at an implied usage level.

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/Fervoyush/plotnine-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server