activate_layout
Activate a specific Moom window layout by name to organize macOS desktop windows for different workflows and tasks.
Instructions
Activate a specific Moom layout by name
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| layoutName | Yes | Name of the layout to activate (e.g., "Teaching (Mac Mini)", "AI Research Mode") |
Implementation Reference
- src/index.js:284-311 (handler)Core handler function that executes the tool by sending an AppleScript command to Moom to apply the specified layout.async activateLayout(layoutName) { // Use AppleScript to apply layout const script = ` tell application "Moom" apply layout "${layoutName}" end tell `; try { await this.runAppleScript(script); return { content: [ { type: 'text', text: `Successfully activated layout: ${layoutName}`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error: ${error.message}`, }, ], }; } }
- src/index.js:33-45 (registration)Tool registration in the MCP ListTools response, defining name, description, and input schema.name: 'activate_layout', description: 'Activate a specific Moom layout by name', inputSchema: { type: 'object', properties: { layoutName: { type: 'string', description: 'Name of the layout to activate (e.g., "Teaching (Mac Mini)", "AI Research Mode")', }, }, required: ['layoutName'], }, },
- src/index.js:35-44 (schema)Input schema defining the expected parameters for the activate_layout tool.inputSchema: { type: 'object', properties: { layoutName: { type: 'string', description: 'Name of the layout to activate (e.g., "Teaching (Mac Mini)", "AI Research Mode")', }, }, required: ['layoutName'], },
- src/index.js:209-210 (handler)Dispatch handler in the CallToolRequest switch statement that routes to the activateLayout method.case 'activate_layout': return await this.activateLayout(args.layoutName);
- src/index.js:238-248 (helper)Helper function used by activateLayout to execute AppleScript commands.async runAppleScript(script) { try { const { stdout, stderr } = await execAsync(`osascript -e '${script}'`); if (stderr) { throw new Error(stderr); } return stdout.trim(); } catch (error) { throw new Error(`AppleScript error: ${error.message}`); } }