Skip to main content
Glama

stop_app_device

Stop an app on an Apple device using its device UDID and process ID. Ideal for managing app processes during development or debugging on XcodeBuildMCP.

Instructions

Stops an app running on a physical Apple device (iPhone, iPad, Apple Watch, Apple TV, Apple Vision Pro). Requires deviceId and processId.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deviceIdYesUDID of the device (obtained from list_devices)
processIdYesProcess ID (PID) of the app to stop

Implementation Reference

  • Core handler logic that terminates the app process on the device using xcrun devicectl device process terminate.
    export async function stop_app_deviceLogic(
      params: StopAppDeviceParams,
      executor: CommandExecutor,
    ): Promise<ToolResponse> {
      const { deviceId, processId } = params;
    
      log('info', `Stopping app with PID ${processId} on device ${deviceId}`);
    
      try {
        const result = await executor(
          [
            'xcrun',
            'devicectl',
            'device',
            'process',
            'terminate',
            '--device',
            deviceId,
            '--pid',
            processId.toString(),
          ],
          'Stop app on device',
          true, // useShell
          undefined, // env
        );
    
        if (!result.success) {
          return {
            content: [
              {
                type: 'text',
                text: `Failed to stop app: ${result.error}`,
              },
            ],
            isError: true,
          };
        }
    
        return {
          content: [
            {
              type: 'text',
              text: `✅ App stopped successfully\n\n${result.output}`,
            },
          ],
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        log('error', `Error stopping app on device: ${errorMessage}`);
        return {
          content: [
            {
              type: 'text',
              text: `Failed to stop app on device: ${errorMessage}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Zod schema for input validation: deviceId (string UDID) and processId (number PID).
    const stopAppDeviceSchema = z.object({
      deviceId: z.string().describe('UDID of the device (obtained from list_devices)'),
      processId: z.number().describe('Process ID (PID) of the app to stop'),
    });
  • Default export registering the tool with name, description, schema (without deviceId), and session-aware handler.
    export default {
      name: 'stop_app_device',
      description: 'Stops a running app on a connected device.',
      schema: stopAppDeviceSchema.omit({ deviceId: true } as const).shape,
      handler: createSessionAwareTool<StopAppDeviceParams>({
        internalSchema: stopAppDeviceSchema as unknown as z.ZodType<StopAppDeviceParams>,
        logicFunction: stop_app_deviceLogic,
        getExecutor: getDefaultCommandExecutor,
        requirements: [{ allOf: ['deviceId'], message: 'deviceId is required' }],
      }),
    };
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the action is 'Stops' (implying a destructive/mutative operation) and lists required parameters, but does not disclose behavioral traits such as permission requirements, side effects (e.g., app termination), error conditions, or what happens if the app is already stopped.

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 front-loaded with the core purpose in the first clause, followed by device scope and parameter requirements in a single, efficient sentence. Every word serves a clear purpose with no redundancy.

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 destructive tool with no annotations and no output schema, the description is adequate in stating what it does and required parameters, but lacks completeness regarding behavioral details (e.g., confirmation of stop, error handling) and does not explain return values or side effects.

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 clear descriptions for both parameters in the schema. The description adds minimal value by mentioning the parameters are required but does not provide additional semantic context beyond what the schema already documents.

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

Purpose5/5

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

The description clearly states the specific action ('Stops') and target resource ('an app running on a physical Apple device'), listing all supported device types. It distinguishes from sibling tools like 'stop_app_sim' by specifying 'physical Apple device' versus simulator.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool (stopping apps on physical devices) and mentions prerequisites ('Requires deviceId and processId'), but does not explicitly state when not to use it or name alternatives like 'stop_app_sim' for simulators.

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