Skip to main content
Glama

get_torrent_info

Retrieve detailed information about torrents in qBittorrent, including download status, progress, and file details for specific torrents or all active downloads.

Instructions

Get information about torrents in qBittorrent.

Args: torrent_hash: Specific torrent hash to get info for (optional, returns all if not provided)

Returns: List of torrent information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
torrent_hashNo

Implementation Reference

  • main.py:154-192 (handler)
    The handler function for the 'get_torrent_info' MCP tool. It fetches torrent details from qBittorrent client (specific torrent or all), formats the data, and returns a list of torrent info dictionaries. Registered via the @mcp.tool() decorator.
    @mcp.tool() def get_torrent_info(torrent_hash: str = None) -> list[dict[str, Any]]: """ Get information about torrents in qBittorrent. Args: torrent_hash: Specific torrent hash to get info for (optional, returns all if not provided) Returns: List of torrent information """ client = get_qbt_client() if torrent_hash: torrents = client.torrents_info(torrent_hashes=torrent_hash) else: torrents = client.torrents_info() result = [] for torrent in torrents: result.append({ "hash": torrent.hash, "name": torrent.name, "size": torrent.size, "size_readable": f"{torrent.size / (1024**3):.2f} GB", "progress": f"{torrent.progress * 100:.2f}%", "state": torrent.state, "download_speed": f"{torrent.dlspeed / (1024**2):.2f} MB/s", "upload_speed": f"{torrent.upspeed / (1024**2):.2f} MB/s", "eta": torrent.eta, "seeders": torrent.num_seeds, "leechers": torrent.num_leechs, "ratio": torrent.ratio, "category": torrent.category, "tags": torrent.tags, "save_path": torrent.save_path }) return result
  • main.py:17-38 (helper)
    Helper function to initialize and return the qBittorrent client instance, used by get_torrent_info and other tools.
    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

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