Writing a tiny MCP server — registries, dispatch, and the response shape — step 6 of 9
Cursor wrote a call_tool dispatcher. When the handler raises an
exception, the dispatcher returns just the exception's string —
not an MCP error envelope. The client has no way to tell this was
an error vs. a normal result.
Fix line 11 so that on exception, the dispatcher returns the proper MCP error shape:
{"isError": True, "content": [{"type": "text", "text": str(e)}]}
Expected output:
True
boom
Cursor wrote a call_tool dispatcher. When the handler raises an
exception, the dispatcher returns just the exception's string —
not an MCP error envelope. The client has no way to tell this was
an error vs. a normal result.
Fix line 11 so that on exception, the dispatcher returns the proper MCP error shape:
{"isError": True, "content": [{"type": "text", "text": str(e)}]}
Expected output:
True
boom
this step needs the editor
on desktop today; in the app (coming soon). save your spot and we'll bring you back here when you're ready.