Skip to main content
Glama

stata_do

Save Stata code as a do-file and execute it with a text log, or run an existing do-file when code is omitted. Capture reproducible analysis output in logs.

Instructions

Save code as a do-file (if given) and execute it with a text log.

filename: e.g. "01_clean" or "analysis/did_main.do". A bare name goes to stata_output/do/; a relative path with folders is relative to the working directory; absolute paths are allowed. If code is omitted, the existing do-file is run. Log is written to stata_output/logs/.log.

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": {
      "filename": "<filename>"
    },
    "name": "stata_do"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeNo
filenameYes
wait_secondsNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.4/5.0
Behavior3/5

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

With no annotations, the description carries the full burden and does disclose the log destination (stata_output/logs/<name>.log) and filesystem side effects of writing a do-file. It says nothing about execution lifecycle — whether the call blocks, what happens if it exceeds the 240s default wait, or whether partial output is returned on timeout.

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?

Front-loaded one-line purpose followed by a path-resolution paragraph that earns its space given 0% schema coverage. The `filename: e.g. ...` fragment is slightly awkward but no sentence is redundant.

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

Completeness3/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 file/log destinations are covered. For a tool that spawns a long-running external process, the absence of any timeout or post-timeout guidance leaves a real operational gap given the unannotated 240-second wait parameter.

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 0%, so the description must compensate, and it does well for `filename` (bare name → stata_output/do/, relative paths against working dir, absolute paths allowed) and `code` (optional; omission means run existing file). `wait_seconds` is never mentioned and its default and timeout behavior are left entirely unexplained.

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?

States a concrete verb and resource: save supplied `code` as a do-file and execute it, capturing a text log. The do-file framing implicitly distinguishes it from an inline-execution sibling like stata_run, but no sibling is named explicitly, so the agent must infer the boundary.

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?

"If `code` is omitted, the existing do-file is run" is a genuine usage condition covering the two modes of the tool. Beyond that there is no guidance on when to prefer this over stata_run, or what to do after a long execution (e.g. use stata_wait).

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