Skip to main content
Glama

System Power

system_power
Destructive

Shutdown or restart your Mac with action commands. Select shutdown to power off or restart to reboot.

Instructions

Shutdown or restart the Mac.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesPower action: shutdown or restart

Implementation Reference

  • The tool handler function that executes the system_power logic. It runs the JXA script for the given action (shutdown/restart) via systemPowerScript().
    async ({ action }) => {
      try {
        return ok(await runJxa<{ action: string; success: boolean }>(systemPowerScript(action)));
      } catch (e) {
        return errJxaFor("system power", e);
      }
    },
  • Registration + schema for system_power tool. Defines inputSchema with a 'action' enum of 'shutdown' or 'restart', and marks the tool as destructive and not read-only.
    server.registerTool(
      "system_power",
      {
        title: "System Power",
        description: "Shutdown or restart the Mac. Use with caution.",
        inputSchema: {
          action: z.enum(["shutdown", "restart"]).describe("Power action: shutdown or restart"),
        },
  • Tool registration via server.registerTool('system_power', ...) — same block as schema.
    server.registerTool(
      "system_power",
      {
        title: "System Power",
        description: "Shutdown or restart the Mac. Use with caution.",
        inputSchema: {
          action: z.enum(["shutdown", "restart"]).describe("Power action: shutdown or restart"),
        },
        annotations: {
          readOnlyHint: false,
          destructiveHint: true,
          idempotentHint: false,
          openWorldHint: false,
        },
      },
      async ({ action }) => {
        try {
          return ok(await runJxa<{ action: string; success: boolean }>(systemPowerScript(action)));
        } catch (e) {
          return errJxaFor("system power", e);
        }
      },
    );
  • Helper function systemPowerScript() that generates a JXA script string. It validates the action via ALLOWED_POWER_ACTIONS set and returns a JXA script that calls System Events' shutdown() or restart().
    export function systemPowerScript(action: string): string {
      if (!ALLOWED_POWER_ACTIONS.has(action)) {
        throw new Error(`Invalid power action: ${action}`);
      }
      return `
        const se = Application('System Events');
        se.${action}();
        JSON.stringify({action: '${action}', success: true});
      `;
    }
Behavior3/5

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

Annotations already indicate destructiveHint=true, so the description's mention of shutdown/restart aligns. However, it does not add details beyond annotations, such as whether it prompts for confirmation or force-closes apps.

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?

Single sentence with no extraneous information. Every word is necessary and front-loaded.

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

Completeness3/5

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

For a simple one-param tool with no output schema, the description is adequate but lacks details on the immediacy or side effects of the action, which is important for a destructive operation.

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 coverage is 100% with one enum parameter fully described. The tool description repeats 'Shutdown or restart' but adds no new meaning beyond the schema's parameter description.

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

Purpose5/5

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

The description 'Shutdown or restart the Mac.' clearly states the verb (shutdown/restart) and resource (the Mac). It is specific and distinguishes itself from siblings like 'system_sleep' which is a different action.

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?

No guidance on when to use this tool versus alternatives such as 'system_sleep' or other system actions. The description does not mention when not to use it or any prerequisites.

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

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/heznpc/AirMCP'

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