Skip to main content
Glama

get_torrent_details

Retrieve detailed information about a specific torrent, including optional magnet link, using the YggTorrent MCP Server for secure, programmatic access.

Instructions

Get details about a specific torrent.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
torrent_idYes
with_magnet_linkNo

Implementation Reference

  • MCP tool handler and registration for 'get_torrent_details'. This function handles the tool call, logs the request, fetches details using the YggTorrentApi, and returns the torrent details as a string or 'Torrent not found'.
    @mcp.tool()
    def get_torrent_details(torrent_id: int) -> str | None:
        """Get details from YggTorrent about a specific torrent by id."""
        logger.info(f"Getting details for torrent: {torrent_id}")
        torrent: Torrent | None = ygg_api.get_torrent_details(
            torrent_id, with_magnet_link=True
        )
        return str(torrent) if torrent else "Torrent not found"
  • Core helper function in YggTorrentApi class that implements the API call to retrieve torrent details from YggTorrent, optionally including magnet link, and formats the response into a Torrent object.
    def get_torrent_details(
        self, torrent_id: int, with_magnet_link: bool = False
    ) -> Torrent | None:
        """
        Get details about a specific torrent.
        Corresponds to GET /torrent/{torrent_id}
    
        Args:
            torrent_id: The ID of the torrent.
    
        Returns:
            Detailed torrent result.
        """
        if torrent_id < 1:
            print("torrent_id must be >= 1")
            return None
        resp = self._request("GET", f"torrent/{torrent_id}")
        if not resp:
            print("Failed to get torrent details")
            return None
        torrent = format_torrent(resp, torrent_id)
        if with_magnet_link:
            torrent.magnet_link = self.get_magnet_link(torrent_id)
        return torrent
Install Server

Other Tools

Related Tools

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/philogicae/ygg-torrent-mcp'

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