0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

VS Code Copilot の「128ツール制限」を気にせず全部ONにできる:virtual tools (大袈裟

0
Last updated at Posted at 2026-06-27

背景

解決手段がみつかってない、の続編・・ :sweat:

Reason: You may not include more than 128 tools in your request.

128 ツール制限。これを避けようとして、自分は「用途別の Toolset を5個くらい作って切り替えれば、必要なツールだけになるしトークンも節約できるっしょ」と頑張ってたんだけど、Toolset 切り替えは現状バグが多くて、意図したツール構成にならず消耗してた

で、調べてたら James Montemagno(Microsoft の中の人)の動画
「How To Use ALL the MCP Servers You Want in VS Code」 に行き着いた。
サムネのノリが最高で、

128 tool limit?!?! I don't think so!

…って感じ。要は virtual tools という仕組みが入ってて、「もう Toolset でちまちま切り替えなくても、全部 ON のまま VS Code がよしなにやってくれる」っぽい。

「じゃあもう何も気にせず全部 ON でよくね?」と思えてきた

128 ツール制限とは?
1回のチャットリクエストでモデルに渡せるツールは最大128個まで、という制限。MCP サーバーや拡張を増やすとすぐ超える。超えると agent mode がリクエストを送れず、手動で「Configure Tools」からツールを減らす羽目になる(参考: microsoft/vscode #290356vscode-copilot-release #13065)。

virtual tools

image.png

概要

VS Code の virtual tools の要点。

  • 128 を超えても、VS Code が勝手に捌いてくれる

ただし開発中の機能で「閾値を超えるとツール呼び出しの精度が落ちることがある」という注意書きはある。まぁ、当然だよね

詳細

1. virtual tools の正体(一次ソース)

テスト用 Issue
microsoft/vscode #258360 "Test: virtual tools and limit behaviors"

This iteration we introduced a notion of 'virtual tools'. The virtual tools act as directories that only activate and show the tools they contain when the model calls them. If the tool count is over a threshold value, we'll group into these virtual tools. Grouping is done for an entire extension or MCP server if it presents a small number of tools, or with a categorization of tools when there are a large number. Built-in tools are never grouped.

  • 仮想ツール = ディレクトリ。中のツールは、モデルが呼んだときに初めて展開・有効化される。
  • 閾値を超えたら、自動でグループ化する。
  • グループの作り方は2パターン:
    • ツール数が少ない拡張/MCP サーバー → その拡張/サーバー単位でまとめる
    • ツール数が多い → カテゴリ分けしてまとめる
  • 組み込みツール(edit/read/search 等のビルトイン)は絶対にグループ化しない

2. 実際の挙動(128 を超えると何が起きる?)

同じ Issue にテスト手順として挙動が書かれてる。ざっくりこう。

  1. 128 未満:今まで通り。何も変わらない。
  2. 128 超:ツールピッカーとツールボタンに ⚠️ が出る。
  3. 次のチャットリクエストで 「Optimizing tool selection」 ステップが走る。
    ちょっと時間かかるけどキャッシュされるので、ツール構成を変えない限り次回以降は出ない。
  4. その状態でもモデルはちゃんとツールを呼べる(グループを開いて使う)。
  5. ツールを減らして 128 未満に戻すと、⚠️ は消える。

キャッシュをリセットしたいとき
コマンドパレットから Developer: Reset Virtual Tool Groups を実行(ウィンドウのリロードが必要)。グループ分けを作り直せる。

3. 「無効化」じゃなくて「グループ化」なのが大事

ここが Toolset との決定的な違い。

In virtual tools, we never disable tools, we group them together and the model can enable groups as it wants.

microsoft/vscode #258360

Toolset / Configure Tools は「人間がツールを ON/OFF して絞る」発想。
virtual tools は「ツールは全部活かしたまま、モデルが必要なグループを自分で開く」発想。

だから「ローカル編集ツールを誤って切っちゃって使えない」みたいな事故が、原理的に起きにくい。全部 ON のままでいいから。

4. トークンはどうなる?

仮想ツールは「ディレクトリ」なので、最初は全ツールの定義をフルでモデルに渡さず、グループのエントリ+必要に応じて展開した中身だけを渡す形になる。
なので、大量ツールを ON にしていても、上流に乗るツール定義のトークンは抑えられる方向に働く。

つまり、自分が Toolset 切り替えで手動でやろうとしていた「トークン節約」を、virtual tools が自動でやってくれていることになる。

5. 注意点(完全無罪ではない)

Virtual tools group similar sets of tools together and they allow the model to activate them on-demand. Certain tool groups will optimistically be pre-activated. We are actively developing this feature and you experience degraded tool calling once the threshold is hit.

How To Use ALL the MCP Servers You Want in VS Code

  • 一部のグループは「先読み」で事前有効化される(preselection)。ただし現状この先読みロジックはまだ素朴で、改善中とのこと(将来的にはチャットモードごとの LRU で「よく使うツールを優先有効化」する構想)。
  • 閾値を超えると、ツール呼び出しの精度が落ちることがある(degraded tool calling)。これは開発中だからで、⚠️ もそれを示す一時的な表示。connor4312 曰く「warning は一時的で、virtual tools が良くなれば消す」。

なので「全部 ON で完全に無問題」ではなく、**「全部 ON でも基本は回る。ただし大量に積みすぎるとツール選択の精度が落ちる場面はある」**くらいの温度感ぽい

なので、

  1. 手動である程度絞っておく、普段使いする程度のものへ
  2. あとは、virtual tools でよしになにまかせて、ストレスにしない

ぐらいがよさげ :thinking:

⚠️ アイコンは「壊れてる」サインではない
128 超で出る ⚠️ は「最適化が走ってますよ」という一時的な表示。エラーではないので、出ても基本そのまま使ってOK。気になるなら本当に使う MCP/拡張だけに絞ればいい。

あとがき

結論。Toolset 切り替えで消耗するより、virtual tools 任せで「気にせずよく使うのは全部 ON」の方が、今は理にかなってる。

中の人も「preselection を賢くする(チャットモードごとに頻出ツールを優先有効化)」って言ってるので、ここが育てば手動管理はますます要らなくなりそう。期待。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?