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, },

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