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

Function handle

src/mcp/server/runner.py:509–518  ·  view source on GitHub ↗
(
        dctx: DispatchContext[TransportContext], method: str, params: Mapping[str, Any] | None
    )

Source from the content-addressed store, hash-verified

507 """
508
509 async def handle(
510 dctx: DispatchContext[TransportContext], method: str, params: Mapping[str, Any] | None
511 ) -> dict[str, Any]:
512 meta = (params or {}).get("_meta", {})
513 connection = Connection.from_envelope(
514 meta.get(PROTOCOL_VERSION_META_KEY, LATEST_MODERN_VERSION),
515 meta.get(CLIENT_INFO_META_KEY),
516 meta.get(CLIENT_CAPABILITIES_META_KEY),
517 )
518 return await serve_one(server, dctx, method, params, connection=connection, lifespan_state=lifespan_state)
519
520 return handle

Callers

nothing calls this directly

Calls 2

serve_oneFunction · 0.85
from_envelopeMethod · 0.80

Tested by

no test coverage detected