Skip to main content
Glama

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
NameRequiredDescriptionDefault
recording_idYesRecording 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),
          }],
        };
      }
    );
  • 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;
    }

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/divineDev-dotcom/android_mcp'

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