-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
What specific problem does this solve?
Currently, the Model Context Protocol (MCP) only supports text-based responses from tools. This limits the capabilities of MCP servers, as they cannot return visual information, such as screenshots or diagrams. Furthermore, there is a lack of robustness and security controls around image handling, which could lead to performance degradation or crashes if invalid or excessively large images are sent.
Impact: This limits the richness and stability of MCP tool interactions.
How should this be solved?
This issue proposes enhancing the MCP response handling pipeline to support images with proper validation and controls. The initial implementation for basic image support is available in Pull Request #5185, and the scope has been updated to include feedback from the code review.
The complete solution involves:
-
Feature: Image Support in MCP Responses
- Modify core logic (
useMcpToolTool.ts
,combineCommandSequences.ts
) to process and pass along image data from tool results. - Update UI components (
McpExecution.tsx
,ChatRow.tsx
) to render images returned by MCP tools directly within the chat view.
- Modify core logic (
-
Enhancement: Robustness and Security Controls (based on review feedback)
- Image Validation: Add validation to handle corrupted or invalid base64 image data gracefully, preventing crashes.
- Configurable Limits: Introduce settings to control:
- The maximum size of each image to prevent memory issues.
- The maximum number of images allowed in a single response to avoid performance degradation.
- Code Quality: Refactor to improve maintainability, for instance by using constants for supported image types.
- Expanded Test Coverage: Add tests for edge cases, including corrupted data, large images, and unsupported MIME types.
Acceptance Criteria
Given an MCP server is connected
When a tool is executed that returns an image
Then the Roo Code chat interface should display the rendered image.
Given an MCP server sends a corrupted image
Then the extension should handle the error gracefully without crashing.
Given the image size and count limits are configured
When an MCP server sends images exceeding these limits
Then the extension should reject the non-compliant images and log a warning.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status