Commit 64a3659
Mohammed Aboullaite
Stamp default ttlMs and cacheScope on server responses (SEP-2549)
The draft spec requires cacheable results to carry ttlMs and cacheScope
on the wire. Other SDKs (Go, Python, TypeScript) all stamp defaults
after handlers return: ttlMs=0 (immediately stale) and cacheScope=public.
This adds the same default stamping in McpAsyncServer and
McpStatelessAsyncServer for all five cacheable result types. For list
results the defaults are set at the build site. For ReadResourceResult,
which is built by user handlers, a withCacheDefaults helper stamps
missing fields while preserving any values the handler set explicitly.1 parent 1c25b7c commit 64a3659
2 files changed
Lines changed: 58 additions & 10 deletions
File tree
- mcp-core/src/main/java/io/modelcontextprotocol/server
Lines changed: 29 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
539 | 539 | | |
540 | 540 | | |
541 | 541 | | |
542 | | - | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
543 | 546 | | |
544 | 547 | | |
545 | 548 | | |
| |||
791 | 794 | | |
792 | 795 | | |
793 | 796 | | |
794 | | - | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
795 | 801 | | |
796 | 802 | | |
797 | 803 | | |
| |||
801 | 807 | | |
802 | 808 | | |
803 | 809 | | |
804 | | - | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
805 | 814 | | |
806 | 815 | | |
807 | 816 | | |
| |||
822 | 831 | | |
823 | 832 | | |
824 | 833 | | |
825 | | - | |
| 834 | + | |
| 835 | + | |
826 | 836 | | |
827 | 837 | | |
828 | 838 | | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
829 | 850 | | |
830 | 851 | | |
831 | 852 | | |
| |||
952 | 973 | | |
953 | 974 | | |
954 | 975 | | |
955 | | - | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
956 | 980 | | |
957 | 981 | | |
958 | 982 | | |
| |||
Lines changed: 29 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
420 | 420 | | |
421 | 421 | | |
422 | 422 | | |
423 | | - | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
424 | 427 | | |
425 | 428 | | |
426 | 429 | | |
| |||
584 | 587 | | |
585 | 588 | | |
586 | 589 | | |
587 | | - | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
588 | 594 | | |
589 | 595 | | |
590 | 596 | | |
| |||
594 | 600 | | |
595 | 601 | | |
596 | 602 | | |
597 | | - | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
598 | 607 | | |
599 | 608 | | |
600 | 609 | | |
| |||
614 | 623 | | |
615 | 624 | | |
616 | 625 | | |
617 | | - | |
| 626 | + | |
| 627 | + | |
618 | 628 | | |
619 | 629 | | |
620 | 630 | | |
621 | 631 | | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
622 | 643 | | |
623 | 644 | | |
624 | 645 | | |
| |||
714 | 735 | | |
715 | 736 | | |
716 | 737 | | |
717 | | - | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
718 | 742 | | |
719 | 743 | | |
720 | 744 | | |
| |||
0 commit comments