Allow CallToolResult to be returned directly to support _meta field for OpenAI Apps (#1459)
Co-authored-by: Max Isbey <224885523+maxisbey@users.noreply.github.com>
This commit is contained in:
parent
40acbc596c
commit
1200ba0082
1 changed files with 445 additions and 5 deletions
|
|
@ -44,6 +44,23 @@ async def test_complex_inputs():
|
|||
assert result.content[2].text == "charlie"
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_direct_call_tool_result_return():
|
||||
"""Test the CallToolResult echo server"""
|
||||
from examples.fastmcp.direct_call_tool_result_return import mcp
|
||||
|
||||
async with client_session(mcp._mcp_server) as client:
|
||||
result = await client.call_tool("echo", {"text": "hello"})
|
||||
assert len(result.content) == 1
|
||||
content = result.content[0]
|
||||
assert isinstance(content, TextContent)
|
||||
assert content.text == "hello"
|
||||
assert result.structuredContent
|
||||
assert result.structuredContent["text"] == "hello"
|
||||
assert isinstance(result.meta, dict)
|
||||
assert result.meta["some"] == "metadata"
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_desktop(monkeypatch: pytest.MonkeyPatch):
|
||||
"""Test the desktop server"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue