Skip to main content
Glama

stop_mac_app

Stops a running macOS application by specifying its name or process ID, ensuring precise control over app termination on the XcodeBuildMCP server.

Instructions

Stops a running macOS application. Can stop by app name or process ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
appNameNoName of the application to stop (e.g., "Calculator" or "MyApp")
processIdNoProcess ID (PID) of the application to stop

Implementation Reference

  • The main handler function stop_mac_appLogic that implements the tool logic: validates params, constructs shell command to kill by PID or app name using pkill/osascript, executes via executor, handles errors and returns ToolResponse.
    export async function stop_mac_appLogic(
      params: StopMacAppParams,
      executor: CommandExecutor,
    ): Promise<ToolResponse> {
      if (!params.appName && !params.processId) {
        return {
          content: [
            {
              type: 'text',
              text: 'Either appName or processId must be provided.',
            },
          ],
          isError: true,
        };
      }
    
      log(
        'info',
        `Stopping macOS app: ${params.processId ? `PID ${params.processId}` : params.appName}`,
      );
    
      try {
        let command: string[];
    
        if (params.processId) {
          // Stop by process ID
          command = ['kill', String(params.processId)];
        } else {
          // Stop by app name - use shell command with fallback for complex logic
          command = [
            'sh',
            '-c',
            `pkill -f "${params.appName}" || osascript -e 'tell application "${params.appName}" to quit'`,
          ];
        }
    
        await executor(command, 'Stop macOS App');
    
        return {
          content: [
            {
              type: 'text',
              text: `✅ macOS app stopped successfully: ${params.processId ? `PID ${params.processId}` : params.appName}`,
            },
          ],
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        log('error', `Error stopping macOS app: ${errorMessage}`);
        return {
          content: [
            {
              type: 'text',
              text: `❌ Stop macOS app operation failed: ${errorMessage}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Zod schema defining the input parameters for the tool: optional appName (string) or processId (number).
    const stopMacAppSchema = z.object({
      appName: z
        .string()
        .optional()
        .describe('Name of the application to stop (e.g., "Calculator" or "MyApp")'),
      processId: z.number().optional().describe('Process ID (PID) of the application to stop'),
    });
  • Tool registration as default export, providing name, description, schema, and handler created via createTypedTool wrapping stop_mac_appLogic.
    export default {
      name: 'stop_mac_app',
      description: 'Stops a running macOS application. Can stop by app name or process ID.',
      schema: stopMacAppSchema.shape, // MCP SDK compatibility
      handler: createTypedTool(stopMacAppSchema, stop_mac_appLogic, getDefaultCommandExecutor),
    };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states the action ('stops') but doesn't describe what 'stop' means (force quit? graceful termination?), whether it requires admin permissions, potential side effects, or error behavior. The description provides basic operational context but lacks critical behavioral details for a destructive operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly concise - two sentences that directly state the tool's purpose and parameter options with zero wasted words. It's front-loaded with the core functionality and efficiently communicates essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool that performs a potentially destructive operation (stopping applications) with no annotations and no output schema, the description is minimally adequate. It covers what the tool does and parameter options, but lacks critical context about behavioral consequences, permissions, error handling, and return values that would be necessary for safe and effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with both parameters clearly documented in the schema. The description adds minimal value beyond the schema by mentioning the two identification methods, but doesn't provide additional context about parameter usage, exclusivity, or validation rules. Baseline 3 is appropriate given complete schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('stops') and resource ('a running macOS application'), making the purpose immediately understandable. It distinguishes from sibling tools like 'stop_app_device' and 'stop_app_sim' by specifying macOS rather than device/simulator targets. However, it doesn't explicitly differentiate from 'swift_package_stop' which might also stop macOS processes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context by specifying 'macOS application' and providing two identification methods (app name or PID), but doesn't explicitly state when to use this versus alternatives like 'stop_app_device' or 'stop_app_sim'. No guidance on prerequisites, permissions, or error conditions is provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/getsentry/XcodeBuildMCP'

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