Repository navigation
Commit 64fcca1
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 7fad072 commit 64fcca1
2 files changed
Lines changed: 58 additions & 10 deletions
File tree
- mcp-core/src/main/java/io/modelcontextprotocol/server
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
548 | 548 | | |
549 | 549 | | |
550 | 550 | | |
551 | | - | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
552 | 555 | | |
553 | 556 | | |
554 | 557 | | |
| |||
815 | 818 | | |
816 | 819 | | |
817 | 820 | | |
818 | | - | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
819 | 825 | | |
820 | 826 | | |
821 | 827 | | |
| |||
825 | 831 | | |
826 | 832 | | |
827 | 833 | | |
828 | | - | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
829 | 838 | | |
830 | 839 | | |
831 | 840 | | |
| |||
846 | 855 | | |
847 | 856 | | |
848 | 857 | | |
849 | | - | |
| 858 | + | |
| 859 | + | |
850 | 860 | | |
851 | 861 | | |
852 | 862 | | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
853 | 874 | | |
854 | 875 | | |
855 | 876 | | |
| |||
976 | 997 | | |
977 | 998 | | |
978 | 999 | | |
979 | | - | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
980 | 1004 | | |
981 | 1005 | | |
982 | 1006 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
427 | 427 | | |
428 | 428 | | |
429 | 429 | | |
430 | | - | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
431 | 434 | | |
432 | 435 | | |
433 | 436 | | |
| |||
606 | 609 | | |
607 | 610 | | |
608 | 611 | | |
609 | | - | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
610 | 616 | | |
611 | 617 | | |
612 | 618 | | |
| |||
616 | 622 | | |
617 | 623 | | |
618 | 624 | | |
619 | | - | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
620 | 629 | | |
621 | 630 | | |
622 | 631 | | |
| |||
636 | 645 | | |
637 | 646 | | |
638 | 647 | | |
639 | | - | |
| 648 | + | |
| 649 | + | |
640 | 650 | | |
641 | 651 | | |
642 | 652 | | |
643 | 653 | | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
644 | 665 | | |
645 | 666 | | |
646 | 667 | | |
| |||
736 | 757 | | |
737 | 758 | | |
738 | 759 | | |
739 | | - | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
740 | 764 | | |
741 | 765 | | |
742 | 766 | | |
| |||
0 commit comments