stata-mcp
Stata GUI MCP
通过 Windows Stata Automation COM,让 Claude Code、Codex、OpenCode、Claude Desktop、Cursor 和 VS Code 控制可见的 Stata GUI,并把每次执行的真实 text log 自动返回给 AI。
A Windows MCP server that controls a visible Stata GUI through Stata Automation COM and automatically returns the real Stata text log for every execution.

中文
项目特点
真实 GUI:命令在可见的 Stata GUI 中运行,而不是隐藏的 Python 模拟环境。
人工接管:AI 执行后,用户可以直接在同一个 Stata 窗口中检查、修改和继续分析。
持久 Session:同一个
session_id复用同一个 Stata GUI;数据、宏、矩阵、估计结果和工作目录可继续使用。自动返回结果:运行若干行代码或完整 do 文件后,MCP 自动读取本次 text log 并返回给 AI。
完整代码块:多行选择通过临时 do 文件整体执行,支持循环、程序定义和续行语法。
多任务窗口:不同
session_id可以维护不同的 Stata GUI 和项目日志。项目本地记录:session、do 文件和最新日志关系保存在项目的
.stata-mcp/中。不改原始脚本:运行完整 do 文件时不会重写用户源文件。
pip 安装:无需下载仓库或在 MCP 配置中填写源码路径。
适用范围
要求 | 说明 |
操作系统 | Windows 10/11 |
Stata | 已安装并获得授权的 Stata 17/18/19,MP、SE 或 BE 均可 |
Automation | Stata COM 接口已注册 |
Python | 3.10–3.13 |
MCP 传输 | 本地 stdio |
本项目当前不支持 macOS/Linux,也不使用 PyStata、Stata CLI 或 batch 后端。pip 包只包含 MCP Python 代码,不包含 Stata 软件、许可证或第三方 ado 包。
Related MCP server: Stata MCP Server
安装
1. 安装 Python 包
在 PowerShell 中运行:
pip install stata-gui-mcppip 会同时安装 MCP Python SDK 和 Windows 所需的 pywin32。用户不需要克隆 GitHub 仓库。
2. 注册 Stata Automation
以管理员身份打开 PowerShell,按实际安装路径运行:
Start-Process -FilePath "C:\Program Files\Stata18\StataMP-64.exe" -ArgumentList "/Register" -Wait常见可执行文件名包括:
StataMP-64.exe
StataSE-64.exe
StataBE-64.exe请根据 Stata 版本、edition 和安装位置调整路径。不要直接在 Git Bash 中运行 /Register,因为 Git Bash 可能把它改写成文件路径。
正常启动时,MCP 直接调用已注册的 COM ProgID stata.StataOLEApp,不要求手工填写 Stata 安装路径。
MCP 客户端配置
所有客户端都启动同一个本地 stdio 命令:
stata-gui-mcp客户端 | 推荐方式 | 配置键/文件 |
Claude Code |
| user scope 或 |
Codex CLI |
|
|
OpenCode | 配置文件或交互式添加 |
|
Claude Desktop | Desktop 配置 |
|
Cursor |
|
|
VS Code |
| 用户 MCP 配置或 |
Claude Code
推荐注册到 user scope,使当前用户的所有项目都能使用:
claude mcp add --transport stdio --scope user stata -- stata-gui-mcp命令含义:
--transport stdio 使用本地标准输入输出传输
--scope user 当前用户的所有项目可用
stata Claude Code 中显示的 server 名称
-- 分隔 Claude 参数和服务器命令
stata-gui-mcp pip 安装的服务器命令如果只希望项目内使用,在项目根目录创建 .mcp.json:
{
"mcpServers": {
"stata": {
"type": "stdio",
"command": "stata-gui-mcp",
"args": [],
"env": {}
}
}
}重新启动 Claude Code 或重新加载 MCP 后,在工具列表中应看到以 mcp__stata__ 开头的工具。
Codex CLI
通过命令添加本地 stdio server:
codex mcp add stata -- stata-gui-mcp也可以编辑用户配置 %USERPROFILE%\.codex\config.toml,或项目级 .codex\config.toml:
[mcp_servers.stata]
command = "stata-gui-mcp"
args = []保存配置后重新启动 Codex。codex mcp list 可列出已注册的 server。
OpenCode
OpenCode 可以交互式添加:
opencode mcp add stata选择 local server,并将命令设为 stata-gui-mcp。也可以编辑用户配置 %USERPROFILE%\.config\opencode\opencode.json,或项目根目录的 opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"stata": {
"type": "local",
"command": ["stata-gui-mcp"],
"enabled": true
}
}
}OpenCode 使用 mcp 键,并把本地命令写成数组;它与 Claude Desktop 的 mcpServers 格式不同。保存后重新启动 OpenCode,或运行 opencode mcp list 检查状态。
Claude Desktop
打开以下 Windows 配置文件:
%APPDATA%\Claude\claude_desktop_config.json加入:
{
"mcpServers": {
"stata": {
"command": "stata-gui-mcp",
"args": []
}
}
}如果文件中已有其他 server,只添加 stata 项,不要覆盖其他配置。完全退出 Claude Desktop 后重新打开,再在 Developer/MCP 页面检查工具。
Cursor
全局配置文件:
%USERPROFILE%\.cursor\mcp.json项目配置文件:
<project>\.cursor\mcp.json内容:
{
"mcpServers": {
"stata": {
"command": "stata-gui-mcp",
"args": []
}
}
}也可以从 Cursor 的 Settings → Tools & MCP 添加。保存后重新加载 Cursor 窗口并启用 stata server。
VS Code
项目级配置文件:
<project>\.vscode\mcp.json内容:
{
"servers": {
"stata": {
"type": "stdio",
"command": "stata-gui-mcp",
"args": []
}
}
}用户级配置可通过命令面板运行 MCP: Open User Configuration 打开。VS Code 使用 servers 键,不是 mcpServers。保存后在 MCP server 列表中启动 stata。
命令不在 PATH 中
如果客户端报告找不到 stata-gui-mcp,可以改用同一 Python 环境的模块入口:
{
"command": "python",
"args": ["-m", "stata_mcp"]
}Claude Code 对应命令:
claude mcp add --transport stdio --scope user stata -- python -m stata_mcp使用虚拟环境时,把 python 换成该环境解释器的绝对路径,例如:
{
"command": "D:\\Python\\python.exe",
"args": ["-m", "stata_mcp"]
}快速开始
运行一个完整 do 文件
stata_run_dofile(
path="D:/research/project/analysis.do",
session_id="main",
role="entry"
)MCP 会:
通过 COM 启动或连接一个可见的 Stata GUI;
将工作目录切换到 do 文件目录;
覆盖该 session 的最新运行日志;
执行原始 do 文件;
自动读取并返回本次 Stata 输出。
在同一个 session 中继续
stata_run(commands="ereturn list\npredict double yhat\nsummarize yhat")多行字符串作为一个临时 do 文件整体执行,执行完成后临时文件会删除。Stata 内存状态继续保留在同一个 GUI 中。
查看数据结构快照
stata_get_data_schema(
sample_rows=20,
include_codebook=true,
include_sample=true,
include_missing=true
)快照包括:
describe
codebook, compact
misstable summarize
list in 1/20, abbreviate(20)
notes
label dirSession 与日志
项目运行后创建:
<project>/.stata-mcp/
├── cache/
│ ├── task_registry.json
│ ├── task_registry.json.lock
│ ├── run_<session>_<hash>.log
│ └── schema_<session>_<hash>.log
└── dofiles/文件 | 内容 | 更新方式 |
| session、entry/source/current do 和日志路径 | session 操作时更新 |
| 防止多个 MCP 进程同时更新 registry 时丢失数据 | registry 事务期间自动加锁 |
| 最近一次命令代码块或完整 do 文件输出 | 每次 |
| 最近一次数据结构快照 | 每次 |
| MCP 通过相对文件名生成的 do 文件 | 写文件工具调用时更新 |
日志读取后不会自动删除。运行日志和 schema 日志相互独立。建议把 .stata-mcp/ 加入分析项目自己的 .gitignore。
每个 session 固定使用一个项目缓存目录。不同 session_id 的文件名包含不同哈希,不会互相覆盖。
输出长度
运行工具默认最多把日志末尾 200,000 个字符返回给 AI。超过时,响应会标记 output_truncated: true 并保留完整 log_path。磁盘日志不会被截断。
可选环境变量:
{
"env": {
"STATA_MCP_MAX_OUTPUT_CHARS": "300000"
}
}工具参考
工具 | 用途 |
| 在最近 session 中将若干行代码作为一个代码块执行,覆盖并返回最新运行日志 |
| 在指定 session 中运行完整 do 文件,覆盖并返回最新运行日志 |
|
|
| 写入 do 文件;相对名称写到项目 |
| 读取 do 文件 |
| 向已有 do 文件追加代码 |
| 读取最近运行日志或显式日志路径,支持 |
| 在当前 Stata GUI 中执行 |
| 执行 |
| 执行 |
| 通过独立 schema 日志返回结构、缺失摘要和样本 |
| 显示 COM、内存 session 和项目 registry 状态 |
stata_run_dofile 仍接受旧版 log_mode 参数以保持客户端兼容,但 1.1 版始终使用 replace,保证每个 session 只保留最近一次运行输出。
与其他 Stata MCP 的比较
不同项目针对不同工作流,没有一个后端适合所有场景。
维度 |
| ||
主要后端 | Windows COM Automation | Stata CLI/批处理导向 | PyStata worker |
GUI | 可见 Stata GUI | 通常无 GUI | 通常无 Stata GUI |
人工接管 | 可直接接管同一窗口 | 不是主要目标 | 不是主要目标 |
状态持续 | 同一 COM GUI session 持续 | 取决于其执行方式 | 持久 PyStata worker |
AI 获取输出 | 每次自动读取 session text log | CLI/log 输出 | PyStata输出和临时日志 |
选中多行代码 | 临时 do 文件整体执行 | 支持命令/文件执行 | 支持 |
多 session | 多个 COM GUI | 以对应项目当前实现为准 | 多 worker 进程 |
主要平台 | Windows | 跨平台 CLI 场景,具体支持见上游 | PyStata 支持的平台,具体支持见上游 |
更适合 | 希望看见、核查并手工继续 Stata | 自动化、批处理和服务器工作流 | 无 GUI 持久会话与深度 IDE 集成 |
本项目的主要优势是可见 GUI + 人工接管 + AI 自动读取真实日志。如果目标是 Linux 服务器、纯批处理或不显示 GUI,应选择 CLI/PyStata 类型方案。
环境变量
普通用户通常无需设置。
变量 | 默认值 | 用途 |
|
| 非标准 COM ProgID |
| 未设置 | 特殊安装位置需要显式预启动 Stata 时的可执行文件路径;MCP 只保留一个存活的预启动进程,退出后会按需重启,Automation 会话仍由 COM ProgID 建立 |
|
| 自动返回给 AI 的日志字符上限 |
| 安装包根目录 | 仅用于状态诊断;项目缓存仍跟随 do 文件 |
默认情况下,COM 注册信息负责定位 Stata,不会把 Python site-packages 的上一级误认为 Stata 安装目录。
安全说明
MCP 获得的权限等同于当前 Windows 用户和 Stata GUI。
内置危险命令检查只是一层意外操作防护,不是完整安全沙箱。
stata_write_dofile和stata_append_dofile会修改明确指定的文件。stata_install_package会访问外部源并修改 Stata ado 环境。建议在运行前审阅 AI 生成的分析代码和文件路径。
MCP 使用具名日志
__stata_mcp_run和__stata_mcp_schema,不会主动执行log close _all。如果用户 do 文件自身执行
log close _all,它也会关闭 MCP 日志,后续输出可能无法捕获;建议只关闭用户自己命名的日志。
故障排查
COM 未注册或无法启动 Stata
以管理员 PowerShell 重新执行 /Register,然后完全退出旧 Stata 进程并重启 MCP 客户端。
找不到 stata-gui-mcp
客户端启动环境的 PATH 与安装 pip 包时的终端可能不同。使用上文的 python -m stata_mcp 配置,或填入正确 Python 解释器绝对路径。
stata_run 提示没有 session
先运行一个绝对路径 do 文件:
stata_run_dofile(path="D:/research/project/analysis.do", session_id="main")后续无路径命令会发送到最近 session。也可以使用:
stata_session(action="set_recent", session_id="main")Stata GUI 被关闭
MCP 检测到 COM 断开时会保留旧日志和 registry,重新初始化一个空 GUI,并明确提示内存状态已丢失。中断命令不会自动重放。
AI 只看到日志末尾
检查响应中的 output_truncated 和 log_path,再调用 stata_read_log 读取完整文件,或调整 STATA_MCP_MAX_OUTPUT_CHARS。
开发
源码仓库:https://github.com/shichengg/stata-mcp
git clone https://github.com/shichengg/stata-mcp
cd stata-mcp
python -m venv .venv
.\.venv\Scripts\python -m pip install -e ".[dev]"
.\.venv\Scripts\python -m pytest欢迎提交 issue 和 pull request。
License
English
Overview
stata-gui-mcp is a Windows MCP server that controls a visible Stata GUI through Stata Automation COM. It keeps Stata state alive per session and automatically returns the actual text log from every selected-code or do-file execution.
Highlights
Visible Stata GUI with direct manual takeover.
Persistent Stata data, macros, matrices, estimates, and working directory within a session.
Multi-line code is executed as one temporary do-file, not line by line.
One replace-only latest run log per session, returned automatically to the AI.
A separate replace-only schema snapshot log.
Multiple
session_idvalues can maintain independent Stata GUI windows.Original user do-files are never rewritten.
Installable from pip without cloning the repository.
Requirements
Windows 10/11.
A licensed Stata 17/18/19 installation (MP, SE, or BE).
Stata Automation COM registered with
/Register.Python 3.10–3.13.
The package does not include Stata or a Stata license. It does not currently provide macOS/Linux, PyStata, CLI, or batch backends.
Installation
Install the package in PowerShell:
pip install stata-gui-mcpRegister the executable that matches your installation from an elevated PowerShell:
Start-Process -FilePath "C:\Program Files\Stata18\StataMP-64.exe" -ArgumentList "/Register" -WaitAdjust the Stata version, edition, and path as needed. Normal MCP startup locates Stata through the registered COM ProgID; no source path or default STATA_EXE is required.
MCP client setup
All clients start the same local stdio command: stata-gui-mcp.
Claude Code
Claude Code is listed first because it is the primary supported setup:
claude mcp add --transport stdio --scope user stata -- stata-gui-mcpProject-scoped .mcp.json:
{
"mcpServers": {
"stata": {
"type": "stdio",
"command": "stata-gui-mcp",
"args": [],
"env": {}
}
}
}Restart Claude Code or reload MCP servers and look for tools prefixed with mcp__stata__.
Codex CLI
codex mcp add stata -- stata-gui-mcpUser configuration %USERPROFILE%\.codex\config.toml or project .codex\config.toml:
[mcp_servers.stata]
command = "stata-gui-mcp"
args = []Restart Codex after saving. codex mcp list shows configured servers.
OpenCode
Interactive setup:
opencode mcp add stataSelect a local server and enter stata-gui-mcp, or edit %USERPROFILE%\.config\opencode\opencode.json / project opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"stata": {
"type": "local",
"command": ["stata-gui-mcp"],
"enabled": true
}
}
}Restart OpenCode or use opencode mcp list.
Claude Desktop
Edit %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"stata": {
"command": "stata-gui-mcp",
"args": []
}
}
}Merge the stata entry with existing servers, fully quit Claude Desktop, and reopen it.
Cursor
Use global %USERPROFILE%\.cursor\mcp.json or project .cursor\mcp.json:
{
"mcpServers": {
"stata": {
"command": "stata-gui-mcp",
"args": []
}
}
}Alternatively use Settings → Tools & MCP, then reload the Cursor window.
VS Code
Create project .vscode\mcp.json:
{
"servers": {
"stata": {
"type": "stdio",
"command": "stata-gui-mcp",
"args": []
}
}
}For a user-level configuration, run MCP: Open User Configuration from the Command Palette. VS Code uses servers, not mcpServers.
PATH fallback
If a client cannot find the console command, use the Python interpreter that installed the package:
{
"command": "python",
"args": ["-m", "stata_mcp"]
}Claude Code equivalent:
claude mcp add --transport stdio --scope user stata -- python -m stata_mcpReplace python with the virtual-environment interpreter's absolute path when applicable.
Quick start
Start a persistent GUI session by running a do-file:
stata_run_dofile(
path="D:/research/project/analysis.do",
session_id="main",
role="entry"
)Continue in the same in-memory Stata state:
stata_run(commands="ereturn list\npredict double yhat\nsummarize yhat")Capture the current dataset schema:
stata_get_data_schema(sample_rows=20)Sessions and logs
<project>/.stata-mcp/
├── cache/
│ ├── task_registry.json
│ ├── task_registry.json.lock
│ ├── run_<session>_<hash>.log
│ └── schema_<session>_<hash>.log
└── dofiles/stata_runandstata_run_dofilereplacerun_<session>_<hash>.logand return it automatically.stata_get_data_schemaseparately replacesschema_<session>_<hash>.log.task_registry.json.lockserializes registry updates across separate MCP processes.Reading either log does not delete it.
Different session IDs use distinct hashed names.
Add
.stata-mcp/to the analysis project's.gitignore.
The automatic response includes at most the last 200,000 characters by default. If output_truncated: true appears, the complete file remains at log_path. Override the limit with STATA_MCP_MAX_OUTPUT_CHARS.
Tool reference
Tool | Purpose |
| Execute a complete code block in the recent session and return its latest run log |
| Run an original do-file in a session and return its latest run log |
| List, inspect, destroy, or select the recent session |
| Write a do-file |
| Read a do-file |
| Append Stata code to a do-file |
| Read a log as full text, core text, or parsed command/result JSON |
| Run |
| Return |
| Return |
| Return schema, missing summary, and sample through a separate log |
| Show COM, in-memory session, and registry status |
log_mode remains accepted by stata_run_dofile for old clients, but version 1.1 always replaces the latest session run log.
Comparison
Dimension |
| ||
Main backend | Windows COM Automation | Stata CLI/batch-oriented | PyStata workers |
Visible Stata GUI | Yes | Usually no | Usually no |
Manual takeover | Same GUI window | Not the primary goal | Not the primary goal |
Persistent state | Persistent COM GUI session | Depends on execution mode | Persistent PyStata worker |
AI output | Automatically returned session text log | CLI/log output | PyStata output and temporary logs |
Multi-session | Multiple COM GUI sessions | See upstream implementation | Multiple worker processes |
Primary fit | Visible, reviewable, human-in-the-loop Stata | Automation and batch workflows | Headless persistent IDE integration |
The differentiator is visible GUI + manual takeover + automatic real-log return. Choose a CLI/PyStata project when a server, headless, or cross-platform workflow matters more.
Environment variables
Variable | Default | Purpose |
|
| Override the registered COM ProgID |
| unset | Explicitly prelaunch a non-standard Stata executable; MCP tracks one live prelaunched process and relaunches it after exit, while Automation sessions are still created through the COM ProgID |
|
| Maximum log characters returned automatically |
| package root | Status diagnostics only |
Security and limitations
The server runs with the current Windows user's permissions.
The dangerous-command check is a guardrail, not a sandbox.
File-writing tools modify explicitly selected files.
Package installation changes the Stata ado environment and may use the network.
Review generated analysis code and paths before execution.
MCP uses named logs and never intentionally issues
log close _all.A user do-file containing
log close _allcan still close the MCP log and truncate capture; close only user-named logs instead.
Troubleshooting
COM startup fails: rerun
/Registerfrom elevated PowerShell and restart Stata/MCP clients.Command not found: use the
python -m stata_mcpfallback with the correct interpreter.No current session: call
stata_run_dofilewith an absolute path first.GUI was closed: MCP preserves old logs/registry and reports that the newly initialized GUI has empty memory; it never silently replays the interrupted command.
Output was truncated: read
log_pathwithstata_read_logor raiseSTATA_MCP_MAX_OUTPUT_CHARS.
Development
git clone https://github.com/shichengg/stata-mcp
cd stata-mcp
python -m venv .venv
.\.venv\Scripts\python -m pip install -e ".[dev]"
.\.venv\Scripts\python -m pytestRepository: https://github.com/shichengg/stata-mcp
License
Available Tools
12 toolsstata_append_dofileA
向已有 do 文件追加内容
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | 已有 do 文件的完整路径 | |
| content | Yes | 要追加的 Stata 代码内容 |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
There are no annotations, so the description carries the full burden of disclosing behavior. It does convey that the operation is non-destructive (append) and targets an existing file, but it does not state what happens if the file is missing, how line separators are handled, or what the result of appending looks like.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, tightly worded sentence that front-loads the verb and target with no filler. It could have used the space to add usage or behavior notes, but as written it is appropriately concise.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a low-complexity append operation with fully documented parameters and no meaningful return value, the description is largely sufficient. The only gaps are edge-case behaviors such as missing files, which are secondary to selecting and invoking the tool correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100% and both path and content already have clear descriptions. The tool description adds no additional parameter-level meaning, so the baseline of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a precise verb, 'append' (追加), and a specific resource, an existing Stata do-file (已有 do 文件). This clearly differentiates it from sibling tools like stata_write_dofile (create/overwrite) and stata_read_dofile (read) without needing to open the schema.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The phrase '已有' implies the file must already exist, and 'append' implies adding to rather than replacing content, so usage is inferable. However, there is no explicit when-to-use/when-not-to-use guidance or mention of alternatives such as stata_write_dofile for creating/overwriting.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
stata_get_data_infoB
运行 describe,并通过 session 最新运行日志将当前数据集基本信息直接返回给调用端
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
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 does reveal the mechanism: run `describe`, read the session's latest run log, and return basic info to the caller. However, it does not mention prerequisites (e.g., a dataset must be loaded), potential side effects on the session, or what happens on failure.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, compact sentence that front-loads the core action (`运行 describe`) and then explains the mechanism and result. There is no redundant information or filler; every phrase contributes meaning.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description is adequate for a zero-parameter tool, but it leaves gaps: the exact meaning of '基本信息' is vague, there is no mention of required session/dataset state, and it does not clarify how this differs from `stata_get_data_schema`. Given there is no output schema or annotations, some additional context would help an agent invoke it correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has zero parameters, so the baseline is 4. There is no parameter information missing, and the description does not need to compensate for undocumented inputs. The empty schema is consistent with the description's focus on an action without arguments.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly identifies the action: it runs Stata's `describe` command and returns basic information about the current dataset to the caller. It conveys the resource and outcome specifically, though it does not explicitly distinguish itself from the closely related sibling `stata_get_data_schema`.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is given about when to use this tool versus alternatives like `stata_get_data_schema` or `stata_get_results`. The intended context is implied by the tool name and description, but there are no explicit usage conditions or exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
stata_get_data_schemaB
使用独立且每次覆盖的 schema text log,读取当前 Stata 数据集结构、缺失摘要和样本预览并返回给调用端
| Name | Required | Description | Default |
|---|---|---|---|
| sample_rows | No | 样本预览行数,默认 20 | |
| include_sample | No | 是否包含样本预览,默认 true | |
| include_missing | No | 是否包含缺失值摘要,默认 true | |
| include_codebook | No | 是否包含 codebook, compact,默认 true |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
There are no annotations, so the description carries the behavioral burden. It does disclose a meaningful implementation detail — the schema text log is independent and overwritten on every call. It does not mention potential side effects, required session state, or what happens if no dataset is loaded, but it provides more than a bare statement of purpose.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The entire description is one sentence with no filler or repetition. It is compact, though the opening clause about the schema text log delays the main action slightly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With no output schema and no annotations, the description gives only a broad sense of return content. It covers the data structure, missing summary, and sample preview, but omits usage boundaries, return format, or error conditions. It is adequate for a moderately simple read tool, but not complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so parameters are already documented. The description loosely aligns with the parameters by mentioning sample preview and missing summary, but it adds no detail about defaults, combinations, or behavior beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description names a specific verb (read) and resource (current Stata dataset structure, missingness summary, and sample preview), and adds a unique mechanism (independent schema text log). It is clear, though it does not explicitly contrast with the similarly named sibling stata_get_data_info.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The intended use is implied: call this when you need the current dataset's schema, missing summary, or sample preview. However, it gives no explicit guidance about when to choose this over stata_get_data_info or stata_get_results, so alternatives are not addressed.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
stata_get_resultsA
运行 return list 或 ereturn list,并通过 session 最新运行日志将 r() 或 e() 存储结果直接返回给调用端
| Name | Required | Description | Default |
|---|---|---|---|
| type | Yes | 结果类型:r 或 e |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are present, so the description carries the full burden. It discloses that the tool executes commands and relies on the session's latest run log to extract results, which is useful context. However, it does not mention prerequisites (e.g., an active session or prior command producing r()/e()) or potential side effects of running commands, so it is only partially transparent.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single concise sentence that front-loads the action and then explains the delivery mechanism. There is no redundant phrasing; all included details (command execution, session log, result type) earn their place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool has a simple input schema and no output schema, so the description needs to explain return values and prerequisites. It describes what is returned (r()/e() stored results) but does not specify the output format or note that a Stata session with recent results must exist, leaving modest gaps for an agent to call it correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema already documents the `type` parameter (enum r/e) with 100% coverage. The description adds meaning by associating the type with the specific commands (`return list` vs `ereturn list`) and clarifying that returned values correspond to r() or e() stored results, going beyond the bare enum documentation.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific action: it runs `return list` or `ereturn list` and returns the stored r()/e() results to the caller. It names the exact Stata commands and the result type, which clearly distinguishes it from siblings like `stata_run` and `stata_read_log`.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies the tool is for retrieving Stata stored results after commands, but it does not explicitly state when to use it over alternatives such as `stata_read_log` or provide any exclusions. The use case is inferable but not spelled out.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
stata_install_packageA
在已打开的 Stata GUI 中安装外部包,如 estout、ivreg2、rdrobust 等
| Name | Required | Description | Default |
|---|---|---|---|
| source | No | 安装来源:ssc(默认)或 net | |
| package | Yes | 包名称,例如 estout、ivreg2、rdrobust |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It does disclose the prerequisite that a Stata GUI must already be open, but it does not mention side effects of installation, network requirements, overwriting behavior, or failure conditions. For a mutating operation, this is a significant transparency gap.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, front-loaded sentence that conveys the action, target, environment, and examples with no filler. Every part earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple two-parameter installer, the description plus fully documented schema provide enough information to invoke the tool correctly. The main gaps are behavioral side effects and expected output, but these are not blocking for a basic install operation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already fully documents both parameters: package names and source with an enum and default. The description adds example packages but no additional meaning beyond what the schema provides, matching the baseline for high schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific verb ('install'), a clear resource ('external packages'), and the environment ('in the already open Stata GUI'), with concrete examples like estout, ivreg2, and rdrobust. This clearly distinguishes the tool from sibling operations such as running commands, writing do-files, or reading results.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies when to use the tool: when an external Stata package needs to be installed in an already-open GUI session. However, it does not explicitly compare it to alternatives such as stata_run, which could also execute an install command, nor does it state when not to use this tool.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
stata_read_dofileA
读取 do 文件内容,返回给 Claude 检查、解释或继续修改
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | do 文件的完整路径 |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the behavioral disclosure burden. It does say the tool reads and returns content, which implies a non-mutating operation, but it does not explicitly state that it does not execute the do-file or trigger Stata, a relevant distinction from sibling tools like stata_run_dofile.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single front-loaded sentence with no redundant or filler content. It states the action, the resource, and the intended purpose efficiently.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple one-parameter read tool, the description provides the essential context: what it reads and why. It could be slightly more complete by explicitly stating that it does not execute the file, but the use case is still clear enough for an agent to invoke it correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema already documents the only parameter, 'path', with the description 'do 文件的完整路径', giving 100% coverage. The tool description adds no parameter-specific meaning beyond the schema, so the baseline score of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific action and resource: '读取 do 文件内容' (read do-file content). This clearly distinguishes it from sibling tools like stata_write_dofile and stata_append_dofile, and the purpose '检查、解释或继续修改' further clarifies its role.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The intended usage is implied by the purpose phrase '检查、解释或继续修改' — use this tool when Claude needs to inspect or modify a do-file. However, it does not explicitly name alternatives or state when not to use it, leaving usage guidance implied rather than explicit.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
stata_read_logA
读取 Stata text log。path 留空时读取最近 session 的 last_log_path;推荐 output_format='dict',它会把日志解析成命令-结果对,便于 AI 判断报错位置。
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | log 文件的完整路径;留空则读取最近 session 的 last_log_path | |
| tail_lines | No | 只读取最后 N 行,留空则读取全部 | |
| output_format | No | 输出格式:full=完整文本,core=去除日志框架行,dict=JSON 命令-结果对 |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the behavioral burden. It discloses the default path fallback and the parsing behavior of output_format='dict' into command-result pairs, which adds real value beyond the schema. It does not mention error conditions such as what happens when no prior session exists, but the disclosed behaviors are meaningful.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two short sentences with front-loaded purpose and actionable defaults/recommendations. No filler, no repetition of schema content, and every clause adds useful information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a zero-required-parameter read tool with full schema coverage, the description covers purpose, default behavior, and recommended output format. It lacks an output schema and annotation safety profile, but the core invocation decision is adequately specified.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
All three parameters are fully described in the schema, so the baseline is 3. The description adds important semantics for path (empty means recent session's last_log_path) and output_format (dict is recommended and parses logs into command-result pairs), which is value beyond the schema. tail_lines remains schema-only but already has a clear one-line description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description identifies a specific verb and resource: reading a Stata text log, and the log-vs-dofile distinction in sibling names makes the target reasonably clear. It does not explicitly contrast with stata_get_results or stata_read_dofile, so it stops short of full sibling differentiation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It provides concrete usage context: leave path empty to target the most recent session's last_log_path, and prefer output_format='dict' when the AI needs to locate errors. It does not explicitly say when to use alternative tools, but the practical guidance is clear and actionable.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
stata_runA
在最近的 Stata MCP session 对应 GUI 中将 commands 作为一个完整代码块执行;每次覆盖该 session 的最新运行 text log,并自动返回实际输出。可先用 stata_session(action='set_recent') 切换目标 session。
| Name | Required | Description | Default |
|---|---|---|---|
| commands | Yes | 要执行的 Stata 命令,多行用换行符分隔 |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full behavioral disclosure burden. It explicitly mentions that the tool overwrites the session's latest run text log and returns actual output, which are important side effects. It does not mention error handling or permission requirements, but the disclosed behavior is clear and adds value beyond the schema.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise, with the primary action front-loaded and side effects and session-switching guidance following. It is two sentences with no fluff, and each clause carries information. It is slightly verbose due to phrasing, but overall efficient.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity (one parameter, no output schema, no annotations), the description covers the essential context: the session to use, the side effect (log overwrite), the return of output, and how to switch sessions. It does not cover error handling, but that is not expected for a simple command executor. It is complete enough for an agent to invoke it correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the baseline is 3. The description adds a nuance by describing 'commands' as a 'complete code block', but does not provide additional syntax or format details beyond what the schema already states. It adds minimal semantic value beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the primary action: executing 'commands' as a complete code block in the most recent Stata session. It also mentions the side effect of overwriting the session's log and returning output, which adds specificity. However, it does not explicitly differentiate from sibling tools like 'stata_run_dofile', so it lacks explicit sibling distinction.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives a usage hint by mentioning that one can switch the target session using 'stata_session(action='set_recent')', which is helpful context. But it does not explicitly state when to use this tool versus alternatives like 'stata_run_dofile' or when not to use it. The guidance is implied rather than explicit.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
stata_run_dofileA
在 Stata GUI 中运行一个 do 文件。该工具以 session_id 表示一个复现任务/同一个 Stata GUI;同一任务的原始 do、检查 do、续跑 do 应使用同一个 session_id。每次调用都会覆盖该 session 在项目 .stata-mcp/cache/ 下的最新运行 text log,并自动返回日志内容;不会修改用户原始 do 文件。
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | do 文件的完整路径,例如 D:/project/analysis.do | |
| role | No | 该 do 在 session 中的角色:entry/source/auxiliary,默认 entry | |
| log_mode | No | 兼容参数;1.1 版始终使用 replace 覆盖 session 最新运行日志 | |
| session_id | No | 可选;同一复现任务固定使用同一个 session_id。不传时兼容旧行为:用 do 文件路径作为 session key |
TDQS
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.
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.
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.
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.
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.
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.
stata_sessionB
管理 Stata MCP session:列出、查询、销毁、切换最近 session。session_id 代表同一复现任务/同一个 Stata GUI,并关联 entry/source/current do、每个 do 的 log_paths 和 last_log_path。
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | 操作:list/get/destroy/set_recent | |
| session_id | No | get/destroy/set_recent 需要指定的 session_id |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations are absent, so the description must carry the full behavioral burden. It does explain what session_id represents and what it is associated with, but it does not disclose the side effects of destroy, what get returns, how set_recent changes behavior, or whether these operations are safe or destructive. A session-management tool with a destroy action needs clearer behavioral disclosure.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single compact sentence that front-loads the tool's purpose and action list, then adds essential session-semantics context. There is no fluff or repetition of the schema. It could be slightly better structured by separating the action enumeration from the session_id semantics, but it remains appropriately sized.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With no output schema and no annotations, the description should clarify return values and behavioral outcomes for each action. It adequately covers what session_id means and which actions need it, but it does not explain what list/get return, what destroy removes, or what set_recent actually switches. The tool is simple enough that this is a moderate gap, not a fatal one.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the baseline is 3. The description goes beyond the schema by explaining that session_id identifies the same reproduction task/GUI and is linked to entry/source/current do and log paths. It also clarifies that get/destroy/set_recent require session_id, which is not reflected as a conditional requirement in the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly identifies the resource (Stata MCP session) and enumerates the four supported operations: list, get, destroy, and set_recent. This maps directly to the action enum and distinguishes the tool from siblings focused on running or editing do-files. '管理' alone would be vague, but the explicit action list makes the purpose concrete.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no explicit guidance on when to use this tool versus alternatives, and it does not explain when one action should be preferred over another. The action enum and the session_id note imply some usage contexts, but the description never states conditions like 'use list to discover active sessions' or 'destroy removes the session and its associated state.'
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
stata_statusA
检查 Stata MCP 服务器状态、内存 session 和项目局部 .stata-mcp/cache/task_registry.json 中记录的 session/do/log 关系
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the transparency burden. '检查' strongly implies a read-only inspection, and naming the project-local cache file adds useful concrete context about the data source. However, it does not explicitly state side-effect-freeness, permission requirements, or behavior when the registry file is missing.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single compact sentence that front-loads the action and lists its targets without filler. The inclusion of the specific cache file path is dense but relevant, and no sentence or phrase is wasted.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the zero-parameter schema and the straightforward status-checking nature, the description adequately covers what the tool does and what it inspects. It does not spell out the exact response format, but for a status/inspection tool that information is largely inferable from the listed targets.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
This tool has zero parameters and an empty input schema, so there is no parameter documentation burden. The description still adds semantic value by explaining what the status check covers, which is sufficient for an agent to invoke the tool correctly.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses the concrete verb '检查' (check/inspect) and identifies three specific objects: Stata MCP server status, in-memory sessions, and session/do/log relationships recorded in .stata-mcp/cache/task_registry.json. This resource-level specificity clearly distinguishes it from siblings like stata_run or stata_session, even without naming them. It is not a tautology and tells an agent exactly what the tool inspects.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit when-to-use or when-not-to-use guidance is provided, and no sibling alternatives are named. The intended usage is implied by the content: call this tool to check server/session/cache status. However, it lacks explicit routing or exclusion conditions that would make this dimension stronger.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
stata_write_dofileA
将 Stata 代码写入 do 文件并保存到磁盘,返回文件路径;相对文件名会写入最近 session 项目的 .stata-mcp/dofiles/,不会使用 MCP runtime。
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | do 文件的完整内容 | |
| filename | No | 文件名(不含扩展名)或绝对路径;留空则自动生成时间戳文件名 |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Without annotations, the description carries the disclosure burden and does add meaningful behavior: it writes to disk, returns the file path, routes relative filenames to .stata-mcp/dofiles/, and notes that MCP runtime is not used. It does not disclose overwrite behavior or session prerequisites, but the disclosed traits are substantial.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
One dense, front-loaded senrence that includes action, return value, path semantics, and a runtime caveat. Every clause adds information; no filler.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple two-parameter tool with full schema coverage, this is nearly complete: it specifies the return value, the default location behavior, and the runtime exception. It could be more complete about overwrite behavior or what happens if no session project exists, but those are edge cases.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema covers 100% of parameters, so the baseline is 3. The description adds no new parameter-level meaning beyond what the schema already states about filename and auto-generation; it mostly restates the path behavior already present in the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb ('write'), a resource ('do file'), and the outcome ('saved to disk, returns file path'). The description clearly distinguishes this from sibling tools like stata_run_dofile or stata_append_dofile by focusing on writing and saving.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for creating or overwriting do-files and clarifies path resolution for relative filenames, but it does not explicitly say when to prefer this tool over alternatives such as stata_append_dofile or stata_run_dofile. No when-not-to-use guidance is provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
12 tool updates
v1.1.0- First observed
stata_append_dofile - First observed
stata_get_data_info - First observed
stata_get_data_schema - First observed
stata_get_results - First observed
stata_install_package - First observed
stata_read_dofile - First observed
stata_read_log - First observed
stata_run - First observed
stata_run_dofile - First observed
stata_session - First observed
stata_status - First observed
stata_write_dofile
TDQS
Scored across 12 tools
Each tool targets a distinct artifact (do file, log, session, package, data metadata), and the descriptions clarify the boundaries well. A few pairs like stata_run/stata_run_dofile and stata_get_data_info/stata_get_data_schema are close enough that an agent could initially pick the wrong one.
Almost all tools follow a consistent stata_verb_noun pattern in snake_case. Minor deviations are stata_session and stata_status, which are noun-only names rather than verb_object, and stata_run which lacks an explicit object.
12 tools is well within the ideal scope for a domain-specific server. Each tool covers a meaningful part of the do-file, session, log, and data-inspection workflow without unnecessary bloat.
The tool surface covers the full write-do-file, append, read, run, read-log, install-package, and retrieve-results workflow coherently. Minor gaps exist around explicit session creation and do-file deletion, but arbitrary command execution via stata_run mitigates most dead ends.
Maintenance
Related MCP Connectors
Use your Mac, Windows or Linux computer from ChatGPT, Claude or Codex: files, commands, documents.
Control Unreal Engine to browse assets, import content, and manage levels and sequences. Automate…
Streamline your Attio workflows using natural language to search, create, update, and organize com…
Automate eSignature workflows and signing tasks via natural language commands.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceProvides a bridge between Stata statistical software and code editors like VS Code and Cursor, enabling users to run Stata commands directly from the editor, view output in real-time, and get AI-powered assistance with Stata coding.506MIT
- AlicenseNot gradedqualityDmaintenanceConnects AI agents to a local Stata installation, enabling execution of Stata code, data inspection, graph generation, and result verification through natural language interactions.731 PyPI86AGPL 3.0
- FlicenseNot gradedqualityDmaintenanceEnables an agent to execute Stata do scripts or inline commands locally and retrieve structured results including status, error diagnostics, and output text for consumption by the model.1-
- AlicenseAqualityBmaintenanceEnables LLM/agent applications to execute Stata code, load and inspect data, obtain structured regression results and graphs, and manage background tasks through the Model Context Protocol.10MIT