Summary
The MCP client retrieves a server's tool list with a single tools/list request and never follows the nextCursor pagination marker. Any server that paginates its tool catalog will have every tool past the first page silently omitted — no error, no warning.
Details
Two code paths are affected, both in packages/opencode/src/mcp/index.ts:
- Standard path —
client.listTools(). In @modelcontextprotocol/sdk@1.26.0 this issues a single request and does not loop over pagination:
async listTools(params, options) {
const result = await this.request({ method: 'tools/list', params }, ListToolsResultSchema, options);
...
}
- Lenient fallback —
listToolsLenient() calls client.request({ method: "tools/list", params: {} }, ...), a single request that ignores nextCursor even though LenientListToolsResultSchema models that field.
Because neither path advances the cursor, tools beyond the first page are dropped from the registered tool set and from the tool-list cache.
Impact
Minor→Medium. Only affects servers whose tool catalog is large enough to paginate; most servers return all tools in one page. When it does occur, the failure is silent — affected tools simply never appear.
Suggested fix
- Loop on
nextCursor, concatenating tools, in both the standard and lenient paths before returning/caching.
- Add a test with a multi-page
tools/list response to verify all pages are collected.
Summary
The MCP client retrieves a server's tool list with a single
tools/listrequest and never follows thenextCursorpagination marker. Any server that paginates its tool catalog will have every tool past the first page silently omitted — no error, no warning.Details
Two code paths are affected, both in
packages/opencode/src/mcp/index.ts:client.listTools(). In@modelcontextprotocol/sdk@1.26.0this issues a single request and does not loop over pagination:listToolsLenient()callsclient.request({ method: "tools/list", params: {} }, ...), a single request that ignoresnextCursoreven thoughLenientListToolsResultSchemamodels that field.Because neither path advances the cursor, tools beyond the first page are dropped from the registered tool set and from the tool-list cache.
Impact
Minor→Medium. Only affects servers whose tool catalog is large enough to paginate; most servers return all tools in one page. When it does occur, the failure is silent — affected tools simply never appear.
Suggested fix
nextCursor, concatenatingtools, in both the standard and lenient paths before returning/caching.tools/listresponse to verify all pages are collected.