get_torrent_stats
Retrieve detailed stats and status information for a torrent using its ID or infohash through the rqbit Torrent Client MCP server.
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)MCP tool handler and registration for 'get_torrent_stats'. Fetches torrent stats via RqbitClient and serializes to JSON string, handling errors.@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)
- RqbitClient helper method that performs the HTTP GET request to the rqbit API endpoint for torrent stats.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