Skip to content

Commit f800029

Browse files
committed
fix: add full items in resource on EmbededResource
1 parent 35df181 commit f800029

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

python/packages/autogen-ext/src/autogen_ext/tools/mcp/_base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ def serialize_item(item):
129129
for key, val in item.resource.model_dump().items():
130130
if isinstance(val, AnyUrl):
131131
resource[key] = str(val)
132+
else:
133+
resource[key] = val
132134
annotations = item.annotations.model_dump() if item.annotations else None
133135
return {"type": type, "resource": resource, "annotations": annotations}
134136
else:

python/packages/autogen-ext/tests/tools/test_mcp_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ async def test_adapter_from_server_params_with_return_value_as_string(
231231
annotations=Annotations(audience=["user"], priority=0.3),
232232
),
233233
]
234-
) == '[{"type": "text", "text": "this is a sample text", "annotations": {"audience": ["user", "assistant"], "priority": 0.7}}, {"type": "image", "data": "this is a sample base64 encoded image", "mimeType": "image/png", "annotations": null}, {"type": "resource", "resource": {"uri": "http://example.com/test"}, "annotations": {"audience": ["user"], "priority": 0.3}}]'
234+
) == '[{"type": "text", "text": "this is a sample text", "annotations": {"audience": ["user", "assistant"], "priority": 0.7}}, {"type": "image", "data": "this is a sample base64 encoded image", "mimeType": "image/png", "annotations": null}, {"type": "resource", "resource": {"uri": "http://example.com/test", "mimeType": null, "text": "this is a sample text"}, "annotations": {"audience": ["user"], "priority": 0.3}}]'
235235

236236

237237
@pytest.mark.asyncio

0 commit comments

Comments
 (0)