get_post
Retrieve detailed information about a specific Reddit post using its unique post ID to access content, metadata, and engagement data.
Instructions
Get details of a specific Reddit post
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| postId | Yes | Reddit post ID |
Implementation Reference
- src/index.ts:309-320 (handler)Handler for the 'get_post' tool: parses arguments using GetPostSchema, fetches the post via redditClient.getPost, and returns JSON stringified post data.case 'get_post': { const args = GetPostSchema.parse(request.params.arguments); const post = await redditClient.getPost(args.postId); return { content: [ { type: 'text', text: JSON.stringify(post, null, 2), }, ], }; }
- src/index.ts:44-46 (schema)Zod schema for validating input to 'get_post' tool: requires a postId string.const GetPostSchema = z.object({ postId: z.string().min(1, "Post ID is required"), });
- src/index.ts:116-129 (registration)Registration of the 'get_post' tool in the MCP server's listTools response, including name, description, and input schema.{ name: 'get_post', description: 'Get details of a specific Reddit post', inputSchema: { type: 'object', properties: { postId: { type: 'string', description: 'Reddit post ID', }, }, required: ['postId'], }, },
- src/reddit-client.ts:134-137 (helper)Core implementation of fetching a Reddit post: makes authenticated API request to /comments/{postId} and maps the response data to RedditPost interface.async getPost(postId: string): Promise<RedditPost> { const data = await this.makeRequest(`/comments/${postId}`); return this.mapPost(data[0].data.children[0].data); }