Skip to main content
Glama
tandat8503

Reddit MCP Server

by tandat8503

get_subreddit_info

Fetch detailed information about any Reddit subreddit, including description, subscribers, active users, creation date, NSFW status, and URL using a subreddit name.

Instructions

🏠 Get subreddit information 🎯 What it does: Fetches detailed info about any Reddit subreddit 📝 Required: subreddit name (without r/ prefix) 💡 Examples: • Get info: {"subreddit": "programming"} • Check subreddit: {"subreddit": "AskReddit"} • View details: {"subreddit": "MachineLearning"} 🔍 Output: Subreddit details with description, subscribers, active users, creation date, NSFW status, and URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
subredditYesSubreddit name to get information about

Implementation Reference

  • MCP tool handler for 'get_subreddit_info': extracts subreddit parameter, calls the Reddit API service, handles errors, formats the subreddit info using formatSubredditInfo helper, and returns a standardized MCP success response.
    createToolHandler(async (params: z.infer<typeof SimpleSubredditInfoSchema>) => {
        const { subreddit } = params;
        
        const result = await redditAPI.getSubredditInfo(subreddit);
    
        if (!result.success) {
          return createErrorResponse("Error getting subreddit info", result.error);
        }
    
        const data = result.data;
        if (!data || !data.data) {
          return createErrorResponse("Subreddit not found");
        }
    
        const subredditInfo = data.data;
        const formattedInfo = formatSubredditInfo(subredditInfo);
        
        return createSuccessResponse(formattedInfo);
    })
  • src/index.ts:565-595 (registration)
    Registration of the 'get_subreddit_info' tool on the MCP server, including name, detailed description, input schema, and handler function.
    server.tool(
      "get_subreddit_info",
      "🏠 Get subreddit information\n" +
      "🎯 What it does: Fetches detailed info about any Reddit subreddit\n" +
      "📝 Required: subreddit name (without r/ prefix)\n" +
      "💡 Examples:\n" +
      "   • Get info: {\"subreddit\": \"programming\"}\n" +
      "   • Check subreddit: {\"subreddit\": \"AskReddit\"}\n" +
      "   • View details: {\"subreddit\": \"MachineLearning\"}\n" +
      "🔍 Output: Subreddit details with description, subscribers, active users, creation date, NSFW status, and URL",
      SimpleSubredditInfoSchema.shape,
      createToolHandler(async (params: z.infer<typeof SimpleSubredditInfoSchema>) => {
          const { subreddit } = params;
          
          const result = await redditAPI.getSubredditInfo(subreddit);
    
          if (!result.success) {
            return createErrorResponse("Error getting subreddit info", result.error);
          }
    
          const data = result.data;
          if (!data || !data.data) {
            return createErrorResponse("Subreddit not found");
          }
    
          const subredditInfo = data.data;
          const formattedInfo = formatSubredditInfo(subredditInfo);
          
          return createSuccessResponse(formattedInfo);
      })
    );
  • Zod input schema for the tool: requires a 'subreddit' string parameter.
    export const SimpleSubredditInfoSchema = z.object({
      subreddit: z.string().describe("Subreddit name to get information about")
    });
  • Helper method in RedditAPIService that performs the actual API call to fetch subreddit information from Reddit's /r/{subreddit}/about.json endpoint.
    async getSubredditInfo(subreddit: string): Promise<ApiCallResult> {
      return this.makeRequest<{ data: RedditSubreddit }>(
        `/r/${subreddit}/about.json`,
      );
    }
  • Helper function to format subreddit information into a human-readable string with emojis and details for the MCP response.
    function formatSubredditInfo(subreddit: RedditSubreddit): string {
      const name = subreddit.display_name || 'Unknown';
      const title = subreddit.title || 'No title';
      const description = subreddit.description || 'No description';
      const subscribers = subreddit.subscribers || 0;
      const activeUsers = subreddit.active_user_count || 0;
      const createdDate = subreddit.created_utc ? new Date(subreddit.created_utc * 1000).toLocaleDateString() : 'Unknown';
      const over18 = subreddit.over18 || false;
      
      let result = `🏠 **r/${name}**\n`;
      result += `📝 ${title}\n`;
      result += `📄 Description: ${description}\n`;
      result += `👥 Subscribers: ${subscribers.toLocaleString()}\n`;
      result += `🟢 Active Users: ${activeUsers.toLocaleString()}\n`;
      result += `📅 Created: ${createdDate}\n`;
      result += `🔞 NSFW: ${over18 ? 'Yes' : 'No'}\n`;
      
      if (subreddit.public_description) {
        result += `📋 Public Description: ${subreddit.public_description}\n`;
      }
      
      result += `🔗 URL: https://reddit.com/r/${name}\n`;
      
      return result;
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses that the tool 'fetches' (read operation) and lists output details, but does not mention behavioral traits like rate limits, authentication needs, error handling, or whether it's idempotent. The description adds some context about the output format, but lacks comprehensive behavioral disclosure for a tool with no annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded with key information (purpose and required parameter) using emoji sections. Each section ('🎯', '📝', '💡', '🔍') earns its place by adding distinct value without redundancy. The structure is efficient and easy to scan.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (1 parameter, no output schema, no annotations), the description is mostly complete: it covers purpose, parameter details, examples, and output format. However, it lacks information on error cases or limitations (e.g., invalid subreddit names), which would be helpful for a tool with no annotations or output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so the baseline is 3. The description adds value by clarifying the parameter semantics: it specifies 'subreddit name (without r/ prefix)' and provides examples, which goes beyond the schema's generic 'Subreddit name to get information about'. This extra detail compensates adequately, but doesn't fully explain edge cases.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool 'fetches detailed info about any Reddit subreddit' with specific verb ('fetches') and resource ('subreddit'), and distinguishes it from sibling tools like get_subreddit_posts (which gets posts) or get_user_profile (which gets user info). The emoji '🏠' and '🎯' sections reinforce this specific purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool (to get subreddit details like description, subscribers, etc.), but does not explicitly state when not to use it or name alternatives among siblings. The '📝 Required' section implies usage for subreddit info retrieval, but lacks explicit comparison to tools like get_trending_subreddits or search_reddit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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

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