Skip to main content
Glama
MR901

mcp-plots

configure_preferences

Set visualization preferences for charts including output format, theme, and dimensions in the mcp-plots server.

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
output_formatNo
themeNo
chart_widthNo
chart_heightNo
reset_to_defaultsNo

Implementation Reference

  • Core handler function implementing the configure_preferences tool logic: validates inputs, updates preferences via config_service, handles reset, shows current config, and formats responses.
    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 using @mcp_server.tool() decorator. Defines the tool name, input parameters (serving as schema), docstring, and delegates to implementation.
    @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 )
  • Helper function to format user preferences dictionary into a user-friendly markdown string with descriptions for theme and output_format.
    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 providing a detailed configuration guide with descriptions of options, examples, and tips, used in current config display.
    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."""
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/MR901/mcp-plots'

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