-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
tools[Component] This issue is related to tools[Component] This issue is related to tools
Milestone
Description
Issue: MCP Tool Response Role Incorrectly Set as "user"
Description
When using ADK to call MCP server through MCPToolset, the tool response's role is incorrectly set as "user" instead of "assistant". This appears to be inconsistent with the expected behavior of tool responses.
Current Behavior
# Example response format
{
"parts": [
{
"function_response": {
"id": "call_xxx",
"name": "read_query",
"response": {
"result": {
"content": [...],
"isError": false
}
}
}
}
],
"role": "user" # <-- This should be "assistant"
}
Expected Behavior
Tool responses should have "role": "assistant"
to properly indicate that they are responses from the agent/tool rather than user input.
Environment
- ADK version: [version]
- MCP server: SQLite implementation
- Python version: [version]
Steps to Reproduce
- Initialize MCPToolset with SQLite server
- Make a tool call through the agent
- Observe the response format
Impact
This issue might affect:
- Message flow tracking
- Response handling logic
- UI rendering of conversation history
Additional Context
The issue occurs when using MCPToolset.from_server() to connect to the MCP server. The response format suggests there might be a mismatch between MCP server's response format and ADK's expected format.
Questions
- Is this the intended behavior of MCPToolset?
- Are there configuration options to control the response role?
- Should this be handled at the MCP server level or ADK level?
Related Code
local_tools, _ = await MCPToolset.from_server(
connection_params=StdioServerParameters(
command='uv',
args=[...],
),
async_exit_stack=self._exit_stack
)
Metadata
Metadata
Assignees
Labels
tools[Component] This issue is related to tools[Component] This issue is related to tools