Skip to content

Commit 1fe6e09

Browse files
committed
docs: document pagination
For #442
1 parent 1cfd489 commit 1fe6e09

File tree

2 files changed

+44
-2
lines changed

2 files changed

+44
-2
lines changed

docs/server.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,25 @@
3535

3636
### Pagination
3737

38-
<!-- TODO -->
38+
Server-side feature lists may be
39+
[paginated](https://modelcontextprotocol.io/specification/2025-06-18/server/utilities/pagination),
40+
using cursors. The SDK supports this by default.
41+
42+
**Client-side**: The `ClientSession` provides methods returning
43+
[iterators](https://go.dev/blog/range-functions) for each feature type.
44+
These iterators are an `iter.Seq2[Feature, error]`, where the error value
45+
indicates whether page retrieval failed.
46+
47+
- [`ClientSession.Prompts`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp#ClientSession.Prompts)
48+
iterates prompts.
49+
- [`ClientSession.Resource`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp#ClientSession.Resource)
50+
iterates resources.
51+
- [`ClientSession.ResourceTemplates`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp#ClientSession.ResourceTemplates)
52+
iterates resource templates.
53+
- [`ClientSession.Tools`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp#ClientSession.Tools)
54+
iterates tools.
55+
56+
**Server-side**: pagination is on by default, so in general nothing is required
57+
server-side. However, you may use
58+
[`ServerOptions.PageSize`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp#ServerOptions.PageSize)
59+
to customize the page size.

internal/docs/server.src.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,25 @@
2828

2929
### Pagination
3030

31-
<!-- TODO -->
31+
Server-side feature lists may be
32+
[paginated](https://modelcontextprotocol.io/specification/2025-06-18/server/utilities/pagination),
33+
using cursors. The SDK supports this by default.
34+
35+
**Client-side**: The `ClientSession` provides methods returning
36+
[iterators](https://go.dev/blog/range-functions) for each feature type.
37+
These iterators are an `iter.Seq2[Feature, error]`, where the error value
38+
indicates whether page retrieval failed.
39+
40+
- [`ClientSession.Prompts`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp#ClientSession.Prompts)
41+
iterates prompts.
42+
- [`ClientSession.Resource`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp#ClientSession.Resource)
43+
iterates resources.
44+
- [`ClientSession.ResourceTemplates`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp#ClientSession.ResourceTemplates)
45+
iterates resource templates.
46+
- [`ClientSession.Tools`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp#ClientSession.Tools)
47+
iterates tools.
48+
49+
**Server-side**: pagination is on by default, so in general nothing is required
50+
server-side. However, you may use
51+
[`ServerOptions.PageSize`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp#ServerOptions.PageSize)
52+
to customize the page size.

0 commit comments

Comments
 (0)