Skip to main content
Glama

get_latest_audio

Retrieve the most recent audio file from the audio directory to access the newest recording without manual searching.

Instructions

Get the most recent audio file from the audio path. ONLY USE THIS IF THE USER ASKS FOR THE LATEST FILE.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_nameYesName of the audio file
transcription_supportNoList of transcription models that support this file format
chat_supportNoList of audio LLM models that support this file format
modified_timeYesLast modified timestamp of the file (Unix time)
size_bytesYesSize of the file in bytes
formatYesAudio format of the file (e.g., 'mp3', 'wav')
duration_secondsNoDuration of the audio file in seconds, if available

Implementation Reference

  • The MCP tool handler for 'get_latest_audio' — decorated with @mcp.tool inside create_file_tools(), calls file_service.get_latest_audio_file().
    @mcp.tool(
        description="Get the most recent audio file from the audio path. "
        "ONLY USE THIS IF THE USER ASKS FOR THE LATEST FILE."
    )
    async def get_latest_audio() -> FilePathSupportParams:
        """Get the most recently modified audio file and returns its path with model support info.
    
        Supported formats:
        - Whisper: mp3, mp4, mpeg, mpga, m4a, wav, webm
        - GPT-4o: mp3, wav
    
        Returns detailed file information including size, format, and duration.
        """
        return await file_service.get_latest_audio_file()
  • Registration of the get_latest_audio tool via create_file_tools() which is called by register_all_tools() in tools/__init__.py.
    def create_file_tools(mcp: MCPServer) -> None:
        """Register file management tools with the MCP server.
    
        Args:
        ----
            mcp: FastMCP server instance.
    
        """
        # Initialize services
        audio_path = check_and_get_audio_path()
        file_repo = FileSystemRepository(audio_path)
        file_service = FileService(file_repo)
    
        @mcp.tool(
            description="Get the most recent audio file from the audio path. "
            "ONLY USE THIS IF THE USER ASKS FOR THE LATEST FILE."
        )
        async def get_latest_audio() -> FilePathSupportParams:
            """Get the most recently modified audio file and returns its path with model support info.
    
            Supported formats:
            - Whisper: mp3, mp4, mpeg, mpga, m4a, wav, webm
            - GPT-4o: mp3, wav
    
            Returns detailed file information including size, format, and duration.
            """
            return await file_service.get_latest_audio_file()
  • FileService.get_latest_audio_file() — service layer that delegates to the repository's get_latest_audio_file().
    async def get_latest_audio_file(self) -> FilePathSupportParams:
        """Get the most recently modified audio file with model support info.
    
        Returns
        -------
            FilePathSupportParams: File metadata and model support information.
    
        """
        return await self.file_repo.get_latest_audio_file()
  • FileSystemRepository.get_latest_audio_file() — the actual implementation that iterates files, filters by supported formats, finds the most recently modified one, and returns metadata via get_audio_file_support().
    async def get_latest_audio_file(self) -> FilePathSupportParams:
        """Get the most recently modified audio file with model support info.
    
        Supported formats:
        - Whisper: mp3, mp4, mpeg, mpga, m4a, wav, webm
        - GPT-4o: mp3, wav
    
        Returns
        -------
            FilePathSupportParams: File metadata and model support information.
    
        Raises
        ------
            AudioFileNotFoundError: If no supported audio files are found.
            AudioFileError: If there's an error accessing audio files.
    
        """
        try:
            files = []
            for file_path in self.audio_files_path.iterdir():
                if not file_path.is_file():
                    continue
    
                file_ext = file_path.suffix.lower()
                if file_ext in TRANSCRIBE_AUDIO_FORMATS or file_ext in CHAT_WITH_AUDIO_FORMATS:
                    files.append((file_path, file_path.stat().st_mtime))
    
            if not files:
                raise AudioFileNotFoundError("No supported audio files found")
    
            latest_file = max(files, key=lambda x: x[1])[0]
            return await self.get_audio_file_support(latest_file)
    
        except AudioFileNotFoundError:
            raise
        except Exception as e:
            raise AudioFileError(f"Failed to get latest audio file: {e}") from e
Behavior2/5

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

No annotations are provided, so the description must disclose behavioral traits. It only states 'from the audio path' without defining the path, how 'most recent' is determined, or what the output format is. This lacks sufficient detail for an agent to understand the tool's behavior.

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, no wasted words, and a clear directive. Every sentence adds value.

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?

The tool has no parameters and an output schema (unknown content). The description is minimal and lacks context about the 'audio path' and how the latest is determined. While simple, it leaves gaps for an agent that may need more context about the environment.

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?

There are no parameters, so schema coverage is 100%. The description does not need to add param info, and the baseline for no parameters is 4. No additional semantics are required.

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 retrieves the most recent audio file, using specific verb 'get' and resource. It differentiates from sibling tools by specifying a unique action (getting the latest file) and includes an explicit usage condition.

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

Usage Guidelines5/5

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

The description explicitly provides a usage guideline: 'ONLY USE THIS IF THE USER ASKS FOR THE LATEST FILE.' This tells the agent exactly when to invoke the tool and implicitly when not to, which is sufficient for decision-making.

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/arcaputo3/mcp-server-whisper'

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