stop_recording
Ends an active recording on an Android device and saves the captured content to disk for later use or analysis.
Instructions
Stop the active recording and save it to disk.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| recording_id | Yes | Recording ID from start_recording |
Implementation Reference
- Registration of the 'stop_recording' MCP tool.
server.registerTool( 'stop_recording', { description: 'Stop the active recording and save it to disk.', inputSchema: { recording_id: z.string().describe('Recording ID from start_recording'), }, }, async ({ recording_id }) => { const recording = actionRecorder.stopRecording(recording_id); return { content: [{ type: 'text' as const, text: JSON.stringify({ success: true, recording: { id: recording.id, name: recording.name, actionCount: recording.actions.length, }, }, null, 2), }], }; } ); - src/automation/action-recorder.ts:79-100 (handler)Actual implementation of the 'stopRecording' logic that stops the recording and saves it to disk.
stopRecording(recordingId: string): Recording { const recording = this.activeRecordings.get(recordingId); if (!recording) { throw new Error(`No active recording found: ${recordingId}`); } this.activeRecordings.delete(recordingId); // Save to disk const config = getConfig(); const dir = config.recordingsDir; if (!existsSync(dir)) { mkdirSync(dir, { recursive: true }); } const filename = `${recording.name.replace(/[^a-zA-Z0-9_-]/g, '_')}_${recording.id}.json`; const filepath = join(dir, filename); writeFileSync(filepath, JSON.stringify(recording, null, 2), 'utf-8'); log.info('Recording saved', { id: recordingId, filepath, actionCount: recording.actions.length }); return recording; }