Is App Running
is_app_runningCheck whether an application, such as 'Safari', is currently running on macOS.
Instructions
Check whether an application is currently running.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Application name to check (e.g. 'Safari') |
Implementation Reference
- src/system/tools.ts:623-640 (registration)Registers the 'is_app_running' tool with an MCP server, including input schema (name string) and handler that calls isAppRunningScript via JXA.
server.registerTool( "is_app_running", { title: "Is App Running", description: "Check whether an application is currently running. Returns process details if found.", inputSchema: { name: z.string().min(1).max(500).describe("Application name to check (e.g. 'Safari')"), }, annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false }, }, async ({ name }) => { try { return ok(await runJxa(isAppRunningScript(name))); } catch (e) { return errJxaFor("check app running", e); } }, ); - src/system/tools.ts:633-639 (handler)Async handler function that runs the JXA script to check if an app is running, returning the result or an error.
async ({ name }) => { try { return ok(await runJxa(isAppRunningScript(name))); } catch (e) { return errJxaFor("check app running", e); } }, - src/system/tools.ts:628-631 (schema)Input schema for the tool: 'name' (string, 1-500 chars) describing the application name to check.
inputSchema: { name: z.string().min(1).max(500).describe("Application name to check (e.g. 'Safari')"), }, annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false }, - src/system/scripts.ts:323-334 (helper)Generates a JXA script string that uses System Events to check if an application process is running, returning running status, name, bundle ID, PID, and visibility.
export function isAppRunningScript(name: string): string { return ` const se = Application('System Events'); const procs = se.processes.whose({name: '${esc(name)}'})(); if (procs.length > 0) { const p = procs[0]; JSON.stringify({running: true, name: p.name(), bundleIdentifier: p.bundleIdentifier(), pid: p.unixId(), visible: p.visible()}); } else { JSON.stringify({running: false, name: '${esc(name)}'}); } `; } - docs/app.js:240-240 (registration)Documentation entry listing the 'is_app_running' tool with description 'Check app' and type 'read'.
{ name: 'is_app_running', desc: 'Check app', type: 'read' },