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

Function handle_read_resource

tests/client/test_client.py:198–201  ·  view source on GitHub ↗
(
        ctx: ServerRequestContext, params: types.ReadResourceRequestParams
    )

Source from the content-addressed store, hash-verified

196 """MCPError raised by a server handler propagates to the client with its code intact."""
197
198 async def handle_read_resource(
199 ctx: ServerRequestContext, params: types.ReadResourceRequestParams
200 ) -> ReadResourceResult:
201 raise MCPError(code=404, message="no resource with that URI was found")
202
203 server = Server("test", on_read_resource=handle_read_resource)
204 async with Client(server) as client:

Callers

nothing calls this directly

Calls 1

MCPErrorClass · 0.90

Tested by

no test coverage detected