Developers & API

Error Handling

Error Handling

All MCP errors follow the JSON-RPC 2.0 standard:

```json { "jsonrpc": "2.0", "id": 1, "error": { "code": -32602, "message": "Invalid params", "data": "client_id is required" } } ```

Common Error Codes:

- `-32600`: Invalid Request (malformed JSON-RPC) - `-32601`: Method not found - `-32602`: Invalid params - `-32001`: Business context required (not authenticated) - `-32603`: Internal error

Error Handling Example:

```typescript try { const result = await mcp.getClientSummary('invalid-id'); } catch (error) { if (error.message.includes('-32602')) { console.error('Invalid parameters provided'); } else if (error.message.includes('-32001')) { console.error('Authentication required'); } else { console.error('Unexpected error:', error); } } ```

Related Resources

Ready to implement these strategies?

Join thousands of trainers using BuildStability to automate engagement tracking and prevent churn.

Start Your Free Trial