stop_all_nodes
Gracefully shut down and preserve the state of all running nodes in a specified lab on the EVE-NG MCP Server.
Instructions
Stop all nodes in a lab.
This tool stops all running nodes in the specified lab. All nodes will be gracefully shut down and their states preserved.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| arguments | Yes |
Implementation Reference
- MCP tool handler for 'stop_all_nodes' that handles input validation, connection checks, delegates to EVENGClientWrapper, and formats user-friendly TextContent responses.async def stop_all_nodes(arguments: BulkNodeControlArgs) -> list[TextContent]: """ Stop all nodes in a lab. This tool stops all running nodes in the specified lab. All nodes will be gracefully shut down and their states preserved. """ try: logger.info(f"Stopping all nodes in {arguments.lab_path}") if not eveng_client.is_connected: return [TextContent( type="text", text="Not connected to EVE-NG server. Use connect_eveng_server tool first." )] # Stop all nodes result = await eveng_client.stop_all_nodes(arguments.lab_path) if result.get('status') == 'success': return [TextContent( type="text", text=f"Successfully stopped all nodes in {arguments.lab_path}\n\n" f"All nodes have been shut down and their states preserved." )] else: return [TextContent( type="text", text=f"Failed to stop all nodes: {result.get('message', 'Unknown error')}" )] except Exception as e: logger.error(f"Failed to stop all nodes: {e}") return [TextContent( type="text", text=f"Failed to stop all nodes: {str(e)}" )]
- Pydantic input schema for bulk node control tools, including 'stop_all_nodes', defining the required 'lab_path' parameter.class BulkNodeControlArgs(BaseModel): """Arguments for bulk node operations.""" lab_path: str = Field(description="Full path to the lab (e.g., /lab_name.unl)")
- eveng_mcp_server/tools/__init__.py:24-25 (registration)Call to register_node_tools within the main register_tools function, which defines and registers the 'stop_all_nodes' MCP tool via @mcp.tool() decorator.# Node management tools register_node_tools(mcp, eveng_client)
- EVENGClientWrapper helper method that ensures connection and calls the underlying EVE-NG API to stop all nodes in the specified lab.async def stop_all_nodes(self, lab_path: str) -> Dict[str, Any]: """Stop all nodes in a lab.""" await self.ensure_connected() try: result = await asyncio.to_thread(self.api.stop_all_nodes, lab_path) self.logger.info("Stopped all nodes", lab_path=lab_path) return result except Exception as e: self.logger.error("Failed to stop all nodes", **log_error(e, {"lab_path": lab_path})) raise EVENGAPIError(f"Failed to stop all nodes: {str(e)}")