Skip to main content
Glama

search_torrents

Find torrents by searching across multiple sources using qBittorrent's search plugins. Filter results by category including movies, TV shows, music, games, and software.

Instructions

Search for torrents using qBittorrent's search plugins.

Args: query: Search query string plugins: Comma-separated list of plugin names or "all" for all enabled plugins category: Filter by category (all, movies, tv, music, games, anime, software, pictures, books)

Returns: List of search results with torrent information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNoall
pluginsNoall
queryYes

Implementation Reference

  • main.py:40-93 (handler)
    The main handler function for the 'search_torrents' tool. It is registered using the @mcp.tool() decorator and implements the torrent search logic using the qBittorrent API, including starting a search job, waiting for results, formatting them, and cleaning up.
    @mcp.tool() def search_torrents(query: str, plugins: str = "all", category: str = "all") -> list[dict[str, Any]]: """ Search for torrents using qBittorrent's search plugins. Args: query: Search query string plugins: Comma-separated list of plugin names or "all" for all enabled plugins category: Filter by category (all, movies, tv, music, games, anime, software, pictures, books) Returns: List of search results with torrent information """ client = get_qbt_client() # Start search search_job = client.search_start(pattern=query, plugins=plugins, category=category) # Get search job ID search_id = search_job.id # Wait for results (check status until complete or timeout) import time max_wait = 30 # seconds waited = 0 while waited < max_wait: status = client.search_status(search_id=search_id) if status[0].status == "Stopped": break time.sleep(1) waited += 1 # Get results results = client.search_results(search_id=search_id, limit=100) # Stop search client.search_delete(search_id=search_id) # Format results formatted_results = [] for result in results.results: formatted_results.append({ "name": result.fileName, "size": result.fileSize, "size_readable": f"{result.fileSize / (1024**3):.2f} GB", "seeders": result.nbSeeders, "leechers": result.nbLeechers, "url": result.fileUrl, "description_url": result.descrLink, "site": result.siteUrl }) return formatted_results

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jabberjabberjabber/qbit-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server