Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

did_analysis

Read-only

Run a complete difference-in-differences analysis: auto-detect design, select the right estimator, and produce a diagnostic report with event study and sensitivity checks.

Instructions

Workflow wrapper that runs a full DiD pipeline: auto-detects 2x2 vs. staggered, runs the right estimator (CS by default), optionally runs Bacon decomposition, event study, and Rambachan-Roth sensitivity, and aggregates into a DIDAnalysis report object. Assumptions: Parallel trends between treated and control (2x2) or across cohorts (staggered) after any covariate adjustment; No anticipation: pre-treatment outcomes unaffected by future treatment; SUTVA / no interference across units; correct design auto-detection (2x2 vs staggered). Pre-conditions: Panel or repeated cross-section with y, treat, time; id required for staggered designs; treat is binary 0/1 for 2x2, or first-treatment period (0 = never-treated) for staggered; event_window within observed periods when run_event_study is enabled. Failure modes: Staggered design detected but no id column supplied, so cohorts cannot be formed -> Pass the unit identifier via id= so first-treatment cohorts can be inferred; Event-study pre-trend test rejects parallel trends in the bundled report -> Inspect the included honest_did sensitivity output and report bounds rather than the point ATT; Requested method incompatible with the detected d...

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yYesOutcome variable column name or outcome array.
idYesUnit, subject, or panel identifier column.
timeYesTime period column.
treatYesBinary treatment or first-treat column
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
methodNoEstimator selectionauto
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_pathYesAbsolute 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.
run_baconNorun_bacon parameter (bool).
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.
run_event_studyNorun_event_study parameter (bool).
run_sensitivityNorun_sensitivity parameter (bool).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

Beyond the read-only annotation, the description discloses auto-detection behavior, default estimator selection, optional pipeline components, the aggregated report object, key assumptions, and failure-mode reactions. It also warns that an incompatible requested method is a failure mode, which is not visible from the schema or annotations. No contradiction with readOnlyHint=true.

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?

The description is long but front-loaded with the core purpose and organized into Assumptions, Pre-conditions, and Failure modes. The length is justified for a complex 14-parameter wrapper, though the final failure-mode sentence is cut off and some pre-conditions echo schema requirements.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex orchestration tool with an output schema, the description provides enough context to call it correctly: purpose, assumptions, pre-conditions, key parameter semantics, and failure-mode remedies. Return-value details are covered by the output schema, so their absence here is not a gap.

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 coverage is 100%, so the baseline is 3. The description adds meaning beyond the schema by explaining how treat encodes 2x2 binary vs. staggered first-treatment period, that id is required for staggered designs, and that event_window must be within observed periods when the event study is enabled. It does not restate every parameter, but the schema already documents those.

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 opens with a specific verb and resource: 'runs a full DiD pipeline' and 'aggregates into a DIDAnalysis report object.' It distinguishes itself from sibling tools by naming auto-detection of 2x2 vs. staggered designs, default CS estimation, and optional Bacon/event-study/sensitivity components.

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?

Pre-conditions and failure modes give concrete conditional guidance, such as requiring id for staggered designs and directing the agent to inspect honest_did sensitivity output when pre-trend tests reject. It does not explicitly name sibling tools to use instead for single-estimator tasks, but the 'workflow wrapper' framing makes the overall usage context clear.

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