Spaces:
Running
Running
Jeremiah Lowin commited on
Commit ·
c7c6360
1
Parent(s): d4466da
Fix output schema test
Browse files
tests/server/test_server_interactions.py
CHANGED
|
@@ -947,12 +947,14 @@ class TestToolOutputSchema:
|
|
| 947 |
assert result.data == {"message": "Hello, world!"}
|
| 948 |
|
| 949 |
async def test_output_schema_false_full_handshake(self):
|
| 950 |
-
"""Test that output_schema=False works through full client/server
|
|
|
|
|
|
|
| 951 |
mcp = FastMCP()
|
| 952 |
|
| 953 |
@mcp.tool(output_schema=False) # type: ignore[arg-type]
|
| 954 |
-
def simple_tool() ->
|
| 955 |
-
return
|
| 956 |
|
| 957 |
async with Client(mcp) as client:
|
| 958 |
# List tools and verify output schema is None
|
|
@@ -964,9 +966,7 @@ class TestToolOutputSchema:
|
|
| 964 |
result = await client.call_tool("simple_tool", {})
|
| 965 |
assert result.structured_content is None
|
| 966 |
assert result.data is None
|
| 967 |
-
assert
|
| 968 |
-
"message": "Hello from disabled schema"
|
| 969 |
-
}
|
| 970 |
|
| 971 |
async def test_output_schema_explicit_object_full_handshake(self):
|
| 972 |
"""Test explicit object output schema through full client/server handshake."""
|
|
|
|
| 947 |
assert result.data == {"message": "Hello, world!"}
|
| 948 |
|
| 949 |
async def test_output_schema_false_full_handshake(self):
|
| 950 |
+
"""Test that output_schema=False works through full client/server
|
| 951 |
+
handshake. We test this by returning a scalar, which requires an output
|
| 952 |
+
schema to serialize."""
|
| 953 |
mcp = FastMCP()
|
| 954 |
|
| 955 |
@mcp.tool(output_schema=False) # type: ignore[arg-type]
|
| 956 |
+
def simple_tool() -> int:
|
| 957 |
+
return 42
|
| 958 |
|
| 959 |
async with Client(mcp) as client:
|
| 960 |
# List tools and verify output schema is None
|
|
|
|
| 966 |
result = await client.call_tool("simple_tool", {})
|
| 967 |
assert result.structured_content is None
|
| 968 |
assert result.data is None
|
| 969 |
+
assert result.content[0].text == "42" # type: ignore[attr-defined]
|
|
|
|
|
|
|
| 970 |
|
| 971 |
async def test_output_schema_explicit_object_full_handshake(self):
|
| 972 |
"""Test explicit object output schema through full client/server handshake."""
|