Ping
Tool Name: ping
Tests TCP reachability: opens one TCP connection to host:port and closes it. This is NOT ICMP, so it needs a listening port (default 80) and says nothing about other ports or ICMP. Single attempt, no loss statistics; latency includes DNS resolution. Read-only, but it connects off-host and honors the user's network: policy in mcp-sudo.yaml. timeout is whole seconds (default 5). A failed connect is not a tool error: the JSON has success: false and an error text. Returns JSON with host, port, success, latency_ms and error. For DNS only use network/nslookup, for the hop path network/trace-path, for an HTTP check network/curl.
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
host | string | yes | Hostname or IP address to connect to |
port | number | no | TCP port, whole number (default 80) |
timeout | number | no | Seconds, whole number (default 5) |
Example
Every example below shows the equivalent linuxctl command and the raw MCP JSON-RPC call it resolves to. The raw call always follows the same two-step pattern (see MCP API overview for the full explanation): open an SSE stream to get a one-time POST endpoint, then POST the JSON-RPC request there - the result streams back on the SSE connection.
linuxctl
linuxctl get network ping 127.0.0.1
Output:
{
"host": "127.0.0.1",
"port": 80,
"success": false,
"latency_ms": 0.264,
"error": "dial tcp 127.0.0.1:80: connect: connection refused"
}
curl (raw MCP JSON-RPC)
# 1. Open the SSE stream (in the background) and capture the one-time POST endpoint
curl -N -s --cacert mcpd.crt -H "Authorization: Bearer $MCP_TOKEN" https://localhost:9091/sse &
# server sends: event: endpoint / data: /message?session_id=...
# 2. POST the tools/call request to that endpoint
curl -s --cacert mcpd.crt -X POST "https://localhost:9091/message?session_id=<from step 1>" \
-H "Authorization: Bearer $MCP_TOKEN" \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": "1", "method": "tools/call", "params": {"name": "network/ping", "arguments": {"host": "127.0.0.1"}}}'
# 3. The result arrives on the SSE stream opened in step 1
Response:
{
"jsonrpc": "2.0",
"id": "16",
"result": {
"content": [
{
"type": "text",
"text": "{\n \"host\": \"127.0.0.1\",\n \"port\": 80,\n \"success\": false,\n \"latency_ms\": 0.264,\n \"error\": \"dial tcp 127.0.0.1:80: connect: connection refused\"\n}"
}
]
}
}