set_window_size
Resize application windows to specific dimensions by specifying app name, width, and height using the Moom MCP Server for macOS.
Instructions
Resize a window to specific dimensions
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| appName | Yes | Name of the application | |
| height | Yes | Window height | |
| width | Yes | Window width |
Implementation Reference
- src/index.js:663-692 (handler)The handler function that executes the window resizing logic using AppleScript to set the front window size via System Events.async setWindowSize(appName, width, height) { const processName = this.getProcessName(appName); const script = ` tell application "${appName}" to activate delay 0.5 tell application "System Events" tell process "${processName}" set frontmost to true set size of front window to {${width}, ${height}} end tell end tell `; try { await this.runAppleScript(script); return { content: [{ type: 'text', text: `Successfully resized ${appName} window to ${width}x${height}` }] }; } catch (error) { return { content: [{ type: 'text', text: `Error resizing ${appName}: ${error.message}` }] }; } }
- src/index.js:180-201 (schema)Input schema definition for the set_window_size tool in the listTools response.{ name: 'set_window_size', description: 'Resize a window to specific dimensions', inputSchema: { type: 'object', properties: { appName: { type: 'string', description: 'Name of the application', }, width: { type: 'number', description: 'Window width', }, height: { type: 'number', description: 'Window height', }, }, required: ['appName', 'width', 'height'], }, },
- src/index.js:231-232 (registration)Registration of the set_window_size tool handler in the CallToolRequest switch statement.case 'set_window_size': return await this.setWindowSize(args.appName, args.width, args.height);
- src/index.js:697-709 (helper)Helper function to map application names to System Events process names, used by setWindowSize.getProcessName(appName) { const processMap = { "Visual Studio Code": "Code", "iTerm": "iTerm2", "Safari": "Safari", "Claude": "Claude", "Terminal": "Terminal", "Finder": "Finder", "Chrome": "Google Chrome", "Firefox": "Firefox" }; return processMap[appName] || appName; }