Skip to content
Back to skills

Mcp Error Handling

ASecurity

Return errors an agent can act on, distinguishing retryable failures from permanent ones and never leaking internals. Use when building MCP tools that will fail in production.

  • 7 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 5, 2026
ai-agentsgo

Works with

  • mcp

Security analysis

A100/100

Scanned September 5, 2026

npx -y skills add Amey-Thakur/AI-SKILLS --skill mcp-error-handling --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Mcp Error Handling?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Mcp Error Handling
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/amey-thakur-mcp-error-handling/badge)](https://www.skillsdirectory.com/skills/amey-thakur-mcp-error-handling)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: mcp-error-handling
description: Return errors an agent can act on, distinguishing retryable failures from permanent ones and never leaking internals. Use when building MCP tools that will fail in production.
---

# MCP error handling

An agent's recovery is only as good as the error it receives. A generic
failure produces a blind retry loop; a specific, actionable error
produces a corrected call. Error text here is an interface, not a log
line.

## Method

1. **Say what went wrong and what would fix it.** Missing required
   parameter start_date beats invalid input, because the agent can act
   on the first and only guess at the second.
2. **Distinguish retryable from permanent.** Rate limits and timeouts
   invite a retry; validation failures and permission denials never
   should, and an agent cannot tell without being told.
3. **Return validation errors per field.** Which parameter, what was
   wrong, what is acceptable, so the retry is corrected rather than
   repeated (see mcp-tool-design).
4. **Never leak internals.** Stack traces, queries, and infrastructure
   detail enter the model's context and possibly its output (see
   error-messages).
5. **Include retry timing when known.** A rate limit that states when to
   retry prevents both hammering and unnecessary abandonment.
6. **Fail fast on unrecoverable conditions.** An agent looping on a
   permanently failing call burns budget and context, so the error must
   close the loop.
7. **Keep errors stable and documented.** Agents and prompts come to
   depend on error shapes, so changing them silently breaks integrations.

## Boundaries

Good errors improve recovery; they cannot fix a tool that fails for the
wrong reasons. Error text is model-visible, so it must be safe to
disclose. Retry policy belongs with the caller, and the server's job is
to give it enough to decide (see timeouts-and-retries).

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…