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

Method Tools

mcp/client.go:1114–1121  ·  view source on GitHub ↗

Tools provides an iterator for all tools 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 *ListToolsParams)

Source from the content-addressed store, hash-verified

1112// The params argument can set the initial cursor.
1113// Iteration stops at the first encountered error, which will be yielded.
1114func (cs *ClientSession) Tools(ctx context.Context, params *ListToolsParams) iter.Seq2[*Tool, error] {
1115 if params == nil {
1116 params = &ListToolsParams{}
1117 }
1118 return paginate(ctx, params, cs.ListTools, func(res *ListToolsResult) []*Tool {
1119 return res.Tools
1120 })
1121}
1122
1123// Resources provides an iterator for all resources available on the server,
1124// automatically fetching pages and managing cursors.

Callers 4

TestListFunction · 0.80
mainFunction · 0.80

Calls 1

paginateFunction · 0.85

Tested by 3

TestListFunction · 0.64