PROMPT 10 Error And Notification Infrastructure
# PROMPT_10: Error and Notification Infrastructure
**Goal:** Implement `McpClient.Error` and `McpClient.NotificationRouter` modules to support client features.
**Duration:** ~30 minutes
**Dependencies:** PROMPT_01-09 (Core complete)
---
## Context
Before implementing high-level MCP feature APIs (Tools, Resources, etc.), we need shared infrastructure for:
1. **Error normalization** - Convert various error types into structured `McpClient.Error` structs
2. **Notification routing** - Route server-initiated notifications to typed callbacks
These modules provide the foundation for consistent error handling and notification dispatch across all feature modules.
> **Reminder (ADR-0015):** Notification routing remains synchronous in the MVP. Build the router so future work can optionally fan out via a `Task.Supervisor`, but do not introduce async processing yet.
---
## Required Reading
**ADR-0011:** Client Features Architecture
- Section: "Shared Infrastructure"
- Error normalization strategy
- Notification routing pattern
**PROTOCOL_DETAILS.md:**
- Section: "Error Codes" - JSON-RPC and MCP error codes
- Section: "Message Methods" - Notification methods
---
## Implementation Requirements
### 1. McpClient.Error Module
**File:** `lib/mcp_client/error.ex`
**Purpose:** Normalized error type for all MCP operations.
**Implementation:**when to use it
Community prompt sourced from the open-source GitHub repo nshkrdotcom/mcp_client (MIT). A "PROMPT 10 Error And Notification Infrastructure" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.
tags
roleplaycommunitygeneral
source
nshkrdotcom/mcp_client · MIT