Skip to content

Commit db28156

Browse files
fix(types): restore task wire types removed with the task feature (#2248)
1 parent c8d7401 commit db28156

13 files changed

Lines changed: 556 additions & 71 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@modelcontextprotocol/core': minor
3+
'@modelcontextprotocol/server': minor
4+
'@modelcontextprotocol/client': minor
5+
---
6+
7+
Restore the 2025-11-25 task wire types that were removed together with the task feature: the task schemas and inferred types, task members of the request/result/notification unions, the `task` request-params augmentation, the `tasks` capability key, the `isTaskAugmentedRequestParams` guard, and `RELATED_TASK_META_KEY`. The task feature itself remains removed — servers do not advertise the `tasks` capability and inbound `tasks/*` requests receive `-32601` — but the wire surface stays so SDKs interoperate cleanly with peers on the 2025-11-25 revision.

docs/migration-SKILL.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,9 @@ The 2025-11 task side-channel through `Protocol` is removed (was always `@experi
499499
| `TaskMessageQueue`, `InMemoryTaskMessageQueue`, `BaseQueuedMessage`, `Queued*`, `CreateTaskServerContext`, `TaskServerContext`, `TaskToolExecution` | removed |
500500
| `ResponseMessage`, `BaseResponseMessage`, `ErrorMessage`, `AsyncGeneratorValue`, `TaskStatusMessage`, `TaskCreatedMessage`, `ResultMessage`, `takeResult`, `toArrayAsync` | removed |
501501

502-
`TaskStore` / `InMemoryTaskStore` / `CreateTaskOptions` / `isTerminal` (storage layer) and `TaskCreationParams` are also removed; they will return with the SEP-2663 server-directed plugin.
502+
`TaskStore` / `InMemoryTaskStore` / `CreateTaskOptions` / `isTerminal` (storage layer) are also removed; they will return with the SEP-2663 server-directed plugin.
503+
504+
NOT removed (wire surface, kept for 2025-11-25 interop): task Zod schemas + inferred types (`Task`, `TaskStatus`, `TaskMetadata`, `RelatedTaskMetadata`, `CreateTaskResult`, `GetTask*`, `ListTasks*`, `CancelTask*`, `TaskStatusNotification*`, `TaskAugmentedRequestParams`), task members of the request/result/notification unions, the `tasks` capability key, `isTaskAugmentedRequestParams`, `RELATED_TASK_META_KEY`. Inbound `tasks/*` requests → `-32601`.
503505

504506
## 13. Client Behavioral Changes
505507

docs/migration.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,9 @@ The 2025-11 experimental tasks side-channel woven through `Protocol` has been re
892892
- `TaskMessageQueue`, `InMemoryTaskMessageQueue`, `BaseQueuedMessage` and the `Queued*` message types, `CreateTaskServerContext`, `TaskServerContext`, `TaskToolExecution`
893893
- `examples/{client,server}/src/simpleTaskInteractive*.ts`
894894

895-
**Also removed:** the storage layer (`TaskStore`, `InMemoryTaskStore`, `CreateTaskOptions`, `isTerminal`) and `TaskCreationParams`. They will return as part of the SEP-2663 server-directed plugin in a follow-up.
895+
**Also removed:** the storage layer (`TaskStore`, `InMemoryTaskStore`, `CreateTaskOptions`, `isTerminal`). It will return as part of the SEP-2663 server-directed plugin in a follow-up.
896+
897+
**Wire types remain.** The task wire surface defined by the 2025-11-25 protocol revision is still exported, for interoperability with peers on that revision: the task Zod schemas and their inferred types (`Task`, `TaskStatus`, `TaskMetadata`, `RelatedTaskMetadata`, `CreateTaskResult`, `GetTask*`, `GetTaskPayload*`, `ListTasks*`, `CancelTask*`, `TaskStatusNotification*`, `TaskAugmentedRequestParams`), the task members of the request/result/notification unions, the `tasks` capability key, the `isTaskAugmentedRequestParams` guard, and `RELATED_TASK_META_KEY`. Only the behavior is gone: servers built on this SDK do not advertise the `tasks` capability, and inbound `tasks/*` requests receive a standard `-32601` (method not found) error.
896898

897899
There is no migration path for the removed surface; it was always `@experimental`. Task support is planned to return as an opt-in extension plugin per SEP-2663.
898900

packages/codemod/src/generated/specSchemaMap.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ export const SPEC_SCHEMA_NAMES: ReadonlySet<string> = new Set([
88
'CallToolRequestParamsSchema',
99
'CallToolRequestSchema',
1010
'CallToolResultSchema',
11+
'CancelTaskRequestSchema',
12+
'CancelTaskResultSchema',
1113
'CancelledNotificationParamsSchema',
1214
'CancelledNotificationSchema',
1315
'ClientCapabilitiesSchema',
@@ -23,6 +25,7 @@ export const SPEC_SCHEMA_NAMES: ReadonlySet<string> = new Set([
2325
'CreateMessageRequestSchema',
2426
'CreateMessageResultSchema',
2527
'CreateMessageResultWithToolsSchema',
28+
'CreateTaskResultSchema',
2629
'CursorSchema',
2730
'ElicitRequestFormParamsSchema',
2831
'ElicitRequestParamsSchema',
@@ -37,6 +40,10 @@ export const SPEC_SCHEMA_NAMES: ReadonlySet<string> = new Set([
3740
'GetPromptRequestParamsSchema',
3841
'GetPromptRequestSchema',
3942
'GetPromptResultSchema',
43+
'GetTaskPayloadRequestSchema',
44+
'GetTaskPayloadResultSchema',
45+
'GetTaskRequestSchema',
46+
'GetTaskResultSchema',
4047
'IconSchema',
4148
'IconsSchema',
4249
'ImageContentSchema',
@@ -63,6 +70,8 @@ export const SPEC_SCHEMA_NAMES: ReadonlySet<string> = new Set([
6370
'ListResourcesResultSchema',
6471
'ListRootsRequestSchema',
6572
'ListRootsResultSchema',
73+
'ListTasksRequestSchema',
74+
'ListTasksResultSchema',
6675
'ListToolsRequestSchema',
6776
'ListToolsResultSchema',
6877
'LoggingLevelSchema',
@@ -101,6 +110,7 @@ export const SPEC_SCHEMA_NAMES: ReadonlySet<string> = new Set([
101110
'ReadResourceRequestParamsSchema',
102111
'ReadResourceRequestSchema',
103112
'ReadResourceResultSchema',
113+
'RelatedTaskMetadataSchema',
104114
'RequestIdSchema',
105115
'RequestMetaSchema',
106116
'RequestSchema',
@@ -130,6 +140,13 @@ export const SPEC_SCHEMA_NAMES: ReadonlySet<string> = new Set([
130140
'StringSchemaSchema',
131141
'SubscribeRequestParamsSchema',
132142
'SubscribeRequestSchema',
143+
'TaskAugmentedRequestParamsSchema',
144+
'TaskCreationParamsSchema',
145+
'TaskMetadataSchema',
146+
'TaskSchema',
147+
'TaskStatusNotificationParamsSchema',
148+
'TaskStatusNotificationSchema',
149+
'TaskStatusSchema',
133150
'TextContentSchema',
134151
'TextResourceContentsSchema',
135152
'TitledMultiSelectEnumSchemaSchema',

packages/core/src/exports/public/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export {
7979
LATEST_PROTOCOL_VERSION,
8080
METHOD_NOT_FOUND,
8181
PARSE_ERROR,
82+
RELATED_TASK_META_KEY,
8283
SUPPORTED_PROTOCOL_VERSIONS
8384
} from '../../types/constants.js';
8485

@@ -100,6 +101,7 @@ export {
100101
isJSONRPCRequest,
101102
isJSONRPCResponse,
102103
isJSONRPCResultResponse,
104+
isTaskAugmentedRequestParams,
103105
parseJSONRPCMessage
104106
} from '../../types/guards.js';
105107

packages/core/src/types/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ export const LATEST_PROTOCOL_VERSION = '2025-11-25';
22
export const DEFAULT_NEGOTIATED_PROTOCOL_VERSION = '2025-03-26';
33
export const SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, '2025-06-18', '2025-03-26', '2024-11-05', '2024-10-07'];
44

5+
export const RELATED_TASK_META_KEY = 'io.modelcontextprotocol/related-task';
6+
57
/* JSON-RPC types */
68
export const JSONRPC_VERSION = '2.0';
79

packages/core/src/types/guards.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import {
77
JSONRPCNotificationSchema,
88
JSONRPCRequestSchema,
99
JSONRPCResponseSchema,
10-
JSONRPCResultResponseSchema
10+
JSONRPCResultResponseSchema,
11+
TaskAugmentedRequestParamsSchema
1112
} from './schemas.js';
1213
import type {
1314
CallToolResult,
@@ -21,7 +22,8 @@ import type {
2122
JSONRPCNotification,
2223
JSONRPCRequest,
2324
JSONRPCResponse,
24-
JSONRPCResultResponse
25+
JSONRPCResultResponse,
26+
TaskAugmentedRequestParams
2527
} from './types.js';
2628

2729
/**
@@ -79,6 +81,15 @@ export const isCallToolResult = (value: unknown): value is CallToolResult => {
7981
return CallToolResultSchema.safeParse(value).success;
8082
};
8183

84+
/**
85+
* Checks if a value is a valid {@linkcode TaskAugmentedRequestParams}.
86+
* @param value - The value to check.
87+
*
88+
* @returns True if the value is a valid {@linkcode TaskAugmentedRequestParams}, false otherwise.
89+
*/
90+
export const isTaskAugmentedRequestParams = (value: unknown): value is TaskAugmentedRequestParams =>
91+
TaskAugmentedRequestParamsSchema.safeParse(value).success;
92+
8293
export const isInitializeRequest = (value: unknown): value is InitializeRequest => InitializeRequestSchema.safeParse(value).success;
8394

8495
export const isInitializedNotification = (value: unknown): value is InitializedNotification =>

0 commit comments

Comments
 (0)