feat: /mcp query <tool> <args> — invoke MCP tools directly from the slash command interface

Resolved 💬 2 comments Opened May 29, 2026 by me2resh Closed Jun 1, 2026

Summary

Add a /mcp query <tool> [args] subcommand that lets operators invoke MCP tools directly from the Claude Code slash command interface, without routing through an agent.

Problem

Today, the only way to call an MCP tool (e.g. search_docs, search_code, custom tools) is to ask the agent to do it. This creates friction for two common workflows:

  1. Debugging index quality — you want to run search_docs("rate limiting", scope="framework") and see the raw results to verify your index is correct. Having the agent in the loop adds interpretation overhead and makes it harder to spot index gaps.
  1. Spot-checking tool outputs — you want to confirm a specific tool returns what you expect before relying on it in an agentic workflow.

The /mcp command today is a management UI (server status, tool listing) — not a query interface.

Proposed interface

/mcp query <server> <tool> [--arg key=value ...]

Examples:

/mcp query apexyard-search search_docs --arg query="rate limiting" --arg scope=framework --arg top_k=5
/mcp query apexyard-search search_code --arg query="repository module" --arg project=my-project
/mcp query stripe list_customers --arg limit=10

Or a simpler JSON-args form:

/mcp query apexyard-search search_docs '{"query": "rate limiting", "scope": "framework"}'

Expected behaviour

  • Calls the tool directly, bypassing the agent
  • Renders the raw JSON response in the output panel (collapsible for large responses)
  • No agent turn consumed — doesn't affect context window
  • Error shown inline if the tool call fails (server down, bad args, schema mismatch)

Why not just ask the agent?

  • Agent adds interpretation, summarisation, and potential hallucination on top of the raw result
  • Debugging index quality requires seeing exact scores, exact excerpts, exact file paths — not a prose summary
  • Agent turn costs tokens; a direct tool call for debugging shouldn't consume context

Acceptance criteria

  • [ ] /mcp query <server> <tool> [args] invokes the named tool on the named server
  • [ ] Raw response rendered in the output panel
  • [ ] Schema validation error shown if args don't match the tool's input schema
  • [ ] Works for any MCP server + tool, not just built-in ones
  • [ ] Tab completion for server name and tool name (from the connected servers list)

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗