internal/mcp: add iterator methods resources and prompts
This CL streamlines the client side pagination logic by adding a generic helper that handles pagination. This also simplifies the existing tools iterator method. Change-Id: If4304deda1ccd22d0c4580d76deaefc64e5dfeb9 Reviewed-on: https://go-review.googlesource.com/c/tools/+/676975 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com> Auto-Submit: Sam Thanawalla <samthanawalla@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
This commit is contained in:
parent
7f8b72203a
commit
bb2347385e
1 changed files with 347 additions and 64 deletions
|
|
@ -41,7 +41,7 @@ func getCursor(input string) string {
|
|||
return cursor
|
||||
}
|
||||
|
||||
func TestPaginateBasic(t *testing.T) {
|
||||
func TestServerPaginateBasic(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
initialItems []*TestItem
|
||||
|
|
@ -170,7 +170,7 @@ func TestPaginateBasic(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestPaginateVariousPageSizes(t *testing.T) {
|
||||
func TestServerPaginateVariousPageSizes(t *testing.T) {
|
||||
fs := newFeatureSet(func(t *TestItem) string { return t.Name })
|
||||
fs.add(allTestItems...)
|
||||
// Try all possible page sizes, ensuring we get the correct list of items.
|
||||
|
|
|
|||
Loading…
Reference in a new issue