Skip to main content
Glama
liuyang1520

Reddit MCP Server

by liuyang1520

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
NameRequiredDescriptionDefault
postIdYesReddit post ID

Implementation Reference

  • 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), }, ], }; }
  • 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'], }, },
  • 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); }

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/liuyang1520/reddit-mcp'

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