Files
coder/coderd/mcp
Hugo Dutka 150c680a4b fix: return MCP server tool execution errors as tool results (#29051)
Coder's MCP server currently sends most tool execution failures as
top-level JSON-RPC errors. The underlying error text is transmitted like
this:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32603,
    "message": "workspace name cannot be empty"
  }
}
```


Not all clients handle it well, and some may return a generic "MCP tool
request failed." to the model instead of passing the details as tool
output.

This PR starts returning execution failures as tool results with
`isError: true` and descriptive content like this:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "isError": true,
    "content": [
      {
        "type": "text",
        "text": "workspace name cannot be empty"
      }
    ]
  }
}
```

This should make the MCP server work better across a broader range of
MCP clients.
2026-09-08 17:28:46 +00:00
..