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
|
|
@ -214,7 +214,8 @@ type ListPromptsParams struct {
|
|||
Cursor string `json:"cursor,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ListPromptsParams) GetMeta() *Meta { return &x.Meta }
|
||||
func (x *ListPromptsParams) GetMeta() *Meta { return &x.Meta }
|
||||
func (x *ListPromptsParams) cursorPtr() *string { return &x.Cursor }
|
||||
|
||||
// The server's response to a prompts/list request from the client.
|
||||
type ListPromptsResult struct {
|
||||
|
|
@ -227,7 +228,8 @@ type ListPromptsResult struct {
|
|||
Prompts []*Prompt `json:"prompts"`
|
||||
}
|
||||
|
||||
func (x *ListPromptsResult) GetMeta() *Meta { return &x.Meta }
|
||||
func (x *ListPromptsResult) GetMeta() *Meta { return &x.Meta }
|
||||
func (x *ListPromptsResult) nextCursorPtr() *string { return &x.NextCursor }
|
||||
|
||||
type ListResourcesParams struct {
|
||||
// This property is reserved by the protocol to allow clients and servers to
|
||||
|
|
@ -238,7 +240,8 @@ type ListResourcesParams struct {
|
|||
Cursor string `json:"cursor,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ListResourcesParams) GetMeta() *Meta { return &x.Meta }
|
||||
func (x *ListResourcesParams) GetMeta() *Meta { return &x.Meta }
|
||||
func (x *ListResourcesParams) cursorPtr() *string { return &x.Cursor }
|
||||
|
||||
// The server's response to a resources/list request from the client.
|
||||
type ListResourcesResult struct {
|
||||
|
|
@ -251,7 +254,8 @@ type ListResourcesResult struct {
|
|||
Resources []*Resource `json:"resources"`
|
||||
}
|
||||
|
||||
func (x *ListResourcesResult) GetMeta() *Meta { return &x.Meta }
|
||||
func (x *ListResourcesResult) GetMeta() *Meta { return &x.Meta }
|
||||
func (x *ListResourcesResult) nextCursorPtr() *string { return &x.NextCursor }
|
||||
|
||||
type ListRootsParams struct {
|
||||
// This property is reserved by the protocol to allow clients and servers to
|
||||
|
|
@ -282,7 +286,8 @@ type ListToolsParams struct {
|
|||
Cursor string `json:"cursor,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ListToolsParams) GetMeta() *Meta { return &x.Meta }
|
||||
func (x *ListToolsParams) GetMeta() *Meta { return &x.Meta }
|
||||
func (x *ListToolsParams) cursorPtr() *string { return &x.Cursor }
|
||||
|
||||
// The server's response to a tools/list request from the client.
|
||||
type ListToolsResult struct {
|
||||
|
|
@ -295,7 +300,8 @@ type ListToolsResult struct {
|
|||
Tools []*Tool `json:"tools"`
|
||||
}
|
||||
|
||||
func (x *ListToolsResult) GetMeta() *Meta { return &x.Meta }
|
||||
func (x *ListToolsResult) GetMeta() *Meta { return &x.Meta }
|
||||
func (x *ListToolsResult) nextCursorPtr() *string { return &x.NextCursor }
|
||||
|
||||
// The severity of a log message.
|
||||
//
|
||||
|
|
|
|||
Loading…
Reference in a new issue