get_torrent_stats
Retrieve detailed stats and status of a torrent using its ID or infohash to monitor progress, peers, and download information.
Instructions
Get stats and status for a specific torrent by its ID or infohash.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"torrent_id": "<torrent_id>"
},
"name": "get_torrent_stats"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| torrent_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- rqbit_client/mcp_server.py:54-63 (handler)The MCP tool handler function for 'get_torrent_stats'. It is registered via the @mcp.tool() decorator and delegates to RqbitClient.get_torrent_stats().
@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) - The actual implementation of get_torrent_stats in the RqbitClient class. Makes a GET request to /torrents/{id_or_infohash}/stats/v1 on the rqbit API.
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 - rqbit_client/mcp_server.py:54-55 (registration)Registration of the tool via @mcp.tool() decorator on the async function get_torrent_stats.
@mcp.tool() async def get_torrent_stats(torrent_id: str) -> str: