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

  1. Before the fix, tools/call with name: query_graph fails. Send tools/list to /api/v4/orbit/mcp and check the three command tools come back first, then list_commands and invoke_command.
  2. Send tools/call with name: query_graph and a query argument. It runs and is rate limited like before.
  3. Send tools/call with name: invoke_command to confirm old clients still work.

MR acceptance checklist

Agent context
  • Listing order: catalog commands first, then the wrappers (gRPC list_tools filtered by ToolCatalog::COMMAND_TOOL_NAMES, as before). If a catalog command has the same name as a wrapper, the wrapper wins, as it does for tools/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; only trusted: true is extra. The catalog uses the MCP source type, not the per-token one.
  • CallTool accepts the wrappers without touching the catalog, and any other name only if the catalog lists it. A catalog AuthorizationError becomes a JSON-RPC internal error instead of an HTTP 500.
  • rate_limit_mcp_command! throttles query_graph called directly and through invoke_command.
  • CallTool does 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.
Edited by Dmitry Gruzd

Merge request reports

Loading
Loading