Skip to content

Commit dfc49d6

Browse files
committed
Add a plain end-to-end test for the 2026-07-28 stateless tools/call
A pinned ClientSession over streamable_http_client against a real Server mounted in-process, just the call and the result. The instrumented sibling test pins the wire contract; this is the readable user-story version.
1 parent 47a422c commit dfc49d6

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

tests/interaction/transports/test_hosting_http_modern.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,25 @@ async def call_tool(ctx: ServerRequestContext, params: CallToolRequestParams) ->
198198
assert "kaboom" not in error.message
199199

200200

201+
@requirement("hosting:http:modern:tools-call-stateless")
202+
async def test_pinned_client_calls_a_tool_on_a_modern_server() -> None:
203+
"""The simplest end-to-end exercise: SDK client to SDK server, ``tools/call``, 2026-07-28 stateless.
204+
205+
A pinned ``ClientSession`` over ``streamable_http_client`` against a real ``Server`` mounted
206+
in-process; just the call and the result. The wire contract (headers, envelope, no handshake,
207+
no session id) is pinned by the instrumented sibling test below.
208+
"""
209+
with anyio.fail_after(5):
210+
async with (
211+
mounted_app(_server()) as (http, _),
212+
streamable_http_client(f"{BASE_URL}/mcp", http_client=http, protocol_version=MODERN_VERSION) as (r, w),
213+
ClientSession(r, w, protocol_version=MODERN_VERSION) as session,
214+
):
215+
result = await session.call_tool("add", {"a": 2, "b": 3})
216+
217+
assert result == snapshot(CallToolResult(content=[TextContent(text="5")], result_type="complete"))
218+
219+
201220
@requirement("hosting:http:modern:tools-call-stateless")
202221
@requirement("lifecycle:stateless:request-envelope")
203222
@requirement("lifecycle:stateless:caller-meta-preserved")

0 commit comments

Comments
 (0)