Skip to main content
Glama

get_network_status

Retrieve the current network status in JSON or summary format using Tailscale CLI integration, enabling automated network monitoring and management.

Instructions

Get current network status from Tailscale CLI

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
formatYesOutput format (json or summary)json

Implementation Reference

  • The handler function that implements the core logic of the 'get_network_status' tool. It fetches the Tailscale network status using the unified client, handles errors, and returns formatted output in either 'json' or 'summary' format.
    async function getNetworkStatus(
      args: z.infer<typeof NetworkStatusSchema>,
      context: ToolContext,
    ): Promise<CallToolResult> {
      try {
        logger.debug("Getting network status with format:", args.format);
    
        // Use unified client which will automatically choose between API and CLI
        const result = await context.client.getStatus();
    
        if (!result.success) {
          return returnToolError(result.error);
        }
    
        const status = result.data as TailscaleCLIStatus;
    
        if (args.format === "summary") {
          let output = "**Tailscale Network Status**\n\n";
          output += `Version: ${status.Version}\n`;
          output += `Backend state: ${status.BackendState}\n`;
          output += `TUN interface: ${status.TUN ? "Active" : "Inactive"}\n`;
          output += `Tailscale IPs: ${(status.TailscaleIPs ?? []).join(", ")}\n\n`;
    
          output += "**This device:**\n";
          output += `  - Hostname: ${status.Self.HostName}\n`;
          output += `  - DNS name: ${status.Self.DNSName}\n`;
          output += `  - OS: ${status.Self.OS}\n`;
          output += `  - IPs: ${status.Self.TailscaleIPs.join(", ")}\n`;
          output += `  - Online: ${status.Self.Online ? "🟢" : "🔴"}\n`;
          if (status.Self.ExitNode) {
            output += "  - Exit node: Yes\n";
          }
          output += "\n";
    
          if (status.Peer && Object.keys(status.Peer).length > 0) {
            const peers = Object.values(status.Peer);
            output += `**Connected peers (${peers.length}):**\n`;
            for (const peer of peers) {
              const onlineStatus = peer.Online ? "🟢" : "🔴";
              output += `  ${onlineStatus} ${peer.HostName} (${peer.DNSName})\n`;
              output += `    - OS: ${peer.OS}\n`;
              output += `    - IPs: ${peer.TailscaleIPs.join(", ")}\n`;
              if (peer.LastSeen && peer.LastSeen !== "0001-01-01T00:00:00Z") {
                output += `    - Last seen: ${peer.LastSeen}\n`;
              }
              if (peer.ExitNode) {
                output += "    - Exit node: Yes\n";
              }
              if (peer.Active) {
                output += "    - Active connection\n";
              }
            }
          }
    
          return returnToolSuccess(output);
        }
        // JSON format
        return returnToolSuccess(JSON.stringify(status, null, 2));
      } catch (error: unknown) {
        logger.error("Error getting network status:", error);
        const err =
          error instanceof Error
            ? error
            : new Error(String(error ?? "Unknown error"));
        return returnToolError(err);
      }
    }
  • Zod schema defining the input parameters for the tool, including an optional 'format' parameter defaulting to 'json'.
    const NetworkStatusSchema = z.object({
      format: z
        .enum(["json", "summary"])
        .optional()
        .default("json")
        .describe("Output format (json or summary)"),
    });
  • Registration of the 'get_network_status' tool within the networkTools module, linking the name, description, schema, and handler.
    {
      name: "get_network_status",
      description: "Get current network status from Tailscale CLI",
      inputSchema: NetworkStatusSchema,
      handler: getNetworkStatus,
    },
  • Registration of the networkTools module (containing get_network_status) into the central ToolRegistry during tool loading.
    this.registerModule(networkTools);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. While 'Get' implies a read operation, the description doesn't disclose important behavioral traits like whether this requires authentication, has rate limits, what the output looks like, or if it's a real-time status check versus cached data. The mention of 'Tailscale CLI' hints at the underlying implementation but doesn't clarify operational behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without any unnecessary words. It's appropriately sized for a simple tool and front-loads the essential information immediately.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a network status tool with no annotations and no output schema, the description is insufficient. It doesn't explain what 'network status' includes (connectivity, peers, routes, etc.), the format or structure of returned data, or any prerequisites or limitations. Given the complexity of network diagnostics and the lack of structured metadata, more context is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already fully documents the single 'format' parameter with its enum values and description. The description adds no additional parameter information beyond what's in the schema, which meets the baseline expectation when schema coverage is complete.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and resource ('current network status from Tailscale CLI'), making the purpose immediately understandable. It doesn't explicitly distinguish from siblings like 'get_tailnet_info' or 'list_devices', but the specificity of 'network status' provides reasonable differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'get_tailnet_info', 'list_devices', and 'ping_peer' available, there's no indication of what distinguishes network status from other network-related queries or when this specific tool is appropriate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/HexSleeves/tailscale-mcp'

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