list_layouts
Retrieve all saved Moom window layouts on macOS through the Moom MCP Server. Ideal for managing and organizing window configurations programmatically.
Instructions
List all saved Moom layouts
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.js:250-282 (handler)The core handler function for the 'list_layouts' tool. It executes an AppleScript command to query Moom for its list of layouts, parses the comma-separated result into an array, and returns a formatted JSON response containing the layouts and count, or an error message if failed.async listLayouts() { const script = ` tell application "Moom" list of layouts end tell `; try { const result = await this.runAppleScript(script); const layouts = result.split(', ').map(name => name.trim()); return { content: [ { type: 'text', text: JSON.stringify({ layouts: layouts, count: layouts.length }, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error listing layouts: ${error.message}`, }, ], }; } }
- src/index.js:128-135 (registration)Registration of the 'list_layouts' tool in the ListToolsRequestSchema handler response array. Defines the tool name, description, and input schema (empty object since no parameters required).{ name: 'list_layouts', description: 'List all saved Moom layouts', inputSchema: { type: 'object', properties: {}, }, },
- src/index.js:131-134 (schema)Input schema definition for the 'list_layouts' tool, specifying an empty object (no required parameters).inputSchema: { type: 'object', properties: {}, },
- src/index.js:238-248 (helper)Helper utility function used by listLayouts() to execute AppleScript commands via osascript, capturing stdout and handling stderr/errors.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}`); } }
- src/index.js:217-218 (registration)Dispatch case in the CallToolRequestSchema handler switch statement that routes 'list_layouts' tool calls to the listLayouts() method. (Note: Duplicate case exists at lines 223-224.)case 'list_layouts': return await this.listLayouts();