Skip to content

Commit 70d5e88

Browse files
committed
add note on migration
1 parent b9a9838 commit 70d5e88

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

docs/migration.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,35 @@ notification = server_notification_adapter.validate_python(data)
233233

234234
All adapters are exported from `mcp.types`.
235235

236+
### `RequestParams.Meta` replaced with `RequestParamsMeta` TypedDict
237+
238+
The nested `RequestParams.Meta` Pydantic model class has been replaced with a top-level `RequestParamsMeta` TypedDict. This affects the `ctx.meta` field in request handlers and any code that imports or references this type.
239+
240+
**Key changes:**
241+
242+
- `RequestParams.Meta` (Pydantic model) → `RequestParamsMeta` (TypedDict)
243+
- Attribute access (`meta.progress_token`) → Dictionary access (`meta.get("progress_token")`)
244+
- `progress_token` field changed from `ProgressToken | None = None` to `NotRequired[ProgressToken]`
245+
`
246+
247+
**In request context handlers:**
248+
249+
```python
250+
# Before (v1)
251+
@server.call_tool()
252+
async def handle_tool(name: str, arguments: dict) -> list[TextContent]:
253+
ctx = server.request_context
254+
if ctx.meta and ctx.meta.progress_token:
255+
await ctx.session.send_progress_notification(ctx.meta.progress_token, 0.5, 100)
256+
257+
# After (v2)
258+
@server.call_tool()
259+
async def handle_tool(name: str, arguments: dict) -> list[TextContent]:
260+
ctx = server.request_context
261+
if ctx.meta and "progress_token" in ctx.meta:
262+
await ctx.session.send_progress_notification(ctx.meta["progress_token"], 0.5, 100)
263+
```
264+
236265
### Resource URI type changed from `AnyUrl` to `str`
237266

238267
The `uri` field on resource-related types now uses `str` instead of Pydantic's `AnyUrl`. This aligns with the [MCP specification schema](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/schema/draft/schema.ts) which defines URIs as plain strings (`uri: string`) without strict URL validation. This change allows relative paths like `users/me` that were previously rejected.

0 commit comments

Comments
 (0)