Skip to content

Commit f54eff4

Browse files
committed
docs(tasks): the example and guide clients declare the elicitation capability their task asks for
1 parent 509e422 commit f54eff4

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

‎docs/clients/tasks.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ import { Client } from '@modelcontextprotocol/client';
1919
import { TasksClientExtension } from '@modelcontextprotocol/client/ext/tasks';
2020

2121
const tasks = new TasksClientExtension();
22-
const client = new Client({ name: 'report-client', version: '1.0.0' }, { versionNegotiation: { mode: 'auto' }, extensions: [tasks] });
22+
const client = new Client({ name: 'report-client', version: '1.0.0' }, { versionNegotiation: { mode: 'auto' }, capabilities: { elicitation: { form: {} } }, extensions: [tasks] });
2323
await client.connect(transport);
2424
```
2525

26-
The client declares `io.modelcontextprotocol/tasks` in the capabilities envelope of every request — the server refuses task handles to clients that do not — and accepts `resultType: "task"` on `tools/call`, which the plain `client.callTool` cannot describe.
26+
The client declares `io.modelcontextprotocol/tasks` in the capabilities envelope of every request — the server refuses task handles to clients that do not — and accepts `resultType: "task"` on `tools/call`, which the plain `client.callTool` cannot describe. Declare the capabilities for the input you can answer, such as `elicitation` above: a task may only ask for what the request that created it declared.
2727

2828
## Call a tool that may become a task
2929

‎examples/ext-tasks/client.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ const { transport, url } = parseExampleArgs();
1818
const tasks = new TasksClientExtension();
1919
const client = new Client(
2020
{ name: 'tasks-example-client', version: '1.0.0' },
21-
{ versionNegotiation: { mode: 'auto' }, extensions: [tasks] }
21+
// The elicitation capability lets the task ask for input; a task may only request what the client declared.
22+
{ versionNegotiation: { mode: 'auto' }, capabilities: { elicitation: { form: {} } }, extensions: [tasks] }
2223
);
2324

2425
await client.connect(

‎packages/client/src/ext/tasks/tasksClientExtension.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
* One extension instance serves one client: `setup` binds it.
2323
*/
2424

25-
import type { CallToolRequestParams, CallToolResult, InputResponses, RequestOptions } from '@modelcontextprotocol/core-internal';
26-
import { CompatibilityCallToolResultSchema, SdkError, SdkErrorCode } from '@modelcontextprotocol/core-internal';
2725
import type { CreateTaskResult, DetailedTask } from '@modelcontextprotocol/core/ext/tasks';
2826
import { createTaskResultSchema, detailedTaskSchema, TASKS_EXTENSION_ID } from '@modelcontextprotocol/core/ext/tasks';
27+
import type { CallToolRequestParams, CallToolResult, InputResponses, RequestOptions } from '@modelcontextprotocol/core-internal';
28+
import { CompatibilityCallToolResultSchema, SdkError, SdkErrorCode } from '@modelcontextprotocol/core-internal';
2929
import * as z from 'zod/v4';
3030

3131
import type { Client } from '../../client/client';

0 commit comments

Comments
 (0)