system_toggle_dark_mode
Switch macOS between light and dark appearance modes using AppleScript automation.
Instructions
[System control and information] Toggle system dark mode
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/categories/system.ts:90-101 (handler)AppleScript code that implements the core logic for toggling system dark mode, used as the handler for the 'system_toggle_dark_mode' tool.{ name: "toggle_dark_mode", description: "Toggle system dark mode", script: ` tell application "System Events" tell appearance preferences set dark mode to not dark mode return "Dark mode is now " & (dark mode as text) end tell end tell `, },
- src/framework.ts:221-232 (registration)Registers all tools for listing, constructing names like 'system_toggle_dark_mode' from category and script names.this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: this.categories.flatMap((category) => category.scripts.map((script) => ({ name: `${category.name}_${script.name}`, // Changed from dot to underscore description: `[${category.description}] ${script.description}`, inputSchema: script.schema || { type: "object", properties: {}, }, })), ), }));
- src/framework.ts:244-247 (registration)Parses the tool name 'system_toggle_dark_mode' by splitting on '_' to identify the 'system' category and 'toggle_dark_mode' script.const [categoryName, ...scriptNameParts] = toolName.split("_"); const scriptName = scriptNameParts.join("_"); // Rejoin in case script name has underscores
- src/index.ts:25-25 (registration)Adds the 'system' category (containing toggle_dark_mode) to the server, making its tools available.server.addCategory(systemCategory);
- src/index.ts:2-2 (registration)Imports the system category definition which includes the toggle_dark_mode script.import { systemCategory } from "./categories/system.js";