The lifespan_context object here is not a dictionary like the other e… (#1002)
Some checks failed
Main branch checks / checks (push) Has been cancelled
Some checks failed
Main branch checks / checks (push) Has been cancelled
Co-authored-by: ihrpr <inna@anthropic.com>
This commit is contained in:
parent
b2d4322ca0
commit
ee54acbfa3
1 changed files with 1 additions and 1 deletions
|
|
@ -204,7 +204,7 @@ mcp = FastMCP("My App", lifespan=app_lifespan)
|
||||||
def query_db() -> str:
|
def query_db() -> str:
|
||||||
"""Tool that uses initialized resources"""
|
"""Tool that uses initialized resources"""
|
||||||
ctx = mcp.get_context()
|
ctx = mcp.get_context()
|
||||||
db = ctx.request_context.lifespan_context["db"]
|
db = ctx.request_context.lifespan_context.db
|
||||||
return db.query()
|
return db.query()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue