modelcontextprotocol / modelcontextprotocol/python-sdk

feat: enhance dynamic tool management with notifications and enable/disable

オープン
#1,429 コメント 4 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

enhancement needs decision P1 v2
主要言語
Python
スター
24.3k
フォーク
4k
平均マージ
1日 1時間
マージ済み PR(30日)
31

説明

Summary

Enhance the Python SDK's dynamic tool management capabilities to match the TypeScript SDK by adding:

  1. Automatic tools/list_changed notifications when tools are added/removed
  2. Tool enable/disable functionality (temporary hiding without removal)

Background

The Python SDK currently supports adding and removing tools dynamically (see #1322), but lacks two key features present in the TypeScript SDK:

1. List Changed Notifications

The TypeScript SDK automatically sends notifications/tools/list_changed when tools are modified. This allows clients to know when they should refresh their tool list.

Python SDK gap: Currently, when calling add_tool() or remove_tool(), clients are not notified of the change and may show stale tool lists.

2. Enable/Disable Tools

The TypeScript SDK provides enable() and disable() methods on tools:

const tool = server.tool("myTool", ..., async () => { ... });
tool.disable()  // Hides from list_tools, blocks calls
tool.enable()   // Re-enables the tool
tool.remove()   // Permanently removes

Benefits:

  • Temporarily hide tools without losing registration
  • Re-enable tools without re-registering
  • Useful for permission-based or state-based tool visibility

Python SDK gap: Only permanent removal via remove_tool() is supported. No way to temporarily disable/re-enable tools.

References

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、add_tool()、remove_tool()、list_tools()、およびツール呼び出しに対応する Python SDK のエントリーポイントを確認し、その動作を参照先の TypeScript SDK の dynamic-server 実装と比較します。追加および削除されたツールが tools/list_changed 通知をトリガーし、無効化されたツールが非表示かつブロックされ、再度有効化でき、引き続き削除可能であれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python, typescript
領域
api, backend
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。