Skip to main content
Glama

Survival analysis (KM + Cox) / 生存分析(KM/Cox 全流程)

survival_cox
Read-only

Survival analysis (KM + Cox) / 生存分析(KM/Cox 全流程) | USE WHEN: follow-up time and event data: survival curves, median survival, hazard ratios, log-rank, multivariable Cox | ALIASES: 生存分析, Cox回归, HR, 风险比, log-rank, 中位生存, 随访, 生存率, hazard ratio | RETURNS: 生存曲线、中位生存、HR、log-rank P

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": {
      "data": "<data>"
    },
    "name": "survival_cox"
  }
}

Input Schema

NameRequiredDescriptionDefault
dataYes逐例记录,**必须是对象数组**:[{"time":10,"event":1,"group":"A","age":65}, …]。不接受二维数组或裸数值(会 400);列名由 time_col/event_col/group_col 指定。
horizonNo时间依赖 ROC 的评价时点(随访时间单位),默认取随访时间中位数。
time_colNo随访时间列名
event_colNo结局事件列名(1=事件)
group_colNo分组列名
roc_timesNo多个评价时点数组,如 [12, 24, 36](月)。用于一次出多条时间依赖 ROC。
score_colNo风险评分/预测概率列名(做时间依赖 ROC 时必须给)。
analysis_typeNokm 或 cox
competing_colNo竞争风险事件列名(0=删失/1=主事件/2=竞争事件)。传了走 Fine-Gray。
landmark_timeNolandmark 分析的界标时点;小于该时点的事件不计入。
covariate_colsNoCox 模型纳入的协变量列名数组(如 ["age","sex","stage"])。每纳入一个协变量约需 10 个事件,事件数不足时 HR 的 CI 会极宽。
categorical_colsNo按分类处理的协变量列名数组(如 ["sex","stage"])。数值编码的 0/1 必须在此声明,否则会被当连续变量。
selection_methodNo变量筛选方法:none/forward/backward/stepwise/lasso,默认 none。
static_covariatesNo基线协变量列名数组(不随时间变化),用于 Cox 调整。与 time_varying_covariates 区分:基线值全表一份。
selection_directionNo筛选方向:both/forward/backward(配合 selection_method)。
time_varying_covariatesNo时变协变量列名数组(长格式下每行带当时的值)。每个受试者可有多行,time_col 取各行的区间起点。

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed12 schema fields changed
    • addedInput schema / properties / categorical_cols
      Added value: +{
      +  "description": "按分类处理的协变量列名数组(如 [\"sex\",\"stage\"])。数值编码的 0/1 必须在此声明,否则会被当连续变量。",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • addedInput schema / properties / competing_col
      Added value: +{
      +  "description": "竞争风险事件列名(0=删失/1=主事件/2=竞争事件)。传了走 Fine-Gray。",
      +  "type": "string"
      +}
    • changedInput schema / properties / covariate_cols / description
      Previous value: -"Cox 协变量列名"New value: +"Cox 模型纳入的协变量列名数组(如 [\"age\",\"sex\",\"stage\"])。每纳入一个协变量约需 10 个事件,事件数不足时 HR 的 CI 会极宽。"
    • changedInput schema / properties / data / description
      Previous value: -"逐行数据,每行含时间/事件/分组/协变量"New value: +"逐例记录,**必须是对象数组**:[{\"time\":10,\"event\":1,\"group\":\"A\",\"age\":65}, …]。不接受二维数组或裸数值(会 400);列名由 time_col/event_col/group_col 指定。"
    • addedInput schema / properties / horizon
      Added value: +{
      +  "description": "时间依赖 ROC 的评价时点(随访时间单位),默认取随访时间中位数。",
      +  "type": "number"
      +}
    • addedInput schema / properties / landmark_time
      Added value: +{
      +  "description": "landmark 分析的界标时点;小于该时点的事件不计入。",
      +  "type": "number"
      +}
    • addedInput schema / properties / roc_times
      Added value: +{
      +  "description": "多个评价时点数组,如 [12, 24, 36](月)。用于一次出多条时间依赖 ROC。",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • addedInput schema / properties / score_col
      Added value: +{
      +  "description": "风险评分/预测概率列名(做时间依赖 ROC 时必须给)。",
      +  "type": "string"
      +}
    • addedInput schema / properties / selection_direction
      Added value: +{
      +  "description": "筛选方向:both/forward/backward(配合 selection_method)。",
      +  "type": "string"
      +}
    • addedInput schema / properties / selection_method
      Added value: +{
      +  "description": "变量筛选方法:none/forward/backward/stepwise/lasso,默认 none。",
      +  "type": "string"
      +}
    • addedInput schema / properties / static_covariates
      Added value: +{
      +  "description": "基线协变量列名数组(不随时间变化),用于 Cox 调整。与 time_varying_covariates 区分:基线值全表一份。",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • addedInput schema / properties / time_varying_covariates
      Added value: +{
      +  "description": "时变协变量列名数组(长格式下每行带当时的值)。每个受试者可有多行,time_col 取各行的区间起点。",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
  2. Added

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, openWorldHint=false, so the safety profile is covered. The description adds value beyond that with the RETURNS line enumerating the produced statistics (curves, median survival, HR, log-rank P), which matters because no output schema exists. It does not disclose runtime cost, event-count requirements, or failure modes beyond what the schema already states.

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?

Pipe-delimited and front-loaded: title, then USE WHEN, then ALIASES, then RETURNS. The alias list is long but serves retrieval, and no sentence is wasted. Slightly dense formatting, but efficient for its length.

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 16-parameter analysis tool with full schema coverage, annotations, and no output schema, the description covers purpose, trigger condition, and return contents. The remaining gap is routing: it never says when to prefer it over the overlapping survival/Cox siblings, which matters given the crowded sibling set.

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% across all 16 parameters, so the schema already documents time_col, event_col, covariate_cols, selection_method, and the rest in detail. The description adds no parameter-level meaning of its own; the baseline 3 applies when structured fields carry the full burden.

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?

Names the concrete resource and methods: survival analysis covering KM curves, median survival, hazard ratios, log-rank, and multivariable Cox. The 'USE WHEN' clause lists the analytic outputs, so an agent can match it to a survival-analysis request. It stops short of naming sibling survival tools (e.g., animal_survival_km, act_cox_model), so differentiation is inferred rather than stated.

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

Usage Guidelines4/5

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

The 'USE WHEN: follow-up time and event data' clause gives an explicit trigger condition plus the target outputs (curves, median survival, HR, log-rank, multivariable Cox), which is stronger than implied usage. There are no when-not conditions and no named alternatives, even though several sibling tools overlap on Cox/median-survival territory.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources