Skip to main content
Glama

list_output_files

Retrieve saved audio files and associated metadata from the output directory for organized access and management of text-to-speech synthesis results.

Instructions

List saved audio files in the output directory with metadata

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "properties": {}, "type": "object" }

Implementation Reference

  • The handler function in AdvancedTTSServer class that executes the tool logic: reads the output directory, filters for supported audio formats (wav, mp3, flac, ogg), retrieves file stats, and returns sorted list with metadata.
    async listOutputFiles() { try { const files = await fs.readdir(this.outputDir); const audioFiles = files.filter(file => AudioFormats.some(format => file.endsWith(`.${format}`)) ); const fileInfo = await Promise.all( audioFiles.map(async (file) => { const filePath = join(this.outputDir, file); const stats = await fs.stat(filePath); return { filename: file, path: filePath, size: stats.size, created: stats.birthtime.toISOString(), modified: stats.mtime.toISOString(), format: file.split('.').pop() }; }) ); return { success: true, files: fileInfo.sort((a, b) => new Date(b.modified).getTime() - new Date(a.modified).getTime() ), totalFiles: fileInfo.length, outputDirectory: this.outputDir }; } catch (error) { return { success: false, error: `Failed to list files: ${error}` }; } }
  • Registers the 'list_output_files' tool in the server's listTools response, including name, description, and input schema (no required parameters).
    name: 'list_output_files', description: 'List saved audio files in the output directory with metadata', inputSchema: { type: 'object', properties: {}, }, },
  • Defines the input schema for the tool: an empty object since no parameters are required.
    type: 'object', properties: {}, },
  • MCP server request handler that calls the listOutputFiles method and formats the response content for the tool call, including error handling and rich text formatting.
    case 'list_output_files': const fileList = await ttsServer.listOutputFiles(); if (fileList.success) { const files = fileList.files?.map(f => `**${f.filename}** (${(f.size / 1024).toFixed(1)}KB) - ${f.format?.toUpperCase()}` ).join('\n'); return { content: [ { type: 'text', text: `🎙️ **Output Files (${fileList.totalFiles})**\n\n` + `**Directory:** ${fileList.outputDirectory}\n\n` + `${files || 'No audio files found'}`, }, ], }; } else { return { content: [ { type: 'text', text: `❌ **Error:** ${fileList.error}`, }, ], }; }

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/samihalawa/advanced-tts-mcp'

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