Skip to content

Commit f6fcbd3

Browse files
committed
fix: mcp tests
1 parent 169fca4 commit f6fcbd3

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

tests_integ/mcp/test_mcp_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,14 @@ def test_mcp_client():
149149

150150
# With the new MCPToolResult, structured content is in its own field
151151
assert "structuredContent" in result
152-
assert result["structuredContent"]["result"] == {"echoed": "STRUCTURED_DATA_TEST"}
152+
assert result["structuredContent"] == {"echoed": "STRUCTURED_DATA_TEST", 'message_length': 20}
153153

154154
# Verify the result is an MCPToolResult (at runtime it's just a dict, but type-wise it should be MCPToolResult)
155155
assert result["status"] == "success"
156156
assert result["toolUseId"] == tool_use_id
157157

158158
assert len(result["content"]) == 1
159-
assert json.loads(result["content"][0]["text"]) == {"echoed": "STRUCTURED_DATA_TEST"}
159+
assert json.loads(result["content"][0]["text"]) == {"echoed": "STRUCTURED_DATA_TEST", 'message_length': 20}
160160

161161

162162
def test_can_reuse_mcp_client():
@@ -199,14 +199,14 @@ async def test_mcp_client_async_structured_content():
199199
assert "structuredContent" in result
200200
# "result" nesting is not part of the MCP Structured Content specification,
201201
# but rather a FastMCP implementation detail
202-
assert result["structuredContent"]["result"] == {"echoed": "ASYNC_STRUCTURED_TEST"}
202+
assert result["structuredContent"] == {"echoed": "ASYNC_STRUCTURED_TEST", 'message_length': 21}
203203

204204
# Verify basic MCPToolResult structure
205205
assert result["status"] in ["success", "error"]
206206
assert result["toolUseId"] == tool_use_id
207207

208208
assert len(result["content"]) == 1
209-
assert json.loads(result["content"][0]["text"]) == {"echoed": "ASYNC_STRUCTURED_TEST"}
209+
assert json.loads(result["content"][0]["text"]) == {"echoed": "ASYNC_STRUCTURED_TEST", 'message_length': 21}
210210

211211

212212
def test_mcp_client_without_structured_content():

tests_integ/mcp/test_mcp_client_structured_content_with_hooks.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,12 @@ def test_mcp_client_hooks_structured_content():
5656
assert result["status"] == "success"
5757
assert len(result["content"]) == 1
5858

59+
print("here?\n")
60+
print(result)
5961
# Verify structured content is present and correct
6062
assert "structuredContent" in result
61-
assert result["structuredContent"]["result"] == {"echoed": test_data}
63+
assert result["structuredContent"] == {"echoed": test_data, 'message_length': 15}
6264

6365
# Verify text content matches structured content
6466
text_content = json.loads(result["content"][0]["text"])
65-
assert text_content == {"echoed": test_data}
67+
assert text_content == {"echoed": test_data, 'message_length': 15}

0 commit comments

Comments
 (0)