System Sleep
system_sleepPut your Mac to sleep to conserve power and lock the screen.
Instructions
Put the Mac to sleep.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/system/tools.ts:493-513 (handler)The tool handler for 'system_sleep'. It registers the tool with the MCP server, calls systemSleepScript() via runJxa, and returns the result { action: 'sleep', success: true }.
server.registerTool( "system_sleep", { title: "System Sleep", description: "Put the Mac to sleep.", inputSchema: {}, annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false, }, }, async () => { try { return ok(await runJxa<{ action: string; success: boolean }>(systemSleepScript())); } catch (e) { return errJxaFor("system sleep", e); } }, ); - src/system/tools.ts:496-498 (schema)Input schema for system_sleep: empty object (no inputs required).
title: "System Sleep", description: "Put the Mac to sleep.", inputSchema: {}, - src/system/tools.ts:493-494 (registration)Tool registered with name 'system_sleep' via server.registerTool().
server.registerTool( "system_sleep", - src/system/scripts.ts:274-280 (helper)The systemSleepScript() function returns a JXA script string that puts the Mac to sleep using System Events' sleep() command.
export function systemSleepScript(): string { return ` const se = Application('System Events'); se.sleep(); JSON.stringify({action: 'sleep', success: true}); `; }