get_torrent_detail
Retrieve comprehensive torrent information including name, size, description, ratings, file count, and seeder/leecher statistics by providing the torrent ID.
Instructions
Get detailed information for a specific torrent by its ID.
Args: torrent_id: The numeric torrent ID (e.g. "1125330").
Returns: A formatted string with full torrent details including name, size, description, ratings, file count, seeder/leecher counts, etc.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| torrent_id | Yes |
Implementation Reference
- mcp_server_mteam/server.py:142-202 (handler)The get_torrent_detail tool implementation, registered via @mcp.tool, which fetches and formats torrent details from the M-Team API.
@mcp.tool def get_torrent_detail(torrent_id: str) -> str: """Get detailed information for a specific torrent by its ID. Args: torrent_id: The numeric torrent ID (e.g. "1125330"). Returns: A formatted string with full torrent details including name, size, description, ratings, file count, seeder/leecher counts, etc. """ url = f"{BASE_URL}/torrent/detail" # detail endpoint accepts form-encoded data (not JSON) detail_headers = {k: v for k, v in _headers().items() if k != "Content-Type"} resp = requests.post(url, data={"id": torrent_id}, headers=detail_headers, timeout=30) resp.raise_for_status() data = resp.json() code = data.get("code") message = data.get("message", "") payload = data.get("data") if payload is None: return f"API error {code}: {message}" item = payload if isinstance(payload, dict) else {} tid = item.get("id", torrent_id) name = item.get("name") or item.get("title") or "(no name)" small_descr = item.get("smallDescr") or "-" size = _format_size(item.get("size")) numfiles = item.get("numfiles", "?") labels = ", ".join(item.get("labelsNew") or []) or "-" imdb = item.get("imdb") or "-" imdb_rating = item.get("imdbRating") or "-" douban = item.get("douban") or "-" douban_rating = item.get("doubanRating") or "-" created = item.get("createdDate", "-") status = item.get("status") or {} seeders = status.get("seeders", "?") leechers = status.get("leechers", "?") times_completed = status.get("timesCompleted", "?") discount = status.get("discount", "-") visible = status.get("visible", True) banned = status.get("banned", False) lines = [ f"Torrent Detail: [{tid}]", "=" * 60, f"Name : {name}", f"Description: {small_descr}", f"Size : {size} ({numfiles} file(s))", f"Labels : {labels}", f"Discount : {discount}", f"Seeders : {seeders} Leechers: {leechers} Completed: {times_completed}", f"Created : {created}", f"Visible : {visible} Banned: {banned}", f"IMDB : {imdb} Rating: {imdb_rating}", f"Douban : {douban} Rating: {douban_rating}", ] return "\n".join(lines)