start_sim_log_cap
Capture structured logs from a specified iOS simulator and app using UUID and bundle ID. Optional console output capture requires app relaunch. Returns a session ID for log tracking.
Instructions
Starts capturing logs from a specified simulator. Returns a session ID. By default, captures only structured logs.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bundleId | Yes | Bundle identifier of the app to capture logs for. | |
| captureConsole | No | Whether to capture console output (requires app relaunch). | |
| simulatorUuid | Yes | UUID of the simulator to capture logs from (obtained from list_simulators). |
Implementation Reference
- The core handler function `start_sim_log_capLogic` that initiates log capture for the specified simulator and app using the `startLogCapture` utility.export async function start_sim_log_capLogic( params: StartSimLogCapParams, _executor: CommandExecutor = getDefaultCommandExecutor(), logCaptureFunction: typeof startLogCapture = startLogCapture, ): Promise<ToolResponse> { const captureConsole = params.captureConsole ?? false; const { sessionId, error } = await logCaptureFunction( { simulatorUuid: params.simulatorId, bundleId: params.bundleId, captureConsole, }, _executor, ); if (error) { return { content: [createTextContent(`Error starting log capture: ${error}`)], isError: true, }; } return { content: [ createTextContent( `Log capture started successfully. Session ID: ${sessionId}.\n\n${captureConsole ? 'Note: Your app was relaunched to capture console output.' : 'Note: Only structured logs are being captured.'}\n\nNext Steps:\n1. Interact with your simulator and app.\n2. Use 'stop_sim_log_cap' with session ID '${sessionId}' to stop capture and retrieve logs.`, ), ], }; }
- Zod schema defining input parameters for the tool: simulatorId (UUID), bundleId, optional captureConsole.const startSimLogCapSchema = z.object({ simulatorId: z .string() .uuid() .describe('UUID of the simulator to capture logs from (obtained from list_simulators).'), bundleId: z.string().describe('Bundle identifier of the app to capture logs for.'), captureConsole: z .boolean() .optional() .describe('Whether to capture console output (requires app relaunch).'), });
- src/mcp/tools/logging/start_sim_log_cap.ts:60-71 (registration)Default export registering the tool with name, public schema (omitting simulatorId), description, and session-aware handler wrapping the logic function.export default { name: 'start_sim_log_cap', description: 'Starts capturing logs from a specified simulator. Returns a session ID. By default, captures only structured logs.', schema: publicSchemaObject.shape, // MCP SDK compatibility handler: createSessionAwareTool<StartSimLogCapParams>({ internalSchema: startSimLogCapSchema as unknown as z.ZodType<StartSimLogCapParams>, logicFunction: start_sim_log_capLogic, getExecutor: getDefaultCommandExecutor, requirements: [{ allOf: ['simulatorId'], message: 'simulatorId is required' }], }), };