Migrate Cosmos DB to pagination

未关闭
#4,331 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
azure, csharp, github
领域
api, databases

调研方向

Read tools/Azure.Mcp.Tools.Cosmos/src/Commands/ItemQueryCommand.cs, tools/Azure.Mcp.Tools.Cosmos/src/Services/CosmosService.cs, and docs/tool-pagination.md; inspect the reverted implementation in commit b3e1b2854 and verify its AOT dependency prerequisite against the current dependencies. Then trace the framework's cursor and nextCursor contract and the existing recorded tests. Done means bounded pages, validated cursors, preserved authorization and query validation, passing pagination and serialization tests, verified AOT compatibility, and updated command docs.

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

描述

enhancement Performance server-Azure.Mcp tools-CosmosDB

Paginate Cosmos DB container queries

Context

ItemQueryCommand calls CosmosService.QueryItems, which reads the query iterator until completion with MaxItemCount = -1. Large result sets can make a single tool call expensive. An earlier pagination implementation was reverted in commit b3e1b2854 because its AOT library needed updating.

Work

  • Investigate the prior implementation and resolve or verify the AOT dependency prerequisite before adopting it; do not assume it works with the current dependency set.
  • Use the framework's cursor and nextCursor contract to expose a Cosmos query continuation. Preserve the existing result shape unless a deliberate compatibility decision says otherwise.
  • Bind the cursor to account, database, container, effective query, subscription, authentication method, tenant, and other fixed query inputs.
  • Decide how existing all-results behavior changes and document the page-size and continuation semantics.

Acceptance criteria

  • One request returns a bounded page rather than draining the iterator; first, continued, empty-with-continuation, and terminal pages are covered.
  • Reject invalid cursors and changed fixed arguments before dispatch. Preserve query validation and authorization.
  • Cover option binding and source-generated serialization in unit tests and follow every page in recorded tests; verify AOT compatibility and update command docs.

References

  • tools/Azure.Mcp.Tools.Cosmos/src/Commands/ItemQueryCommand.cs
  • tools/Azure.Mcp.Tools.Cosmos/src/Services/CosmosService.cs
  • docs/tool-pagination.md
主要语言
C#
星标
3.9k
派生
689
平均合并
2 天 11 小时
30 天内合并 PR
143

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

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

microsoft/mcp 的其他 Issue

查看 microsoft/mcp 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

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