Skip to main content
Glama
philogicae

Fr Torrent Search MCP Server

get_torrent

Retrieve a torrent's magnet link or file path by its unique ID from YggTorrent or La Cale torrent databases.

Instructions

Get a specific torrent (either magnet link or torrent file path) by id.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
torrent_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler: The @mcp.tool() decorated function that implements the 'get_torrent' tool logic. Calls get_client().get_torrent(torrent_id) and returns the result as a string.
    @mcp.tool()
    def get_torrent(torrent_id: str) -> str:
        """Get a specific torrent (either magnet link or torrent file path) by id."""
        logger.info(f"Getting torrent for: {torrent_id}")
        result = get_client().get_torrent(torrent_id)
        if isinstance(result, bytes):
            return "Received raw bytes, not supported via this tool."
        return result or "Torrent not found"
  • FrTorrentApi.get_torrent(): Aggregator client method that delegates to the appropriate sub-API (YggTorrent or LaCale) based on the torrent_id prefix.
    def get_torrent(self, torrent_id: str, **kwargs) -> str | bytes | None:
        """
        Get a specific torrent by delegating to the appropriate API.
        """
        self.ensure_initialized()
        api = self._get_api_for_id(torrent_id)
        if api:
            return api.get_torrent(torrent_id, **kwargs)
        return None
  • BaseTorrentApi.get_torrent(): Core base class implementation that iterates through modes (FILE, MAGNET, BYTES) calling get_torrent_as() to return the first successful result.
    def get_torrent(self, torrent_id: str, **kwargs) -> str | bytes | None:
        """
        Get a specific torrent.
    
        Args:
            torrent_id: The ID of the torrent.
    
        Returns:
            The .torrent filename, magnet link, .torrent bytes or None.
        """
        for mode in self.order:
            result = self.get_torrent_as(torrent_id, mode, **kwargs)
            if result:
                return result
        return None
  • BaseTorrentApi.get_torrent_as(): Helper that dispatches to download_torrent_file (FILE), get_magnet_link (MAGNET), or download_torrent_file_bytes (BYTES) based on mode.
    def get_torrent_as(
        self, torrent_id: str, mode: Mode | str, **kwargs
    ) -> str | bytes | None:
        """
        Get a specific torrent by mode.
    
        Args:
            torrent_id: The ID of the torrent.
            mode: The mode to use to get the torrent.
    
        Returns:
            The .torrent filename, magnet link, .torrent bytes or None.
        """
        _mode: Mode = Mode(mode) if isinstance(mode, str) else mode
        if _mode not in self.order:
            logger.error(f"Invalid mode: {_mode.value}")
        else:
            try:
                if _mode == Mode.FILE:
                    return self.download_torrent_file(torrent_id, **kwargs)
                elif _mode == Mode.MAGNET:
                    return self.get_magnet_link(torrent_id)
                elif _mode == Mode.BYTES:
                    return self.download_torrent_file_bytes(torrent_id)
            except Exception as e:
                logger.error(
                    f"Failed to get torrent ({_mode.value}) for ID {torrent_id}: {e}"
                )
        return None
  • Registration: The @mcp.tool() decorator on line 65 registers 'get_torrent' as an MCP tool.
    @mcp.tool()
    def get_torrent(torrent_id: str) -> str:
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided so description carries full burden, but it does not disclose behavior such as error handling, read-only nature, or authentication needs. Only states it returns either magnet link or file path.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, efficient and front-loaded with the action and resource. However, lacks detail required for completeness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Minimal information given the output schema exists but not described, and no annotation coverage. Agent would need to infer return type from output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% and description only adds 'by id', which provides no detail on format or constraints of torrent_id parameter.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Uses specific verb 'get' and resource 'specific torrent', distinguishes from siblings like download_torrent_file and get_magnet_link by indicating this tool returns either a magnet link or file path.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use or avoid this tool vs alternatives. Sibling tools are listed but not referenced in the description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/fr-torrent-search-mcp'

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