Skip to main content
Glama

stata_table

Export stored Stata models to a formatted LaTeX table using esttab and booktabs, then return the .tex file for papers or reports.

Instructions

Export stored models to a publication LaTeX table (esttab, booktabs) and return the .tex.

models: names from estimates store (e.g. ["m1","m2","m3"]), in column order. filename: bare name -> stata_output/tables/.tex. keep/order: Stata coefficient lists, e.g. "treat_post" or "1.treat#1.post". coeflabels: {"treat_post": "Treat $\times$ Post"}; fe_rows: {"Firm FE": ["Yes","Yes","Yes"], ...} stats: from N, r2, r2_a, r2_within, N_clust, F, ymean (ymean must be added via estadd); default ["N","r2_a"] (use r2_within for reghdfe). se_note: describe the SEs, e.g. "Standard errors clustered at the county level in parentheses." Stars: * p<0.10, ** p<0.05, *** p<0.01. Requires estout (ssc install estout).

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": {
      "models": "<models>",
      "filename": "<filename>"
    },
    "name": "stata_table"
  }
}

Input Schema

NameRequiredDescriptionDefault
keepNo
labelNo
notesNo
orderNo
statsNo
titleNo
modelsYes
fe_rowsNo
mtitlesNo
se_noteNoStandard errors in parentheses.
decimalsNo
filenameYes
fragmentNo
coeflabelsNo
show_constantNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations, the description carries the burden and discloses real behavior: a file side effect at stata_output/tables/<name>.tex, an external dependency that must be installed, default statistics, and star thresholds. It omits overwrite/error behavior when a stored model is missing, which is the main remaining gap.

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?

Purpose is front-loaded in the first sentence, then each subsequent line is a compact parameter note with examples and no filler. Every sentence conveys usable information.

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 15-parameter, annotation-free tool with an output schema present, the description covers the model list, output path, formatting fields, and dependency well enough to invoke it correctly. It stops short of explaining failure modes or the semantics of the undocumented formatting flags.

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?

Schema description coverage is 0%, so the description must compensate, and it does so for the hardest parameters: filename path resolution, Stata coefficient-list syntax for keep/order, the coeflabels and fe_rows shapes, the allowed stats values with the ymean/estadd caveat, and se_note. Several remaining parameters (label, title, notes, mtitles, decimals, fragment, show_constant) are left to the schema titles alone.

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 description gives a specific verb and resource ('Export stored models to a publication LaTeX table') plus the underlying command (esttab, booktabs) and the return artifact (the .tex). This clearly separates it from siblings like stata_results or stata_run, which do not write publication tables.

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?

It establishes the prerequisite workflow ('models: names from `estimates store`') and the dependency ('Requires estout (ssc install estout)'), which tells the agent when the tool is invocable. It does not name an alternative tool for users who want non-LaTeX output, but the usage context is clear enough to act on.

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