Skip to main content
Glama
pranav797

Credit Risk MCP Server

by pranav797

explain_prediction

Explains a borrower default-risk score by showing which applicant factors increase or decrease risk, returning ranked SHAP contributions with human-readable names.

Instructions

Explain a default-risk prediction: which factors push risk up or down.

Use this when the user wants the "why" behind a score, not just the number. Runs SHAP on the single applicant and returns the strongest contributing features with human-readable names.

Args: profile: the applicant to explain. top_n: how many contributing factors to return (default 8).

Returns a dict with default_probability, risk_tier, and top_factors — a list of {feature, friendly_name, value, shap_contribution, direction} ordered by impact, where direction is "increases risk" or "decreases risk".

Educational model — not real lending advice.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
top_nNo
profileYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior4/5

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

With no annotations, the description carries the behavioral burden and does so well: it discloses the method (SHAP), the scope (single applicant), and the shape of the output including the 'direction' semantics. It omits operational traits like whether it is read-only/side-effect-free, but the computation-only nature is strongly implied.

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 description is front-loaded with purpose and usage, then structured into Args and Returns. The Returns block partly duplicates the existing output schema, which is mild redundancy, but every other sentence earns its place.

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 two-parameter tool with an output schema, the description supplies purpose, usage guidance, parameter meaning, and a brief note on return contents. It is essentially complete, with only the detailed return schema left to the structured output definition as intended.

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?

Top-level schema description coverage is 0%, so the description must compensate, and it does: 'profile: the applicant to explain' and 'top_n: how many contributing factors to return (default 8)' cover both parameters, and the nested profile fields are documented in the schema itself.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/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 — 'Explain a default-risk prediction: which factors push risk up or down' — and frames it against the sibling that returns only a number. An agent can tell it apart from score_borrower and get_feature_importance without opening a schema.

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?

It gives a clear selection condition: 'Use this when the user wants the "why" behind a score, not just the number,' which routes the agent away from the scoring tool. It does not explicitly name or distinguish against get_feature_importance or compare_borrowers, so the routing guidance is clear but not exhaustive.

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