Skip to main content
Glama
Fervoyush

Plotnine MCP Server

by Fervoyush

import_plot_config

Load saved plot configurations to recreate visualizations quickly. Modify specific parameters like data sources while preserving the original design structure for consistent plotting.

Instructions

Import and use a saved plot configuration.

Load a previously exported plot configuration and create a plot from it. You can optionally override specific parameters (like data_source) while keeping the rest of the configuration intact.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
config_pathYesPath to the saved configuration JSON file
overridesNoOptional overrides for config parameters (e.g., new data_source)

Implementation Reference

  • Implements the core logic for the import_plot_config tool: loads JSON config from file, applies optional overrides, and creates the plot by calling create_plot_handler.
    async def import_plot_config_handler(arguments: dict[str, Any]) -> list[TextContent]:
        """Handle import_plot_config tool calls."""
        try:
            from pathlib import Path
    
            config_path = Path(arguments["config_path"])
            overrides = arguments.get("overrides", {})
    
            # Check if file exists
            if not config_path.exists():
                return [
                    TextContent(
                        type="text",
                        text=f"Configuration file not found: {config_path}\n\nPlease check the path and try again.",
                    )
                ]
    
            # Load config from file
            with open(config_path, "r") as f:
                config = json.load(f)
    
            # Apply overrides if provided
            if overrides:
                config.update(overrides)
    
            # Create plot using the loaded config
            result = await create_plot_handler(config)
    
            # Prepend info about the config source
            original_message = result[0].text if result else ""
            new_message = f"""Plot created from imported configuration!
    
    Config file: {config_path}
    Overrides applied: {len(overrides)} parameter(s)
    
    {original_message}"""
    
            return [TextContent(type="text", text=new_message)]
    
        except json.JSONDecodeError as e:
            return [
                TextContent(
                    type="text",
                    text=f"Invalid JSON in config file: {str(e)}\n\nPlease check that the file contains valid JSON.",
                )
            ]
        except Exception as e:
            return [
                TextContent(
                    type="text",
                    text=f"Error importing config: {str(e)}\n\nPlease check:\n- Config file is valid\n- All required fields are present",
                )
            ]
  • Registers the import_plot_config tool in the MCP server with its description and input schema definition.
            Tool(
                name="import_plot_config",
                description="""Import and use a saved plot configuration.
    
    Load a previously exported plot configuration and create a plot from it.
    You can optionally override specific parameters (like data_source) while
    keeping the rest of the configuration intact.""",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "config_path": {
                            "type": "string",
                            "description": "Path to the saved configuration JSON file",
                        },
                        "overrides": {
                            "type": "object",
                            "description": "Optional overrides for config parameters (e.g., new data_source)",
                        },
                    },
                    "required": ["config_path"],
                },
            ),
  • Defines the input schema for the import_plot_config tool, specifying config_path as required and overrides as optional.
    inputSchema={
        "type": "object",
        "properties": {
            "config_path": {
                "type": "string",
                "description": "Path to the saved configuration JSON file",
            },
            "overrides": {
                "type": "object",
                "description": "Optional overrides for config parameters (e.g., new data_source)",
            },
        },
        "required": ["config_path"],
    },
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 adequately describes the core behavior (importing a saved config and creating a plot) and mentions the override capability. However, it lacks details about potential side effects (e.g., whether this creates persistent plots, requires specific permissions, or has rate limits), error conditions, or what the output looks like (though no output schema exists).

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 efficiently structured in three sentences: first states the overall purpose, second explains the core action, third adds important nuance about overrides. Every sentence earns its place with no wasted words, and key information is front-loaded.

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 moderate complexity (importing configs with overrides) and no annotations or output schema, the description is adequate but has gaps. It covers the what and how but lacks details about behavioral implications (e.g., whether this is a read-only operation, what happens on failure, or format of created plots). For a tool that presumably creates visualizations, more context about outputs or constraints would be helpful.

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 both parameters thoroughly. The description adds marginal value by mentioning 'optional overrides for config parameters (e.g., new data_source)', which provides a concrete example but doesn't significantly expand beyond what the schema provides. 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 tool's purpose with specific verbs ('import and use', 'load', 'create a plot') and identifies the resource ('saved plot configuration'). It distinguishes from siblings like 'export_plot_config' (which saves configurations) and 'create_plot' (which creates from scratch rather than from saved configs).

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 provides clear context for when to use this tool: when you have a previously exported configuration and want to create a plot from it. It mentions the optional ability to override parameters, which adds useful guidance. However, it doesn't explicitly state when NOT to use it or name specific alternatives among the siblings (e.g., 'create_plot' for starting fresh, 'create_plot_from_template' for template-based creation).

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