Skip to main content
Glama
elevenlabs

ElevenLabs MCP Server

Official
by elevenlabs

play_audio

Play audio files in WAV or MP3 format using the ElevenLabs MCP Server to listen to generated speech or processed audio content.

Instructions

Play an audio file. Supports WAV and MP3 formats.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
input_file_pathYes

Implementation Reference

  • The main execution function for the 'play_audio' MCP tool. It validates the input file path, reads and plays the audio file using an external 'play' function (likely from pydub), and returns a success confirmation message. The @mcp.tool decorator registers it with MCP and provides the tool description serving as schema documentation.
    @mcp.tool(description="Play an audio file. Supports WAV and MP3 formats.")
    def play_audio(input_file_path: str) -> TextContent:
        file_path = handle_input_file(input_file_path)
        play(open(file_path, "rb").read(), use_ffmpeg=False)
        return TextContent(type="text", text=f"Successfully played audio file: {file_path}")
  • Utility function called by play_audio to resolve and validate the input file path. Ensures the file exists, is a file, and (optionally) is an audio/video file by calling check_audio_file.
    def handle_input_file(file_path: str, audio_content_check: bool = True) -> Path:
        if not os.path.isabs(file_path) and not os.environ.get("ELEVENLABS_MCP_BASE_PATH"):
            make_error(
                "File path must be an absolute path if ELEVENLABS_MCP_BASE_PATH is not set"
            )
        path = Path(file_path)
        if not path.exists() and path.parent.exists():
            parent_directory = path.parent
            similar_files = try_find_similar_files(path.name, parent_directory)
            similar_files_formatted = ",".join([str(file) for file in similar_files])
            if similar_files:
                make_error(
                    f"File ({path}) does not exist. Did you mean any of these files: {similar_files_formatted}?"
                )
            make_error(f"File ({path}) does not exist")
        elif not path.exists():
            make_error(f"File ({path}) does not exist")
        elif not path.is_file():
            make_error(f"File ({path}) is not a file")
    
        if audio_content_check and not check_audio_file(path):
            make_error(f"File ({path}) is not an audio or video file")
        return path
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions supported formats (WAV and MP3), which adds useful context beyond the basic action. However, it lacks critical behavioral details such as whether playback is synchronous or asynchronous, error handling for unsupported formats, system requirements, or what happens during execution (e.g., does it block other operations?). For a tool with no annotations, this is insufficient.

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 extremely concise with two sentences that directly convey the core functionality and a key constraint (supported formats). Every word earns its place, and it's front-loaded with the primary action. There is no wasted verbiage or 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?

Given the tool's moderate complexity (playing audio files), no annotations, no output schema, and low schema coverage, the description is minimally adequate. It covers the basic purpose and format support but lacks details on behavior, error cases, or integration context. It meets the bare minimum for a simple tool but leaves gaps that could hinder effective use.

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

Parameters4/5

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

The description adds meaningful context about the parameter by specifying supported formats (WAV and MP3), which helps the agent understand valid inputs for 'input_file_path'. With 0% schema description coverage and only one parameter, this compensation is effective. However, it doesn't detail path requirements (e.g., absolute vs. relative, file existence checks), keeping it from a perfect score.

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 ('Play') and resource ('an audio file'), making the purpose immediately understandable. It distinguishes from siblings like 'text_to_speech' or 'speech_to_text' by focusing on playing existing audio files rather than generating or converting audio. However, it doesn't explicitly differentiate from all siblings (e.g., 'isolate_audio' might also involve audio files).

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 doesn't mention when this tool is appropriate (e.g., for playback of stored files) versus when to use siblings like 'text_to_speech' (for generating speech from text) or 'compose_music' (for creating new audio). There are no exclusions or prerequisites stated.

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/elevenlabs/elevenlabs-mcp'

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