Skip to main content
Glama
philogicae

rqbit Torrent Client MCP

download_torrent

Download torrents using magnet links, HTTP URLs, or local files with the rqbit Torrent Client MCP for simplified torrent retrieval.

Instructions

Download a torrent from a magnet link, HTTP URL, or local file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
magnet_link_or_url_or_pathYes

Implementation Reference

  • The main handler function for the 'download_torrent' MCP tool. It is decorated with @mcp.tool() for automatic registration and handles the tool execution by delegating to RqbitClient.add_torrent and serializing the result to JSON.
    @mcp.tool() async def download_torrent(magnet_link_or_url_or_path: str) -> str: """Download a torrent from a magnet link, HTTP URL, or local file.""" logger.info( f"Downloading torrent from magnet link/HTTP URL/local file: {magnet_link_or_url_or_path}" ) result = await rqbit_client.add_torrent(magnet_link_or_url_or_path) if isinstance(result, str): error = f"Error downloading torrent {magnet_link_or_url_or_path}: {result}" logger.error(error) return error return dumps(result)
  • Supporting method in RqbitClient that implements the core logic of adding a torrent by making HTTP POST requests to the rqbit server API, handling different input types (magnet, URL, local file). Called by the tool handler.
    async def add_torrent( self, url_or_path: str, content: bytes | None = None ) -> dict[str, Any] | str: """Add a torrent from a magnet, HTTP URL, or local file.""" url = "/torrents?&overwrite=true" if url_or_path.startswith("http"): url += "&is_url=true" if content: return await self._safe_request("POST", url, content=content) # type: ignore if os.path.exists(url_or_path): try: with open(url_or_path, "rb") as f: return await self._safe_request("POST", url, content=f.read()) # type: ignore except FileNotFoundError: return f"Error: File not found at {url_or_path}" except IOError as e: return f"Error reading file {url_or_path}: {e}" return await self._safe_request("POST", url, content=url_or_path) # type: ignore

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/philogicae/rqbit-mcp'

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