Get a comment by id
getCommentRetrieve a single comment using its unique ID.
Instructions
Fetch a single comment by id.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| commentId | Yes |
Implementation Reference
- src/tools.ts:358-366 (handler)The getComment tool handler: registers a tool named 'getComment' that fetches a single comment by id from the Langfuse API endpoint /api/public/comments/{commentId}. The handler extracts commentId from args, URL-encodes it, and calls client.get().
server.registerTool( "getComment", { title: "Get a comment by id", description: "Fetch a single comment by id.", inputSchema: { commentId: z.string().min(1) }, }, async ({ commentId }) => asJson(await client.get(`/api/public/comments/${enc(commentId)}`)), ); - src/tools.ts:360-364 (schema)Input schema for the getComment tool: requires a single parameter 'commentId' which is a non-empty string (z.string().min(1)).
{ title: "Get a comment by id", description: "Fetch a single comment by id.", inputSchema: { commentId: z.string().min(1) }, }, - src/tools.ts:358-366 (registration)The getComment tool is registered via server.registerTool('getComment', ...) in the registerTools function. It's also listed in the TOOL_NAMES array at line 417.
server.registerTool( "getComment", { title: "Get a comment by id", description: "Fetch a single comment by id.", inputSchema: { commentId: z.string().min(1) }, }, async ({ commentId }) => asJson(await client.get(`/api/public/comments/${enc(commentId)}`)), ); - src/tools.ts:10-10 (helper)The 'enc' helper (encodeURIComponent) is used in the handler to safely encode commentId in the URL path.
const enc = encodeURIComponent; - src/tools.ts:6-8 (helper)The 'asJson' helper transforms the API response into the MCP content format expected by the tool handler.
const asJson = (data: unknown) => ({ content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }], });