first agentic pass

This commit is contained in:
Caitie McCaffrey 2026-05-11 14:25:28 -07:00
commit 8c434efe8d
2 changed files with 3075 additions and 0 deletions

View file

@ -0,0 +1,405 @@
{
"$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",
"$defs": {
"TaskStatus": {
"description": "The status of a task.",
"enum": ["working", "input_required", "completed", "failed", "cancelled"],
"type": "string"
},
"TaskMetadata": {
"description": "Metadata for augmenting a request with task execution.\nInclude this in the `task` field of the request parameters.",
"properties": {
"ttl": {
"description": "Requested duration in milliseconds to retain task from creation.",
"type": "integer"
}
},
"type": "object"
},
"RelatedTaskMetadata": {
"description": "Metadata for associating messages with a task.\nInclude this in the `_meta` field under the key `io.modelcontextprotocol/related-task`.",
"properties": {
"taskId": {
"description": "The task identifier this message is associated with.",
"type": "string"
}
},
"required": ["taskId"],
"type": "object"
},
"Task": {
"description": "Data associated with a task.",
"properties": {
"taskId": {
"description": "The task identifier.",
"type": "string"
},
"status": {
"$ref": "#/$defs/TaskStatus",
"description": "Current task state."
},
"statusMessage": {
"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.",
"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"],
"type": "object"
},
"CreateTaskResult": {
"description": "A response to a task-augmented request.",
"properties": {
"_meta": {
"additionalProperties": {},
"description": "See the core MCP specification for notes on `_meta` usage.",
"type": "object"
},
"task": {
"$ref": "#/$defs/Task"
}
},
"required": ["task"],
"type": "object"
},
"TaskAugmentedRequestParams": {
"description": "Common params for any task-augmented request.",
"properties": {
"_meta": {
"additionalProperties": {},
"description": "See the core MCP specification 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"]
}
},
"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."
}
},
"type": "object"
},
"GetTaskRequest": {
"description": "A request to retrieve the state of a task.",
"properties": {
"id": {
"description": "A unique identifier for the request.",
"type": ["string", "integer"]
},
"jsonrpc": {
"const": "2.0",
"type": "string"
},
"method": {
"const": "tasks/get",
"type": "string"
},
"params": {
"properties": {
"taskId": {
"description": "The task identifier to query.",
"type": "string"
}
},
"required": ["taskId"],
"type": "object"
}
},
"required": ["id", "jsonrpc", "method", "params"],
"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": "#/$defs/Task"
}
]
},
"GetTaskPayloadRequest": {
"description": "A request to retrieve the result of a completed task.",
"properties": {
"id": {
"description": "A unique identifier for the request.",
"type": ["string", "integer"]
},
"jsonrpc": {
"const": "2.0",
"type": "string"
},
"method": {
"const": "tasks/result",
"type": "string"
},
"params": {
"properties": {
"taskId": {
"description": "The task identifier to retrieve results for.",
"type": "string"
}
},
"required": ["taskId"],
"type": "object"
}
},
"required": ["id", "jsonrpc", "method", "params"],
"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": {},
"properties": {
"_meta": {
"additionalProperties": {},
"description": "See the core MCP specification for notes on `_meta` usage.",
"type": "object"
}
},
"type": "object"
},
"CancelTaskRequest": {
"description": "A request to cancel a task.",
"properties": {
"id": {
"description": "A unique identifier for the request.",
"type": ["string", "integer"]
},
"jsonrpc": {
"const": "2.0",
"type": "string"
},
"method": {
"const": "tasks/cancel",
"type": "string"
},
"params": {
"properties": {
"taskId": {
"description": "The task identifier to cancel.",
"type": "string"
}
},
"required": ["taskId"],
"type": "object"
}
},
"required": ["id", "jsonrpc", "method", "params"],
"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": "#/$defs/Task"
}
]
},
"ListTasksRequest": {
"description": "A request to retrieve a list of tasks.",
"properties": {
"id": {
"description": "A unique identifier for the request.",
"type": ["string", "integer"]
},
"jsonrpc": {
"const": "2.0",
"type": "string"
},
"method": {
"const": "tasks/list",
"type": "string"
},
"params": {
"properties": {
"cursor": {
"description": "An opaque token representing the current pagination position.",
"type": "string"
}
},
"type": "object"
}
},
"required": ["id", "jsonrpc", "method"],
"type": "object"
},
"ListTasksResult": {
"description": "The response to a tasks/list request.",
"properties": {
"_meta": {
"additionalProperties": {},
"description": "See the core MCP specification for notes on `_meta` usage.",
"type": "object"
},
"nextCursor": {
"description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.",
"type": "string"
},
"tasks": {
"items": {
"$ref": "#/$defs/Task"
},
"type": "array"
}
},
"required": ["tasks"],
"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": "#/$defs/Task"
}
]
},
"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.",
"properties": {
"jsonrpc": {
"const": "2.0",
"type": "string"
},
"method": {
"const": "notifications/tasks/status",
"type": "string"
},
"params": {
"$ref": "#/$defs/TaskStatusNotificationParams"
}
},
"required": ["jsonrpc", "method", "params"],
"type": "object"
},
"TaskServerCapabilities": {
"description": "Task-related server capabilities. Include this in the server's capabilities object during initialization.",
"properties": {
"tasks": {
"properties": {
"list": {
"description": "Whether this server supports tasks/list.",
"type": "object"
},
"cancel": {
"description": "Whether this server supports tasks/cancel.",
"type": "object"
},
"requests": {
"properties": {
"tools": {
"properties": {
"call": {
"description": "Whether the server supports task-augmented tools/call requests.",
"type": "object"
}
},
"type": "object"
}
},
"type": "object"
}
},
"type": "object"
}
},
"type": "object"
},
"TaskClientCapabilities": {
"description": "Task-related client capabilities. Include this in the client's capabilities object during initialization.",
"properties": {
"tasks": {
"properties": {
"list": {
"description": "Whether this client supports tasks/list.",
"type": "object"
},
"cancel": {
"description": "Whether this client supports tasks/cancel.",
"type": "object"
},
"requests": {
"properties": {
"sampling": {
"properties": {
"createMessage": {
"description": "Whether the client supports task-augmented sampling/createMessage requests.",
"type": "object"
}
},
"type": "object"
},
"elicitation": {
"properties": {
"create": {
"description": "Whether the client supports task-augmented elicitation/create requests.",
"type": "object"
}
},
"type": "object"
}
},
"type": "object"
}
},
"type": "object"
}
},
"type": "object"
},
"ToolTaskSupport": {
"description": "Task support declaration for individual tools.\n- \"forbidden\": Tool does not support task-augmented execution (default when absent)\n- \"optional\": Tool may support task-augmented execution\n- \"required\": Tool requires task-augmented execution",
"enum": ["forbidden", "optional", "required"],
"type": "string"
}
}
}

View file

@ -0,0 +1,425 @@
/**
* MCP Tasks Extension Schema
* 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
*
* @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;
}
/* Tasks */
/**
* The status of a task.
*
* @category `tasks`
*/
export type TaskStatus =
| "working" // The request is currently being processed
| "input_required" // The task is waiting for input (e.g., elicitation or sampling)
| "completed" // The request completed successfully and results are available
| "failed" // The associated request did not complete successfully. For tool calls specifically, this includes cases where the tool call result has `isError` set to true.
| "cancelled"; // The request was cancelled before completion
/**
* Metadata for augmenting a request with task execution.
* Include this in the `task` field of the request parameters.
*
* @category `tasks`
*/
export interface TaskMetadata {
/**
* Requested duration in milliseconds to retain task from creation.
*/
ttl?: number;
}
/**
* Metadata for associating messages with a task.
* Include this in the `_meta` field under the key `io.modelcontextprotocol/related-task`.
*
* @category `tasks`
*/
export interface RelatedTaskMetadata {
/**
* The task identifier this message is associated with.
*/
taskId: string;
}
/**
* Data associated with a task.
*
* @category `tasks`
*/
export interface Task {
/**
* The task identifier.
*/
taskId: string;
/**
* Current task state.
*/
status: TaskStatus;
/**
* Optional human-readable message describing the current task state.
* This can provide context for any status, including:
* - Reasons for "cancelled" status
* - Summaries for "completed" status
* - Diagnostic information for "failed" status (e.g., error details, what went wrong)
*/
statusMessage?: string;
/**
* ISO 8601 timestamp when the task was created.
*/
createdAt: string;
/**
* ISO 8601 timestamp when the task was last updated.
*/
lastUpdatedAt: string;
/**
* Actual retention duration from creation in milliseconds, null for unlimited.
* @nullable
*/
ttl: number | null;
/**
* Suggested polling interval in milliseconds.
*/
pollInterval?: number;
}
/**
* A response to a task-augmented request.
*
* @category `tasks`
*/
export interface CreateTaskResult extends Result {
task: Task;
}
/* Task Operations */
/**
* A request to retrieve the state of a task.
*
* @category `tasks/get`
*/
export interface GetTaskRequest extends JSONRPCRequest {
method: "tasks/get";
params: {
/**
* The task identifier to query.
*/
taskId: string;
};
}
/**
* The response to a tasks/get request.
*
* @category `tasks/get`
*/
export type GetTaskResult = Result & Task;
/**
* A request to retrieve the result of a completed task.
*
* @category `tasks/result`
*/
export interface GetTaskPayloadRequest extends JSONRPCRequest {
method: "tasks/result";
params: {
/**
* The task identifier to retrieve results for.
*/
taskId: string;
};
}
/**
* The response to a tasks/result request.
* The structure matches the result type of the original request.
* For example, a tools/call task would return the CallToolResult structure.
*
* @category `tasks/result`
*/
export interface GetTaskPayloadResult extends Result {
[key: string]: unknown;
}
/**
* A request to cancel a task.
*
* @category `tasks/cancel`
*/
export interface CancelTaskRequest extends JSONRPCRequest {
method: "tasks/cancel";
params: {
/**
* The task identifier to cancel.
*/
taskId: string;
};
}
/**
* The response to a tasks/cancel request.
*
* @category `tasks/cancel`
*/
export type CancelTaskResult = Result & Task;
/**
* A request to retrieve a list of tasks.
*
* @category `tasks/list`
*/
export interface ListTasksRequest extends PaginatedRequest {
method: "tasks/list";
}
/**
* The response to a tasks/list request.
*
* @category `tasks/list`
*/
export interface ListTasksResult extends PaginatedResult {
tasks: Task[];
}
/* Task Notifications */
/**
* Parameters for a `notifications/tasks/status` notification.
*
* @category `notifications/tasks/status`
*/
export type TaskStatusNotificationParams = NotificationParams & Task;
/**
* 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.
*
* @category `notifications/tasks/status`
*/
export interface TaskStatusNotification extends JSONRPCNotification {
method: "notifications/tasks/status";
params: TaskStatusNotificationParams;
}
/* Task-Augmented Request Params */
/**
* Common params for any task-augmented request.
* Extends the base RequestParams to include an optional `task` field.
*
* @category `tasks`
*/
export interface TaskAugmentedRequestParams extends RequestParams {
/**
* If specified, the caller is requesting task-augmented execution for this request.
* The request will return a CreateTaskResult immediately, and the actual result can be
* retrieved later via tasks/result.
*
* Task augmentation is subject to capability negotiation - receivers MUST declare support
* for task augmentation of specific request types in their capabilities.
*/
task?: TaskMetadata;
}
/* Capability Additions */
/**
* Task-related server capabilities.
* Include this in the server's `capabilities` object during initialization.
*
* @category `tasks`
*/
export interface TaskServerCapabilities {
tasks?: {
/**
* Whether this server supports tasks/list.
*/
list?: Record<string, never>;
/**
* Whether this server supports tasks/cancel.
*/
cancel?: Record<string, never>;
/**
* Specifies which request types can be augmented with tasks.
*/
requests?: {
/**
* Task support for tool-related requests.
*/
tools?: {
/**
* Whether the server supports task-augmented tools/call requests.
*/
call?: Record<string, never>;
};
};
};
}
/**
* Task-related client capabilities.
* Include this in the client's `capabilities` object during initialization.
*
* @category `tasks`
*/
export interface TaskClientCapabilities {
tasks?: {
/**
* Whether this client supports tasks/list.
*/
list?: Record<string, never>;
/**
* Whether this client supports tasks/cancel.
*/
cancel?: Record<string, never>;
/**
* Specifies which request types can be augmented with tasks.
*/
requests?: {
/**
* Task support for sampling-related requests.
*/
sampling?: {
/**
* Whether the client supports task-augmented sampling/createMessage requests.
*/
createMessage?: Record<string, never>;
};
/**
* Task support for elicitation-related requests.
*/
elicitation?: {
/**
* Whether the client supports task-augmented elicitation/create requests.
*/
create?: Record<string, never>;
};
};
};
}
/* Tool-Level Task Support */
/**
* Task support declaration for individual tools.
* Include this in the tool's definition returned by tools/list.
*
* - "forbidden": Tool does not support task-augmented execution (default when absent)
* - "optional": Tool may support task-augmented execution
* - "required": Tool requires task-augmented execution
*
* @category `tasks`
*/
export type ToolTaskSupport = "forbidden" | "optional" | "required";