You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
to_mcp_server returns the model's thought parts to MCP clients #7834
Describe the Bug:
An agent exposed with to_mcp_server returns its thoughts to MCP clients. _part_to_content in tools/mcp_tool/_agent_to_mcp.py turns any part with text into a TextContent block, including parts with thought=True. With a thinking model that returns thoughts, the MCP client gets the model's hidden reasoning as part of the tool result. Intermediate events reported through report_progress also include thought text.
AgentTool already skips thought parts when it builds its result (agent_tool.py), and the memory services exclude them too (#7473, #7691).
Steps to Reproduce:
Expose an agent whose final event has parts [Part(text="...", thought=True), Part(text="answer")] with to_mcp_server(agent).
Call the tool from an MCP client.
Expected Behavior:
The client receives only answer, and progress messages contain no thought text.
Observed Behavior:
MCP client received: 'The user is on the free tier; do not mention the internal escalation path.'
MCP client received: 'Your contract renews on Nov 30.'
Environment Details:
ADK Library Version (pip show google-adk): 2.13.0 (also on main at 75fb788)
Desktop OS: macOS
Python Version (python -V): 3.11.16
Model Information:
Are you using LiteLLM: No
Which model is being used: any thinking model that returns thoughts (e.g. Gemini with include_thoughts=True)
🟡 Optional Information
Minimal Reproduction Code:
classThinkingAgent(BaseAgent):
asyncdef_run_async_impl(self, ctx):
yieldEvent(
author=self.name,
content=types.Content(role="model", parts=[
types.Part(text="The user is on the free tier; do not mention the internal escalation path.", thought=True),
types.Part(text="Your contract renews on Nov 30."),
]),
)
server=to_mcp_server(ThinkingAgent(name="contracts_agent"))
# MCP client: await client.call_tool("contracts_agent", {"request": "When does my contract renew?"})
How often has this issue occurred?:
Always (100%), with thinking models that return thoughts
Activity
fix: keep the model's thoughts out of to_mcp_server results