Skip to main content
Glama

load

Load audio files for analysis by extracting time series data with optional offset and duration parameters.

Instructions

Loads an audio file and returns the path to the audio time series Offset and duration are optional, in seconds. Be careful, you will never know the name of the song.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes
offsetNo
durationNo

Implementation Reference

  • The main handler for the 'load' MCP tool. Decorated with @mcp.tool(), it loads an audio file using librosa.load, saves the time series y to a CSV file in temp dir, computes STFT and HPSS but only returns the path to y CSV.
    @mcp.tool()
    def load(
        file_path: str,
        offset: float = 0.0,
        duration: float = None,
    ) -> dict:
        """
        Loads an audio file and returns the path to the audio time series
        Offset and duration are optional, in seconds.
        Be careful, you will never know the name of the song.
        """
        y, sr = librosa.load(path=file_path, offset=offset, duration=duration)
    
        # stock y inside a csv file
        name = file_path.split("/")[-1].split(".")[0] + "_y"
        y_path = os.path.join(tempfile.gettempdir(), name + ".csv")
        np.savetxt(y_path, y, delimiter=";")
    
        D = librosa.stft(y)
        harmonics, percussion = librosa.decompose.hpss(D)
        # Save the harmonic and percussive components to separate files
        # name_harmonic = file_path.split("/")[-1].split(".")[0] + "_harmonic"
        # name_percussive = file_path.split("/")[-1].split(".")[0] + "_percussive"
        # harmonic_path = os.path.join(tempfile.gettempdir(), name_harmonic + ".csv")
        # percussive_path = os.path.join(tempfile.gettempdir(), name_percussive + ".csv")
        # np.savetxt(harmonic_path, harmonics, delimiter=";")
        # np.savetxt(percussive_path, percussion, delimiter=";")
    
        return {
            "y_path": y_path,
            # "y_harmonic_path": harmonic_path,
            # "y_percussive_path": percussive_path,
        }
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses that it loads files and returns a path, and includes a behavioral warning about not identifying song names. However, it lacks details on error handling (e.g., invalid file paths), performance aspects (e.g., file size limits), or output format specifics beyond 'path to audio time series', leaving gaps for a mutation-like tool.

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 appropriately sized with three sentences: the first states the core purpose, the second adds parameter context, and the third provides a critical warning. It's front-loaded with the main action, but the warning could be more integrated; overall, it's efficient with little waste.

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, no output schema, and 3 parameters with 0% schema coverage, the description is moderately complete. It covers the basic operation and key parameters but lacks details on output (beyond 'path'), error cases, or integration with siblings like 'beat_track'. For a tool that likely mutates state (loading files), more behavioral context would improve completeness.

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 0%, so the description must compensate. It adds meaning by explaining that offset and duration are 'optional, in seconds', which clarifies their units and optionality beyond the schema's default values. However, it doesn't detail the 'file_path' parameter (e.g., format or constraints), leaving one of three parameters with minimal semantic enhancement.

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 'loads' and resource 'audio file', specifying it returns 'the path to the audio time series'. It distinguishes from siblings like 'download_from_url' or 'get_duration' by focusing on loading local files for audio processing. However, it doesn't explicitly differentiate from all siblings (e.g., 'mfcc' or 'chroma_cqt' which might also process audio).

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

Usage Guidelines3/5

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

The description implies usage for loading audio files with optional offset/duration, and the warning 'you will never know the name of the song' suggests it's for audio analysis rather than identification. However, it lacks explicit guidance on when to use this versus alternatives like 'download_from_url' for remote files or 'get_duration' for metadata, and doesn't mention prerequisites or exclusions.

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/hugohow/mcp-music-analysis'

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