Skip to main content
Glama

connect_network

Enable automated Tailscale network connections, manage subnet routes, DNS settings, and device hostnames using predefined configurations for streamlined network integration.

Instructions

Connect to the Tailscale network

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
acceptDNSYesAccept DNS configuration from the network
acceptRoutesYesAccept subnet routes from other devices
advertiseRoutesNoCIDR routes to advertise to other devices
authKeyNoAuthentication key for unattended setup
hostnameNoSet a custom hostname for this device
loginServerNoCustom coordination server URL

Implementation Reference

  • The handler function that implements the core logic of the connect_network tool. It processes input arguments, prepares options for Tailscale connection, calls the client.connect method, and returns success or error.
    async function connectNetwork(
      args: z.infer<typeof ConnectNetworkSchema>,
      context: ToolContext,
    ): Promise<CallToolResult> {
      try {
        const options = {
          acceptRoutes: args.acceptRoutes || false,
          acceptDns: args.acceptDNS ?? false, // Note: CLI uses acceptDns, not acceptDNS
          hostname: args.hostname,
          advertiseRoutes: args.advertiseRoutes || [],
          authKey: args.authKey,
          loginServer: args.loginServer,
        };
    
        logger.debug("Connecting to Tailscale network with options:", options);
    
        // Use unified client - this operation is CLI-only
        const result = await context.client.connect(options);
    
        if (!result.success) {
          return returnToolError(result.error);
        }
    
        return returnToolSuccess(
          `Successfully connected to Tailscale network\n\n${result.data}`,
        );
      } catch (error: unknown) {
        logger.error("Error connecting to network:", error);
        return returnToolError(error);
      }
    }
  • Zod schema defining the input validation and types for the connect_network tool parameters.
    const ConnectNetworkSchema = z.object({
      acceptRoutes: z
        .boolean()
        .optional()
        .default(false)
        .describe("Accept subnet routes from other devices"),
      acceptDNS: z
        .boolean()
        .optional()
        .default(false)
        .describe("Accept DNS configuration from the network"),
      hostname: z
        .string()
        .optional()
        .describe("Set a custom hostname for this device"),
      advertiseRoutes: z
        .array(z.string())
        .optional()
        .describe("CIDR routes to advertise to other devices"),
      authKey: z
        .string()
        .optional()
        .describe("Authentication key for unattended setup"),
      loginServer: z.string().optional().describe("Custom coordination server URL"),
    });
  • The object registering the connect_network tool within the networkTools module's tools array, associating the name, description, input schema, and handler function.
    {
      name: "connect_network",
      description: "Connect to the Tailscale network",
      inputSchema: ConnectNetworkSchema,
      handler: connectNetwork,
    },
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. 'Connect to the Tailscale network' implies a state-changing operation but doesn't specify whether this requires admin privileges, what happens if already connected, whether it's idempotent, what side effects occur, or what the expected outcome looks like. For a network connection tool with zero annotation coverage, this is insufficient.

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 with zero wasted words. It's appropriately sized for a tool with this level of complexity and gets straight to the point without unnecessary elaboration.

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 connection tool with 6 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain what 'connect' means operationally, what happens after connection, what permissions are required, or what the tool returns. The agent must rely entirely on the input schema for parameter details and guess at behavioral aspects.

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 documents all 6 parameters thoroughly. The description adds no parameter-specific information beyond what's in the schema. According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in the description.

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 ('Connect') and the target resource ('Tailscale network'), providing a specific verb+resource combination. However, it doesn't differentiate this tool from its sibling 'disconnect_network' beyond the obvious opposite action, nor does it specify what 'connect' entails operationally beyond the high-level concept.

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. There's no mention of prerequisites (e.g., needing authentication), when this operation is appropriate versus using other network management tools, or what state the network should be in before invocation. The agent must infer usage from the tool name alone.

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