Skip to main content
Glama
jordanburke

reddit-mcp-server

get_subreddit_info

Fetch detailed information about any Reddit community, including subscriber count, description, and activity metrics, to analyze subreddit characteristics.

Instructions

Get information about a subreddit

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
subreddit_nameYesName of the subreddit

Implementation Reference

  • Primary handler implementation for the 'get_subreddit_info' tool: validates input with Zod schema, fetches data via RedditClient, formats with formatSubredditInfo, and returns comprehensive markdown summary.
    server.addTool({
      name: "get_subreddit_info",
      description: "Get detailed information about a subreddit including description, stats, and community analysis",
      parameters: z.object({
        subreddit_name: z.string().describe("The subreddit name (without r/ prefix)"),
      }),
      execute: async (args) => {
        const client = getRedditClient()
        if (!client) {
          throw new Error("Reddit client not initialized")
        }
    
        const subreddit = await client.getSubredditInfo(args.subreddit_name)
        const formattedSubreddit = formatSubredditInfo(subreddit)
    
        return `# Subreddit Information: r/${formattedSubreddit.name}
    
    ## Overview
    - Name: r/${formattedSubreddit.name}
    - Title: ${formattedSubreddit.title}
    - Subscribers: ${formattedSubreddit.stats.subscribers.toLocaleString()}
    - Active Users: ${
          typeof formattedSubreddit.stats.activeUsers === "number"
            ? formattedSubreddit.stats.activeUsers.toLocaleString()
            : formattedSubreddit.stats.activeUsers
        }
    
    ## Description
    ${formattedSubreddit.description.short}
    
    ## Detailed Description
    ${formattedSubreddit.description.full}
    
    ## Metadata
    - Created: ${formattedSubreddit.metadata.created}
    - Flags: ${formattedSubreddit.metadata.flags.join(", ")}
    
    ## Links
    - Subreddit: ${formattedSubreddit.links.subreddit}
    - Wiki: ${formattedSubreddit.links.wiki}
    
    ## Community Analysis
    - ${formattedSubreddit.communityAnalysis.replace(/\n  - /g, "\n- ")}
    
    ## Engagement Tips
    - ${formattedSubreddit.engagementTips.replace(/\n  - /g, "\n- ")}`
      },
    })
  • RedditClient method that authenticates and fetches raw subreddit data from Reddit's API endpoint /r/{subredditName}/about.json, parsing into RedditSubreddit type.
    async getSubredditInfo(subredditName: string): Promise<RedditSubreddit> {
      await this.authenticate()
      try {
        const response = await this.makeRequest(`/r/${subredditName}/about.json`)
        if (!response.ok) {
          throw new Error(`HTTP ${response.status}`)
        }
    
        const json = (await response.json()) as RedditApiSubredditResponse
        const data = json.data
    
        return {
          displayName: data.display_name,
          title: data.title,
          description: data.description || "",
          publicDescription: data.public_description || "",
          subscribers: data.subscribers,
          activeUserCount: data.active_user_count ?? undefined,
          createdUtc: data.created_utc,
          over18: data.over18,
          subredditType: data.subreddit_type,
          url: data.url,
        }
      } catch {
        // Failed to get subreddit info
        throw new Error(`Failed to get subreddit info for ${subredditName}`)
      }
    }
  • Helper function that processes raw RedditSubreddit data into a rich formatted structure including stats, descriptions, metadata, links, community analysis, and engagement tips.
    export function formatSubredditInfo(subreddit: RedditSubreddit): FormattedSubredditInfo {
      const flags: string[] = []
      if (subreddit.over18) flags.push("NSFW")
      if (subreddit.subredditType) flags.push(`Type: ${subreddit.subredditType}`)
    
      const ageDays = (Date.now() / 1000 - subreddit.createdUtc) / (24 * 3600)
    
      return {
        name: subreddit.displayName,
        title: subreddit.title,
        stats: {
          subscribers: subreddit.subscribers,
          activeUsers: subreddit.activeUserCount !== undefined ? subreddit.activeUserCount : "Unknown",
        },
        description: {
          short: subreddit.publicDescription,
          full:
            subreddit.description.length > 300 ? subreddit.description.substring(0, 297) + "..." : subreddit.description,
        },
        metadata: {
          created: formatTimestamp(subreddit.createdUtc),
          flags: flags.length ? flags : ["None"],
        },
        links: {
          subreddit: `https://reddit.com${subreddit.url}`,
          wiki: `https://reddit.com/r/${subreddit.displayName}/wiki`,
        },
        communityAnalysis: analyzeSubredditHealth(subreddit.subscribers, subreddit.activeUserCount, ageDays),
        engagementTips: getSubredditEngagementTips(subreddit),
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It doesn't disclose behavioral traits such as whether this is a read-only operation (implied by 'Get' but not stated), rate limits, authentication needs, error handling, or what happens if the subreddit doesn't exist. The description is minimal and lacks essential context for safe and effective use.

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 a single, efficient sentence with zero waste. It's appropriately sized for a simple tool and front-loaded with the core purpose. Every word earns its place, making it easy to parse quickly.

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

Completeness2/5

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

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what information is returned (e.g., description, subscriber count, rules), potential errors, or usage constraints. For a tool with no structured data beyond the input schema, more context is needed to guide the agent effectively.

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

Parameters3/5

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

The description adds no meaning beyond the input schema, which has 100% coverage for the single parameter 'subreddit_name'. The schema already describes it as 'Name of the subreddit', so the description doesn't compensate or provide additional context like format examples (e.g., 'programming' without 'r/'). Baseline 3 is appropriate as the schema does the heavy lifting.

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

Purpose3/5

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

The description 'Get information about a subreddit' states a clear verb ('Get') and resource ('subreddit'), but it's vague about what specific information is retrieved. It distinguishes from siblings like 'get_top_posts' or 'get_trending_subreddits' by focusing on subreddit metadata rather than content, but lacks specificity about the scope of information.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. For example, it doesn't clarify if this should be used before posting to check subreddit rules versus using 'get_top_posts' for content discovery, or how it differs from 'get_user_info' for user-specific data. The description implies usage for subreddit metadata but offers no explicit context or exclusions.

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

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