Skip to content

[BUG] Non-textual Base64-encoded data returned by MCP should not be passed to the LLM. Occupy a large amount of context #1862

@DesistDaydream

Description

@DesistDaydream

Quick Summary

Non-textual Base64-encoded data returned by MCP should not be passed to the LLM.

Occupy a large amount of context

Environment & Tools

  • PicoClaw Version: 6148ccc
  • Go Version: go 1.26.1
  • AI Model & Provider: DeepSeek
  • Operating System: WSL Ubuntu
  • Channels: Telegram

📸 Steps to Reproduce

  1. Configuring MCP. e.g. https://github.com/grafana/mcp-grafana
  2. Use "Get panel or dashboard image" Tool
  3. picoclaw sent the Base64 data directly to the LLM, consuming a significant amount of context.

❌ Actual Behavior

picoclaw sent the Base64 data directly to the LLM, consuming a significant amount of context.

✅ Expected Behavior

Reference https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool-result

Before forwarding the information returned by MCP to the LLM, picoclaw should check whether the type field within the Tool Result is set to image. If it is, the embedded Base64 data should be wrapped in the specified ![image](data:" + mcpResp.MimeType + ";base64," + mcpResp.Data + ")" format and sent directly to the IM service.

💬 Additional Context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions