get_torrent_details
Fetch detailed information about a specific torrent by its ID or infohash, including metadata and current status.
Instructions
Get details for a specific torrent by its ID or infohash.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| torrent_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- rqbit_client/mcp_server.py:42-51 (registration)MCP tool registration via @mcp.tool() decorator — 'get_torrent_details' tool is registered as an MCP tool with input parameter 'torrent_id' (str)
@mcp.tool() async def get_torrent_details(torrent_id: str) -> str: """Get details for a specific torrent by its ID or infohash.""" logger.info(f"Getting details for torrent: {torrent_id}") result = await rqbit_client.get_torrent_details(torrent_id) if isinstance(result, str): error = f"Error getting torrent details {torrent_id}: {result}" logger.error(error) return error return dumps(result) - rqbit_client/mcp_server.py:42-51 (handler)Handler function that calls rqbit_client.get_torrent_details() and returns JSON result or error string
@mcp.tool() async def get_torrent_details(torrent_id: str) -> str: """Get details for a specific torrent by its ID or infohash.""" logger.info(f"Getting details for torrent: {torrent_id}") result = await rqbit_client.get_torrent_details(torrent_id) if isinstance(result, str): error = f"Error getting torrent details {torrent_id}: {result}" logger.error(error) return error return dumps(result) - rqbit_client/mcp_server.py:43-43 (schema)Input schema: single parameter 'torrent_id: str' for the get_torrent_details MCP tool
async def get_torrent_details(torrent_id: str) -> str: - Helper method in RqbitClient class — sends GET request to '/torrents/{id_or_infohash}' via _safe_request, returns dict or error string
async def get_torrent_details(self, id_or_infohash: str) -> dict[str, Any] | str: """Get details for a specific torrent.""" return await self._safe_request("GET", f"/torrents/{id_or_infohash}") # type: ignore - rqbit_client/wrapper/client.py:78-82 (helper)_safe_request helper — wraps _request with error handling, returns parsed response or error string
async def _safe_request(self, method: str, path: str, **kwargs) -> Any | str | None: try: return await self._request(method, path, **kwargs) except RqbitHTTPError as e: return str(e)