Skip to main content
Glama

stata_run

Run Stata code in a persistent session and return output for quick checks or exploration; long jobs keep running and can be polled with a wait call.

Instructions

Run Stata code in the persistent session and return the output.

code may be multi-line (supports ///, comments, locals within the block). Use for quick checks/exploration. For real analysis prefer stata_do (saved do-file + log). If the job exceeds wait_seconds it keeps running; then call stata_wait.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "code": "<code>"
    },
    "name": "stata_run"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYes
wait_secondsNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior4/5

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

No annotations are supplied, so the description carries the whole burden, and it does disclose two non-obvious traits: the session is persistent, and long jobs keep running past the wait window rather than being cancelled. It stops short of stating what happens on Stata errors, whether prior session state is mutated, or how output is truncated, so it is strong but not exhaustive for a code-execution tool.

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?

Four short sentences, front-loaded with the action and return, then capabilities, then routing, then timeout behavior. Every sentence carries distinct information with no restatement of the title or name.

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?

An output schema exists, so return values need no explanation, and the description covers the core invocation path plus the async hand-off. What remains missing is failure behavior and whether the persistent session requires prior setup, which matters for a stateful execution tool.

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

Parameters4/5

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

Schema description coverage is 0%, so the description must compensate, and it does: it explains that 'code' may be multi-line and supports /// continuations, comments, and locals within a block, and it conveys the meaning of wait_seconds as a timeout after which the job continues running. It omits the default value (240) and any bounds or units guidance for wait_seconds, leaving one gap.

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

Purpose5/5

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

States a specific verb and resource ('Run Stata code in the persistent session and return the output') and immediately differentiates itself from the sibling stata_do by scoping itself to quick checks/exploration. An agent can pick between stata_run, stata_do, and stata_wait without opening any schema.

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

Usage Guidelines5/5

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

Gives explicit when-to-use ('quick checks/exploration'), an explicit alternative with its condition ('For real analysis prefer stata_do (saved do-file + log)'), and a follow-up branch ('If the job exceeds wait_seconds it keeps running; then call stata_wait'). This is the full when/when-not/next-step set.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.