Skip to main content
Glama
shichengg
by shichengg

stata_write_dofile

Save Stata code to a do file on disk and get its file path. Use relative filenames to store within the current project's .stata-mcp/dofiles directory.

Instructions

将 Stata 代码写入 do 文件并保存到磁盘,返回文件路径;相对文件名会写入最近 session 项目的 .stata-mcp/dofiles/,不会使用 MCP runtime。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesdo 文件的完整内容
filenameNo文件名(不含扩展名)或绝对路径;留空则自动生成时间戳文件名

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.1.0

TDQS

A4/5.0
Behavior4/5

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.

Conciseness5/5

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.

Completeness4/5

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.

Parameters3/5

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.

Purpose5/5

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.

Usage Guidelines3/5

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.