Skip to content

Event feedback breaks json output mode #19198

@Stono

Description

@Stono

What happened?

When I use an MCP server, along with JSON output, you get messages being printed to stdout before the json output, thus making it impossible to pipe-parse the output from gemini-cli with jq, eg:

gemini --yolo --prompt "${INPUT_COMMAND}" --output-format json 2> "${TEMP_STDERR}" 1> "${TEMP_STDOUT}"

On stdout you get:

Prompts updated for server: githubResources updated for server: githubTools updated for server: github{
  "session_id": "504f1f1c-fe88-42c0-8aa1-8c2237db8937",
  "response": "WHAT IS 5+5? IT'S 10!",
  "stats": {

This appears to be coming from the MCP client

`Resources updated for server: ${this.serverName}`,

What did you expect to happen?

informational messages like this should really go to stdout.
if stdout is also expected to be json however in output-mode=json, i'm not sure what to suggest.

Client information

Client Information

Run gemini to enter the interactive CLI, then run the /about command.

│ CLI Version                                                                     0.28.2                                                                                                                                               │
│ Git Commit                                                                      da5e47ae3                                                                                                                                            │
│ Model                                                                           auto-gemini-3                                                                                                                                        │
│ Sandbox                                                                         no sandbox                                                                                                                                           │
│ OS                                                                              darwin                                                                                                                                               │
│ Auth Method                                                                     vertex-ai                                                                                                                                            │
│ GCP Project                                                                     at-delivery-platform-testing                                                                                                                         │
│ IDE Client                                                                      VS Code           

Login information

No response

Anything else we need to know?

No response

Metadata

Metadata

Assignees

Labels

area/non-interactiveIssues related to GitHub Actions, SDK, 3P Integrations, Shell Scripting, Command line automationstatus/need-triageIssues that need to be triaged by the triage automation.type/bug

Type

No fields configured for Bug.

Projects

Status

Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions