list_themes
Discover available themes for customizing plot styling in Plotnine visualizations, enabling tailored design choices for data graphics.
Instructions
List all available themes for plot styling
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_themes"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/plotnine_mcp/server.py:790-830 (handler)The main execution logic for the list_themes tool. Imports THEME_MAP, defines descriptions, constructs a formatted message listing themes and customizations, and returns it as TextContent.
async def list_themes_handler() -> list[TextContent]: """Handle list_themes tool calls.""" from .plot_builder import THEME_MAP theme_descriptions = { "gray": "Gray background with white gridlines (ggplot2 default)", "bw": "Black and white theme with no background", "minimal": "Minimalist theme with minimal gridlines", "classic": "Classic look with axis lines and no gridlines", "dark": "Dark background theme", "light": "Light theme with subtle gray background", "void": "Empty theme with no elements (for custom designs)", } message = "Available Themes\n" + "=" * 50 + "\n\n" message += "Base themes:\n" for theme_name in sorted(THEME_MAP.keys()): desc = theme_descriptions.get(theme_name, "") message += f" - {theme_name}: {desc}\n" message += "\n" + "=" * 50 + "\n" message += "Customization options:\n" message += " - figure_size: [width, height] in inches\n" message += " - legend_position: 'right', 'left', 'top', 'bottom', 'none'\n" message += " - legend_direction: 'vertical', 'horizontal'\n" message += " - panel_background: background color/style\n" message += " - plot_background: overall plot background\n" message += " - text: global text properties\n" message += " - axis_text: axis label styling\n" message += " - axis_title: axis title styling\n" message += "\nExample usage:\n" message += ' "theme": {\n' message += ' "base": "minimal",\n' message += ' "customizations": {\n' message += ' "figure_size": [12, 6],\n' message += ' "legend_position": "bottom"\n' message += ' }\n' message += ' }\n' return [TextContent(type="text", text=message)] - src/plotnine_mcp/server.py:339-346 (registration)Registers the list_themes tool in the @server.list_tools() handler with its name, description, and empty input schema (no parameters required).
Tool( name="list_themes", description="List all available themes for plot styling", inputSchema={ "type": "object", "properties": {}, }, ), - src/plotnine_mcp/server.py:342-345 (schema)Defines the input schema for list_themes tool: an empty object (no input parameters needed).
inputSchema={ "type": "object", "properties": {}, }, - Supporting constant THEME_MAP that maps theme names to plotnine theme functions, used by the handler to list available themes.
THEME_MAP = { "gray": theme_gray, "grey": theme_gray, "bw": theme_bw, "minimal": theme_minimal, "classic": theme_classic, "dark": theme_dark, "light": theme_light, "void": theme_void, } - src/plotnine_mcp/server.py:535-536 (registration)Tool dispatch in @server.call_tool(): routes 'list_themes' calls to the list_themes_handler.
elif name == "list_themes": return await list_themes_handler()