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

Function server_on_request

tests/server/test_server_context.py:36–39  ·  view source on GitHub ↗
(dctx: DCtx, method: str, params: Mapping[str, Any] | None)

Source from the content-addressed store, hash-verified

34 conn_holder: list[Connection] = []
35
36 async def server_on_request(dctx: DCtx, method: str, params: Mapping[str, Any] | None) -> dict[str, Any]:
37 ctx: Context[_Lifespan] = Context(dctx, lifespan=_Lifespan("app"), connection=conn_holder[0])
38 captured.append(ctx)
39 return {}
40
41 async with running_pair(direct_pair, server_on_request=server_on_request) as (client, server, *_):
42 conn_holder.append(Connection.for_loop(server, session_id="sess-1"))

Callers

nothing calls this directly

Calls 4

logMethod · 0.95
ContextClass · 0.90
_LifespanClass · 0.85
for_loopMethod · 0.80

Tested by

no test coverage detected