Skip to main content
Glama

from_stata

Read-only

Translate one Stata command into a verified StatsPAI tool-call payload with ready-to-dispatch arguments and Python code, returning close-match suggestions for unrecognized commands.

Instructions

Translate a single Stata command to a verified StatsPAI tool-call payload. Returns python_code (string for chat replies) AND arguments (ready-to-dispatch JSON-RPC for tools/call). Tier-1 commands: regress / xtreg / reghdfe / ivreg2 / csdid / did_imputation / synth / rdrobust; count-panel commands include nbreg / xtnbreg / ppmlhdfe. Unrecognised commands return close-match suggestions instead of guessing. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact).

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": {
      "command": "<command>"
    },
    "name": "from_stata"
  }
}

Input Schema

NameRequiredDescriptionDefault
detailNoPayload depth; agent is the fullest.agent
commandYesOne Stata command, e.g. 'reghdfe y x, absorb(id year) cluster(id)'. Multi-command lines must be split by the caller.
data_idNoData handle (d_...) from load_data; replaces data_path.
data_csvNoSmall inline table as CSV text.
as_handleNoCache the fit and return its result_id.
data_pathNoAbsolute path of a data file on the server.
result_idNoHandle of an earlier fit made with as_handle=true.
data_recordsNoSmall inline table as row objects.
max_output_bytesNoResult byte budget (default 262144; 0 = none).

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

With readOnlyHint=true and openWorldHint=false already covering the safety profile, the description still adds real behavior: the dual return payload, the refusal-and-suggest path for unrecognized commands, and a validation/evidence-tier disclosure ('known-truth, reference, external-parity, or Monte Carlo artifact'). It does not explain how the tier is chosen or what happens on a partial parse, but the key non-obvious traits are surfaced.

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?

Four front-loaded sentences covering what it does, what it returns, what it supports, and how it fails, with no filler. The return-value clause is somewhat redundant given an output schema exists, but it is useful for chat-reply framing and does not obscure the leading purpose statement.

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?

A nine-parameter tool with an output schema and annotations is adequately framed: purpose, coverage, failure mode, validation, and result shape are all present. The remaining gap is which of data_id/data_path/data_csv/data_records to supply and how the detail levels change the payload, which matters at this parameter count.

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 100%, so all nine parameters including detail, data_id, data_csv, as_handle and max_output_bytes are already documented in the schema. The description only reinforces the command parameter's single-command constraint and the example syntax; it adds nothing about the mutual exclusivity of the four data-input parameters or the detail levels.

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: translate a single Stata command into a verified StatsPAI tool-call payload, and enumerates the covered command families (regress, xtreg, reghdfe, ivreg2, csdid, did_imputation, synth, rdrobust, nbreg, xtnbreg, ppmlhdfe). It also clarifies the output is dual-purpose (python_code for chat, arguments for tools/call), so an agent can tell this apart from execution siblings like regress or rdrobust that run the analysis itself.

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

Usage Guidelines4/5

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

Scope guidance is explicit about the supported tier and about the one-command-per-call constraint ('Multi-command lines must be split by the caller'), and it defines out-of-scope behavior ('Unrecognised commands return close-match suggestions instead of guessing'). It stops short of naming an alternative for non-Stata input (e.g. from_r for R syntax) or stating when to prefer calling the underlying tool directly.

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