You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Phase 1-2 of tasks experimental isolation:
- Create src/experimental/tasks/ directory structure
- Move TaskStore, TaskMessageQueue, and related interfaces to experimental/tasks/interfaces.ts
- Add experimental/tasks/types.ts for re-exporting spec types
- Update shared/task.ts to re-export from experimental for backward compatibility
- Add barrel exports for experimental module
All tests pass (1399 tests).
Copy file name to clipboardExpand all lines: README.md
+9-7Lines changed: 9 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1385,6 +1385,8 @@ const client = new Client(
1385
1385
1386
1386
### Task-Based Execution
1387
1387
1388
+
> **⚠️ Experimental API**: Task-based execution is an experimental feature and may change without notice. Access these APIs via the `.experimental.tasks` namespace.
1389
+
1388
1390
Task-based execution enables "call-now, fetch-later" patterns for long-running operations. This is useful for tools that take significant time to complete, where clients may want to disconnect and check on progress or retrieve results later.
1389
1391
1390
1392
Common use cases include:
@@ -1400,7 +1402,7 @@ To enable task-based execution, configure your server with a `TaskStore` impleme
1400
1402
1401
1403
```typescript
1402
1404
import { Server } from'@modelcontextprotocol/sdk/server/index.js';
// Implement TaskStore backed by your database (e.g., PostgreSQL, Redis, etc.)
@@ -1458,8 +1460,8 @@ const server = new Server(
1458
1460
}
1459
1461
);
1460
1462
1461
-
// Register a tool that supports tasks
1462
-
server.registerToolTask(
1463
+
// Register a tool that supports tasks using the experimental API
1464
+
server.experimental.tasks.registerToolTask(
1463
1465
'my-echo-tool',
1464
1466
{
1465
1467
title: 'My Echo Tool',
@@ -1508,7 +1510,7 @@ server.registerToolTask(
1508
1510
1509
1511
#### Client-Side: Using Task-Based Execution
1510
1512
1511
-
Clients use `callToolStream()` to initiate task-augmented tool calls. The returned `AsyncGenerator` abstracts automatic polling and status updates:
1513
+
Clients use `experimental.tasks.callToolStream()` to initiate task-augmented tool calls. The returned `AsyncGenerator` abstracts automatic polling and status updates:
@@ -1566,7 +1568,7 @@ if (taskStatus.status === 'completed') {
1566
1568
}
1567
1569
```
1568
1570
1569
-
The `callToolStream()` method also works with non-task tools, making it a drop-in replacement for `callTool()` in applications that support it. When used to invoke a tool that doesn't support tasks, the `taskCreated` and `taskStatus` events will not be emitted.
1571
+
The `experimental.tasks.callToolStream()` method also works with non-task tools, making it a drop-in replacement for `callTool()` in applications that support it. When used to invoke a tool that doesn't support tasks, the `taskCreated` and `taskStatus` events will not be emitted.
0 commit comments