Skip to content

Conversation

@LucaButBoring
Copy link
Contributor

@LucaButBoring LucaButBoring commented May 13, 2025

Updates sampling to support resources as messages, but also to reuse the same supported message type as tool calls to enforce parity between tools and sampling.

Motivation and Context

See #503. This change improves the cohesiveness of sampling in the protocol by making sure that sampling does not lag behind tool calls in terms of what data can be handled.

How Has This Been Tested?

Breaking Changes

None from a spec perspective - if SDKs implement this as a tagged union (as the TS SDK does) and consumers assume exhaustive case handling means all types have been handled, then consumers may need to update their code to support this.

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

  • Reusing the same type definition for the actual message types that tool results use is likely to be a point of contention, but I think it's important to avoid allowing sampling to become outdated. This PR does not add verbiage that actually requires them to be in sync at a specification level, so this can be revisited if cases arise in which it makes sense to only implement a message type for one feature and not the other. All this does is make parity the default decision.
  • If this is merged before docs(sampling): rewrite sampling docs for MCP server builders #515, I'll backport information on resource support to that PR. If that PR is merged before this one, I'll revise the documentation changes here to respect that.

@evalstate
Copy link
Member

evalstate commented May 14, 2025

Hi @LucaButBoring -- it's probably worth considering this alongside: #198

@LucaButBoring LucaButBoring force-pushed the spec/sampling-resources branch from 79fb8c7 to 5789ac9 Compare May 14, 2025 18:02
@LucaButBoring
Copy link
Contributor Author

LucaButBoring commented May 14, 2025

Hi @LucaButBoring -- it's probably worth considering this alongside: #198

Looks like that's close to getting merged, any idea who to tag for more traction on that (also I think yours needs to be moved to the draft folder)? I can revise this PR to accommodate yours once it gets merged.

@evalstate
Copy link
Member

Yep, needs an update - I'll pick that up tomorrow and give it a nudge.

@LucaButBoring
Copy link
Contributor Author

Rebased and added a section to the spec on resource links.

@LucaButBoring LucaButBoring force-pushed the spec/sampling-resources branch from 6f22167 to 77bcdee Compare August 13, 2025 18:47
@LucaButBoring LucaButBoring requested review from a team and ihrpr August 13, 2025 18:47
@Auties00
Copy link

hi are there any blockers for this feature?
is it expected to be merged by the next MCP version release?

@jonathanhefner
Copy link
Member

hi are there any blockers for this feature?
is it expected to be merged by the next MCP version release?

This change would need an accompanying SEP. (This PR and the related issue were both submitted before the SEP process was established.) I think it would suffice to update the original issue to match the SEP format.

@dsp-ant
Copy link
Member

dsp-ant commented Nov 24, 2025

I am closing this for no. If we feel this should exists, then let's create a SEP.

@dsp-ant dsp-ant closed this Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants