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

Co-authored-by: ihrpr <inna@anthropic.com>
This commit is contained in:
John T 2025-07-10 06:55:34 -04:00 • committed by GitHub
commit ee54acbfa3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -204,7 +204,7 @@ mcp = FastMCP("My App", lifespan=app_lifespan)
def query_db() -> str:
"""Tool that uses initialized resources"""
ctx = mcp.get_context()
db = ctx.request_context.lifespan_context["db"]
db = ctx.request_context.lifespan_context.db
return db.query()
```