Skip to main content
Glama

get_subreddit_info

Retrieve key details about any Reddit community, including rules, member counts, and activity metrics, to understand its purpose and engagement.

Instructions

Get information about a subreddit

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
subreddit_nameYesName of the subreddit

Implementation Reference

  • Main tool handler that fetches subreddit data via RedditClient, formats it using formatSubredditInfo, and returns a formatted Markdown response.
    export async function getSubredditInfo(params: { subreddit_name: string }) {
      const { subreddit_name } = params;
      const client = getRedditClient();
    
      if (!client) {
        throw new McpError(
          ErrorCode.InternalError,
          "Reddit client not initialized"
        );
      }
    
      try {
        console.log(`[Tool] Getting info for r/${subreddit_name}`);
        const subreddit = await client.getSubredditInfo(subreddit_name);
        const formattedSubreddit = formatSubredditInfo(subreddit);
    
        return {
          content: [
            {
              type: "text",
              text: `
    # 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- ")}
              `,
            },
          ],
        };
      } catch (error) {
        console.error(`[Error] Error getting subreddit info: ${error}`);
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to fetch subreddit data: ${error}`
        );
      }
    }
  • Input schema definition for the get_subreddit_info tool, specifying subreddit_name as required string parameter.
      name: "get_subreddit_info",
      description: "Get information about a subreddit",
      inputSchema: {
        type: "object",
        properties: {
          subreddit_name: {
            type: "string",
            description: "Name of the subreddit",
          },
        },
        required: ["subreddit_name"],
      },
    },
  • src/index.ts:446-449 (registration)
    Tool call routing in the switch statement that invokes the getSubredditInfo handler from the tools module.
    case "get_subreddit_info":
      return await tools.getSubredditInfo(
        toolParams as { subreddit_name: string }
      );
  • RedditClient method that performs the actual API call to fetch raw subreddit data from Reddit.
    async getSubredditInfo(subredditName: string): Promise<RedditSubreddit> {
      await this.authenticate();
      try {
        const response = await this.api.get(`/r/${subredditName}/about.json`);
        const data = response.data.data;
    
        return {
          displayName: data.display_name,
          title: data.title,
          description: data.description || "",
          publicDescription: data.public_description || "",
          subscribers: data.subscribers,
          activeUserCount: data.active_user_count,
          createdUtc: data.created_utc,
          over18: data.over18,
          subredditType: data.subreddit_type,
          url: data.url,
        };
      } catch (error) {
        console.error(
          `[Error] Failed to get subreddit info for ${subredditName}:`,
          error
        );
        throw new Error(`Failed to get subreddit info for ${subredditName}`);
      }
    }
  • Helper function that formats raw RedditSubreddit data into a structured FormattedSubredditInfo object with analysis and 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 the full burden of behavioral disclosure. It only states the basic purpose without mentioning whether this is a read-only operation, if it requires authentication, what rate limits apply, what happens if the subreddit doesn't exist, or what format the information is returned in. For a tool with zero annotation coverage, this is inadequate.

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 extremely concise at just 5 words, front-loaded with the core purpose. There's no wasted language or unnecessary elaboration, making it efficient for an AI agent 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 for a tool that presumably returns structured information about subreddits. It doesn't hint at what information is returned (e.g., description, subscriber count, rules), nor does it address error conditions or behavioral aspects. The description alone is insufficient for confident tool invocation.

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 schema description coverage is 100% with a single parameter 'subreddit_name' clearly documented in the schema. The description doesn't add any parameter semantics beyond what the schema provides, such as format examples (e.g., 'programming' vs 'r/programming') or constraints. With high schema coverage, the baseline score of 3 is appropriate.

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 doesn't distinguish from sibling tools like 'get_subreddit' (which appears to be a near-duplicate) or 'get_user_info' (which focuses on users rather than subreddits).

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?

The description provides no guidance on when to use this tool versus alternatives. With multiple sibling tools like 'get_subreddit', 'search_subreddits', and 'get_trending_subreddits', there's no indication of when this specific tool is appropriate or what makes it different from other subreddit-related tools.

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

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