diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..504afef --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules/ +package-lock.json diff --git a/package.json b/package.json new file mode 100644 index 0000000..fd8fcab --- /dev/null +++ b/package.json @@ -0,0 +1,14 @@ +{ + "name": "@modelcontextprotocol/experimental-ext-tasks", + "private": true, + "version": "0.1.0", + "description": "MCP Tasks Extension - Experimental extension for task management in the Model Context Protocol", + "license": "Apache-2.0", + "scripts": { + "check:schema": "tsc --noEmit" + }, + "devDependencies": { + "@modelcontextprotocol/sdk": "^1.29.0", + "typescript": "^5.0.0" + } +} diff --git a/schema/draft/2025-11-25/schema.json b/schema/draft/2025-11-25/schema.json index fa1d2ba..0bef671 100644 --- a/schema/draft/2025-11-25/schema.json +++ b/schema/draft/2025-11-25/schema.json @@ -1,11 +1,11 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "description": "MCP Tasks Extension Schema. Contains only task-related definitions from the MCP 2025-11-25 specification. Base types (Result, JSONRPCRequest, JSONRPCNotification, etc.) are defined in the core MCP schema.", - "$comment": "Extension Identifier: io.modelcontextprotocol/tasks. Core MCP types (Result, JSONRPCRequest, etc.) are structurally inlined in this schema for portability. The authoritative definitions are in the core schema at https://github.com/modelcontextprotocol/modelcontextprotocol/tree/main/schema/2025-11-25", + "description": "MCP Tasks Extension Schema. Contains only task-related definitions from the MCP 2025-11-25 specification. Core MCP types are referenced via remote $ref pointing to the 2025-11-25 core schema.", + "$comment": "Extension Identifier: io.modelcontextprotocol/tasks. Core schema: https://github.com/modelcontextprotocol/modelcontextprotocol/tree/2025-11-25/schema/2025-11-25", "$defs": { "TaskStatus": { "description": "The status of a task.", - "enum": ["working", "input_required", "completed", "failed", "cancelled"], + "enum": ["cancelled", "completed", "failed", "input_required", "working"], "type": "string" }, "TaskMetadata": { @@ -32,10 +32,18 @@ "Task": { "description": "Data associated with a task.", "properties": { - "taskId": { - "description": "The task identifier.", + "createdAt": { + "description": "ISO 8601 timestamp when the task was created.", "type": "string" }, + "lastUpdatedAt": { + "description": "ISO 8601 timestamp when the task was last updated.", + "type": "string" + }, + "pollInterval": { + "description": "Suggested polling interval in milliseconds.", + "type": "integer" + }, "status": { "$ref": "#/$defs/TaskStatus", "description": "Current task state." @@ -44,24 +52,16 @@ "description": "Optional human-readable message describing the current task state.\nThis can provide context for any status, including:\n- Reasons for \"cancelled\" status\n- Summaries for \"completed\" status\n- Diagnostic information for \"failed\" status (e.g., error details, what went wrong)", "type": "string" }, - "createdAt": { - "description": "ISO 8601 timestamp when the task was created.", - "type": "string" - }, - "lastUpdatedAt": { - "description": "ISO 8601 timestamp when the task was last updated.", + "taskId": { + "description": "The task identifier.", "type": "string" }, "ttl": { "description": "Actual retention duration from creation in milliseconds, null for unlimited.", "type": ["integer", "null"] - }, - "pollInterval": { - "description": "Suggested polling interval in milliseconds.", - "type": "integer" } }, - "required": ["taskId", "status", "createdAt", "lastUpdatedAt", "ttl"], + "required": ["createdAt", "lastUpdatedAt", "status", "taskId", "ttl"], "type": "object" }, "CreateTaskResult": { @@ -69,7 +69,7 @@ "properties": { "_meta": { "additionalProperties": {}, - "description": "See the core MCP specification for notes on `_meta` usage.", + "description": "See [General fields: `_meta`](/specification/2025-11-25/basic/index#meta) for notes on `_meta` usage.", "type": "object" }, "task": { @@ -84,18 +84,18 @@ "properties": { "_meta": { "additionalProperties": {}, - "description": "See the core MCP specification for notes on `_meta` usage.", + "description": "See [General fields: `_meta`](/specification/2025-11-25/basic/index#meta) for notes on `_meta` usage.", "properties": { "progressToken": { - "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.", - "type": ["string", "integer"] + "$ref": "https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/main/schema/2025-11-25/schema.json#/$defs/ProgressToken", + "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications." } }, "type": "object" }, "task": { "$ref": "#/$defs/TaskMetadata", - "description": "If specified, the caller is requesting task-augmented execution for this request.\nThe request will return a CreateTaskResult immediately, and the actual result can be retrieved later via tasks/result.\n\nTask augmentation is subject to capability negotiation - receivers MUST declare support for task augmentation of specific request types in their capabilities." + "description": "If specified, the caller is requesting task-augmented execution for this request.\nThe request will return a CreateTaskResult immediately, and the actual result can be\nretrieved later via tasks/result.\n\nTask augmentation is subject to capability negotiation - receivers MUST declare support\nfor task augmentation of specific request types in their capabilities." } }, "type": "object" @@ -104,8 +104,7 @@ "description": "A request to retrieve the state of a task.", "properties": { "id": { - "description": "A unique identifier for the request.", - "type": ["string", "integer"] + "$ref": "https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/main/schema/2025-11-25/schema.json#/$defs/RequestId" }, "jsonrpc": { "const": "2.0", @@ -130,29 +129,21 @@ "type": "object" }, "GetTaskResult": { - "description": "The response to a tasks/get request.", "allOf": [ { - "properties": { - "_meta": { - "additionalProperties": {}, - "description": "See the core MCP specification for notes on `_meta` usage.", - "type": "object" - } - }, - "type": "object" + "$ref": "https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/main/schema/2025-11-25/schema.json#/$defs/Result" }, { "$ref": "#/$defs/Task" } - ] + ], + "description": "The response to a tasks/get request." }, "GetTaskPayloadRequest": { "description": "A request to retrieve the result of a completed task.", "properties": { "id": { - "description": "A unique identifier for the request.", - "type": ["string", "integer"] + "$ref": "https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/main/schema/2025-11-25/schema.json#/$defs/RequestId" }, "jsonrpc": { "const": "2.0", @@ -177,12 +168,12 @@ "type": "object" }, "GetTaskPayloadResult": { - "description": "The response to a tasks/result request.\nThe structure matches the result type of the original request.\nFor example, a tools/call task would return the CallToolResult structure.", "additionalProperties": {}, + "description": "The response to a tasks/result request.\nThe structure matches the result type of the original request.\nFor example, a tools/call task would return the CallToolResult structure.", "properties": { "_meta": { "additionalProperties": {}, - "description": "See the core MCP specification for notes on `_meta` usage.", + "description": "See [General fields: `_meta`](/specification/2025-11-25/basic/index#meta) for notes on `_meta` usage.", "type": "object" } }, @@ -192,8 +183,7 @@ "description": "A request to cancel a task.", "properties": { "id": { - "description": "A unique identifier for the request.", - "type": ["string", "integer"] + "$ref": "https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/main/schema/2025-11-25/schema.json#/$defs/RequestId" }, "jsonrpc": { "const": "2.0", @@ -218,29 +208,21 @@ "type": "object" }, "CancelTaskResult": { - "description": "The response to a tasks/cancel request.", "allOf": [ { - "properties": { - "_meta": { - "additionalProperties": {}, - "description": "See the core MCP specification for notes on `_meta` usage.", - "type": "object" - } - }, - "type": "object" + "$ref": "https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/main/schema/2025-11-25/schema.json#/$defs/Result" }, { "$ref": "#/$defs/Task" } - ] + ], + "description": "The response to a tasks/cancel request." }, "ListTasksRequest": { "description": "A request to retrieve a list of tasks.", "properties": { "id": { - "description": "A unique identifier for the request.", - "type": ["string", "integer"] + "$ref": "https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/main/schema/2025-11-25/schema.json#/$defs/RequestId" }, "jsonrpc": { "const": "2.0", @@ -251,13 +233,7 @@ "type": "string" }, "params": { - "properties": { - "cursor": { - "description": "An opaque token representing the current pagination position.", - "type": "string" - } - }, - "type": "object" + "$ref": "https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/main/schema/2025-11-25/schema.json#/$defs/PaginatedRequestParams" } }, "required": ["id", "jsonrpc", "method"], @@ -268,7 +244,7 @@ "properties": { "_meta": { "additionalProperties": {}, - "description": "See the core MCP specification for notes on `_meta` usage.", + "description": "See [General fields: `_meta`](/specification/2025-11-25/basic/index#meta) for notes on `_meta` usage.", "type": "object" }, "nextCursor": { @@ -286,22 +262,15 @@ "type": "object" }, "TaskStatusNotificationParams": { - "description": "Parameters for a `notifications/tasks/status` notification.", "allOf": [ { - "properties": { - "_meta": { - "additionalProperties": {}, - "description": "See the core MCP specification for notes on `_meta` usage.", - "type": "object" - } - }, - "type": "object" + "$ref": "https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/main/schema/2025-11-25/schema.json#/$defs/NotificationParams" }, { "$ref": "#/$defs/Task" } - ] + ], + "description": "Parameters for a `notifications/tasks/status` notification." }, "TaskStatusNotification": { "description": "An optional notification from the receiver to the requestor, informing them that a task's status has changed. Receivers are not required to send these notifications.", diff --git a/schema/draft/2025-11-25/schema.ts b/schema/draft/2025-11-25/schema.ts index 8f58da1..efbe04b 100644 --- a/schema/draft/2025-11-25/schema.ts +++ b/schema/draft/2025-11-25/schema.ts @@ -3,110 +3,23 @@ * Extension Identifier: io.modelcontextprotocol/tasks * * This file contains only the task-related types from the MCP 2025-11-25 specification. - * Base types (Result, JSONRPCRequest, JSONRPCNotification, etc.) are defined in the - * core MCP schema at https://github.com/modelcontextprotocol/modelcontextprotocol + * Base types are imported from the core MCP SDK. * * @see https://modelcontextprotocol.io/specification/2025-11-25/basic/utilities/tasks */ -// ============================================================================ -// Base type stubs (defined in core MCP schema) -// ============================================================================ -// -// The following types are minimal stubs of core MCP types, provided solely so -// that this file compiles. They are NOT part of the Tasks extension API. -// Implementations MUST use the authoritative definitions from the core schema: -// https://github.com/modelcontextprotocol/modelcontextprotocol/tree/main/schema/2025-11-25 -// ============================================================================ - -/** - * @internal Core MCP type stub — see core schema for authoritative definition. - */ -type ProgressToken = string | number; - -/** - * @internal Core MCP type stub — see core schema for authoritative definition. - */ -type Cursor = string; - -/** - * @internal Core MCP type stub — see core schema for authoritative definition. - */ -type RequestId = string | number; - -/** - * @internal Core MCP type stub — see core schema for authoritative definition. - */ -interface RequestParams { - _meta?: { - progressToken?: ProgressToken; - [key: string]: unknown; - }; -} - -/** - * @internal Core MCP type stub — see core schema for authoritative definition. - */ -interface NotificationParams { - _meta?: { [key: string]: unknown }; -} - -/** - * @internal Core MCP type stub — see core schema for authoritative definition. - */ -interface Result { - _meta?: { [key: string]: unknown }; - [key: string]: unknown; -} - -/** - * @internal Core MCP type stub — see core schema for authoritative definition. - */ -interface Request { - method: string; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - params?: { [key: string]: any }; -} - -/** - * @internal Core MCP type stub — see core schema for authoritative definition. - */ -interface Notification { - method: string; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - params?: { [key: string]: any }; -} - -/** - * @internal Core MCP type stub — see core schema for authoritative definition. - */ -interface JSONRPCRequest extends Request { - jsonrpc: "2.0"; - id: RequestId; -} - -/** - * @internal Core MCP type stub — see core schema for authoritative definition. - */ -interface JSONRPCNotification extends Notification { - jsonrpc: "2.0"; -} - -/** - * @internal Core MCP type stub — see core schema for authoritative definition. - */ -interface PaginatedRequest extends JSONRPCRequest { - params?: RequestParams & { - cursor?: Cursor; - }; -} - -/** - * @internal Core MCP type stub — see core schema for authoritative definition. - */ -interface PaginatedResult extends Result { - nextCursor?: Cursor; -} +import type { + Cursor, + JSONRPCNotification, + JSONRPCRequest, + NotificationParams, + PaginatedRequest, + PaginatedResult, + ProgressToken, + RequestId, + RequestParams, + Result, +} from "@modelcontextprotocol/sdk/types.js"; /* Tasks */ @@ -301,7 +214,8 @@ export interface ListTasksResult extends PaginatedResult { * * @category `notifications/tasks/status` */ -export type TaskStatusNotificationParams = NotificationParams & Task; +export type TaskStatusNotificationParams = NotificationParams & + Task & { [key: string]: unknown }; /** * An optional notification from the receiver to the requestor, informing them that a task's status has changed. Receivers are not required to send these notifications. diff --git a/tsconfig.json b/tsconfig.json index f6efb51..fbf7ab8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,8 @@ "noEmit": true, "target": "ES2020", "module": "ES2020", - "moduleResolution": "node" + "moduleResolution": "node", + "skipLibCheck": true }, "include": ["schema/**/*.ts"] }