Fix standalone Orbit MCP endpoint not listing catalog commands as tools
What does this MR do and why?
On /api/v4/orbit/mcp, tools/list only offered the list_commands and invoke_command wrappers. Agents that call catalog commands such as query_graph as top-level tools got "Unknown tool" errors. /api/v4/mcp already lists them as real tools.
This adds the catalog commands (query_graph, get_graph_schema, get_response_format) to tools/list and lets tools/call run them by name. The change is additive: the wrappers stay listed and callable, so existing Duo flows and custom agents keep working and the change is safe to backport. Requests from the Duo Workflow Service still get only the wrappers, because the Orbit MCP server config it receives (PreApprovedTools) pre-approves only those names; that stays until the follow-up switches the flows. Removing the wrappers is a later follow-up on master.
Measured with Claude Code, 21 runs per cell: errors from calling catalog commands as tools were 3 (Sonnet) and 20 (Haiku) without the change, and 0 with it. Correctness was the same, and the additive arm made 0 wrapper calls.
Related to gitlab-org/orbit/knowledge-graph#1532.
How to set up and validate locally
- Before the fix,
tools/callwithname: query_graphfails. Sendtools/listto/api/v4/orbit/mcpand check the three command tools come back first, thenlist_commandsandinvoke_command. - Send
tools/callwithname: query_graphand aqueryargument. It runs and is rate limited like before. - Send
tools/callwithname: invoke_commandto confirm old clients still work.
MR acceptance checklist
- I have evaluated the MR acceptance checklist for this MR.
Agent context
- Listing order: catalog commands first, then the wrappers (gRPC
list_toolsfiltered byToolCatalog::COMMAND_TOOL_NAMES, as before). If a catalog command has the same name as a wrapper, the wrapper wins, as it does fortools/call. - A connection failure in one source leaves the other listed; if both fail the list is empty. Specs cover the connection-failure cases. An authorization failure in both sources is still an HTTP 500, as on master.
- Catalog entries use
CommandTool#to_h, so annotations and icons match/api/v4/mcp; onlytrusted: trueis extra. The catalog uses the MCP source type, not the per-token one. CallToolaccepts the wrappers without touching the catalog, and any other name only if the catalog lists it. A catalogAuthorizationErrorbecomes a JSON-RPC internal error instead of an HTTP 500.rate_limit_mcp_command!throttlesquery_graphcalled directly and throughinvoke_command.CallTooldoes not refuse catalog names for the Duo Workflow Service: they are simply not listed there, and refusing would add nothing.ToolCatalog, the AI Catalog picker and the Duo config service are unchanged.- The knowledge-graph docs still describe the two-tool shape and need a follow-up.
- No feature flag.
- Specs:
ee/spec/requests/api/orbit/mcp_spec.rb,ee/spec/lib/api/orbit/mcp_handlers/,ee/spec/services/mcp/tools/orbit/,ee/spec/models/ai/catalog/,mcp_config_service_spec.rb(0 failures). Rubocop clean.