Skip to main content
Glama
seanshin0214

Dr. QuantMaster MCP Server

by seanshin0214

generate_stata_code

Generate Stata code for statistical analysis, diagnostics, and data visualization to support quantitative research workflows.

Instructions

Stata 코드 생성 (분석, 진단, 시각화)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
analysis_typeYes분석 유형
variablesNo변수 정보
optionsNo추가 옵션

Implementation Reference

  • The handler function that generates Stata code templates for specified analysis types (ols, panel_fe, did) using hardcoded templates.
    function handleGenerateStataCode(args: Record<string, unknown>) {
      const analysisType = args.analysis_type as string;
      const templates: Record<string, string> = {
        ols: `
    * OLS Regression
    reg y x1 x2 x3
    
    * Robust SE
    reg y x1 x2 x3, robust
    
    * Diagnostics
    vif
    hettest
    ovtest
    `,
        panel_fe: `
    * Panel Setup
    xtset id time
    
    * Fixed Effects
    xtreg y x1 x2, fe cluster(id)
    
    * Two-way FE (reghdfe)
    reghdfe y x1 x2, absorb(id time) cluster(id)
    
    * Hausman test
    xtreg y x1 x2, fe
    estimates store fe
    xtreg y x1 x2, re
    hausman fe
    `,
        did: `
    * Basic DID
    gen treat_post = treat * post
    reg y treat post treat_post, cluster(id)
    
    * reghdfe
    reghdfe y treat_post, absorb(id time) cluster(id)
    
    * Event Study
    forvalues t = -5/5 {
        gen treat_t\`t' = treat * (time == event_time + \`t')
    }
    reghdfe y treat_t*, absorb(id time) cluster(id)
    coefplot, keep(treat_t*)
    `
      };
    
      return {
        analysis_type: analysisType,
        stata_code: templates[analysisType] || "* Analysis template not found"
      };
    }
  • Tool registration in the tools array, including name, description, and input schema definition.
      name: "generate_stata_code",
      description: "Stata 코드 생성 (분석, 진단, 시각화)",
      inputSchema: {
        type: "object",
        properties: {
          analysis_type: { type: "string", description: "분석 유형" },
          variables: { type: "object", description: "변수 정보" },
          options: { type: "object", description: "추가 옵션" },
        },
        required: ["analysis_type"],
      },
    },
  • Dispatch case in handleToolCall function that routes calls to the generate_stata_code handler.
      return handleGenerateStataCode(args);
    case "generate_python_code":
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool generates code but doesn't specify if it's read-only, requires authentication, has rate limits, or what the output format is. For a code generation tool with zero annotation coverage, this is a significant gap in transparency about its behavior and constraints.

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 very concise with a single phrase 'Stata 코드 생성 (분석, 진단, 시각화)', which is efficient and front-loaded. However, it might be overly brief, potentially under-specifying the tool's purpose. Every word earns its place, but it could benefit from slightly more detail without becoming verbose.

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?

Given the complexity of a code generation tool with 3 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain what the tool returns, any behavioral traits, or usage context. For a tool that likely produces structured output, the lack of output schema and minimal description leaves significant gaps in understanding how to use it 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?

The schema description coverage is 100%, with parameters 'analysis_type', 'variables', and 'options' all having descriptions in the schema. The description doesn't add any meaning beyond what the schema provides, such as examples or clarifications. Given the high schema coverage, a baseline score of 3 is appropriate as the schema handles the parameter documentation adequately.

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

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Stata 코드 생성 (분석, 진단, 시각화)' states the tool generates Stata code for analysis, diagnosis, and visualization, which is a clear purpose. However, it's somewhat vague about the specific scope and doesn't differentiate from sibling tools like 'generate_python_code' or 'generate_r_code' beyond the language. It's adequate but lacks specificity about what kind of Stata code it produces.

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. It doesn't mention sibling tools like 'generate_python_code' or 'generate_r_code' for language choice, or other code-related tools like 'code_template' or 'optimize_code'. There's no context on prerequisites, scenarios, or exclusions, leaving the agent with minimal usage direction.

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