fix(everything): move task to params.task and remove pollInterval from requests

- Use params.task instead of params._meta.task for task metadata
- Remove pollInterval from task requests (only available on result)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
olaservo
2026-01-21 18:39:29 -07:00
parent a160653441
commit 1542b65154
2 changed files with 4 additions and 6 deletions

View File

@@ -54,9 +54,8 @@ export const registerTriggerElicitationRequestAsyncTool = (server: McpServer) =>
method: "elicitation/create" as const,
params: {
task: {
ttl: 600000, // 10 minutes (user input may take a while)
pollInterval: POLL_INTERVAL,
},
ttl: 600000, // 10 minutes (user input may take a while)
},
message: "Please provide inputs for the following fields (async task demo):",
requestedSchema: {
type: "object" as const,

View File

@@ -63,13 +63,12 @@ export const registerTriggerSamplingRequestAsyncTool = (server: McpServer) => {
const { prompt, maxTokens } = validatedArgs;
// Create the sampling request WITH task metadata
// The _meta.task field signals to the client that this should be executed as a task
const request: CreateMessageRequest & { params: { _meta?: { task: { ttl: number; pollInterval: number } } } } = {
// The params.task field signals to the client that this should be executed as a task
const request: CreateMessageRequest & { params: { task?: { ttl: number } } } = {
method: "sampling/createMessage",
params: {
task: {
ttl: 300000, // 5 minutes
pollInterval: POLL_INTERVAL,
},
messages: [
{