mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Python: normalize empty MCP tool output to null (#4683)
* Python: normalize empty MCP tool output to null * Python: hardcode null for empty MCP output
This commit is contained in:
committed by
GitHub
Unverified
parent
c67d3523ae
commit
052ba7be07
@@ -195,13 +195,16 @@ def test_parse_tool_result_from_mcp_meta_not_in_string():
|
||||
|
||||
|
||||
def test_parse_tool_result_from_mcp_empty_content():
|
||||
"""Test that empty content produces list with empty text Content."""
|
||||
"""Test that empty MCP content normalizes to JSON null text content."""
|
||||
mcp_result = types.CallToolResult(content=[])
|
||||
result = _parse_tool_result_from_mcp(mcp_result)
|
||||
assert isinstance(result, list)
|
||||
assert len(result) == 1
|
||||
assert result[0].type == "text"
|
||||
assert result[0].text == ""
|
||||
assert result[0].text == "null"
|
||||
|
||||
function_result = Content.from_function_result(call_id="call_null", result=result)
|
||||
assert function_result.result == "null"
|
||||
|
||||
|
||||
def test_parse_tool_result_from_mcp_audio_content():
|
||||
|
||||
Reference in New Issue
Block a user