Skip to main content
Glama
seanshin0214

Dr. QuantMaster MCP Server

by seanshin0214

visualization_code

Generate visualization code for statistical analysis in R, Python, or Stata to create coefficient plots, marginal effects, residual plots, power curves, and forest plots.

Instructions

시각화 코드 생성 (ggplot2, matplotlib, Stata graphs)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chart_typeYes차트 유형
languageYes언어
customizationNo커스터마이징 옵션

Implementation Reference

  • The main handler function for the 'visualization_code' tool. It takes chart_type and language as input and returns appropriate visualization code templates for R, Stata, or Python based on predefined templates.
    function handleVisualizationCode(args: Record<string, unknown>) {
      const chartType = args.chart_type as string;
      const language = args.language as string;
    
      const templates: Record<string, Record<string, string>> = {
        coefficient_plot: {
          r: `library(ggplot2)\nmodelsummary::modelplot(model, coef_omit = "Intercept")`,
          stata: `coefplot, drop(_cons) xline(0)`,
          python: `import matplotlib.pyplot as plt\ncoefs = model.params[1:]\nerrs = model.bse[1:]\nplt.errorbar(coefs.index, coefs, yerr=1.96*errs, fmt='o')`
        },
        forest_plot: {
          r: `library(metafor)\nforest(meta_result)`,
          stata: `metan effect se, forestplot`,
          python: `# Use forestplot package or matplotlib`
        }
      };
    
      return {
        chart_type: chartType,
        language,
        code: templates[chartType]?.[language] || "# Visualization code template"
      };
    }
  • The tool definition including name, description, and inputSchema for parameter validation (chart_type, language, customization). This registers the tool schema in the tools array.
    name: "visualization_code",
    description: "시각화 코드 생성 (ggplot2, matplotlib, Stata graphs)",
    inputSchema: {
      type: "object",
      properties: {
        chart_type: {
          type: "string",
          enum: ["coefficient_plot", "marginal_effects", "residual_plot", "power_curve", "forest_plot"],
          description: "차트 유형"
        },
        language: { type: "string", enum: ["r", "stata", "python"], description: "언어" },
        customization: { type: "object", description: "커스터마이징 옵션" },
      },
      required: ["chart_type", "language"],
    },
  • The switch case in handleToolCall that routes calls to the visualization_code tool to its handler function.
    case "visualization_code":
      return handleVisualizationCode(args);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states what the tool does (generates visualization code) but doesn't describe what the output looks like (code snippets? complete scripts?), whether it requires specific data formats as input, what happens with the customization parameter, or any limitations. For a code generation tool with zero annotation coverage, this is a significant gap in behavioral context.

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

Conciseness5/5

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

The description is extremely concise - a single phrase in parentheses that efficiently communicates the scope. Every word earns its place by specifying the visualization libraries supported. There's no wasted text, repetition, or unnecessary elaboration. The structure is front-loaded with the core purpose immediately clear.

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

Completeness2/5

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

For a code generation tool with 3 parameters (including a nested object for customization) and no output schema, the description is insufficient. It doesn't explain what the tool outputs (code format, completeness), how the customization parameter works, or provide examples. With no annotations and rich parameter structure, the description should do more to help an agent understand how to use this tool effectively.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents all three parameters with descriptions and enums. The description doesn't add any parameter-specific information beyond what's in the schema. It mentions the three libraries (ggplot2, matplotlib, Stata graphs) which correspond to the language enum values, but this doesn't provide additional semantic value beyond the schema. Baseline 3 is appropriate when schema does the heavy lifting.

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: '시각화 코드 생성' (visualization code generation) with specific libraries mentioned (ggplot2, matplotlib, Stata graphs). It distinguishes from siblings like generate_python_code or generate_r_code by focusing specifically on visualization code rather than general code generation. However, it doesn't explicitly differentiate from table_code or other visualization-related tools.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. There are many sibling tools that could overlap (generate_python_code, generate_r_code, table_code, power_curve, etc.), but the description offers no explicit when/when-not guidance or mentions of prerequisites. The user must infer usage from the tool name and description alone.

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/seanshin0214/quantmaster-mcp-server'

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