Commit 5eb6d54
committed
feat: backwards-compatible createMessage overloads for SEP-1577
Introduce method overloading for createMessage to preserve backwards
compatibility while supporting the new tools feature from SEP-1577.
When called without tools, createMessage returns CreateMessageResult
with single content (backwards compatible). When called with tools,
it returns CreateMessageResultWithTools which allows array content.
This allows existing code that doesn't use tools to continue working
without any changes, while new code using tools gets the appropriate
type that handles array content.
Changes:
- Add SamplingContentSchema for basic content types (no tool use)
- Add CreateMessageResultWithToolsSchema for tool-enabled responses
- Add CreateMessageRequestParamsBase/WithTools types for overloads
- Add method overloads to Server.createMessage()
- Update tests to use appropriate schemas
- Simplify example that doesn't use tools1 parent f67fc2f commit 5eb6d54
File tree
4 files changed
+110
-12
lines changed- src
- examples/server
- server
4 files changed
+110
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
6 | 11 | | |
7 | 12 | | |
8 | 13 | | |
| |||
467 | 472 | | |
468 | 473 | | |
469 | 474 | | |
470 | | - | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
471 | 501 | | |
472 | 502 | | |
473 | 503 | | |
| |||
510 | 540 | | |
511 | 541 | | |
512 | 542 | | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
513 | 547 | | |
514 | 548 | | |
515 | 549 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
787 | 788 | | |
788 | 789 | | |
789 | 790 | | |
790 | | - | |
| 791 | + | |
791 | 792 | | |
792 | 793 | | |
793 | 794 | | |
| |||
800 | 801 | | |
801 | 802 | | |
802 | 803 | | |
803 | | - | |
| 804 | + | |
| 805 | + | |
804 | 806 | | |
805 | 807 | | |
806 | 808 | | |
| |||
810 | 812 | | |
811 | 813 | | |
812 | 814 | | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
813 | 819 | | |
814 | 820 | | |
815 | | - | |
| 821 | + | |
816 | 822 | | |
817 | 823 | | |
818 | 824 | | |
| |||
828 | 834 | | |
829 | 835 | | |
830 | 836 | | |
831 | | - | |
| 837 | + | |
| 838 | + | |
832 | 839 | | |
833 | 840 | | |
834 | 841 | | |
| |||
840 | 847 | | |
841 | 848 | | |
842 | 849 | | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
843 | 854 | | |
844 | 855 | | |
845 | 856 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1495 | 1495 | | |
1496 | 1496 | | |
1497 | 1497 | | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
1498 | 1504 | | |
1499 | 1505 | | |
1500 | 1506 | | |
| |||
1576 | 1582 | | |
1577 | 1583 | | |
1578 | 1584 | | |
1579 | | - | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
1580 | 1588 | | |
1581 | 1589 | | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
1582 | 1617 | | |
1583 | 1618 | | |
1584 | 1619 | | |
| |||
1597 | 1632 | | |
1598 | 1633 | | |
1599 | 1634 | | |
1600 | | - | |
| 1635 | + | |
1601 | 1636 | | |
1602 | 1637 | | |
1603 | 1638 | | |
| |||
2005 | 2040 | | |
2006 | 2041 | | |
2007 | 2042 | | |
| 2043 | + | |
2008 | 2044 | | |
2009 | 2045 | | |
2010 | 2046 | | |
| |||
2274 | 2310 | | |
2275 | 2311 | | |
2276 | 2312 | | |
| 2313 | + | |
2277 | 2314 | | |
2278 | 2315 | | |
2279 | 2316 | | |
2280 | 2317 | | |
2281 | 2318 | | |
| 2319 | + | |
| 2320 | + | |
| 2321 | + | |
| 2322 | + | |
| 2323 | + | |
| 2324 | + | |
| 2325 | + | |
| 2326 | + | |
| 2327 | + | |
| 2328 | + | |
| 2329 | + | |
| 2330 | + | |
| 2331 | + | |
| 2332 | + | |
2282 | 2333 | | |
2283 | 2334 | | |
2284 | 2335 | | |
| |||
0 commit comments