Skip to main content
Glama

cox_regression

Fit Cox proportional hazards regression models to estimate covariate effects on time-to-event data using formula-based input and duration/event columns.

Instructions

Fit a Cox proportional hazards regression with statsmodels PHReg.

``formula`` contains only the covariate terms (for example ``"x1 + x2"``).
``data`` is a ``{column: list}`` mapping or an ``"@<path>.csv"`` reference.
Event indicators must be 0/1 and durations must be positive.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYes
formulaYes
event_colYes
duration_colYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.3/5.0
Behavior3/5

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

With no annotations, the description carries the burden and does add real domain constraints: formula holds covariates only, data accepts a mapping or '@path.csv' reference, event indicators must be 0/1, durations must be positive. However, it says nothing about return values, convergence behavior, or failure modes, leaving notable gaps.

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 operation is front-loaded in the first sentence, followed by tightly scoped clarifications of formula, data, and input constraints. No filler sentences; each line adds information.

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?

For a 4-parameter statistical tool with no annotations, 0% schema coverage, and no output schema, the description covers inputs adequately but omits what the tool returns (coefficients/hazard ratios), error handling, and how duration_col/event_col are supplied. Adequate but with clear gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate, and it does so well: it clarifies the formula's scope (covariates only, with an example), the accepted data formats, and the value constraints for the event and duration inputs. It never names duration_col/event_col explicitly, but the constraints clearly map to them.

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 verb and resource — fitting a Cox proportional hazards regression via statsmodels PHReg — which is a distinct statistical model among siblings like linear_regression, glm, and kaplan_meier. It does not, however, explicitly differentiate itself from related survival/modeling siblings.

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

Usage Guidelines2/5

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

There is no guidance on when to use Cox PH regression versus alternatives such as kaplan_meier (non-parametric survival) or glm, nor any prerequisite context. The agent must infer usage purely from the model name.

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