import { z } from 'zod'; import { type CallToolResult, type McpServer } from '@modelcontextprotocol/server'; import { TaskManager, type Task } from '../lib/tasks.js'; /** * The tasks surface (`io.modelcontextprotocol/tasks` extension): durable * handles for long-running tool calls. * * - Long-running tools (`brief run`, `web fetch`, `web ingest`) run * detached when the client declares the extension, and their response * carries a `task` object (`{ content, task }` — the 2025-11-25 task * result family, which this SDK passes through on the wire untouched). * - `tasks/get` returns the current state, `tasks/result`-style payload for * terminal states; `tasks/cancel` is cooperative; `tasks/list` pages; * `tasks/getPayload` returns the original tool call so a client can * resume a task by re-issuing it. * * Clients that never declare the extension keep the blocking behavior — * nothing changes for them. */ /** Full extension name a client declares in its per-request capabilities. */ export declare const TASKS_EXTENSION = "io.modelcontextprotocol/tasks"; /** The wire shape of a task (TaskSchema vocabulary, plus terminal payload). */ export declare const taskWireSchema: z.ZodObject<{ taskId: z.ZodString; status: z.ZodEnum<{ working: "working"; input_required: "input_required"; completed: "completed"; failed: "failed"; cancelled: "cancelled"; }>; ttl: z.ZodUnion; createdAt: z.ZodString; lastUpdatedAt: z.ZodString; pollInterval: z.ZodOptional; statusMessage: z.ZodOptional; result: z.ZodOptional; error: z.ZodOptional; }, z.core.$strip>; export declare function wireTask(task: Task): z.infer; /** * The tool response for a detached run: the client reads the summary text * and the `task` handle. The SDK's wire validation passes the `task` field * through untouched (the 2025-11-25 task result family); a tasks-aware * client polls `tasks/get` with the handle, every other client just sees * the text — both are served without opting into anything. */ export declare function taskToolResult(task: Task, summary: string): CallToolResult; export declare function registerTasksRpc(mcp: McpServer, tasks: TaskManager): void; //# sourceMappingURL=tasks.d.ts.map