Skip to main content
Glama

SHAP single-case explanation / SHAP 单样本解释

shap_explain
Read-onlyIdempotent

SHAP single-case explanation / SHAP 单样本解释 | USE WHEN: explain why one patient was predicted high risk (feature contributions) | ALIASES: SHAP, 解释预测, 为什么高风险, 特征贡献, explain prediction, 可解释性 | RETURNS: SHAP 贡献图

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": {
      "csv_data": "<csv_data>"
    },
    "name": "shap_explain"
  }
}

Input Schema

NameRequiredDescriptionDefault
csv_dataYes带表头的 CSV 文本,**整段放在一个字符串里**(不是数组、不 base64)。首行是列名,其后每行一个样本。硬性要求:① 至少 1 个特征列 + 1 个结局列;② 数据行 ≥2(含表头 ≥3 行)。结局列按此顺序识别:列名命中 outcome/target/y/label/endpoint/result/结局/因变量/目标变量/结局变量 → 否则取**最后一列**(须为二分类)→ 否则从右往左找第一个二分类列;都找不到会报「未识别到结局列」。结局值只认 0/1、yes/no、true/false、阳性/阴性、是/否、存活/死亡/alive/event 等;其它值该行被跳过。列名命中 id
model_typeNo**只认 logistic 或 xgboost**,默认 logistic。传其它值不会报错 —— 会被当成 xgboost,xgboost 不可用时再静默退回 logistic,于是你可能在解释一个自己没选的模型。
sample_indexNo要解释第几个样本,**从 0 开始**,必须小于数据行数。默认 0。

Output Schema

NameRequiredDescriptionDefault
costNo
resultYes业务字段,键见 description 的 RETURNS 段
successYes
data_sourceYeslocal_computation|external_corpus|llm_generated|user_data|pending
engine_statusYesok|queued|error|unavailable|not_run

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added
  2. Removed
  3. Changed3 schema fields changed
    • changedInput schema / properties / csv_data / description
      Previous value: -"CSV 文本"New value: +"带表头的 CSV 文本,**整段放在一个字符串里**(不是数组、不 base64)。首行是列名,其后每行一个样本。硬性要求:① 至少 1 个特征列 + 1 个结局列;② 数据行 ≥2(含表头 ≥3 行)。结局列按此顺序识别:列名命中 outcome/target/y/label/endpoint/result/结局/因变量/目标变量/结局变量 → 否则取**最后一列**(须为二分类)→ 否则从右往左找第一个二分类列;都找不到会报「未识别到结局列」。结局值只认 0/1、yes/no、true/false、阳性/阴性、是/否、存活/死亡/alive/event 等;其它值该行被跳过。列名命中 id"
    • changedInput schema / properties / model_type / description
      Previous value: -"模型类型"New value: +"**只认 logistic 或 xgboost**,默认 logistic。传其它值不会报错 —— 会被当成 xgboost,xgboost 不可用时再静默退回 logistic,于是你可能在解释一个自己没选的模型。"
    • changedInput schema / properties / sample_index / description
      Previous value: -"样本序号"New value: +"要解释第几个样本,**从 0 开始**,必须小于数据行数。默认 0。"
  4. Changed1 schema field changed
    • changedInput schema / required
      Previous value: -[]New value: +[
      +  "csv_data"
      +]
  5. Added

TDQS

B3.4/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, destructiveHint=false and openWorldHint=false, so safety and repeatability are covered structurally and the description needn't restate them. Beyond that the description adds almost nothing behavioral: no mention of failure modes, validation errors, or the silent model fallback — those caveats live only in the schema, not here. 'RETURNS: SHAP 贡献图' is the sole extra signal.

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 pipe-delimited layout front-loads the identity, then use case, then return value, which reads well for an agent scanning tools. The bilingual duplication and long ALIASES block are bulk that serves search rather than comprehension, but nothing is genuinely misleading or padded with prose.

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?

Because an output schema exists and the input schema documents all three parameters in detail with annotations covering safety, the remaining burden is small and the description mostly meets it. The gaps are the relationship to global-importance siblings and any hint about how to choose sample_index when multiple cases matter, leaving the definition adequate but not complete for a diagnostic tool in a 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%, so csv_data formatting rules, the outcome-column detection order, and model_type's silent fallback are all already documented in structured fields. The description adds no parameter-level meaning beyond the schema, which sets the baseline at 3.

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 verb and resource ('SHAP single-case explanation') and sharpens it with 'explain why one patient was predicted high risk (feature contributions)', so the agent knows this is per-sample attribution rather than a global summary. It never names the closely related sibling act_feature_importance, so the 'single-case vs. global importance' distinction is left implicit 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 Guidelines3/5

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

The 'USE WHEN' clause gives one concrete triggering scenario (explaining an individual patient's high-risk prediction), which is real guidance rather than nothing. However, there are no exclusions and no named alternative — an agent unsure whether to reach for this versus global feature-importance tooling gets no routing signal, and the ALIASES list is retrieval metadata, not usage guidance.

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