close_window
Close a window on Linux by specifying its title pattern, using the window manager's graceful close hint.
Instructions
Request a window matching the given title pattern to close (gracefully, via the WM close hint).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title_pattern | Yes |
Implementation Reference
- server.js:210-217 (handler)The 'closeWindow' async function that executes the close_window tool logic. It uses wmctrl -c to send a close request to a window matching the given title_pattern.
async function closeWindow(args) { const missing = requireBin('wmctrl'); if (missing) return errorResult(missing); if (!args.title_pattern) return errorResult('title_pattern is required'); const r = await run(BIN.wmctrl, ['-c', args.title_pattern]); if (r.code !== 0) return errorResult(`close_window failed: ${r.stderr || r.stdout || 'unknown'}`); return textResult({ matched: args.title_pattern, close_requested: true }); } - server.js:429-438 (schema)Tool definition and input schema for close_window, specifying title_pattern as a required string input and including a destructiveHint annotation.
{ name: 'close_window', description: 'Request a window matching the given title pattern to close (gracefully, via the WM close hint).', annotations: { title: 'Close window', destructiveHint: true }, inputSchema: { type: 'object', properties: { title_pattern: { type: 'string' } }, required: ['title_pattern'], }, }, - server.js:558-558 (registration)Registration entry mapping the tool name 'close_window' to the closeWindow handler function in the HANDLERS map.
close_window: closeWindow,