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
|`isJSONRPCResponse` (deprecated in v1) |`isJSONRPCResultResponse` (**not** v2's new `isJSONRPCResponse`, which correctly matches both result and error) |
|`StreamableHTTPError`| REMOVED (use `SdkError` with `SdkErrorCode.ClientHttp*`) |
99
-
|`WebSocketClientTransport`| REMOVED (use `StreamableHTTPClientTransport` or `StdioClientTransport`) |
100
-
101
-
All other **type** symbols from `@modelcontextprotocol/sdk/types.js` retain their original names. **Zod schemas** (e.g., `CallToolResultSchema`, `ListToolsResultSchema`) are no longer part of the public API — they are internal to the SDK. For runtime validation, use type guard functions like `isCallToolResult` instead of `CallToolResultSchema.safeParse()`.
|`StreamableHTTPError`| REMOVED (use `SdkError` with `SdkErrorCode.ClientHttp*`) |
99
+
|`WebSocketClientTransport`| REMOVED (use `StreamableHTTPClientTransport` or `StdioClientTransport`) |
100
+
101
+
All other **type** symbols from `@modelcontextprotocol/sdk/types.js` retain their original names. **Zod schemas** (e.g., `CallToolResultSchema`, `ListToolsResultSchema`) are no longer part of the public API — they are internal to the SDK. For runtime validation, use
102
+
`isSpecType('TypeName', value)` (e.g., `isSpecType('CallToolResult', v)`) or `specTypeSchema('TypeName')` for the `StandardSchemaV1` validator object. The `'TypeName'` argument is typed as `SpecTypeName`, a literal union of all spec type names.
102
103
103
104
### Error class changes
104
105
@@ -210,7 +211,8 @@ Zod schemas, all callback return types. Note: `callTool()` and `request()` signa
210
211
211
212
The variadic `.tool()`, `.prompt()`, `.resource()` methods are removed. Use the `register*` methods with a config object.
212
213
213
-
**IMPORTANT**: v2 requires schema objects implementing [Standard Schema](https://standardschema.dev/) — raw shapes like `{ name: z.string() }` are no longer supported. Wrap with `z.object()` (Zod v4), or use ArkType's `type({...})`, or Valibot. For raw JSON Schema, wrap with `fromJsonSchema(schema)` from `@modelcontextprotocol/server` (validator defaults automatically; pass an explicit validator for custom configurations). Applies to `inputSchema`, `outputSchema`, and `argsSchema`.
214
+
**IMPORTANT**: v2 requires schema objects implementing [Standard Schema](https://standardschema.dev/) — raw shapes like `{ name: z.string() }` are no longer supported. Wrap with `z.object()` (Zod v4), or use ArkType's `type({...})`, or Valibot. For raw JSON Schema, wrap with
215
+
`fromJsonSchema(schema)` from `@modelcontextprotocol/server` (validator defaults automatically; pass an explicit validator for custom configurations). Applies to `inputSchema`, `outputSchema`, and `argsSchema`.
214
216
215
217
### Tools
216
218
@@ -280,20 +282,20 @@ Note: the third argument (`metadata`) is required — pass `{}` if no metadata.
Remove unused schema imports: `CallToolResultSchema`, `CompatibilityCallToolResultSchema`, `ElicitResultSchema`, `CreateMessageResultSchema`, etc., when they were only used in `request()`/`send()`/`callTool()` calls.
437
439
438
-
If `CallToolResultSchema`was used for **runtime validation** (not just as a `request()` argument), replace with the `isCallToolResult` type guard:
440
+
If a `*Schema` constant was used for **runtime validation** (not just as a `request()` argument), replace with `isSpecType()` / `specTypeSchema()`:
| Passing `<TypeName>Schema` as a validator argument |`specTypeSchema('<TypeName>')` (returns `StandardSchemaV1<T>`) |
448
+
449
+
`isCallToolResult(value)` still works, but `isSpecType` covers every spec type by name.
444
450
445
451
## 12. Experimental: `TaskCreationParams.ttl` no longer accepts `null`
446
452
447
453
`TaskCreationParams.ttl` changed from `z.union([z.number(), z.null()]).optional()` to `z.number().optional()`. Per the MCP spec, `null` TTL (unlimited lifetime) is only valid in server responses (`Task.ttl`), not in client requests. Omit `ttl` to let the server decide.
0 commit comments