Skip to main content
Glama

list_recordings

Browse and manage recorded web sessions by listing available .webm and .gif files in your recordings directory for easy access and organization.

Instructions

List all .webm and .gif recordings in the output directory.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directoryNoDirectory to list (default: ./recordings)

Implementation Reference

  • The core handler function that lists recordings in a directory.
    export async function listRecordings(dir) {
      try {
        await access(dir);
      } catch {
        return [];
      }
    
      const files = await readdir(dir);
      const recordings = [];
    
      for (const file of files) {
        if (file.endsWith('.webm') || file.endsWith('.gif') || file.endsWith('.mp4')) {
          const filePath = join(dir, file);
          const fileStat = await stat(filePath);
          recordings.push({
            name: file,
            path: filePath,
            type: file.endsWith('.gif') ? 'gif' : file.endsWith('.mp4') ? 'mp4' : 'webm',
            sizeBytes: fileStat.size,
            sizeMB: (fileStat.size / 1024 / 1024).toFixed(2),
            createdAt: fileStat.mtime.toISOString()
          });
        }
      }
    
      return recordings.sort((a, b) => b.createdAt.localeCompare(a.createdAt));
    }
  • src/index.js:176-195 (registration)
    Registration of the 'list_recordings' tool and its MCP invocation handler.
    // Tool 7: List recordings
    mcp.tool(
      'list_recordings',
      'List all .webm and .gif recordings in the output directory.',
      {
        directory: z.string().optional().describe('Directory to list (default: ./recordings)')
      },
      async ({ directory }) => {
        try {
          const dir = directory || process.env.RECORDING_OUTPUT_DIR || './recordings';
          const recordings = await listRecordings(dir);
          if (recordings.length === 0) {
            return { content: [{ type: 'text', text: `No recordings found in ${dir}` }] };
          }
          const list = recordings.map(r => `${r.name} (${r.type}, ${r.sizeMB} MB, ${r.createdAt})`).join('\n');
          return { content: [{ type: 'text', text: `Recordings in ${dir}:\n\n${list}` }] };
        } catch (err) {
          return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true };
        }
      }

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/mcpware/pagecast'

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