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

Offen
#1,429 4 Kommentare 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
38/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
python, typescript
Bereich
api, backend

Rechercherichtung

Beginne mit den Python-SDK-Einstiegspunkten für add_tool(), remove_tool(), list_tools() und die Tool-Aufrufe und vergleiche anschließend ihr Verhalten mit der referenzierten TypeScript SDK-Implementierung von dynamic-server. Als abgeschlossen gilt die Aufgabe, wenn hinzugefügte und entfernte Tools tools/list_changed-Benachrichtigungen auslösen, während deaktivierte Tools verborgen und blockiert werden, wieder aktiviert werden können und weiterhin entfernbar bleiben.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

enhancement needs decision P1 v2

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

Vorherrschende Sprache
Python
Sterne
24.3k
Forks
4k
Ø Merge
1 T. 19 Min.
Gemergte PRs (30 T.)
29

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus modelcontextprotocol/python-sdk

Alle Issues in modelcontextprotocol/python-sdk

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.