Skip to main content
Glama

did

Read-only

Estimate difference-in-differences treatment effects for two-period or staggered panel data, with automatic method selection and support for Callaway-Sant'Anna, Sun-Abraham, BJS, SDID, and DDD.

Instructions

Difference-in-differences dispatcher. 2x2 (two periods, 0/1 treat) when id is omitted; with id, a 0/1 indicator on a multi-period panel is converted to first-treatment cohorts and Callaway-Sant'Anna runs. Pass method= to force '2x2', 'cs', 'sa', 'bjs', 'sdid' or 'ddd'. 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": {
      "time": "<time>",
      "treat": "<treat>",
      "y": "<y>"
    },
    "name": "did"
  }
}

Input Schema

NameRequiredDescriptionDefault
yYesOutcome column
idNoUnit identifier; required for staggered designs (method='cs'/'sa'/'bjs') and SDID
timeYesTime period column
treatYesBinary treatment indicator (0/1) or first-treatment period column (0 = never treated)
detailNoPayload depth; agent is the fullest.agent
methodNoEstimator (see sp.describe_function('did')).auto
parityNo
clusterNoCluster column for cluster-robust SEs
data_idNoData handle (d_...) from load_data; replaces data_path.
data_csvNoSmall inline table as CSV text.
subgroupNoAffected-subgroup column (method='ddd' only)
as_handleNoCache the fit and return its result_id.
crit_distNo
data_pathNoAbsolute path of a data file on the server.
result_idNoHandle of an earlier fit made with as_handle=true.
covariatesNoOptional control columns
aggregationNoCallaway-Sant'Anna aggregation of ATT(g,t)
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

A3.7/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, so the safety profile is covered; the description adds real behavioral context beyond that — automatic conversion of a 0/1 panel indicator into first-treatment cohorts, the method-forcing override, and a validated-evidence-tier requirement. It stops short of describing how data must be supplied or what happens on conflicting inputs (e.g., both data_id and data_path).

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?

Three front-loaded sentences with no filler, lead sentence establishing the tool's role immediately. Minor cost: heavy shorthand ('2x2', 'cs', 'sa', 'bjs', 'ddd') is used before the reader has the enum mapping, which slightly taxes comprehension.

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 19-parameter tool with an output schema and annotations, the description supplies the essential dispatch logic and validation gate; the remaining parameters (data_id, data_path, data_csv, result_id, as_handle) are documented in the schema. It would be stronger if it named the data-input pathway or handle-reuse pattern, but nothing critical to correct invocation is absent.

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 89%, so the schema already carries most parameter meaning and baseline is 3. The description reinforces the id/time/treat interplay and lists forceable methods, but that list omits several schema enum values (auto, callaway_santanna, sun_abraham, staggered_rollout), making it a partial rather than additive explanation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb-and-resource label ('Difference-in-differences dispatcher') and then spells out the two dispatch modes: 2x2 when id is omitted, Callaway-Sant'Anna when it is supplied. An agent can distinguish the core behavior from siblings like callaway_santanna or sdid, though the description never explicitly contrasts itself with those named alternatives.

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?

Gives conditional guidance for the estimator path (omit id for 2x2, provide id for staggered/CS, pass method= to force a specific estimator) and states a validation-tier precondition. However, it never says when to call this tool rather than the dedicated callaway_santanna or sdid siblings, leaving the dispatcher-vs-specialist choice to inference.

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