Skip to content

Conversation

@bzsurbhi
Copy link

@bzsurbhi bzsurbhi commented Jun 5, 2025

Added support for long-running operations by making use of Resource and it's subscribe/notify features. Some other approaches and discussions are out there already #617 and #549

This approach modifies ReadResourceResult to support CallToolResult

Motivation and Context

  • Client → Server - CallToolAsyncRequest
  • Server → Client - CallToolAsyncResult(AsyncOperation)
  • Client → Server(poll) - GetOperationRequest
  • Server → Client - GetOperationResult(resourceUri and status)
  • Once status is ACTIVE → Client can read the resource using resourceUri

pLN1Rjim3BtxAuYSEY1DxWPIr73Sma2N5ccwox23gh2EC5dI93bR4FJVHrbssWrU0lIINHoRv2CV7oNcsdbcVLFBnD2luC8mvI6N0fN_m_I8TeisIMOpA9NmWdcX5SncIOo5owik90MljNHJpgJCt4vns2jMunYOhPgQGjqOlYEQJ8ejlYOH19U4ZvbIo0cveXmjUeckaHxssg1jQwRGsk_xxzSaKTeZw92cOmbG_4BUa3Lm

How Has This Been Tested?

Breaking Changes

Non breaking change

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

@mikekistler
Copy link
Contributor

Of the various proposals for async tool calls, I think this one shows the most promise. In particular:

  • Using a resource to store the result and returning a link to that resource immediately enables partial results through ResourceUpdated notifications.
  • The current status/results of the async tool call can be obtained by reading the resource.
  • The Host can store the resource URI and disconnect from the MCP server, and reconnect later to get updated status/results and possibly resume ResourceUpdated notifications/partial results stream.

In fact, all the elements needed for this solution already exist in the current spec, but I think creating new, special-purpose abstractions for them is preferable because it should make it easier for LLMs to understand and utilize the features of partial result streaming and reusability / durability.

It would make sense to also add support for web hooks to allow the server to signal a disconnected host that new results are available, but this is purely additive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Draft

Development

Successfully merging this pull request may close these issues.

2 participants