DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.
Python ai-agentsai-tutorclawbotcli-tooldeepresearchinteractive-learninglearningmulti-agent-systemsrag
fix(mcp): omit image payloads from tool text (#848)
NoxsMediad388b697c5d5
diff --git a/deeptutor/services/mcp/manager.py b/deeptutor/services/mcp/manager.pyindex c9a40ea20..6d91fc512 100644--- a/deeptutor/services/mcp/manager.py+++ b/deeptutor/services/mcp/manager.py@@ -557,6 +557,8 @@ class MCPConnectionManager:for block in result.content:if isinstance(block, types.TextContent):parts.append(block.text)+ elif isinstance(block, types.ImageContent):+ parts.append("[MCP image omitted]")else:parts.append(str(block))return "\n".join(parts) or "(no output)"diff --git a/tests/services/mcp/test_progress_reporting.py b/tests/services/mcp/test_progress_reporting.pyindex 259f21492..c69183e82 100644--- a/tests/services/mcp/test_progress_reporting.py+++ b/tests/services/mcp/test_progress_reporting.py@@ -208,6 +208,25 @@ async def test_progress_reaches_the_sink_end_to_end() -> None:assert result.content == "done"+async def test_image_content_is_omitted_without_serializing_base64() -> None:+ class _ImageSession(_Session):+ async def call_tool(self, tool_name, arguments, progress_callback=None): # type: ignore[no-untyped-def]+ from mcp import types++ return types.CallToolResult(+ content=[+ types.TextContent(type="text", text="page image"),+ types.ImageContent(type="image", data="QUJD", mimeType="image/jpeg"),+ ]+ )++ result = await _adapter(MCPConnectionManager(), _ImageSession()).execute()++ assert result.content == "page image\n[MCP image omitted]"+ assert "QUJD" not in result.content++# ── why a connection failed ────────────────────────────────────────────────