Skip to main content
Glama

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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 `, },
  • 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: {}, }, })), ), }));
  • 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";

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/joshrutkowski/applescript-mcp'

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