MCPcopy Index your code
hub / github.com/modelcontextprotocol/python-sdk / factory

Function factory

tests/shared/test_jsonrpc_dispatcher.py:209–213  ·  view source on GitHub ↗
(*, can_send_request: bool = True)

Source from the content-addressed store, hash-verified

207 return {"finished": True}
208
209 def factory(*, can_send_request: bool = True):
210 client, server, close = jsonrpc_pair(can_send_request=can_send_request)
211 assert isinstance(server, JSONRPCDispatcher)
212 server._peer_cancel_mode = "signal" # pyright: ignore[reportPrivateUsage]
213 return client, server, close
214
215 result_box: list[dict[str, Any]] = []
216 async with running_pair(factory, server_on_request=server_on_request) as (client, *_):

Callers

nothing calls this directly

Calls 1

jsonrpc_pairFunction · 0.85

Tested by

no test coverage detected