get_torrent_stats
Retrieve detailed statistics and status information for a torrent using its ID or infohash to monitor progress and performance.
Instructions
Get stats and status for a specific torrent by its ID or infohash.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| torrent_id | Yes |
Implementation Reference
- rqbit_client/mcp_server.py:54-63 (handler)The primary MCP tool handler for 'get_torrent_stats'. Registered via @mcp.tool() decorator. It takes a torrent_id, fetches stats using the RqbitClient, handles errors, and returns JSON string.@mcp.tool() async def get_torrent_stats(torrent_id: str) -> str: """Get stats and status for a specific torrent by its ID or infohash.""" logger.info(f"Getting stats/status for torrent: {torrent_id}") result = await rqbit_client.get_torrent_stats(torrent_id) if isinstance(result, str): error = f"Error getting torrent stats {torrent_id}: {result}" logger.error(error) return error return dumps(result)
- Helper method in RqbitClient wrapper that performs the actual HTTP request to the rqbit API endpoint /torrents/{id}/stats/v1 to retrieve torrent statistics.async def get_torrent_stats(self, id_or_infohash: str) -> dict[str, Any] | str: """Get stats for a specific torrent.""" return await self._safe_request("GET", f"/torrents/{id_or_infohash}/stats/v1") # type: ignore