Skip to main content
Glama
DeveloperZo

MCP Audio Tweaker

by DeveloperZo

batch_process_audio

Process multiple audio files simultaneously by applying operations like normalization, compression, or format conversion to batches in specified directories.

Instructions

Apply audio processing operations to multiple files in a directory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputDirectoryYesDirectory containing input files
outputDirectoryYesDirectory for processed files
filePatternNoGlob pattern for file matching*.{mp3,wav,ogg,flac,m4a,aac}
operationsYesAudio processing operations to apply (same as process_audio_file)
overwriteNoWhether to overwrite existing output files

Implementation Reference

  • MCP tool handler for 'batch_process_audio': parses input schema, delegates to AudioProcessor.batchProcessAudio (with fallback to advanced processor), returns JSON result.
    case 'batch_process_audio': {
      try {
        const input = BatchProcessAudioInputSchema.parse(args);
        const result = await audioProcessor.batchProcessAudio(
          { directory: input.inputDirectory, pattern: input.filePattern },
          { directory: input.outputDirectory },
          input.operations,
          (args as any).overwrite || false
        );
        
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(result, null, 2)
            }
          ]
        };
      } catch (validationError) {
        // If validation fails, try with the advanced processor
        const result = await advancedProcessor.batchProcessAudio(
          { directory: (args as any).inputDirectory, pattern: (args as any).filePattern },
          { directory: (args as any).outputDirectory },
          (args as any).operations,
          (args as any).overwrite || false
        );
        
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(result, null, 2)
            }
          ]
        };
      }
    }
  • Zod input schema for batch_process_audio tool defining inputDirectory, outputDirectory, filePattern, and operations with transformations.
    export const BatchProcessAudioInputSchema = z.object({
      inputDirectory: z.string().min(1),
      outputDirectory: z.string().min(1),
      filePattern: z.string().default('*.{mp3,wav,ogg,flac,m4a,aac}').optional(),
      operations: AudioOperationsSchema
    }).transform((data) => {
      // Transform string values to numbers for format operations
      if (data.operations.format) {
        if (data.operations.format.sampleRate && typeof data.operations.format.sampleRate === 'string') {
          data.operations.format.sampleRate = parseInt(data.operations.format.sampleRate) as any;
        }
        if (data.operations.format.channels && typeof data.operations.format.channels === 'string') {
          data.operations.format.channels = parseInt(data.operations.format.channels) as any;
        }
      }
      return data;
    });
  • Tool registration object for 'batch_process_audio' exported and included in tools list for MCP ListToolsRequest.
     */
    export const batchProcessAudioTool: Tool = {
      name: 'batch_process_audio',
      description: 'Apply audio processing operations to multiple files in a directory',
      inputSchema: {
        type: 'object',
        properties: {
          inputDirectory: {
            type: 'string',
            description: 'Directory containing input files'
          },
          outputDirectory: {
            type: 'string',
            description: 'Directory for processed files'
          },
          filePattern: {
            type: 'string',
            description: 'Glob pattern for file matching',
            default: '*.{mp3,wav,ogg,flac,m4a,aac}'
          },
          operations: {
            type: 'object',
            description: 'Audio processing operations to apply (same as process_audio_file)'
          },
          overwrite: {
            type: 'boolean',
            description: 'Whether to overwrite existing output files',
            default: false
          }
        },
        required: ['inputDirectory', 'outputDirectory', 'operations']
      }
    };
  • Tools array registration including batchProcessAudioTool for MCP server list tools handler.
    export const tools = [
      processAudioFileTool,
      batchProcessAudioTool,
  • Core batchProcessAudio implementation in BaseAudioProcessor: discovers files, queues concurrent FFmpeg processing with operations, handles output paths and errors.
    async batchProcessAudio(
      input: ProcessingInput,
      output: ProcessingOutput,
      operations: AudioOperations,
      overwrite: boolean = false
    ): Promise<BatchProcessingResult> {
      const startTime = Date.now();
      
      try {
        // Find input files
        const inputFiles = await this.findInputFiles(input);
        
        if (inputFiles.length === 0) {
          throw new FFmpegError('No audio files found matching the criteria');
        }
        
        logger.info(`Found ${inputFiles.length} files to process`);
        
        // Process files with concurrency control via PQueue
        const processingPromises = inputFiles.map((inputFile) =>
          this.queue.add(async () => {
            const outputFile = this.generateBatchOutputPath(inputFile, input, output);
            // Create a new command for each file
            const command = createFFmpegCommand(inputFile);
            // Apply operations
            this.applyOperationsToCommand(command, operations);
            // Execute command
            return this.processAudioFile(inputFile, outputFile, operations, overwrite);
          })
        );
    
        const allResults = await Promise.all(processingPromises);
        const results: ProcessingResult[] = allResults.filter((r): r is ProcessingResult => !!r);
        
        const totalProcessingTime = Date.now() - startTime;
        const successfulFiles = results.filter(r => r.success).length;
        const failedFiles = results.length - successfulFiles;
        
        return {
          totalFiles: results.length,
          successfulFiles,
          failedFiles,
          results,
          totalProcessingTime
        };
        
      } catch (error) {
        throw new FFmpegError(`Batch processing failed: ${(error as Error).message}`);
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states 'apply audio processing operations' which implies mutation/write operations, but doesn't disclose critical behaviors like whether it processes files sequentially or in parallel, error handling, progress tracking, or resource usage. The mention of 'overwrite' parameter hints at destructive potential, but this isn't elaborated in the description itself.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded with the core functionality.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a batch processing tool with 5 parameters, nested objects, no annotations, and no output schema, the description is inadequate. It doesn't explain what 'audio processing operations' entail, how results are returned, error behavior, or performance characteristics. The context signals indicate complexity that isn't addressed in the minimal description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 5 parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema (e.g., it doesn't explain the 'operations' object structure or provide examples). Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'apply' and resource 'audio processing operations to multiple files in a directory', which is specific and actionable. However, it doesn't explicitly distinguish this batch processing tool from its sibling 'process_audio_file' (single-file processing), which would be needed for a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'process_audio_file' (for single files) or other audio processing siblings. It mentions 'multiple files in a directory' but doesn't specify thresholds, prerequisites, or exclusions for batch versus single-file processing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/DeveloperZo/mcp-audio-tweaker'

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