manage_routes
Enable or disable specific CIDR routes for a device using the Tailscale MCP Server, ensuring precise control over network configurations and routing.
Instructions
Enable or disable routes for a device
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | Whether to enable or disable the routes | |
| deviceId | Yes | The ID of the device | |
| routes | Yes | Array of CIDR routes to manage |
Implementation Reference
- src/tools/device-tools.ts:131-165 (handler)The handler function for the manage_routes tool, which enables or disables specified CIDR routes for a given device using the Tailscale client.async function manageRoutes( args: z.infer<typeof ManageRoutesSchema>, context: ToolContext, ): Promise<CallToolResult> { try { logger.debug("Managing routes:", args); let result: UnifiedResponse<void>; if (args.action === "enable") { result = await context.client.enableDeviceRoutes( args.deviceId, args.routes, ); } else { result = await context.client.disableDeviceRoutes( args.deviceId, args.routes, ); } if (!result.success) { return returnToolError(result.error); } const verbPast = args.action === "enable" ? "enabled" : "disabled"; return returnToolSuccess( `Successfully ${verbPast} routes ${args.routes.join( ", ", )} for device ${args.deviceId}`, ); } catch (error: unknown) { logger.error("Error managing routes:", error); return returnToolError(error); } }
- src/tools/device-tools.ts:24-30 (schema)Zod input schema for the manage_routes tool defining deviceId, routes array, and action (enable/disable).const ManageRoutesSchema = z.object({ deviceId: z.string().describe("The ID of the device"), routes: z.array(z.string()).describe("Array of CIDR routes to manage"), action: z .enum(["enable", "disable"]) .describe("Whether to enable or disable the routes"), });
- src/tools/device-tools.ts:182-187 (registration)Tool registration object within the deviceTools module's tools array, linking name, description, schema, and handler.{ name: "manage_routes", description: "Enable or disable routes for a device", inputSchema: ManageRoutesSchema, handler: manageRoutes, },