removeTool method

  1. @override
void removeTool(
  1. String name
)
override

Remove a tool from the server

Implementation

@override
void removeTool(String name) {
  if (!_tools.containsKey(name)) {
    throw McpError('Tool with name "$name" does not exist');
  }

  _tools.remove(name);
  _toolHandlers.remove(name);

  // Notify clients about tool changes if connected and supported
  if (isConnected && capabilities.hasTools && capabilities.toolsListChanged) {
    _broadcastNotification('notifications/tools/list_changed', {});
  }

  // Emit change event
  _toolsChangedController.add(null);

  // Update metrics
  _updateResourceMetrics();
}