You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Serialize spec results through the per-version surface schema
Generated surface types switch to extra="ignore" (with a per-version
allow-list for spec-declared open types: Result, _meta, GetTaskPayloadResult,
Tool input/output schemas, URLElicitationRequiredError data). The runner now
serializes spec-method results by dumping the monolith model and re-dumping
through the negotiated version's surface row, so 2026-only fields (resultType,
ttlMs, cacheScope) never reach the wire on a pre-2026 session.
- Monolith ttl_ms/cache_scope default to None; the SDK does not stamp a
caching policy. EmptyResult.result_type stays None (deployed peer servers
strict-validate ping responses).
- Spec methods absent at the negotiated version reject with METHOD_NOT_FOUND
even if a handler is registered; custom methods fall through unchanged.
- Version fallback for pre-handshake/stateless is the literal 2025-11-25,
not LATEST_PROTOCOL_VERSION.
- Add serialize_server_result to types.methods; codegen drift-guard asserts
the open-class substitution count.
- Docstrings now say method-gating per version, shape per schema era.
Copy file name to clipboardExpand all lines: docs/migration.md
+1-5Lines changed: 1 addition & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -221,10 +221,6 @@ Common renames:
221
221
222
222
Because `populate_by_name=True` is set, the old camelCase names still work as constructor kwargs (e.g., `Tool(inputSchema={...})` is accepted), but attribute access must use snake_case (`tool.input_schema`).
223
223
224
-
### Results now serialize `resultType` and cache-directive defaults
225
-
226
-
Serialized results now include `resultType` by default (and `ttlMs`/`cacheScope` on cacheable results). Peers ignore unknown result fields, so this interoperates across protocol versions, but tests or recorded fixtures that compare exact serialized payloads need the new keys added.
227
-
228
224
### Server handler results are validated against the protocol schema
229
225
230
226
Results returned from server handlers are now validated against the negotiated protocol version's schema before being sent. A result that does not conform raises on the server side and the client receives an `INTERNAL_ERROR` response. The case most existing code will hit is `Tool.inputSchema`: the spec requires it to contain `"type": "object"`, so an empty `{}` is now rejected.
@@ -1237,7 +1233,7 @@ If you relied on extra fields round-tripping through MCP types, move that data i
1237
1233
1238
1234
### 2025-11-25 and 2026-07-28 protocol fields modeled
1239
1235
1240
-
`mcp.types` models the 2025-11-25 and 2026-07-28 protocol fields (e.g. `resultType`, `ttlMs`/`cacheScope` on cacheable results, `inputResponses`/`requestState` on retried requests), so inbound payloads carrying these keys parse into typed fields and round-trip. Most are optional with `None`defaults; the result-directive fields carry serialized defaults - see [Results now serialize `resultType` and cache-directive defaults](#results-now-serialize-resulttype-and-cache-directive-defaults).
1236
+
`mcp.types` models the 2025-11-25 and 2026-07-28 protocol fields (e.g. `resultType`, `ttlMs`/`cacheScope` on cacheable results, `inputResponses`/`requestState` on retried requests), so inbound payloads carrying these keys parse into typed fields and round-trip. `ttlMs`/`cacheScope` default to `None`; `resultType`defaults to `"complete"` on concrete results (`None` on `EmptyResult`); the server strips all of them from the wire at pre-2026 versions.
1241
1237
1242
1238
### `streamable_http_app()` available on lowlevel Server
0 commit comments