Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

mccrary_test

Read-only

Detect manipulation of the running variable at the cutoff in regression-discontinuity designs. Use this test to check for sorting around the threshold, indicating potential invalidity of local randomization.

Instructions

McCrary (2008) density test for manipulation of the running variable at the cutoff in regression-discontinuity designs. A significant discontinuity in the density of x at c is direct evidence that units are sorting around the cutoff (e.g. test-taking strategy, income manipulation), invalidating local randomisation. Assumptions: Smooth density of x at c under the null of no manipulation; Local-linear density estimator captures the shape near c. Pre-conditions: x is continuous with mass on both sides of c; no extreme heaping at c (rounded data invalidates the local-linear density estimate). Failure modes: Test rejects (p < alpha) -- manipulation evidence -> Switch to donut-hole RD (sp.rdrobust(donut=delta)) or partial-identification bounds (sp.rdrbounds); Heaped data near c (e.g. integer-rounded scores) -> The density-test statistic is unreliable on heaped data; consider Frandsen (2017) integer-RD adjustment. Alternatives: sp.rddensity, sp.rdrbounds. Typical minimum N: 200.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cNoCutoff value
xYesRunning variable
bwNoBandwidth; auto if None
alphaNoSignificance level for confidence intervals and tests.
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
n_binsNoHistogram bins; auto if None
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.4/5.0
Behavior4/5

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

Annotations already provide readOnlyHint=true and openWorldHint=false, so the description doesn't need to repeat those. It adds valuable behavioral context: assumptions (smooth density under null, local-linear estimator), pre-conditions (continuous x, no extreme heaping), and failure modes (unreliable on heaped data, typical N=200). This goes well beyond what annotations convey.

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 ~150 words but well-organized: purpose, assumptions, pre-conditions, failure modes, alternatives, and typical N. It is dense but each sentence contributes useful information. Slightly long, but the structure and front-loading of purpose make it efficient.

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 statistical test, the description covers assumptions, pre-conditions, failure modes, and alternatives, which is essential for correct usage. The presence of an output schema covers return values. Nothing critical is missing for an agent to decide whether and how to call this tool.

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 100%, so all parameters are already documented in the input schema. The description adds some context (e.g., x as running variable, c as cutoff, bandwidth auto if None) but doesn't provide syntax or format details beyond the schema. Baseline 3 is appropriate given the high coverage.

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 clearly states the specific statistical test (McCrary 2008 density test for manipulation of the running variable at the cutoff in RD designs) and what it does: detect discontinuities in density as evidence of sorting. It also names alternatives (sp.rddensity, sp.rdrbounds) and failure modes, distinguishing it from siblings like rdrobust or rddensity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly explains when to use the test (to check for manipulation in RD) and when not to (heaped data). It provides failure modes and next steps (donut-hole RD, partial-identification bounds, Frandsen adjustment) and names alternative tools. This is exemplary guidance for an agent.

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