Skip to main content
Glama

download_from_url

Download a file from a specified URL using this tool, which retrieves and returns the file path for further audio analysis on the MCP server. Input only the URL to proceed.

Instructions

Downloads a file from a given URL and returns the path to the downloaded file. Be careful, you will never know the name of the song.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes

Implementation Reference

  • The handler function decorated with @mcp.tool() that implements the logic to download an audio file from a URL, validate it's mp3 or wav, save to temp directory, and return the path.
    @mcp.tool() def download_from_url(url: str) -> str: """ Downloads a file from a given URL and returns the path to the downloaded file. Be careful, you will never know the name of the song. """ # mettre une exception si ce n'est pas un fichier audio ! if not url.endswith(".mp3") and not url.endswith(".wav"): raise ValueError(f"URL: {url} is not a valid audio file") response = requests.get(url) if response.status_code == 200: file_path = os.path.join(tempfile.gettempdir(), "downloaded_file") with open(file_path, "wb") as file: file.write(response.content) return file_path else: raise ValueError(f"Failed to download file from URL: {url}")

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

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