Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

bacon_decomposition

Read-only

Decompose a two-way fixed-effects DID estimate into its 2x2 comparison weights to reveal negative weights from treated-vs-treated comparisons, validating whether the estimate is trustworthy.

Instructions

Goodman-Bacon (2021) decomposition: breaks the two-way fixed-effects DID estimator into its 2x2 comparison weights. Reveals whether treated-vs-treated comparisons (which can have negative weights) dominate the estimate. Run this before trusting a TWFE-DID point estimate. Validation: certified parity evidence.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yYes
idYes
timeYes
treatYes
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
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.
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.2/5.0
Behavior4/5

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

The annotations already establish readOnlyHint=true and openWorldHint=false, so the description does not need to restate safety. It adds useful behavioral context by warning about negative weights and by noting 'certified parity evidence,' which signals implementation validation. No contradiction with annotations.

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: it states the method, the key output, the risk it addresses, and when to run it—all in three sentences plus a short validation phrase. Every sentence earns its place.

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 output schema, annotations, and standard DID parameter names, the description is largely complete for invoking the tool correctly. It is missing only explicit guidance about closely related sibling tools like bacon_plot or twfe_decomposition, and a direct parameter role mapping.

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 60%, so the four required parameters id, time, treat, and y lack explicit schema descriptions. The tool description provides methodological context that implies their roles but does not explicitly define them. This is adequate for a DID-savvy agent but not strongly compensating.

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 names a specific estimator (Goodman-Bacon 2021) and states precisely what the tool does: decomposes a TWFE-DID estimator into 2x2 comparison weights and exposes potentially negative treated-vs-treated comparisons. This clearly distinguishes it from generic decomposition or plotting siblings.

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 gives an explicit decision rule: 'Run this before trusting a TWFE-DID point estimate.' This tells the agent when the tool is appropriate. It stops short of a 5 by not stating when not to use it or naming an alternative such as bacon_plot/twfe_decomposition.

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