ExperimentalExperimentalRegisters a task-based tool with a config object and handler.
Task-based tools support long-running operations that can be polled for status
and results. The handler must implement createTask, getTask, and getTaskResult
methods.
The tool name
Tool configuration (description, schemas, etc.)
Task handler with createTask, getTask, getTaskResult methods
RegisteredTool for managing the tool's lifecycle
server.experimental.tasks.registerToolTask('long-computation', {
description: 'Performs a long computation',
inputSchema: { input: z.string() },
execution: { taskSupport: 'required' }
}, {
createTask: async (args, extra) => {
const task = await extra.taskStore.createTask({ ttl: 300000 });
startBackgroundWork(task.taskId, args);
return { task };
},
getTask: async (args, extra) => {
return extra.taskStore.getTask(extra.taskId);
},
getTaskResult: async (args, extra) => {
return extra.taskStore.getTaskResult(extra.taskId);
}
});
ExperimentalRegisters a task-based tool with a config object and handler.
Task-based tools support long-running operations that can be polled for status
and results. The handler must implement createTask, getTask, and getTaskResult
methods.
The tool name
Tool configuration (description, schemas, etc.)
Task handler with createTask, getTask, getTaskResult methods
RegisteredTool for managing the tool's lifecycle
server.experimental.tasks.registerToolTask('long-computation', {
description: 'Performs a long computation',
inputSchema: { input: z.string() },
execution: { taskSupport: 'required' }
}, {
createTask: async (args, extra) => {
const task = await extra.taskStore.createTask({ ttl: 300000 });
startBackgroundWork(task.taskId, args);
return { task };
},
getTask: async (args, extra) => {
return extra.taskStore.getTask(extra.taskId);
},
getTaskResult: async (args, extra) => {
return extra.taskStore.getTaskResult(extra.taskId);
}
});
Experimental task features for McpServer.
Access via
server.experimental.tasks: