resume_torrent
Resume paused torrent downloads in qBittorrent using the torrent hash to continue interrupted downloads and complete file transfers.
Instructions
Resume a paused torrent.
Args: torrent_hash: Hash of the torrent to resume
Returns: Status message
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| torrent_hash | Yes |
Implementation Reference
- main.py:241-257 (handler)The main handler function for the 'resume_torrent' tool, decorated with @mcp.tool() to register it. It resumes the specified torrent using the qBittorrent client's torrents_resume method and returns a status dictionary.def resume_torrent(torrent_hash: str) -> dict[str, str]: """ Resume a paused torrent. Args: torrent_hash: Hash of the torrent to resume Returns: Status message """ client = get_qbt_client() try: client.torrents_resume(torrent_hashes=torrent_hash) return {"status": "success", "message": f"Torrent {torrent_hash} resumed"} except Exception as e: return {"status": "error", "message": str(e)}
- main.py:17-38 (helper)Helper function to get or initialize the qBittorrent client instance, used by the resume_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