list_torrents
View all torrents in the rqbit torrent client to monitor downloads and manage transfers.
Instructions
List all torrents.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- rqbit_client/mcp_server.py:17-25 (handler)The main handler function for the 'list_torrents' MCP tool. It invokes the RqbitClient's list_torrents method, handles errors, and returns the result as a JSON string.@mcp.tool() async def list_torrents() -> str: """List all torrents.""" logger.info("Listing all torrents") result = await rqbit_client.list_torrents() if isinstance(result, str): logger.error(f"Error listing torrents: {result}") return f"Error listing torrents: {result}" return dumps(result)
- Helper method in the RqbitClient wrapper that sends a GET request to '/torrents' endpoint to retrieve the list of torrents.async def list_torrents(self) -> list[dict[str, Any]] | str: """list all torrents.""" return await self._safe_request("GET", "/torrents") # type: ignore
- rqbit_client/mcp_server.py:17-17 (registration)The @mcp.tool() decorator registers the list_torrents function as an MCP tool.@mcp.tool()