Loading
Return Orbit MCP client errors as tool results
What does this MR do and why?
The Orbit MCP endpoint turned every gRPC error from Orbit into JSON-RPC -32603 "Internal error". When an agent sent a bad command name, it did not see the Orbit error, such as Tool not found: no_such_command. Now a client error comes back as an isError tool result with the Orbit error text. Client errors are the codes INVALID_ARGUMENT, NOT_FOUND, and FAILED_PRECONDITION. Other errors still return the generic error.
References
- Relates to gitlab-org/orbit/knowledge-graph#1377. Companion MRs: gitlab-org/orbit/knowledge-graph!2770 (merged) and gitlab-org/modelops/applied-ml/code-suggestions/ai-assist!7405.
- call_tool.rb#L23-27 and grpc_client.rb#L29-46.
- The
ConnectionError#client_error?helper follows the same approach as !261207 (merged).
Screenshots or screen recordings
| Before | After |
|---|---|
{"jsonrpc":"2.0","error":{"code":-32603,"message":"Internal error"},"id":3} |
![]() |
How to set up and validate locally
- Run GDK with Orbit and Duo Agent Platform.
- Call the MCP endpoint with an unknown command:
curl -sk "https://gdk.test:3443/api/v4/orbit/mcp" \ -H "PRIVATE-TOKEN: $TOKEN" -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"invoke_command","arguments":{"command_name":"no_such_command","parameters":{}}}}' - The response is
{"jsonrpc":"2.0","result":{"content":[{"type":"text","text":"Tool not found: no_such_command"}],"isError":true},"id":3}. - A valid
query_graphcall still returnsisError: false. If Orbit is down, the response is still-32603.
Specs: call_tool_spec.rb, grpc_client_spec.rb, and the Orbit MCP request spec ran 274 examples with 0 failures. Before the fix, the new examples failed.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Michael Angelo Rivera
