link
List existing network connections or batch connect/disconnect GNS3 nodes with two-phase validation to prevent partial topology changes.
Instructions
Manage network connections (links)
v0.47.0: Renamed from set_network_connections to link (CRUD consolidation).
Actions: - list: List all links in a project - batch: Execute multiple connect/disconnect operations with two-phase validation
Two-phase execution for batch operations prevents partial topology changes:
VALIDATE ALL operations (check nodes exist, ports free, adapters valid)
EXECUTE ALL operations (only if all valid - atomic)
Connection Operations (for 'batch' action): Connect: {action: "connect", node_a, node_b, port_a, port_b, adapter_a, adapter_b} Disconnect: {action: "disconnect", link_id}
Port addressing: - adapter_* as number: link uses (adapter_*, port_*). Switches/hubs have all ports on adapter 0, so port_b=2 selects Ethernet2. - adapter_* as port name ("eth1", "Ethernet2", "Gi0/1"): the name fixes both adapter and port; port_* is ignored.
Examples: # List links >>> link(action="list", project_id="abc-123") >>> link(action="list", project_id="abc-123", format="json")
# Connect two nodes (batch)
>>> link(action="batch", connections=[{
... "action": "connect",
... "node_a": "Router1",
... "node_b": "Router2",
... "port_a": 0,
... "port_b": 0,
... "adapter_a": 0,
... "adapter_b": 0
... }])
# Disconnect link (batch)
>>> link(action="batch", connections=[{"action": "disconnect", "link_id": "abc123"}])Returns: JSON with OperationResult (completed and failed operations) or list of links
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"action": "<action>"
},
"name": "link"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | Action: 'list' (list links) or 'batch' (batch operations) | |
| format | No | Output format: 'table' (default) or 'json' (for 'list') | table |
| project_id | No | Project ID (required for 'list') | |
| connections | No | List of connection operations (required for 'batch') |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |