Skip to main content
Glama

ivreg

Read-only

Run 2SLS instrumental-variables regression with first-stage F diagnostics to estimate causal effects when regressors are endogenous.

Instructions

2SLS instrumental-variables regression with first-stage F diagnostics; classical SEs unless robust=. Formula syntax: 'y ~ x_exog + (d_endog ~ z_instrument)'. Validation: certified parity evidence.

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": {
      "formula": "<formula>"
    },
    "name": "ivreg"
  }
}

Input Schema

NameRequiredDescriptionDefault
detailNoPayload depth; agent is the fullest.agent
robustNononrobust
data_idNoData handle (d_...) from load_data; replaces data_path.
formulaYes'y ~ x + (d ~ z)' style.
data_csvNoSmall inline table as CSV text.
as_handleNoCache the fit and return its result_id.
data_pathNoAbsolute path of a data file on the server.
result_idNoHandle of an earlier fit made with as_handle=true.
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 safety is covered, but the description still adds real behavioral context: the estimator is 2SLS, first-stage F diagnostics are produced, and standard errors default to classical unless 'robust' is set. It omits that fits can be cached via as_handle, but the core computational behavior is disclosed.

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?

Three short, front-loaded segments: what the estimator is, how to write the formula, and what the SE default is. No filler or repetition, and the most important information (2SLS + formula shape) comes first.

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?

An output schema exists, so return values need not be explained, and the schema covers the data-input and handle parameters. Still, for a 10-parameter fitting tool the description says nothing about data sourcing (data_id/data_csv/data_path) or the handle workflow, so an agent must read the schema to call it correctly.

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 90%, so the schema already documents most parameters, including a formula example nearly identical to the one in the description. The description's main addition is clarifying that the default nonrobust option corresponds to classical standard errors, which is marginal beyond what the structured fields provide.

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 names a specific estimator and resource ('2SLS instrumental-variables regression') plus the diagnostics it produces ('first-stage F'), so an agent knows exactly what class of model this fits. It does not, however, contrast itself with sibling tools such as iv, pipeline_iv, or feols, leaving the choice to be inferred.

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?

Usage is only implied: the formula pattern 'y ~ x_exog + (d_endog ~ z_instrument)' signals that this tool is for designs with an endogenous regressor and an excluded instrument. There is no explicit statement of when to prefer this over IV pipeline or DML siblings, nor any stated prerequisites.

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