Skip to main content
Glama
misbahsy

Video & Audio Editing MCP Server

by misbahsy

convert_audio_properties

Transform audio files by converting formats, adjusting bitrate, sample rate, and channels for precise customization in audio editing workflows.

Instructions

Converts audio file format and ALL specified properties like bitrate, sample rate, and channels.

Args: input_audio_path: Path to the source audio file. output_audio_path: Path to save the converted audio file. target_format: Desired output audio format (e.g., 'mp3', 'wav', 'aac'). bitrate: Target audio bitrate (e.g., '128k', '192k'). Optional. sample_rate: Target audio sample rate in Hz (e.g., 44100, 48000). Optional. channels: Number of audio channels (1 for mono, 2 for stereo). Optional. Returns: A status message indicating success or failure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bitrateNo
channelsNo
input_audio_pathYes
output_audio_pathYes
sample_rateNo
target_formatYes

Implementation Reference

  • The primary handler function implementing the 'convert_audio_properties' tool logic using FFmpeg to adjust audio format, bitrate, sample rate, and channels. The @mcp.tool() decorator handles both implementation and registration in FastMCP, with type hints providing the input schema.
    @mcp.tool()
    def convert_audio_properties(input_audio_path: str, output_audio_path: str, target_format: str, 
                                   bitrate: str = None, sample_rate: int = None, channels: int = None) -> str:
        """Converts audio file format and ALL specified properties like bitrate, sample rate, and channels.
    
        Args:
            input_audio_path: Path to the source audio file.
            output_audio_path: Path to save the converted audio file.
            target_format: Desired output audio format (e.g., 'mp3', 'wav', 'aac').
            bitrate: Target audio bitrate (e.g., '128k', '192k'). Optional.
            sample_rate: Target audio sample rate in Hz (e.g., 44100, 48000). Optional.
            channels: Number of audio channels (1 for mono, 2 for stereo). Optional.
        Returns:
            A status message indicating success or failure.
        """
        try:
            stream = ffmpeg.input(input_audio_path)
            kwargs = {}
            if bitrate: 
                kwargs['audio_bitrate'] = bitrate
            if sample_rate: 
                kwargs['ar'] = sample_rate
            if channels: 
                kwargs['ac'] = channels
            kwargs['format'] = target_format
    
            output_stream = stream.output(output_audio_path, **kwargs)
            output_stream.run(capture_stdout=True, capture_stderr=True)
            return f"Audio converted successfully to {output_audio_path} with format {target_format} and specified properties."
        except ffmpeg.Error as e:
            error_message = e.stderr.decode('utf8') if e.stderr else str(e)
            return f"Error converting audio properties: {error_message}"
        except FileNotFoundError:
            return f"Error: Input audio file not found at {input_audio_path}"
        except Exception as e:
            return f"An unexpected error occurred: {str(e)}"
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the tool 'converts' which implies mutation/write operations, but doesn't disclose behavioral traits like whether it overwrites existing files, requires specific permissions, handles errors, or has performance/rate limits. The return value is mentioned but lacks detail on success/failure conditions.

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 well-structured and appropriately sized. The first sentence clearly states the purpose, followed by organized sections for Args and Returns with bullet-like clarity. Every sentence earns its place by providing essential information without redundancy.

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

Completeness3/5

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

For a mutation tool with 6 parameters, 0% schema coverage, no annotations, and no output schema, the description does well on parameters but lacks behavioral context. It explains what the tool does and parameters thoroughly, but doesn't cover important aspects like file handling behavior, error conditions, or performance characteristics that would be needed for safe invocation.

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

Parameters5/5

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

With 0% schema description coverage, the description fully compensates by providing clear semantics for all 6 parameters. It explains each parameter's purpose, gives examples (e.g., 'mp3', '128k', 44100), indicates optionality, and clarifies numeric meanings (e.g., '1 for mono, 2 for stereo'). This adds significant value beyond the bare schema.

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

Purpose5/5

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

The description clearly states the tool converts audio file format and properties like bitrate, sample rate, and channels. It uses specific verbs ('converts') and resources ('audio file'), and distinguishes from sibling tools like 'convert_audio_format' (which likely only changes format) and individual property setters like 'set_audio_bitrate'.

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

Usage Guidelines4/5

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

The description implies usage for comprehensive audio conversion with multiple properties, suggesting it's appropriate when format AND specific audio properties need adjustment. However, it doesn't explicitly state when NOT to use it or name alternatives like 'convert_audio_format' for format-only changes or individual property setters for single adjustments.

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

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/misbahsy/video-audio-mcp'

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