claude-code - 💡(How to fix) Fix feat: /mcp query <tool> <args> — invoke MCP tools directly from the slash command interface

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

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.

Error Message

  • Error shown inline if the tool call fails (server down, bad args, schema mismatch)
  • Schema validation error shown if args don't match the tool's input schema

Root Cause

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.

Code Example

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

---

/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

---

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

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.

  2. 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)

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix feat: /mcp query <tool> <args> — invoke MCP tools directly from the slash command interface