What would you like to be added?
Support the Image Content MCP tool result data type. When an MCP server responds with base64 encoded image data as part of its tool result, Gemini is not able to "see" the image.
Let's improve Gemini CLI to allow it to "see" images within MCP tool responses.
I can currently think of two possible approaches:
- Generative AI SDK
- Gemini CLI
- Modify the Gemini CLI, as an MCP app, to intercept image content in MCP tool responses.
- Potentially substitute a text placeholder: "The tool responded with an image here. The image can be found after this function response."
- Then add
inlineData with the base64 image data, pushed as a new Part after the functionResponse.
- Possible code location to understand this suggestion:
|
const responseParts: Part[] = await this.mcpTool.callTool(functionCalls); |
|
|
|
return { |
|
llmContent: responseParts, |
|
returnDisplay: getStringifiedResultForDisplay(responseParts), |
|
}; |
- Bonus: I'd yolo support for MCP Audio Content here as well and see if it works! I don't see why it wouldn't. 🤷
Why is this needed?
This autonomous agent loop is getting popular:
Start with a UI mock -> write UI code -> take_screenshot -> edit code -> take_screenshot -> ..
MCP tools such as Puppeteer that are able to return screenshot image responses will be very handy to make this work within Gemini CLI.
Additional context
This is a similar or the same issue as with Cline: cline/cline#1865
What would you like to be added?
Support the Image Content MCP tool result data type. When an MCP server responds with base64 encoded image data as part of its tool result, Gemini is not able to "see" the image.
Let's improve Gemini CLI to allow it to "see" images within MCP tool responses.
I can currently think of two possible approaches:
functionResponsePart type of the Gemini Generative AI SDKs. There is currently no indication (function calling example) that multimodal content that the model will understand as multimodal is supported in function responses. Only text or structured/JSON text.inlineDatawith the base64 image data, pushed as a newPartafter thefunctionResponse.gemini-cli/packages/core/src/tools/mcp-tool.ts
Lines 84 to 89 in bf873a1
Why is this needed?
This autonomous agent loop is getting popular:
MCP tools such as Puppeteer that are able to return screenshot image responses will be very handy to make this work within Gemini CLI.
Additional context
This is a similar or the same issue as with Cline: cline/cline#1865