Commit f15f1ac
committed
add SEP-1577 sampling with tools support
Introduces parallel V2 sampling types (SamplingMessageV2,
CreateMessageWithToolsRequest/Result, ToolUseContent, ToolResultContent,
ToolChoice) alongside the existing V1 types, leaving the legacy wire format
byte-identical. Servers call createMessageWithTools on the exchange; a version
gate refuses multi-content or tools payloads when the negotiated protocol
version is older than 2025-11-25. Clients opt in via samplingWithTools(handler)
on the builder, which advertises sampling.tools in the capability handshake.
StopReason gains TOOL_USE.
Signed-off-by: Dariusz Jędrzejczyk <2554306+chemicL@users.noreply.github.com>1 parent df75857 commit f15f1ac
12 files changed
Lines changed: 1234 additions & 81 deletions
File tree
- mcp-core/src/main/java/io/modelcontextprotocol
- client
- server
- spec
- mcp-test/src/test/java/io/modelcontextprotocol
- client
- spec
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
Lines changed: 41 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
106 | 109 | | |
107 | 110 | | |
108 | 111 | | |
| |||
142 | 145 | | |
143 | 146 | | |
144 | 147 | | |
| 148 | + | |
| 149 | + | |
145 | 150 | | |
146 | 151 | | |
147 | 152 | | |
| |||
227 | 232 | | |
228 | 233 | | |
229 | 234 | | |
230 | | - | |
231 | | - | |
232 | | - | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
233 | 249 | | |
234 | | - | |
235 | 250 | | |
236 | 251 | | |
237 | 252 | | |
| |||
575 | 590 | | |
576 | 591 | | |
577 | 592 | | |
578 | | - | |
| 593 | + | |
579 | 594 | | |
580 | | - | |
581 | | - | |
582 | | - | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
583 | 616 | | |
584 | 617 | | |
585 | 618 | | |
| |||
Lines changed: 42 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
| 193 | + | |
| 194 | + | |
193 | 195 | | |
194 | 196 | | |
195 | 197 | | |
| |||
310 | 312 | | |
311 | 313 | | |
312 | 314 | | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
313 | 332 | | |
314 | 333 | | |
315 | 334 | | |
| |||
554 | 573 | | |
555 | 574 | | |
556 | 575 | | |
557 | | - | |
| 576 | + | |
| 577 | + | |
558 | 578 | | |
559 | 579 | | |
560 | 580 | | |
| |||
611 | 631 | | |
612 | 632 | | |
613 | 633 | | |
| 634 | + | |
| 635 | + | |
614 | 636 | | |
615 | 637 | | |
616 | 638 | | |
| |||
729 | 751 | | |
730 | 752 | | |
731 | 753 | | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
732 | 771 | | |
733 | 772 | | |
734 | 773 | | |
| |||
964 | 1003 | | |
965 | 1004 | | |
966 | 1005 | | |
967 | | - | |
968 | | - | |
| 1006 | + | |
| 1007 | + | |
969 | 1008 | | |
970 | 1009 | | |
971 | 1010 | | |
| |||
0 commit comments