A task-augmented tools/call can't return a CreateTaskResult on a 2025-11-25 session

Offen
#3,267 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
66/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
node.js, typescript

Rechercherichtung

Start by reading the server's tools/call request handler and result validation, then compare it with the 1.32.1 behavior described in the issue. Reproduce the case with params.task and the supplied handler result. Done means the task request accepts and returns a valid CreateTaskResult on the 2025-11-25 path while ordinary tool calls continue to validate as CallToolResult.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

v2

Package: @modelcontextprotocol/server 2.4.0
Compared with: @modelcontextprotocol/sdk 1.32.1
Runtime: Node.js 24.22.1

Summary

In the 2025-11-25 revision, a tools/call whose params carry task is answered with a CreateTaskResult ({ task: { taskId, status, … } }). Server wraps every tools/call handler and validates its result as a CallToolResult, whatever the request carried, so a server that implements 2025-11-25 tasks itself gets -32602 Invalid tools/call result instead of its task result. 1.32.1 validated the result against CreateTaskResultSchema when params.task was set.

This is the 2025-11-25 core tasks path (params.task on tools/call), not the 2026-07-28 tasks extension covered by #2637.

Reproduction

const { Server, InMemoryTransport } = require('@modelcontextprotocol/server');
const { Client } = require('@modelcontextprotocol/client');

(async () => {
  const server = new Server({ name: 'repro', version: '1.0.0' }, { capabilities: { tools: {} } });
  const now = new Date().toISOString();
  server.setRequestHandler('tools/call', async () => ({
    task: { taskId: 't-1', status: 'working', ttl: 60000, createdAt: now, lastUpdatedAt: now },
  }));
  const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
  await server.connect(serverTransport);
  const client = new Client({ name: 'c', version: '1' });
  await client.connect(clientTransport);

  const passThrough = { '~standard': { version: 1, vendor: 'repro', validate: (value) => ({ value }) } };
  const result = await client
    .request({ method: 'tools/call', params: { name: 'slow', arguments: {}, task: { ttl: 60000 } } }, passThrough)
    .catch((error) => error.message);
  console.log(result);
})();

Expected

The CreateTaskResult the handler returned.

Actual

Invalid tools/call result: [ { "code": "custom",
  "message": "content is required when the body carries 'task' — another result family cannot default into an empty tools/call success", … } ]

Suggestion

When the request carries params.task on a 2025-era session, validate the result as a CreateTaskResult (as 1.x did), even without a built-in tasks runtime, so servers that keep their own task store can serve 2025-11-25 tasks.

Vorherrschende Sprache
TypeScript
Sterne
13.8k
Forks
2.5k
Ø Merge
6 T. 23 Std.
Gemergte PRs (30 T.)
2

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus modelcontextprotocol/typescript-sdk

Alle Issues in modelcontextprotocol/typescript-sdk

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.