Skip to content

Commit b2d7fd2

Browse files
refactor: update tests, McpServer, and examples for TaskManager API
- Update protocol.test.ts to construct TaskManager and pass to Protocol - Remove assertTaskCapability/assertTaskHandlerCapability from test subclasses - Update McpServer to use extra.task?.taskStore instead of extra.taskStore - Update example server to use extra.task.taskStore/taskId/requestedTtl - Update core task interfaces for TaskContext grouping All packages now typecheck cleanly with zero errors.
1 parent 4c6fcd2 commit b2d7fd2

3 files changed

Lines changed: 15 additions & 5581 deletions

File tree

examples/server/src/simpleStreamableHttp.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -484,16 +484,16 @@ const getServer = () => {
484484
}
485485
},
486486
{
487-
async createTask({ duration }, { taskStore, taskRequestedTtl }) {
487+
async createTask({ duration }, extra) {
488488
// Create the task
489-
const task = await taskStore.createTask({
490-
ttl: taskRequestedTtl
489+
const task = await extra.task.taskStore.createTask({
490+
ttl: extra.task.requestedTtl
491491
});
492492

493493
// Simulate out-of-band work
494494
(async () => {
495495
await new Promise(resolve => setTimeout(resolve, duration));
496-
await taskStore.storeTaskResult(task.taskId, 'completed', {
496+
await extra.task.taskStore.storeTaskResult(task.taskId, 'completed', {
497497
content: [
498498
{
499499
type: 'text',
@@ -508,11 +508,11 @@ const getServer = () => {
508508
task
509509
};
510510
},
511-
async getTask(_args, { taskId, taskStore }) {
512-
return await taskStore.getTask(taskId);
511+
async getTask(_args, extra) {
512+
return await extra.task.taskStore.getTask(extra.task.taskId);
513513
},
514-
async getTaskResult(_args, { taskId, taskStore }) {
515-
const result = await taskStore.getTaskResult(taskId);
514+
async getTaskResult(_args, extra) {
515+
const result = await extra.task.taskStore.getTaskResult(extra.task.taskId);
516516
return result as CallToolResult;
517517
}
518518
}

0 commit comments

Comments
 (0)