Fix lifespan_context access example in README (#437)
This commit is contained in:
parent
c2ca8e03e0
commit
58b989c0a3
1 changed files with 1 additions and 1 deletions
|
|
@ -194,7 +194,7 @@ mcp = FastMCP("My App", lifespan=app_lifespan)
|
|||
@mcp.tool()
|
||||
def query_db(ctx: Context) -> str:
|
||||
"""Tool that uses initialized resources"""
|
||||
db = ctx.request_context.lifespan_context["db"]
|
||||
db = ctx.request_context.lifespan_context.db
|
||||
return db.query()
|
||||
```
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue