Add Bulk Operations for tools
まだ誰も着手していません。
評価
調査の方向性
まず、addTool、removeTool、asyncServer、および issue に示されている SyncToolSpecification/AsyncToolSpecification の変換に関連するサーバー API を探します。現在の copy-on-write 更新がどのようにコミットされるかを確認し、単一項目の場合と同等の動作をする一括追加および一括削除のエントリポイントを実装してから、1 回の一括操作でコピーの繰り返しを回避できることを検証します。
索引モデルが issue の本文から書いたものです。
説明
So I am trying to submit a trivial change, but before I do that, I would like to know if this change will be acceptable. The idea is that today the MCP server does not support bulk operations for add tools or remove tools, and it is backed by a copy-on-write array list. So if I add a lot of tools, then every single time there is a copy that happens before a single tool gets committed, and that's not that great for performance when I would like to make changes to a lot of tools, for example.
Expected Behavior
Expected behavior is rather simple: I would like an API that lets me add several tools in bulk and that lets me remove several tools in bulk as well.
/**
* Add a new tool specification at runtime.
* @param toolSpecification The tool specification to add
*/
public void addTool(McpStatelessServerFeatures.SyncToolSpecification toolSpecification) {
this.asyncServer
.addTool(McpStatelessServerFeatures.AsyncToolSpecification.fromSync(toolSpecification,
this.immediateExecution))
.block();
}
/**
* Add multiple tool specifications at runtime.
* @param toolSpecifications The tool specifications to add
*/
public void addTools(List<McpStatelessServerFeatures.SyncToolSpecification> toolSpecifications) {
if (toolSpecifications == null) {
this.asyncServer.addTools(null).block();
return;
}
this.asyncServer
.addTools(toolSpecifications.stream()
.map(toolSpecification -> McpStatelessServerFeatures.AsyncToolSpecification.fromSync(toolSpecification,
this.immediateExecution))
.toList())
.block();
}
Current Behavior
The current behavior is that it just has a single method for add and remove
/**
* Add a new tool specification at runtime.
* @param toolSpecification The tool specification to add
*/
public void addTool(McpStatelessServerFeatures.SyncToolSpecification toolSpecification) {
this.asyncServer
.addTool(McpStatelessServerFeatures.AsyncToolSpecification.fromSync(toolSpecification,
this.immediateExecution))
.block();
}
Context
The reason we need this is because we are trying to create what sort of looks like an MCP gateway. For a lot of our internal tooling, these tool definitions come from a database. These tools can get enabled and disabled at runtime. There is also a use case where we interact with a lot of upstream MCP clients and publish out their tools as tools that we own ourselves. If one of those MCP clients goes bad or unhealthy for whatever reason or tries to remove the tools that we have access to, then that same thing should reflect for our clients as well, and it will be great to have that capability because if an MCP client or several MCP clients try to remove their tool all at once, we're looking at hundreds or tens of removals in a single shot. In some cases, maybe even hundreds or hundreds if we are dealing with two or three bigger MCP clients. That's the reason why we need this.
FYI, I have a PR that is already ready that I can immediately push if you guys think this is an acceptable change to introduce or allow addition and removal of tools in bulk.
- 主要言語
- Java
- スター
- 3.7k
- フォーク
- 1.1k
- 平均マージ
- 1日 15時間
- マージ済み PR(30日)
- 9
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
modelcontextprotocol/java-sdk のほかの issue
-
area/transport bug P2
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
modelcontextprotocol/java-sdk#1136 ·
-
area/client bug P2
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
modelcontextprotocol/java-sdk#1124 · コメント 1 件 ·
-
ServerCapabilities.logging is added unconditionally, overriding the caller's explicit capabilities オープンbug P2 ready for work
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
modelcontextprotocol/java-sdk#1086 · コメント 1 件 ·
-
enhancement good first issue P3
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
modelcontextprotocol/java-sdk#1067 ·
-
bug P2 ready for work
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
modelcontextprotocol/java-sdk#898 · コメント 1 件 ·
modelcontextprotocol/java-sdk の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
OpenHFT/Chronicle-Map#622 ·
-
Bug Java Platform: Java
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
getsentry/sentry-java#6138 · コメント 1 件 ·
-
bug needs triage p2
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
GoogleCloudPlatform/DataflowTemplates#4273 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100