Skip to main content
Glama
jabberjabberjabber

qBittorrent MCP Server

download_torrent

Download torrent files using URLs or magnet links, with options to specify save location, assign categories and tags, and control download state.

Instructions

Download a torrent by URL or magnet link.

Args: url: Torrent URL or magnet link save_path: Directory to save the torrent (optional) category: Category to assign to the torrent (optional) tags: Comma-separated tags to assign (optional) paused: Start torrent in paused state (default: False)

Returns: Status information about the download

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNo
pausedNo
save_pathNo
tagsNo
urlYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • main.py:96-152 (handler)
    The handler function decorated with @mcp.tool() that implements the download_torrent tool logic using the qBittorrent API to add torrents by URL or magnet link.
    @mcp.tool()
    def download_torrent(
        url: str,
        save_path: str = None,
        category: str = None,
        tags: str = None,
        paused: bool = False
    ) -> dict[str, Any]:
        """
        Download a torrent by URL or magnet link.
    
        Args:
            url: Torrent URL or magnet link
            save_path: Directory to save the torrent (optional)
            category: Category to assign to the torrent (optional)
            tags: Comma-separated tags to assign (optional)
            paused: Start torrent in paused state (default: False)
    
        Returns:
            Status information about the download
        """
        client = get_qbt_client()
    
        # Prepare options
        options = {}
        if save_path:
            options["savepath"] = save_path
        if category:
            options["category"] = category
        if tags:
            options["tags"] = tags
        if paused:
            options["paused"] = "true"
    
        # Add torrent
        try:
            result = client.torrents_add(urls=url, **options)
    
            if result == "Ok.":
                return {
                    "status": "success",
                    "message": "Torrent added successfully",
                    "url": url
                }
            else:
                return {
                    "status": "error",
                    "message": f"Failed to add torrent: {result}",
                    "url": url
                }
        except Exception as e:
            return {
                "status": "error",
                "message": f"Error adding torrent: {str(e)}",
                "url": url
            }
  • main.py:17-38 (helper)
    Helper function to initialize and return the qBittorrent client instance used by the download_torrent handler.
    def get_qbt_client():
        """Get or create qBittorrent client instance."""
        global qbt_client
    
        if qbt_client is None:
            host = os.getenv("QBITTORRENT_HOST", "http://localhost:8080")
            username = os.getenv("QBITTORRENT_USERNAME", "admin")
            password = os.getenv("QBITTORRENT_PASSWORD", "adminadmin")
    
            qbt_client = qbittorrentapi.Client(
                host=host,
                username=username,
                password=password
            )
    
            try:
                qbt_client.auth_log_in()
            except qbittorrentapi.LoginFailed as e:
                raise Exception(f"Failed to login to qBittorrent: {e}")
    
        return qbt_client
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the 'paused' parameter default but doesn't cover critical aspects like whether this starts an immediate download, requires authentication, has rate limits, what happens if the URL is invalid, or if it overwrites existing files. The return statement is vague ('Status information').

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 well-structured with a clear purpose statement followed by organized Args and Returns sections. It's appropriately sized with no redundant information. The only minor improvement would be integrating the parameter explanations more seamlessly rather than a separate Args block.

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 complexity of a download operation with 5 parameters, no annotations, but an output schema exists, the description is moderately complete. It covers parameters adequately but lacks behavioral context (permissions, errors, side effects). The existence of an output schema means it doesn't need to detail return values, but the vague 'Status information' could be more informative.

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?

With 0% schema description coverage, the description compensates well by explaining all 5 parameters in the Args section, adding meaning beyond the bare schema. It clarifies optional vs required parameters, default values, and basic semantics (e.g., 'tags' as comma-separated). However, it doesn't provide examples or constraints (e.g., URL format).

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 action ('Download a torrent') and the resource ('by URL or magnet link'), making the purpose immediately understandable. However, it doesn't explicitly differentiate this tool from its siblings like 'search_torrents' or 'get_torrent_info', which would require a 5.

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. There's no mention of prerequisites, when not to use it, or how it relates to sibling tools like 'pause_torrent' or 'resume_torrent' that might be used after downloading.

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/jabberjabberjabber/qbit-mcp'

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