get_c411_torrent_comments
Retrieve user comments for torrents on c411.org by providing the torrent's infoHash, enabling community feedback review.
Instructions
Get comments for a c411.org torrent by its infoHash.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| infoHash | Yes | The 40-character hex infoHash of the torrent | |
| page | No | Comment page number. Defaults to 1. | |
| limit | No | Number of comments per page. Defaults to 20. |
Output Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | Yes | ||
| error | No | ||
| limit | Yes | ||
| total | No | ||
| comments | Yes | ||
| infoHash | Yes | ||
| totalPages | No | ||
| resultCount | Yes |
Implementation Reference
- src/c411-client.ts:397-421 (handler)The implementation of the getTorrentComments method that fetches comments for a c411 torrent.
async getTorrentComments(infoHash: string, page = 1, limit = 20): Promise<TorrentCommentsPage> { if (!infoHash || !/^[a-fA-F0-9]{40}$/.test(infoHash)) { throw new Error('Invalid infoHash. Must be a 40-character hex string.'); } try { const referer = `${this.baseUrl}/torrents/${infoHash}`; const response = await this.getJsonWithAuthentication<C411ApiListResponse<unknown>>( `/api/torrents/${infoHash}/comments?page=${page}&limit=${limit}`, referer, 'Torrent comments not found.', 'Torrent comments lookup failed' ); const comments = toTorrentComments(response?.data); return { infoHash, page, limit, ...(response?.meta?.total !== undefined ? { total: response.meta.total } : {}), ...(response?.meta?.totalPages !== undefined ? { totalPages: response.meta.totalPages } : {}), resultCount: comments.length, comments, }; } catch (error) { - src/register-tools.ts:74-87 (registration)Registration of the get_c411_torrent_comments tool and the handler invoking the C411 client.
server.registerTool('get_c411_torrent_comments', { description: 'Get comments for a c411.org torrent by its infoHash.', inputSchema: torrentCommentsToolSchema, outputSchema: torrentCommentsToolOutputSchema, }, async (args) => { try { const commentsPage = await client.getTorrentComments(args.infoHash, args.page, args.limit); return textWithStructuredContent(formatStructuredTorrentCommentsPage(commentsPage), commentsPage); } catch (error) { const message = error instanceof Error ? error.message : 'Torrent comments lookup failed'; return errorContent(message, { infoHash: args.infoHash, page: args.page, limit: args.limit,