Skip to content

Conversation

@connor4312
Copy link
Member

Implement full support for both server-side and client-side tasks on tool calls, sampling, and elicitation

Refs modelcontextprotocol/modelcontextprotocol#1732

Copilot AI review requested due to automatic review settings November 17, 2025 16:47
@connor4312 connor4312 self-assigned this Nov 17, 2025
Implement full support for both server-side and client-side tasks on tool calls, sampling, and elicitation

Refs modelcontextprotocol/modelcontextprotocol#1732
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements full support for MCP tasks as specified in SEP-1732, enabling both server-side and client-side task-augmented execution for tool calls, sampling, and elicitation requests.

Key Changes

  • Adds comprehensive task management infrastructure with McpTaskManager for handling asynchronous task execution, polling, and lifecycle management
  • Updates the MCP protocol schema to include task-related types, requests, and notifications
  • Implements task-augmented request handling for tools/call, sampling/createMessage, and elicitation/create operations

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
modelContextProtocol.ts Extensive protocol schema updates including new task types, parameters, requests/responses, and capability negotiation fields
mcpTaskManager.ts New task manager implementation for managing server-side and client-side task state, execution, and lifecycle
mcpServerRequestHandler.ts Adds task augmentation support, client task tracking, polling implementation, and task-related request handlers
mcpServerConnection.ts Integrates task manager into server connections for persistence across reconnections
mcpServer.ts Adds shared task manager instance and implements task hints for tool calls
mcpSamplingService.ts Updates message content handling to support arrays using asArray utility
mcpTypes.ts Updates handler signatures to accept optional CancellationToken parameters
mcpTypesUtils.ts Adds isTaskResult type guard utility
mcpRegistry.ts Threads task manager through connection creation
mcpRegistryTypes.ts Adds task manager to connection options
mcpIcons.ts Adds backward compatibility for icon sizes as strings
mcpSamplingLog.test.ts Updates test assertions to handle array content using asArray
mcpIcons.test.ts Updates test data to use array format for icon sizes
mcpServerConnection.test.ts Adds task manager instances to all test connection creations
mcpServerRequestHandler.test.ts Adds task manager to handler creation in tests
chatToolOutputWebviewSubPart.ts New file for rendering tool outputs using webviews (appears unrelated to tasks)

@connor4312 connor4312 marked this pull request as ready for review November 26, 2025 02:14
@connor4312 connor4312 enabled auto-merge (squash) November 26, 2025 02:14
@vs-code-engineering vs-code-engineering bot added this to the November 2025 milestone Nov 26, 2025
}

export function isTaskResult(obj: MCP.Result | MCP.CreateTaskResult): obj is MCP.CreateTaskResult {
return (obj as MCP.CreateTaskResult).task !== undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it time for zod? 👀

@connor4312 connor4312 merged commit 120655a into main Nov 26, 2025
28 checks passed
@connor4312 connor4312 deleted the connor4312/mcp-tasks branch November 26, 2025 03:47
@He-Pin
Copy link

He-Pin commented Nov 26, 2025

Cool!

@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Jan 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants