Skip to main content
Glama
MR901

mcp-plots

configure_preferences

Set chart output format, theme, and dimensions for data visualizations. Customize preferences or reset to defaults to control how plots are displayed.

Instructions

Interactive configuration tool for setting user preferences. Parameters: - output_format: "mermaid", "mcp_image", or "mcp_text" - theme: "default", "dark", "seaborn", "minimal", etc. - chart_width: Chart width in pixels - chart_height: Chart height in pixels - reset_to_defaults: Reset all preferences to system defaults If no parameters provided, shows current configuration with sample.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chart_heightNo
chart_widthNo
output_formatNo
reset_to_defaultsNo
themeNo

Implementation Reference

  • Core handler implementation for the configure_preferences tool. Handles parameter validation using ChartConstants, updates user preferences via ConfigurationService, reset to defaults, displays current config, and formats responses in MCP-compatible format.
    def _configure_preferences_impl( output_format: str = None, theme: str = None, chart_width: int = None, chart_height: int = None, reset_to_defaults: bool = False ) -> Dict[str, Any]: """ Interactive configuration tool for setting user preferences. Parameters: - output_format: "mermaid", "mcp_image", or "mcp_text" - theme: "default", "dark", "seaborn", "minimal", etc. - chart_width: Chart width in pixels - chart_height: Chart height in pixels - reset_to_defaults: Reset all preferences to system defaults If no parameters provided, shows current configuration with sample. """ try: config_service = get_config_service() if reset_to_defaults: prefs = config_service.reset_to_defaults() return { "content": [{ "type": "text", "text": f"✅ **Configuration Reset**\n\nAll preferences reset to defaults:\n{_format_preferences(prefs.to_dict())}" }] } # Validate inputs before updating updates = {} if output_format is not None: if ChartConstants.OutputFormats.validate(output_format): updates["output_format"] = output_format else: valid_formats = ", ".join(ChartConstants.OutputFormats.all()) raise ValueError(f"Invalid output format '{output_format}'. Valid options: {valid_formats}") if theme is not None: if ChartConstants.Themes.validate(theme): updates["theme"] = theme else: valid_themes = ", ".join(ChartConstants.Themes.all()) raise ValueError(f"Invalid theme '{theme}'. Valid options: {valid_themes}") if chart_width is not None: if chart_width < ChartConstants.ConfigDefaults.MIN_WIDTH or chart_width > ChartConstants.ConfigDefaults.MAX_WIDTH: raise ValueError(f"Chart width must be between {ChartConstants.ConfigDefaults.MIN_WIDTH} and {ChartConstants.ConfigDefaults.MAX_WIDTH}") updates["chart_width"] = chart_width if chart_height is not None: if chart_height < ChartConstants.ConfigDefaults.MIN_HEIGHT or chart_height > ChartConstants.ConfigDefaults.MAX_HEIGHT: raise ValueError(f"Chart height must be between {ChartConstants.ConfigDefaults.MIN_HEIGHT} and {ChartConstants.ConfigDefaults.MAX_HEIGHT}") updates["chart_height"] = chart_height # Show current config if no updates if not updates: current_prefs = config_service.get_user_preferences() return { "content": [{ "type": "text", "text": f"📊 **Current Configuration**\n\n{_format_preferences(current_prefs.to_dict())}\n\n{_get_config_guide()}" }] } # Update preferences updated_prefs = config_service.update_preferences(**updates) return { "content": [{ "type": "text", "text": f"✅ **Configuration Updated**\n\n{_format_preferences(updated_prefs.to_dict())}" }] } except Exception as e: logger.error(f"configure_preferences failed: {e}") return {"status": "error", "error": str(e)}
  • MCP tool registration decorator (@mcp_server.tool()) and wrapper function for configure_preferences, which delegates to the core impl.
    @mcp_server.tool() def configure_preferences( output_format: str = None, theme: str = None, chart_width: int = None, chart_height: int = None, reset_to_defaults: bool = False ) -> Dict[str, Any]: """ Interactive configuration tool for setting user preferences. Parameters: - output_format: "mermaid", "mcp_image", or "mcp_text" - theme: "default", "dark", "seaborn", "minimal", etc. - chart_width: Chart width in pixels - chart_height: Chart height in pixels - reset_to_defaults: Reset all preferences to system defaults If no parameters provided, shows current configuration with sample. """ return _configure_preferences_impl( output_format=output_format, theme=theme, chart_width=chart_width, chart_height=chart_height, reset_to_defaults=reset_to_defaults )
  • Top-level call to register_tools which registers the configure_preferences tool (among others) on the MCP server instance.
    from src.capabilities.tools import register_tools register_tools(self.mcp_server, config=capabilities_config)
  • Helper function to format the user preferences dictionary into a markdown-friendly string with descriptions for themes and formats.
    def _format_preferences(prefs: Dict[str, Any]) -> str: """Format preferences for display.""" formatted = [] for key, value in prefs.items(): # Add descriptions for better UX if key == "theme": desc = _get_theme_description(value) formatted.append(f"- **{key.replace('_', ' ').title()}**: `{value}` - {desc}") elif key == "output_format": desc = _get_format_description(value) formatted.append(f"- **{key.replace('_', ' ').title()}**: `{value}` - {desc}") else: formatted.append(f"- **{key.replace('_', ' ').title()}**: `{value}`") return "\n".join(formatted)
  • Helper function that generates a comprehensive configuration guide string shown to users when viewing current preferences.
    def _get_config_guide() -> str: """Get user-focused configuration guide.""" return f"""## 🎛️ **Available Options** ### **Output Formats** (Where will you use your charts?) - **`{ChartConstants.OutputFormats.MERMAID}`** - Shows directly in Cursor (great for quick analysis) - **`{ChartConstants.OutputFormats.MCP_IMAGE}`** - High-quality images for presentations - **`{ChartConstants.OutputFormats.MCP_TEXT}`** - Scalable graphics for web and documents ### **Visual Styles** - **`{ChartConstants.Themes.DEFAULT}`** - {_get_theme_description('default')} - **`{ChartConstants.Themes.DARK}`** - {_get_theme_description('dark')} - **`{ChartConstants.Themes.SEABORN}`** - {_get_theme_description('seaborn')} - **`{ChartConstants.Themes.MINIMAL}`** - {_get_theme_description('minimal')} ### **Chart Dimensions** - **Width**: {ChartConstants.ConfigDefaults.MIN_WIDTH}-{ChartConstants.ConfigDefaults.MAX_WIDTH} pixels (typical: 800-1200) - **Height**: {ChartConstants.ConfigDefaults.MIN_HEIGHT}-{ChartConstants.ConfigDefaults.MAX_HEIGHT} pixels (typical: 600-800) ### **Quick Setup Examples** - **For exploring data**: Use `mermaid` format with `default` theme - **For presentations**: Use `mcp_image` format with larger size (1200x800) - **For modern dashboards**: Use `mcp_image` format with `dark` theme - **To start fresh**: Reset all settings to defaults **💡 Tip**: Mermaid format shows results instantly in Cursor - perfect for data exploration. Switch to image format when you need polished charts for presentations."""

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/MR901/mcp-plots'

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