connect_node_to_network
Establish communication by linking a node interface to a network in an EVE-NG lab using the Connect Node to Network tool. Input lab path, node ID, interface, and network ID to activate the connection.
Instructions
Connect a node to a network.
This tool creates a connection between a node interface and a network in the lab, enabling communication through that network.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| arguments | Yes |
Implementation Reference
- The @mcp.tool()-decorated handler function that executes the connect_node_to_network tool. It validates arguments, checks connection, calls eveng_client.connect_node_to_cloud, and returns success/error TextContent.@mcp.tool() async def connect_node_to_network(arguments: ConnectNodeToNetworkArgs) -> list[TextContent]: """ Connect a node to a network. This tool creates a connection between a node interface and a network in the lab, enabling communication through that network. """ try: logger.info(f"Connecting node {arguments.node_id} to network {arguments.network_id}") if not eveng_client.is_connected: return [TextContent( type="text", text="Not connected to EVE-NG server. Use connect_eveng_server tool first." )] # Connect node to network (cloud) result = await eveng_client.connect_node_to_cloud( arguments.lab_path, arguments.node_id, arguments.node_interface, arguments.network_id ) if result.get('status') == 'success': return [TextContent( type="text", text=f"Successfully connected node to network!\n\n" f"Lab: {arguments.lab_path}\n" f"Node: {arguments.node_id}\n" f"Interface: {arguments.node_interface}\n" f"Network: {arguments.network_id}\n\n" f"Connection established successfully." )] else: return [TextContent( type="text", text=f"Failed to connect node to network: {result.get('message', 'Unknown error')}" )] except Exception as e: logger.error(f"Failed to connect node to network: {e}") return [TextContent( type="text", text=f"Failed to connect node to network: {str(e)}" )]
- Pydantic BaseModel defining the input schema/arguments for the connect_node_to_network tool, including lab_path, node_id, node_interface, and network_id.class ConnectNodeToNetworkArgs(BaseModel): """Arguments for connect_node_to_network tool.""" lab_path: str = Field(description="Full path to the lab (e.g., /lab_name.unl)") node_id: str = Field(description="Source node ID") node_interface: str = Field(description="Node interface name (e.g., 'Gi0/0', 'eth0')") network_id: str = Field(description="Target network ID")
- eveng_mcp_server/tools/__init__.py:27-28 (registration)Within register_tools, calls register_network_tools(mcp, eveng_client) which defines and registers the connect_node_to_network tool via @mcp.tool() decorator.# Network management tools register_network_tools(mcp, eveng_client)
- eveng_mcp_server/server.py:53-53 (registration)Top-level call to register_tools in the main server.py, which chains to network tool registration including connect_node_to_network.register_tools(self.mcp, self.eveng_client)