Skip to main content
Glama
moimran
by moimran

connect_node_to_node

Create a direct point-to-point connection between two nodes in an EVE-NG lab network. Specify lab path, source, and destination node IDs with interfaces to enable direct communication.

Instructions

Connect two nodes together directly.

This tool creates a direct point-to-point connection between two nodes in the lab, enabling direct communication between them.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argumentsYes

Implementation Reference

  • MCP tool handler function that executes the connect_node_to_node tool logic, validates arguments, calls the eveng_client helper, and formats the response.
    @mcp.tool() async def connect_node_to_node(arguments: ConnectNodeToNodeArgs) -> list[TextContent]: """ Connect two nodes together directly. This tool creates a direct point-to-point connection between two nodes in the lab, enabling direct communication between them. """ try: logger.info(f"Connecting node {arguments.src_node_id} to node {arguments.dst_node_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 nodes together result = await eveng_client.connect_node_to_node( arguments.lab_path, arguments.src_node_id, arguments.src_interface, arguments.dst_node_id, arguments.dst_interface ) if result: # connect_node_to_node returns boolean return [TextContent( type="text", text=f"Successfully connected nodes!\n\n" f"Lab: {arguments.lab_path}\n" f"Source Node: {arguments.src_node_id} ({arguments.src_interface})\n" f"Destination Node: {arguments.dst_node_id} ({arguments.dst_interface})\n\n" f"Point-to-point connection established successfully." )] else: return [TextContent( type="text", text="Failed to connect nodes: Connection could not be established." )] except Exception as e: logger.error(f"Failed to connect nodes: {e}") return [TextContent( type="text", text=f"Failed to connect nodes: {str(e)}" )]
  • Pydantic model defining the input schema/arguments for the connect_node_to_node tool.
    class ConnectNodeToNodeArgs(BaseModel): """Arguments for connect_node_to_node tool.""" lab_path: str = Field(description="Full path to the lab (e.g., /lab_name.unl)") src_node_id: str = Field(description="Source node ID") src_interface: str = Field(description="Source node interface name") dst_node_id: str = Field(description="Destination node ID") dst_interface: str = Field(description="Destination node interface name")
  • Registration call to register_network_tools within the central register_tools function, which defines and registers all network tools including connect_node_to_node.
    # Network management tools register_network_tools(mcp, eveng_client)
  • Helper method in EVENGClientWrapper that wraps the EVE-NG API call to connect two nodes, handling connection, errors, and logging.
    async def connect_node_to_node(self, lab_path: str, src: str, src_label: str, dst: str, dst_label: str) -> Dict[str, Any]: """Connect two nodes together.""" await self.ensure_connected() try: result = await asyncio.to_thread(self.api.connect_node_to_node, lab_path, src, src_label, dst, dst_label) self.logger.info("Connected nodes", lab_path=lab_path, src=src, dst=dst) return result except Exception as e: self.logger.error("Failed to connect nodes", **log_error(e, {"lab_path": lab_path, "src": src, "dst": dst})) raise EVENGAPIError(f"Failed to connect nodes: {str(e)}")

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/moimran/eveng-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server