demo · v149
Error Handling Lab
WebMCP tool calls can fail in five distinct ways: validation error (wrong input types), runtime error (tool execution failed), timeout (response took too long), permission denied (user revoked consent), and partial success (some outputs missing). Each failure has a structured error response and a recommended recovery strategy. Select a scenario to see the full call/response cycle and how a well-implemented agent handles it.
Select an error scenario
Validation Error
Wrong input schema
code: "INVALID_PARAMS"
Runtime Error
Tool execution failed
code: "TOOL_EXECUTION_ERROR"
Timeout
Response took too long
code: "TIMEOUT"
Permission Denied
User revoked tool consent
code: "PERMISSION_DENIED"
Partial Success
Some outputs missing
code: "PARTIAL_RESULT"
Tool Not Found
Capability removed from page
code: "TOOL_NOT_FOUND"
Scenario
Live simulation
// WebMCP: handle all error types from a tool call try { const result = await navigator.modelContext.callTool({ name: 'search_products', input: { query: 'running shoes', maxResults: 5 } }); // Handle partial success if (result.partial) { console.warn('Partial result:', result.missingFields); } renderResults(result.output); } catch (err) { switch (err.code) { case 'INVALID_PARAMS': // Fix the input and retry once break; case 'PERMISSION_DENIED': // Show UI to re-request consent break; case 'TIMEOUT': // Retry with exponential backoff break; case 'TOOL_NOT_FOUND': // Refresh tool registry before retrying break; default: // Surface to user, do not retry blindly } }
see also
- Tool Registry Explorer — register and inspect tools
- Agent Handshake Simulator — full success path
- Tool Consent Panel — consent and revocation
- Schema Validator — correct JSON tool definitions
- ChromeStatus: WebMCP
implementation reference
Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗