api-errors

api-errors is a skill for Claude Code, Codex from magnusquest/startgg-mcp. It costs 54 tokens per session (2,747 once invoked), scanned A, original, Apache-2.0.

A reference for handling errors in MCP services, including standard error types and patterns for catching or passing them on.

In plain words
What is it for?
Use it when choosing error codes, throwing errors from tool handlers, or adding recovery with the provided error-handling utilities.
Why use it?
It helps errors reach callers in a consistent form and keeps service recovery separate from request-handler error reporting.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when choosing error codes, throwing errors from tool handlers, or adding recovery with the provided error-handling utilities.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/magnusquest/startgg-mcp/api-errors
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add magnusquest/startgg-mcp --skill api-errors
Clone the repo
git clone --depth 1 https://github.com/magnusquest/startgg-mcp

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for api-errors

README.md
[![agentmods](https://agentmods.dev/badge/skills/magnusquest/startgg-mcp/api-errors/github.svg)](https://agentmods.dev/skills/magnusquest/startgg-mcp/api-errors)
Your own site
<a href="https://agentmods.dev/skills/magnusquest/startgg-mcp/api-errors"><img src="https://agentmods.dev/badge/skills/magnusquest/startgg-mcp/api-errors/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for api-errors

Your own site · 80×15
<a href="https://agentmods.dev/skills/magnusquest/startgg-mcp/api-errors"><img src="https://agentmods.dev/badge/skills/magnusquest/startgg-mcp/api-errors.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 54 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,747 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00054 $0.02747
Opus 5.5 $0.00022 $0.01099
Sonnet 5.5 $0.00011 $0.00549
Haiku 4.5 $0.00005 $0.00275

Measured 1mo ago against content hash 0ccb95b3747a, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

api-errors scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

() => externalApi.fetch(url),
skills/api-errors/SKILL.md · 257 lines

How it starts

The opening of the file, as written. The whole thing — 257 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Overview

Error handling in @cyanheads/mcp-ts-core follows a strict layered pattern: tool and resource handlers throw McpError freely (no try/catch), the handler factory catches and normalizes all errors, and services use ErrorHandler.tryCatch for graceful recovery.

Imports:

import { notFound, validationError, McpError, JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
import { ErrorHandler } from '@cyanheads/mcp-ts-core/utils';

Error Factories (Preferred)

Shorter than new McpError(...) and self-documenting. All return McpError instances. All accept an optional options parameter for error chaining via { cause }.

throw notFound('Item not found', { itemId: '123' });
throw validationError('Missing required field: name', { field: 'name' });
throw unauthorized('Token expired');

// With cause for error chaining
throw serviceUnavailable('API call failed', { url }, { cause: error });

Available factories:

Factory Code
invalidParams(msg, data?, options?) InvalidParams (-32602)
invalidRequest(msg, data?, options?) InvalidRequest (-32600)
notFound(msg, data?, options?) NotFound (-32001)
forbidden(msg, data?, options?) Forbidden (-32005)
unauthorized(msg, data?, options?) Unauthorized (-32006)
validationError(msg, data?, options?) ValidationError (-32007)
conflict(msg, data?, options?) Conflict (-32002)
rateLimited(msg, data?, options?) RateLimited (-32003)
timeout(msg, data?, options?) Timeout (-32004)
serviceUnavailable(msg, data?, options?) ServiceUnavailable (-32000)
configurationError(msg, data?, options?) ConfigurationError (-32008)

options is { cause?: unknown } — the standard ES2022 ErrorOptions type.


McpError Constructor

For codes not covered by factories (InternalError, DatabaseError, etc.):

throw new McpError(code, message?, data?, options?)
  • code — a JsonRpcErrorCode enum value
  • message — optional human-readable description of the failure
  • data — optional structured context (plain object)
  • options — optional { cause?: unknown } for error chaining

Read the full file on GitHub · 257 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 257 lines · 54 tokens per session scan A 0ccb95b3747a

Subscribe to this mod's changes

api-errors is a skill published in the GitHub repository magnusquest/startgg-mcp (1 stars, last pushed 6mo ago), licensed Apache-2.0. It adds 54 tokens to every session and 2,747 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

api-integration-architect

Design, implement, debug, and optimize API integrations with expert-level patterns for REST, GraphQL, webhooks, and authentication flows.

sickn33/agentic-awesome-skills · 33 tokens

printing-press-amend

Amend a published CLI from one of two input sources: (1) dogfood mode mines the active Claude Code session transcript for friction (missing flags, hand- rolled API payloads, silent-null returns); (2) direct-input mode accepts user-supplied asks (rename a command, add commands or feeds, fix a named bug, optionally…

mvanhorn/cli-printing-press · 222 tokens

convex-performance-audit

Audits Convex performance for reads, subscriptions, write contention, and function limits. Use for slow features, insights findings, OCC conflicts, or read amplification.

openclaw/clawhub · 38 tokens

convex-insights

Query a running Convex app's logs + health in natural language (official MCP): failures, slow/expensive functions, deploy causality — scoped, evidence-backed, with a dashboard deep link.

openclaw/clawhub · 45 tokens

diagnose-backend-bug

Diagnose a bounded backend or multi-service failure from GitHub Issues, Jira, Aone, user-provided exports, logs, traces, responses, stack traces, or job records. Use when a service, API, RPC, worker, queue, CLI, or scheduled job bug needs correlation through the project's existing observability route before repair; do…

QoderAI/better-harness · 87 tokens

axiom-networking

Use when implementing or debugging ANY network connection, API call, or socket in an Apple app. Covers URLSession, Network.framework, NetworkConnection, connection diagnostics.

CharlesWiltgen/Axiom · 37 tokens