Skip to main content
Glama

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
NameRequiredDescriptionDefault
comment_idYesL'ID du commentaire à récupérer

Implementation Reference

  • 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}` ); } }
  • 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 } );

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/samy-clivolt/reddit-mcp-server'

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