Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

from_stata

Read-only

Convert a Stata command to a verified StatsPAI tool-call payload. Supports regression, panel, IV, DID, synthetic control, RD; unknown commands yield close-match suggestions.

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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
detailNoPayload depth: 'minimal' (~150 tokens) for sub-step calls where only the point estimate is needed; 'standard' (~1K tokens) for diagnostics + coefficient table; 'agent' (~2K tokens, default) adds violations / next_steps / suggested_functions so the LLM can plan its next call without another round-trip.agent
commandYesOne Stata command, e.g. 'reghdfe y x, absorb(id year) cluster(id)'. Multi-command lines must be split by the caller.
as_handleNoIf true, cache the fitted result on the server and return result_id + result_uri alongside the JSON payload so a subsequent tools/call can chain without re-running.
data_pathNoAbsolute path or URL to a data file. Supported: .csv / .tsv / .txt (delimited), .parquet / .pq, .feather / .arrow, .xlsx / .xls, .dta (Stata), .json / .jsonl. Schemes: file://, s3://, gs://, https://.
result_idNoOptional handle to a previously-fitted result (returned by an earlier call when as_handle=true). Tools that operate on a fitted object accept this in place of re-supplying data_path + columns.
data_columnsNoOptional column projection. Parquet/Feather/Stata loaders honour this for fast partial reads.
data_sample_nNoOptional uniform random subsample size (seed=0, deterministic) — useful on huge panels.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/5.0
Behavior4/5

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

Despite annotations already marking it read-only, the description adds useful behavioral details: it returns a verified payload, never guesses on unrecognised commands, and instead returns close-match suggestions. It also discloses the dual output format (python_code and arguments), which helps the agent understand what the tool actually produces. This goes beyond the minimal annotation signal without contradicting it.

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?

The description is compact and front-loaded: the first sentence states purpose and output, the second scopes supported commands, and the third explains fallback behavior. Every sentence earns its place, and there is no redundant restating of schema details or annotations.

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 the rich input schema and existing output schema, the description is sufficiently complete for an agent to know what commands are supported, what the tool returns, and what happens for unrecognised input. It lacks an explicit contrast with sibling tools like from_r, but that gap is more about usage guidance than invocation completeness. Overall, the agent has enough context to call the tool correctly in most 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 coverage is 100%, so the input schema already documents all seven parameters thoroughly. The description adds modest context by listing supported command forms and noting that multi-command lines must be split, but the schema’s command example already conveys this. With full schema coverage, the description does not need to compensate heavily, so the baseline 3 applies.

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?

The first sentence states a specific verb and resource: translating a single Stata command into a verified StatsPAI tool-call payload, and even distinguishes the output format (python_code and arguments). The Stata focus clearly separates it from sibling tools like from_r and other estimation tools. The list of supported command families further sharpens the purpose.

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 gives implied usage context: it is for Stata commands, especially Tier-1 commands like regress, reghdfe, and rdrobust, and for count-panel commands like nbreg. However, it does not explicitly state when to use this tool instead of from_r or another translation/estimation sibling, nor does it offer exclusions such as 'use from_r for R code'. The supported-command list implies scope but does not fully spell out the alternatives.

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

Deploy Server

Other Tools