Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

MCP tools/list fetched as a single page — tools beyond the first page are silently dropped

未关闭
#986 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
冷清
技术栈
typescript
领域
api

调研方向

从 packages/opencode/src/mcp/index.ts 开始,检查标准的 client.listTools() 路径和 listToolsLenient() 请求路径,并注意 nextCursor 的处理。添加一个多页 tools/list 测试,验证每一页中的工具都会被收集,并保留在已注册工具集和缓存中。

由索引模型根据 Issue 内容生成。

描述

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 pathclient.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 fallbacklistToolsLenient() 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.
主要语言
TypeScript
星标
813
派生
134
平均合并
2 天 3 小时
30 天内合并 PR
65

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

AltimateAI/altimate-code 的其他 Issue

查看 AltimateAI/altimate-code 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。