Skip to content

feat: support sampling with tools - #409

Open
wWzZb wants to merge 1 commit into
modelcontextprotocol:mainfrom
wWzZb:codex/issue-155-sampling
Open

feat: support sampling with tools#409
wWzZb wants to merge 1 commit into
modelcontextprotocol:mainfrom
wWzZb:codex/issue-155-sampling

Conversation

@wWzZb

@wWzZb wWzZb commented Aug 7, 2026

Copy link
Copy Markdown

What

  • Add tools and toolChoice to sampling requests and wire them through ClientGateway::sample().
  • Add sampling tool-use and tool-result content blocks, array content support, message metadata, and standard stop-reason values with open-string compatibility.
  • Expose sampling.context and sampling.tools client capabilities.
  • Add round-trip and validation coverage for the new schema types.

Why

The SDK did not yet model the SEP-1577 protocol additions, so servers could not express tool-enabled sampling loops through the typed API.

Impact

Existing single-content sampling calls remain supported. The new constructor parameters are optional and appended to preserve current call sites.

Checks

  • make cs
  • make phpstan
  • make tests — 936 tests, 2781 assertions, 7 existing skips

Closes #155

@wWzZb
wWzZb marked this pull request as ready for review August 7, 2026 07:13
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.

[Server][Schema] Implement SEP-1577: Sampling With Tools

1 participant