Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

interflex

Read-only

Estimate how a treatment's effect varies across a moderator using binning, linear, or kernel models, with diagnostic tests for valid inference.

Instructions

Conditional marginal effects of d across a moderator x Validation: certified parity evidence.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dYesOutcome, treatment (binary 0/1 or continuous) and moderator.
xYesOutcome, treatment (binary 0/1 or continuous) and moderator.
yYesOutcome, treatment (binary 0/1 or continuous) and moderator.
zNoAdditional covariates entering linearly.
bwNoKernel bandwidth on the moderator's scale (before the adaptive density scaling). Required for ``estimator='kernel'``; interflex's cross-validated choice is not ported.
vceNoVariance construction. ``'robust'`` is the HC1 sandwich (interflex's default) and ``'homoscedastic'`` the classical covariance for the linear and binning models and the Wald test; ``'bootstrap'`` (kernel estimator only) draws nonparametric bootstrap standard errors, the linear and binning estimators always reporting delta-method SEs.robust
seedNoBootstrap replications and seed.
waldNoReport the Wald and LR tests of the linear interaction against the binning model (``estimator='binning'`` or ``'linear'``).
alphaNoSignificance level for confidence intervals and tests.
nbinsNoNumber of moderator bins (cut at sample quantiles) for the binning estimator; ``cutoffs`` overrides the quantiles.
nevalNoEvaluation points, equally spaced over the moderator's range.
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_bootNoBootstrap replications and seed.
x_evalNoExplicit evaluation points.
cutoffsNocutoffs parameter (Optional[Sequence[float]]).
weightsNoObservation weights column.
adaptiveNoKernel estimator only. ``True`` scales the bandwidth at each evaluation point by the moderator's density as the R package does (``h(x) = bw * sqrt(geometric-mean density / density(x))``); ``False`` uses the fixed Gaussian kernel ``phi((X - x)/bw)`` of the Stata ``interflex`` command.
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://.
estimatorNoestimator parameter (str).binning
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.
wald_testNoReference distribution of the Wald statistic: chi-square (R ``lmtest::waldtest(test = "Chisq")``) or the F distribution with the full model's residual degrees of freedom (Stata interflex).chisq
treat_typeNoInferred from ``d`` when omitted (two distinct values = discrete).
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.
wald_full_moderateNoWhether the fully interacted model behind the Wald / LR tests also interacts the covariates ``z`` with the bins (R interflex). The Stata command leaves the covariates uninteracted; set ``False`` to reproduce its test.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.5/5.0
Behavior4/5

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

Annotations declare readOnlyHint=true, meaning no mutation; the description adds behavioral details about estimator variants (binning, linear, kernel), adaptive bandwidth, Wald tests, and a validation parity note. It discloses that interflex's cross-validated bandwidth choice is not ported, and that `bw` is required for kernel. This goes beyond the annotations and gives the agent meaningful operational context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence plus a validation phrase, which is concise. It front-loads the core function. However, it mixes a correctness/parity claim ('Validation: certified parity evidence') into the description without explaining what that means or how it should influence usage. Some space is wasted because the sentence mentions only three params, while the schema already documents them.

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

Completeness3/5

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

Given the tool has 26 params, 5 enums, output schema, and rich sibling context, the description is thin. It does not mention when to use the kernel vs binning estimator, the role of the `detail` parameter, or how this relates to interflex_plot. However, the schema and output schema carry a lot of weight, so it's not critically incomplete, but it's below the complexity level of 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 the schema already documents all 26 parameters thoroughly. The description adds little beyond the schema: it names d, x, y but not their distinct roles as outcome/treatment/moderator roles. Many params have good descriptions in schema (e.g., vce, adaptive, detail), and the description references these but doesn't add meaning beyond what schema already provides. Baseline 3 is appropriate.

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?

The description states a specific purpose: computing conditional marginal effects of treatment d across moderator x. It names the treatment and moderator variables explicitly, which distinguishes it from generic regression or RD tools. However, it does not explicitly contrast with the sibling interflex_plot (though the name suggests that's plotting), so it falls slightly short of full sibling differentiation.

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?

The description includes Validation: certified parity evidence, which hints at a validation context but doesn't explain when to use this tool versus alternatives like interflex_plot or megamma. There is no explicit when/when-not or alternative naming. The required params d, x, y, data_path imply linear-interaction estimation workflow, but the guidance is minimal.

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