fix typo: server has get_context attribute instead of request_context. (#446)
This commit is contained in:
parent
7b6a903eb9
commit
173e0ee3b8
1 changed files with 1 additions and 1 deletions
|
|
@ -619,7 +619,7 @@ server = Server("example-server", lifespan=server_lifespan)
|
||||||
# Access lifespan context in handlers
|
# Access lifespan context in handlers
|
||||||
@server.call_tool()
|
@server.call_tool()
|
||||||
async def query_db(name: str, arguments: dict) -> list:
|
async def query_db(name: str, arguments: dict) -> list:
|
||||||
ctx = server.request_context
|
ctx = server.get_context()
|
||||||
db = ctx.lifespan_context["db"]
|
db = ctx.lifespan_context["db"]
|
||||||
return await db.query(arguments["query"])
|
return await db.query(arguments["query"])
|
||||||
```
|
```
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue