delete_torrent
Remove torrents from qBittorrent client with option to delete associated downloaded files, freeing up storage space and managing download queue.
Instructions
Delete a torrent from qBittorrent.
Args: torrent_hash: Hash of the torrent to delete delete_files: Also delete downloaded files (default: False)
Returns: Status message
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| delete_files | No | ||
| torrent_hash | Yes |
Implementation Reference
- main.py:260-282 (handler)The delete_torrent tool handler, decorated with @mcp.tool() for registration, implements deletion of a torrent from qBittorrent, optionally deleting files, using the qBittorrent client.@mcp.tool() def delete_torrent(torrent_hash: str, delete_files: bool = False) -> dict[str, str]: """ Delete a torrent from qBittorrent. Args: torrent_hash: Hash of the torrent to delete delete_files: Also delete downloaded files (default: False) Returns: Status message """ client = get_qbt_client() try: client.torrents_delete(delete_files=delete_files, torrent_hashes=torrent_hash) return { "status": "success", "message": f"Torrent {torrent_hash} deleted (files deleted: {delete_files})" } except Exception as e: return {"status": "error", "message": str(e)}