google-gemini / google-gemini/gemini-cli

MCP prompt responses are submitted as JSON-encoded text

Open Beginner friendly
#29,204 2 comments 0 reactions 0 assignees View on GitHub
area/core effort/small kind/bug priority/p2 status/bot-triaged status/need-information
Dominant language
TypeScript
Stars
107k
Forks
14.6k
Avg merge
2d 3h
Merged PRs (30d)
45

Description

## Summary

MCP prompt responses are JSON-encoded before they are returned as `submit_prompt` content. This changes valid prompt text rather than preserving the text returned by the MCP server.

## Reproduction

1. Configure an MCP prompt that returns a text result such as `He said "hello".
Next line`.
2. Invoke the corresponding slash command.

## Actual behavior

`McpPromptLoader` calls `JSON.stringify()` on the returned text. The submitted prompt therefore contains literal outer quotes and escape sequences, for example `"He said \"hello\".\nNext line"`.

## Expected behavior

The `submit_prompt` action should receive the original MCP text unchanged, including embedded quotes and newlines.

## Impact

Every successful text response from an MCP prompt is altered before it reaches the conversation. Prompts with quotes, code, or multiple lines are especially visibly corrupted.

## Proposed fix

Pass the text response through directly and add a regression test that includes quotes and a newline.

I'd like to take this issue and submit a PR to fix it.

Contributor guide

Open the contributing guide

Research direction

Start at McpPromptLoader and trace how the MCP text reaches the submit_prompt action, focusing on the JSON.stringify() call described in the issue. Add a regression test covering embedded quotes and a newline, then verify that the submitted content matches the original MCP response unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
84/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.