Skip to main content
Glama
shichengg
by shichengg

stata_run_dofile

Execute a do-file in the Stata GUI, track each run with a session ID, overwrite the session's latest log, and return the log content without altering the original file.

Instructions

在 Stata GUI 中运行一个 do 文件。该工具以 session_id 表示一个复现任务/同一个 Stata GUI;同一任务的原始 do、检查 do、续跑 do 应使用同一个 session_id。每次调用都会覆盖该 session 在项目 .stata-mcp/cache/ 下的最新运行 text log,并自动返回日志内容;不会修改用户原始 do 文件。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesdo 文件的完整路径,例如 D:/project/analysis.do
roleNo该 do 在 session 中的角色:entry/source/auxiliary,默认 entry
log_modeNo兼容参数;1.1 版始终使用 replace 覆盖 session 最新运行日志
session_idNo可选;同一复现任务固定使用同一个 session_id。不传时兼容旧行为:用 do 文件路径作为 session key

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.1.0

TDQS

A3.8/5.0
Behavior4/5

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

With no annotations provided, the description carries the full behavioral burden. It transparently discloses that each call overwrites the session's latest running log in .stata-mcp/cache/, automatically returns the log content, and does not modify the user's original do file. These are important side effects and constraints. It does not mention potential blocking behavior or error handling, but the disclosed information is substantial and accurate.

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 composed of a few sentences, with the primary purpose stated first. It includes essential behavioral details (log overwriting, return value, non-modification) without unnecessary verbosity. The structure is clear and efficient, though it could benefit from a slight reordering to front-load the most critical behavioral note about log overwriting.

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 that there is no output schema, the description explains what the tool returns (log content). It covers the key aspects an agent needs to know: setting up session_id for related tasks, the behavior of the log, and the safe handling of the original file. It does not mention return format or error handling in detail, but for a run tool with this parameter set, it is fairly complete.

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?

The schema already provides 100% coverage with descriptions for all parameters. The description adds value beyond the schema by explaining the session_id semantics (same session for related tasks) and clarifying that log_mode is a compatibility parameter that always uses 'replace' in version 1.1. This enhances the agent's understanding of how to use the parameters correctly.

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: running a do file in Stata GUI. It specifies the resource (do file) and the environment (Stata GUI). It is distinct enough, though it does not explicitly differentiate from the sibling 'stata_run' tool, which could be a potential confusion point. Overall the purpose is specific and unambiguous.

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 useful usage context: it explains the session_id concept (same session for original/check/continuation do files) and notes the behavior of overwriting the latest log. However, it does not give explicit guidance on when to use this tool versus alternatives like stata_run or stata_append_dofile. The context is helpful but not a full usage guideline.

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