mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Python: feat(mcp): add full _meta field support for CallToolResult objects (#2286)
* feat(mcp): add full _meta field support for CallToolResult objects - Extract and preserve complete _meta field from MCP CallToolResult responses - Merge metadata into additional_properties of converted content items - Handle isError field for proper error state integration - Support arbitrary metadata like token usage, costs, and performance metrics - Maintain backward compatibility with existing tool execution workflows - Add comprehensive test coverage for all metadata scenarios including edge cases - Update documentation with metadata handling examples and patterns Fixes protocol compliance violation where _meta fields were being dropped, enables proper monitoring and cost tracking of MCP tool usage. * Update python/packages/core/agent_framework/_mcp.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Clarify MCP _meta field test to use generic example metadata - Updated test_mcp_call_tool_result_with_meta_arbitrary_data to use arbitrary metadata fields - Added comments to emphasize that _meta structure is server-specific and not standardized --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
Unverified
parent
a7a0660cac
commit
d18ce24bf8
@@ -10,6 +10,10 @@ OpenAI Chat Client with Local MCP Example
|
||||
|
||||
This sample demonstrates integrating Model Context Protocol (MCP) tools with
|
||||
OpenAI Chat Client for extended functionality and external service access.
|
||||
|
||||
The Agent Framework now supports enhanced metadata extraction from MCP tool
|
||||
results, including error states, token usage, costs, and other arbitrary
|
||||
metadata through the _meta field of CallToolResult objects.
|
||||
"""
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user