get_comment
Retrieve specific Reddit comments using their unique ID to access detailed discussion content and user interactions.
Instructions
Accéder à un commentaire spécifique
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| comment_id | Yes | L'ID du commentaire à récupérer |
Implementation Reference
- src/tools/search-tools.ts:5-60 (handler)The core handler function that fetches a specific Reddit comment by ID using the Reddit client, formats it with analysis, and returns structured markdown content.export async function getComment(params: { comment_id: string }) { const { comment_id } = params; const client = getRedditClient(); if (!client) { throw new McpError( ErrorCode.InternalError, "Reddit client not initialized" ); } try { console.log(`[Tool] Getting comment ${comment_id}`); const comment = await client.getComment(comment_id); const formattedComment = formatCommentInfo(comment); return { content: [ { type: "text", text: ` # Commentaire Reddit ## Détails du commentaire - Auteur: u/${formattedComment.author} - Score: ${formattedComment.stats.score} - Controverse: ${formattedComment.stats.controversiality} ## Contenu ${formattedComment.content} ## Contexte - Subreddit: r/${formattedComment.context.subreddit} - Thread: ${formattedComment.context.thread} ## Métadonnées - Posté: ${formattedComment.metadata.posted} - Drapeaux: ${formattedComment.metadata.flags.length ? formattedComment.metadata.flags.join(", ") : "Aucun"} ## Lien ${formattedComment.link} ## Analyse du commentaire ${formattedComment.commentAnalysis} `, }, ], }; } catch (error) { console.error(`[Error] Error getting comment: ${error}`); throw new McpError( ErrorCode.InternalError, `Failed to fetch comment: ${error}` ); } }
- src/index.ts:231-242 (schema)The input schema definition for the 'get_comment' tool, specifying the required 'comment_id' parameter.name: "get_comment", description: "Accéder à un commentaire spécifique", inputSchema: { type: "object", properties: { comment_id: { type: "string", description: "L'ID du commentaire à récupérer", }, }, required: ["comment_id"], },
- src/index.ts:473-476 (registration)The registration and dispatch logic in the CallToolRequest handler that routes calls to the getComment tool function.case "get_comment": return await tools.getComment( toolParams as { comment_id: string } );