Skip to content

fix(tui): wire MCP prompts into slash command dispatch#3565

Open
EronWright wants to merge 2 commits into
docker:mainfrom
EronWright:fix/mcp-prompt-slash-commands
Open

fix(tui): wire MCP prompts into slash command dispatch#3565
EronWright wants to merge 2 commits into
docker:mainfrom
EronWright:fix/mcp-prompt-slash-commands

Conversation

@EronWright

@EronWright EronWright commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

What

MCP prompt palette items were registered without SlashCommand/Immediate, so
typing an MCP prompt as a slash command (e.g. /review, /summarize) fell
through to the model as plain chat text instead of invoking the prompt — only
clicking the item in the command palette worked.

This wires MCP prompt items into the slash-command parser, mirroring the
existing agent-command and skill items:

  • Set SlashCommand + Immediate so Parser.Parse matches them.
  • Map a non-empty argument to the prompt's first declared argument (so
    /summarize <text> works from the keyboard), falling back to the input dialog
    when a required argument is missing, and to an empty-args run otherwise.

Companion to the skill-dispatch fix in #3054 — this is the MCP-prompt analog.
Unlike skills it does not need SkipImmediateParse: its Execute emits
MCPPromptMsg directly rather than re-emitting a SendMsg that would be
re-parsed.

Refactor + tests

To make the item builders unit-testable without standing up an App, the
per-item construction is factored into small helpers — newMCPPromptItem and,
for symmetry, newAgentCommandItem — each with unit tests that drive the real
item through Parser.Parse (slash-command wiring + argument mapping/forwarding).

@aheritier aheritier added area/mcp MCP protocol, MCP tool servers, integration area/tui For features/issues/fixes related to the TUI kind/fix PR fixes a bug (maps to fix:). Use on PRs only. labels Jul 10, 2026
MCP prompt items were added to the command palette but not to the slash
command parser — they were missing SlashCommand and Immediate fields.
As a result, an MCP server's prompts (e.g. /review, /summarize) passed
through as plain text instead of invoking the MCP prompt.

Add SlashCommand and Immediate to MCP prompt items, mirroring the
existing pattern for agent commands and skills. Update Execute to map
a non-empty arg string to the first declared prompt argument, so
/summarize <text> and /review <path> work from the keyboard without the
command palette dialog.
…omptItem

Factor the agent-command palette / slash Item construction out of
BuildCommandCategories into a newAgentCommandItem helper, mirroring
newMCPPromptItem. Behavior is unchanged; the extraction makes the item
builder unit-testable without constructing an App, and the two builders
now read symmetrically. Add unit tests covering the slash-command wiring
and argument forwarding.
@EronWright EronWright force-pushed the fix/mcp-prompt-slash-commands branch from 1ec88cd to 2f0c879 Compare July 10, 2026 05:37
@EronWright EronWright marked this pull request as ready for review July 10, 2026 14:57
@EronWright EronWright requested a review from a team as a code owner July 10, 2026 14:57
@Sayt-0

Sayt-0 commented Jul 10, 2026

Copy link
Copy Markdown
Member

Hi @EronWright ! your commits must be signed in this repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/mcp MCP protocol, MCP tool servers, integration area/tui For features/issues/fixes related to the TUI kind/fix PR fixes a bug (maps to fix:). Use on PRs only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants