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
|
|
@ -332,6 +332,13 @@ func writeDecl(configName string, config typeConfig, def *jsonschema.Schema, nam
|
|||
fmt.Fprintf(w, "\nfunc (x *%s) GetMeta() *Meta { return &x.Meta }", typeName)
|
||||
}
|
||||
|
||||
if _, ok := def.Properties["cursor"]; ok {
|
||||
fmt.Fprintf(w, "\nfunc (x *%s) cursorPtr() *string { return &x.Cursor }", typeName)
|
||||
}
|
||||
if _, ok := def.Properties["nextCursor"]; ok {
|
||||
fmt.Fprintf(w, "\nfunc (x *%s) nextCursorPtr() *string { return &x.NextCursor }", typeName)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue