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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

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."""
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. It discloses that the tool can both set preferences and show current configuration, which is useful behavioral context. However, it doesn't mention permission requirements, persistence mechanisms, or whether changes are immediate/reversible, leaving gaps for a configuration tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear purpose statement followed by a parameter list and behavioral note. It's appropriately sized at 6 lines, though the parameter explanations could be slightly more concise (e.g., combining width/height descriptions).

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 5 parameters with 0% schema coverage and no annotations, the description does an excellent job explaining parameter semantics. The presence of an output schema means return values don't need explanation. The main gap is lack of sibling tool differentiation and some behavioral context like persistence details.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds significant value beyond the input schema, which has 0% description coverage. It provides specific semantics for all 5 parameters: enumerating valid values for 'output_format' and 'theme', explaining units for 'chart_width' and 'chart_height', and clarifying the boolean 'reset_to_defaults' parameter's effect.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/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 as 'Interactive configuration tool for setting user preferences' with specific parameters listed. It distinguishes from the sibling 'render_chart' by focusing on configuration rather than rendering, though the distinction could be more explicit.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides implied usage guidance by stating 'If no parameters provided, shows current configuration with sample,' which suggests when to use it for read vs. write operations. However, it lacks explicit guidance on when to use this tool versus alternatives like 'render_chart' or other configuration methods.

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

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