Skip to main content
Glama
itrimble

Moom MCP Server

by itrimble

create_quad_layout

Arrange four applications in a 2x2 grid layout on a specified display using the Moom MCP Server for macOS window management.

Instructions

Create a quad (2x2) window layout on a specific display

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
layoutNameYesName for the quad layout
displayNoWhich display to use
appsYesArray of 4 app names for TL, TR, BL, BR positions

Implementation Reference

  • The handler function that executes the tool logic: validates 4 apps, uses AppleScript with Moom shortcuts to position apps in TL/TR/BL/BR quadrants, and saves the layout.
    async createQuadLayout(layoutName, display = 'main', apps) {
      if (apps.length !== 4) {
        return {
          content: [{
            type: 'text',
            text: 'Error: Quad layout requires exactly 4 apps'
          }]
        };
      }
    
      const script = `
        -- Rectangle shortcuts for quarters
        on topLeft()
          tell application "System Events"
            key code 32 using {control down, command down} -- U
          end tell
        end topLeft
        
        on topRight()
          tell application "System Events"
            key code 34 using {control down, command down} -- I
          end tell
        end topRight
        
        on bottomLeft()
          tell application "System Events"
            key code 38 using {control down, command down} -- J
          end tell
        end bottomLeft
        
        on bottomRight()
          tell application "System Events"
            key code 40 using {control down, command down} -- K
          end tell
        end bottomRight
        
        -- Position apps in quarters
        tell application "${apps[0]}" to activate
        delay 0.5
        topLeft()
        delay 0.5
        
        tell application "${apps[1]}" to activate
        delay 0.5
        topRight()
        delay 0.5
        
        tell application "${apps[2]}" to activate
        delay 0.5
        bottomLeft()
        delay 0.5
        
        tell application "${apps[3]}" to activate
        delay 0.5
        bottomRight()
        delay 0.5
        
        -- Save as Moom layout
        tell application "Moom"
          save layout and replace "${layoutName}"
        end tell
      `;
    
      try {
        await this.runAppleScript(script);
        return {
          content: [{
            type: 'text',
            text: `Successfully created quad layout: ${layoutName}`
          }]
        };
      } catch (error) {
        return {
          content: [{
            type: 'text',
            text: `Error creating quad layout: ${error.message}`
          }]
        };
      }
    }
  • Input schema definition specifying parameters: layoutName (required), display (optional), apps (array of 4 strings, required).
    {
      name: 'create_quad_layout',
      description: 'Create a quad (2x2) window layout on a specific display',
      inputSchema: {
        type: 'object',
        properties: {
          layoutName: {
            type: 'string',
            description: 'Name for the quad layout',
          },
          display: {
            type: 'string',
            enum: ['main', 'left', 'right'],
            description: 'Which display to use',
          },
          apps: {
            type: 'array',
            items: { type: 'string' },
            description: 'Array of 4 app names for TL, TR, BL, BR positions',
          },
        },
        required: ['layoutName', 'apps'],
      },
    },
  • src/index.js:219-220 (registration)
    Switch case in CallToolRequest handler that routes the tool call to the createQuadLayout method.
    case 'create_quad_layout':
      return await this.createQuadLayout(args.layoutName, args.display, args.apps);
  • src/index.js:83-83 (registration)
    Tool name registration in the ListTools response.
    name: 'create_quad_layout',

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