Skip to main content
Glama

device_action

Manage device permissions and configurations by performing actions like authorizing, deauthorizing, deleting, or expiring keys on a specified device within the Tailscale MCP Server.

Instructions

Perform actions on a specific device

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesThe action to perform on the device
deviceIdYesThe ID of the device to act on

Implementation Reference

  • Executes the device_action tool by dispatching to appropriate UnifiedTailscaleClient methods based on the specified action (authorize, deauthorize, delete, expire-key). Returns success or error messages.
    async function deviceAction( args: z.infer<typeof DeviceActionSchema>, context: ToolContext, ): Promise<CallToolResult> { try { logger.debug("Performing device action:", args); let result: UnifiedResponse<void>; switch (args.action) { case "authorize": result = await context.client.authorizeDevice(args.deviceId); break; case "deauthorize": result = await context.client.deauthorizeDevice(args.deviceId); break; case "delete": result = await context.client.deleteDevice(args.deviceId); break; case "expire-key": result = await context.client.expireDeviceKey(args.deviceId); break; default: return returnToolError(`Unknown action: ${args.action}`); } if (!result.success) { return returnToolError(result.error); } return returnToolSuccess( `Successfully performed action "${args.action}" on device ${args.deviceId}`, ); } catch (error: unknown) { logger.error("Error performing device action:", error); return returnToolError(error); } }
  • Zod schema defining the input parameters for the device_action tool: deviceId (string) and action (enum: authorize, deauthorize, delete, expire-key).
    const DeviceActionSchema = z.object({ deviceId: z.string().describe("The ID of the device to act on"), action: z .enum(["authorize", "deauthorize", "delete", "expire-key"]) .describe("The action to perform on the device"), });
  • Registers the device_action tool within the deviceTools module, specifying name, description, inputSchema, and handler.
    name: "device_action", description: "Perform actions on a specific device", inputSchema: DeviceActionSchema, handler: deviceAction, },
  • Top-level registration of the deviceTools module (containing device_action) in the ToolRegistry's loadTools method.
    this.registerModule(deviceTools); this.registerModule(networkTools); this.registerModule(aclTools); this.registerModule(adminTools);
  • Shared Zod schema for DeviceActionRequest used across the codebase, matching the tool's input schema.
    export const DeviceActionRequestSchema = z.object({ deviceId: z.string(), action: z.enum(["authorize", "deauthorize", "delete", "expire-key"]), });

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