Skip to content

Commit 4bddade

Browse files
committed
The lifespan_context object here is not a dictionary like the other example without a dataclass
1 parent d0443a1 commit 4bddade

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ mcp = FastMCP("My App", lifespan=app_lifespan)
198198
def query_db() -> str:
199199
"""Tool that uses initialized resources"""
200200
ctx = mcp.get_context()
201-
db = ctx.request_context.lifespan_context["db"]
201+
db = ctx.request_context.lifespan_context.db
202202
return db.query()
203203
```
204204

0 commit comments

Comments
 (0)