Apply suggestions from code review

Co-authored-by: Cliff Hall <cliff@futurescale.com>
This commit is contained in:
Ola Hungerford
2026-01-21 17:55:10 -07:00
committed by GitHub
parent c20c017171
commit a160653441
3 changed files with 9 additions and 13 deletions

View File

@@ -96,7 +96,7 @@ MCP Tasks are bidirectional - both server and client can be task executors:
| Server -> Client | `elicitation/create` | Client | `trigger-elicitation-request-async` |
For client-side tasks:
1. Server sends request with task metadata (e.g., `_meta.task.ttl`)
1. Server sends request with task metadata (e.g., `params.task.ttl`)
2. Client creates task and returns `CreateTaskResult` with `taskId`
3. Server polls `tasks/get` for status updates
4. When complete, server calls `tasks/result` to retrieve the result

View File

@@ -53,6 +53,10 @@ export const registerTriggerElicitationRequestAsyncTool = (server: McpServer) =>
const request = {
method: "elicitation/create" as const,
params: {
task: {
ttl: 600000, // 10 minutes (user input may take a while)
pollInterval: POLL_INTERVAL,
},
message: "Please provide inputs for the following fields (async task demo):",
requestedSchema: {
type: "object" as const,
@@ -76,12 +80,6 @@ export const registerTriggerElicitationRequestAsyncTool = (server: McpServer) =>
},
required: ["name"],
},
_meta: {
task: {
ttl: 600000, // 10 minutes (user input may take a while)
pollInterval: POLL_INTERVAL,
},
},
},
};

View File

@@ -67,6 +67,10 @@ export const registerTriggerSamplingRequestAsyncTool = (server: McpServer) => {
const request: CreateMessageRequest & { params: { _meta?: { task: { ttl: number; pollInterval: number } } } } = {
method: "sampling/createMessage",
params: {
task: {
ttl: 300000, // 5 minutes
pollInterval: POLL_INTERVAL,
},
messages: [
{
role: "user",
@@ -79,12 +83,6 @@ export const registerTriggerSamplingRequestAsyncTool = (server: McpServer) => {
systemPrompt: "You are a helpful test server.",
maxTokens,
temperature: 0.7,
_meta: {
task: {
ttl: 300000, // 5 minutes
pollInterval: POLL_INTERVAL,
},
},
},
};