Skip to main content
Glama
Fervoyush
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"], },

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