Skip to main content
Glama
misbahsy

Video & Audio Editing MCP Server

by misbahsy

set_audio_sample_rate

Modify the sample rate of an audio file to a specified value, saving the adjusted file to a designated path. Use this tool to ensure compatibility or optimize audio quality for specific applications.

Instructions

Sets the sample rate for an audio file. Args: input_audio_path: Path to the source audio file. output_audio_path: Path to save the audio file with the new sample rate. sample_rate: Target audio sample rate in Hz (e.g., 44100, 48000). Returns: A status message indicating success or failure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
input_audio_pathYes
output_audio_pathYes
sample_rateYes

Implementation Reference

  • The handler function for the 'set_audio_sample_rate' MCP tool. It uses FFmpeg to resample the audio file to the specified sample rate (via 'ar' parameter) and handles errors gracefully.
    @mcp.tool()
    def set_audio_sample_rate(input_audio_path: str, output_audio_path: str, sample_rate: int) -> str:
        """Sets the sample rate for an audio file.
        Args:
            input_audio_path: Path to the source audio file.
            output_audio_path: Path to save the audio file with the new sample rate.
            sample_rate: Target audio sample rate in Hz (e.g., 44100, 48000).
        Returns:
            A status message indicating success or failure.
        """
        try:
            ffmpeg.input(input_audio_path).output(output_audio_path, ar=sample_rate).run(capture_stdout=True, capture_stderr=True)
            return f"Audio sample rate set to {sample_rate} Hz and saved to {output_audio_path}"
        except ffmpeg.Error as e:
            error_message = e.stderr.decode('utf8') if e.stderr else str(e)
            return f"Error setting audio sample rate: {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?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions that the tool modifies audio files (implied by 'Sets'), but lacks details on permissions, side effects (e.g., file overwriting), error handling, or performance aspects like rate limits. The return statement is generic, offering minimal insight into actual behavior.

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

Conciseness4/5

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

The description is well-structured with sections for Args and Returns, making it easy to parse. It is front-loaded with the core purpose, and each sentence adds value without redundancy. However, the return statement could be more specific, slightly reducing efficiency.

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?

Given no annotations, 0% schema coverage, and no output schema, the description does well on parameters but lacks behavioral and usage context. It covers the basic operation but misses details like file format support, error conditions, or integration with sibling tools, making it minimally adequate but incomplete for a mutation tool.

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?

Schema description coverage is 0%, so the description must compensate fully. It does so by clearly explaining all three parameters: 'input_audio_path' as the source file, 'output_audio_path' as the destination, and 'sample_rate' with units and examples (e.g., 44100 Hz). This adds essential meaning 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's purpose with a specific verb ('Sets') and resource ('sample rate for an audio file'), distinguishing it from siblings like 'set_audio_bitrate' or 'set_audio_channels'. It precisely identifies what the tool does without being vague or tautological.

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. It does not mention sibling tools like 'convert_audio_properties' or 'set_audio_bitrate', nor does it specify prerequisites, constraints, or typical use cases, leaving the agent without context for selection.

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