ping_peer
Ping a specified peer device to test connectivity by sending a defined number of packets. Use the hostname or IP address for the target, enabling network diagnostics via Tailscale MCP Server.
Instructions
Ping a peer device
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | Yes | Number of ping packets to send | |
| target | Yes | Hostname or IP address of the target device |
Implementation Reference
- src/tools/network-tools.ts:179-200 (handler)The handler function for the 'ping_peer' MCP tool. It takes target hostname/IP and optional count, uses the Tailscale client to perform the ping via CLI, and returns success or error.async function pingPeer( args: z.infer<typeof PingPeerSchema>, context: ToolContext, ): Promise<CallToolResult> { try { logger.debug(`Pinging ${args.target} (${args.count} packets)`); // Use unified client - this operation is CLI-only const result = await context.client.ping(args.target, args.count); if (!result.success) { return returnToolError(result.error); } return returnToolSuccess( `Ping results for ${args.target}:\n\n${result.data}`, ); } catch (error: unknown) { logger.error("Error pinging peer:", error); return returnToolError(error); } }
- src/tools/network-tools.ts:43-53 (schema)Zod schema defining the input parameters for the 'ping_peer' tool: target (string) and count (number, default 4).const PingPeerSchema = z.object({ target: z.string().describe("Hostname or IP address of the target device"), count: z .number() .int() .min(1) .max(100) .optional() .default(4) .describe("Number of ping packets to send"), });
- src/tools/network-tools.ts:246-251 (registration)Registration of the 'ping_peer' tool in the networkTools module's tools array, linking name, description, input schema, and handler function.{ name: "ping_peer", description: "Ping a peer device", inputSchema: PingPeerSchema, handler: pingPeer, },