Skip to main content
Glama
itrimble

Moom MCP Server

by itrimble

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
NameRequiredDescriptionDefault
layoutNameYesName of the layout to activate (e.g., "Teaching (Mac Mini)", "AI Research Mode")

Implementation Reference

  • 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'],
      },
    },
  • 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'],
    },
  • Dispatch handler in the CallToolRequest switch statement that routes to the activateLayout method.
    case 'activate_layout':
      return await this.activateLayout(args.layoutName);
  • 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}`);
      }
    }

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/itrimble/moom-mcp'

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