Skip to main content
Glama
Fervoyush

Plotnine MCP Server

by Fervoyush

export_plot_config

Save plot configurations as JSON files to recreate visualizations, share with others, version control, or use as templates for consistent data graphics.

Instructions

Export plot configuration to a JSON file for reuse.

This saves the exact configuration used to create a plot, allowing you to:

  • Recreate the same plot later

  • Share configurations with others

  • Version control your visualizations

  • Use as templates for similar plots

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
configYesThe plot configuration to export (same structure as create_plot)
filenameYesOutput filename (e.g., 'my_plot_config.json')
directoryNoDirectory to save config file./plot_configs

Implementation Reference

  • The main execution logic for the export_plot_config tool. Saves the provided plot configuration dictionary to a JSON file in the specified directory (default ./plot_configs), ensuring .json extension, creating dir if needed, and returns success message with file info or error.
    async def export_plot_config_handler(arguments: dict[str, Any]) -> list[TextContent]:
        """Handle export_plot_config tool calls."""
        try:
            from pathlib import Path
    
            config = arguments["config"]
            filename = arguments["filename"]
            directory = arguments.get("directory", "./plot_configs")
    
            # Create directory if it doesn't exist
            output_dir = Path(directory)
            output_dir.mkdir(parents=True, exist_ok=True)
    
            # Ensure filename ends with .json
            if not filename.endswith(".json"):
                filename += ".json"
    
            output_path = output_dir / filename
    
            # Write config to file
            with open(output_path, "w") as f:
                json.dump(config, f, indent=2)
    
            message = f"""Plot configuration exported successfully!
    
    File: {output_path}
    Size: {output_path.stat().st_size} bytes
    
    You can now:
    - Use 'import_plot_config' to recreate this plot
    - Share this file with others
    - Version control your visualization configs
    - Edit the JSON to customize parameters"""
    
            return [TextContent(type="text", text=message)]
    
        except Exception as e:
            return [
                TextContent(
                    type="text",
                    text=f"Error exporting config: {str(e)}\n\nPlease check:\n- Config is valid JSON\n- Filename is valid\n- Directory is writable",
                )
            ]
  • Registers the export_plot_config tool with the MCP server in the list_tools() handler. Includes tool name, description, and complete inputSchema definition.
            Tool(
                name="export_plot_config",
                description="""Export plot configuration to a JSON file for reuse.
    
    This saves the exact configuration used to create a plot, allowing you to:
    - Recreate the same plot later
    - Share configurations with others
    - Version control your visualizations
    - Use as templates for similar plots""",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "config": {
                            "type": "object",
                            "description": "The plot configuration to export (same structure as create_plot)",
                        },
                        "filename": {
                            "type": "string",
                            "description": "Output filename (e.g., 'my_plot_config.json')",
                        },
                        "directory": {
                            "type": "string",
                            "default": "./plot_configs",
                            "description": "Directory to save config file",
                        },
                    },
                    "required": ["config", "filename"],
                },
            ),
  • In the call_tool() dispatch function, routes calls to name 'export_plot_config' to the specific handler function.
    elif name == "export_plot_config":
        return await export_plot_config_handler(arguments)
  • The JSON schema defining required inputs: config (object matching create_plot structure), filename (string), optional directory.
    inputSchema={
        "type": "object",
        "properties": {
            "config": {
                "type": "object",
                "description": "The plot configuration to export (same structure as create_plot)",
            },
            "filename": {
                "type": "string",
                "description": "Output filename (e.g., 'my_plot_config.json')",
            },
            "directory": {
                "type": "string",
                "default": "./plot_configs",
                "description": "Directory to save config file",
            },
        },
        "required": ["config", "filename"],
    },
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses that the tool saves configurations to a file for reuse, which implies a non-destructive, persistent storage action. However, it lacks details on permissions, error handling, or file format specifics (beyond JSON), leaving some behavioral aspects unclear.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose in the first sentence, followed by a bulleted list of use cases that are directly relevant and add value. Every sentence earns its place, with no wasted words, making it efficient and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (3 parameters, no output schema, no annotations), the description is mostly complete. It explains the purpose and use cases effectively, but could benefit from more behavioral details (e.g., file overwriting, error scenarios) to fully compensate for the lack of annotations and output schema.

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?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds no additional parameter details beyond what the schema provides, such as explaining the 'config' structure or 'directory' default behavior. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Export plot configuration to a JSON file') and resource ('plot configuration'), distinguishing it from sibling tools like 'import_plot_config' (which imports) and 'create_plot' (which creates plots). It provides a precise verb+resource combination that is not tautological with the tool name.

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

Usage Guidelines4/5

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

The description explicitly lists use cases (recreating plots, sharing, version control, templates), which provides clear context for when to use this tool. However, it does not specify when NOT to use it or name explicit alternatives (e.g., 'create_plot_from_template' might be a related tool), missing full sibling differentiation.

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