MCPcopy Create free account
hub / github.com/modelcontextprotocol/typescript-sdk / createTask

Function createTask

test/server/index.test.ts:2251–2266  ·  view source on GitHub ↗
(_args, extra)

Source from the content-addressed store, hash-verified

2249 },
2250 {
2251 async createTask(_args, extra) {
2252 const task = await extra.taskStore.createTask({
2253 ttl: extra.taskRequestedTtl
2254 });
2255
2256 // Simulate some async work
2257 (async () => {
2258 await new Promise(resolve => setTimeout(resolve, 10));
2259 const result = {
2260 content: [{ type: 'text', text: 'Tool executed successfully!' }]
2261 };
2262 await extra.taskStore.storeTaskResult(task.taskId, 'completed', result);
2263 })();
2264
2265 return { task };
2266 },
2267 async getTask(_args, extra) {
2268 const task = await extra.taskStore.getTask(extra.taskId);
2269 if (!task) {

Callers

nothing calls this directly

Calls 2

createTaskMethod · 0.65
storeTaskResultMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…