MCPcopy Create free account
hub / github.com/modelcontextprotocol/go-sdk / Resources

Method Resources

mcp/client.go:1127–1134  ·  view source on GitHub ↗

Resources provides an iterator for all resources available on the server, automatically fetching pages and managing cursors. The params argument can set the initial cursor. Iteration stops at the first encountered error, which will be yielded.

(ctx context.Context, params *ListResourcesParams)

Source from the content-addressed store, hash-verified

1125// The params argument can set the initial cursor.
1126// Iteration stops at the first encountered error, which will be yielded.
1127func (cs *ClientSession) Resources(ctx context.Context, params *ListResourcesParams) iter.Seq2[*Resource, error] {
1128 if params == nil {
1129 params = &ListResourcesParams{}
1130 }
1131 return paginate(ctx, params, cs.ListResources, func(res *ListResourcesResult) []*Resource {
1132 return res.Resources
1133 })
1134}
1135
1136// ResourceTemplates provides an iterator for all resource templates available on the server,
1137// automatically fetching pages and managing cursors.

Callers 3

TestListFunction · 0.80
Example_resourcesFunction · 0.80
mainFunction · 0.80

Calls 1

paginateFunction · 0.85

Tested by 2

TestListFunction · 0.64
Example_resourcesFunction · 0.64