Align the MCP client with 2026-07-28: resultType, input_required retry, tasks surface (N2 WP3) #27

Merged
weichen merged 1 commits from feature/n2-mcp-wp3 into main 2026-10-07 13:40:14 +00:00
Owner

Why: the completion doc requires the client to recognize resultType, treat input_required as a protocol-level result whose answer retries the original tools/call, and expose tasks/get|update|cancel; today only a content-block special case existed and the negotiated version was never inspected.

What:

  • Advertise 2026-07-28, store the server-negotiated version on both transports, SupportsResultType branches on it (older servers keep byte-identical behavior — pinned by TestNegotiatedVersionFallbackKeepsLegacyPath).
  • callToolResult gains ResultType/TaskID; protocol-level input_required → ask → tasks/update (when TaskID present) → retry original tools/call, bounded at 3 rounds; legacy content-block path unchanged.
  • Client gains TasksGet/TasksUpdate/TasksCancel on stdio+HTTP; per-run TaskTracker records seen TaskIDs and the native adapter cancels them at run end (Background ctx, other runs unaffected).
  • Synthesized default tool schemas declare JSON Schema 2020-12.

Evidence: GOWORK=off go vet + go test -count=1 ./... green; acceptance-③ regression TestStdioSlowCancelThenEcho passes unchanged (Readers()==1).

Impact: version negotiation makes old-server behavior byte-identical; new semantics activate only on negotiated 2026-07-28.

Refs: Agent-System-Documents#42 (N2 plan WP3)

Why: the completion doc requires the client to recognize resultType, treat input_required as a protocol-level result whose answer retries the original tools/call, and expose tasks/get|update|cancel; today only a content-block special case existed and the negotiated version was never inspected. What: - Advertise 2026-07-28, store the server-negotiated version on both transports, SupportsResultType branches on it (older servers keep byte-identical behavior — pinned by TestNegotiatedVersionFallbackKeepsLegacyPath). - callToolResult gains ResultType/TaskID; protocol-level input_required → ask → tasks/update (when TaskID present) → retry original tools/call, bounded at 3 rounds; legacy content-block path unchanged. - Client gains TasksGet/TasksUpdate/TasksCancel on stdio+HTTP; per-run TaskTracker records seen TaskIDs and the native adapter cancels them at run end (Background ctx, other runs unaffected). - Synthesized default tool schemas declare JSON Schema 2020-12. Evidence: GOWORK=off go vet + go test -count=1 ./... green; acceptance-③ regression TestStdioSlowCancelThenEcho passes unchanged (Readers()==1). Impact: version negotiation makes old-server behavior byte-identical; new semantics activate only on negotiated 2026-07-28. Refs: Agent-System-Documents#42 (N2 plan WP3)
weichen added 1 commit 2026-10-07 13:39:05 +00:00
Align the MCP client with 2026-07-28: resultType, input_required retry, tasks surface (N2 WP3)
ci / vet-and-test (pull_request) Successful in 52s
ci / docker-checkout-hostgateway (pull_request) Successful in 1s
fcd2539b9e
Why: the completion doc requires the client to recognize resultType,
treat input_required as a protocol-level result whose answer retries the
original tools/call, and expose tasks/get|update|cancel; today only a
content-block special case existed and the advertised version was never
checked against the server's.
Evidence: GOWORK=off go vet + go test -count=1 ./... green;
TestInputRequiredResultTypeRetriesOriginalCall (ask → tasks/update →
retry, call order and final content), TestNegotiatedVersionFallbackKeepsLegacyPath
(byte-level legacy behavior on 2024-11-05), TestTasksGetAndCancelRoundTrip,
TestRunEndCancelsSeenTasks, TestDefaultSchemaDeclares202012; the
acceptance-③ regression TestStdioSlowCancelThenEcho passes unchanged.
Impact: advertise 2026-07-28 and branch on the negotiated version
(older servers keep byte-identical behavior); synthesized default tool
schemas now declare JSON Schema 2020-12; runs cancel the MCP tasks they
saw via a per-run TaskTracker (other runs on the shared manager are
unaffected).
Refs: Agent-System-Documents#42 (N2 plan WP3)
weichen merged commit 77e7f97827 into main 2026-10-07 13:40:14 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weichen/Agent-Native#27