Skip to main content
Glama

get_trending_subreddits

Discover trending subreddits to identify popular communities and topics currently active on Reddit.

Instructions

Get currently trending subreddits

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:171-178 (registration)
    Registration of the 'get_trending_subreddits' tool in the MCP server's ListTools response, including name, description, and empty input schema.
    {
      name: "get_trending_subreddits",
      description: "Get currently trending subreddits",
      inputSchema: {
        type: "object",
        properties: {},
      },
    },
  • MCP server CallToolRequest handler that dispatches the 'get_trending_subreddits' tool call to the implementation.
    case "get_trending_subreddits":
      return await tools.getTrendingSubreddits();
  • Main tool handler function that orchestrates the call to Reddit client, handles errors, and formats the MCP response with a numbered list of trending subreddits.
    export async function getTrendingSubreddits() {
      const client = getRedditClient();
    
      if (!client) {
        throw new McpError(
          ErrorCode.InternalError,
          "Reddit client not initialized"
        );
      }
    
      try {
        console.log("[Tool] Getting trending subreddits");
        const trendingSubreddits = await client.getTrendingSubreddits();
    
        return {
          content: [
            {
              type: "text",
              text: `
    # Trending Subreddits
    
    ${trendingSubreddits
      .map((subreddit, index) => `${index + 1}. r/${subreddit}`)
      .join("\n")}
              `,
            },
          ],
        };
      } catch (error) {
        console.error(`[Error] Error getting trending subreddits: ${error}`);
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to fetch trending subreddits: ${error}`
        );
      }
    }
  • RedditClient helper method that performs the actual API request to Reddit's /subreddits/popular.json endpoint to retrieve popular (trending) subreddit names.
    async getTrendingSubreddits(limit: number = 5): Promise<string[]> {
      await this.authenticate();
      try {
        const response = await this.api.get("/subreddits/popular.json", {
          params: { limit },
        });
    
        return response.data.data.children.map(
          (child: any) => child.data.display_name
        );
      } catch (error) {
        console.error("[Error] Failed to get trending subreddits:", error);
        throw new Error("Failed to get trending subreddits");
      }
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states what the tool does but lacks details on traits like rate limits, authentication needs, data freshness (e.g., how 'currently' is defined), or response format. This leaves gaps in understanding operational constraints.

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 no wasted words, front-loading the core action ('Get') and resource. It's appropriately sized for a simple tool with no parameters, making it easy to parse quickly.

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

Completeness3/5

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

Given the tool's simplicity (0 parameters, no annotations, no output schema), the description is minimally adequate but lacks completeness. It doesn't explain what 'trending' means, how results are returned, or any behavioral nuances, which could hinder an agent's ability to use it effectively without additional context.

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 input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description doesn't add parameter details, which is appropriate here, but it could theoretically mention implicit context (e.g., time-based filtering), though not required. Baseline is high due to no parameters.

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

Purpose4/5

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

The description clearly states the verb ('Get') and resource ('currently trending subreddits'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_top_posts' or 'get_subreddit_info', which might also retrieve subreddit-related data but with different scopes or criteria.

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. It doesn't mention context such as real-time trends, popularity metrics, or how it differs from siblings like 'get_subreddit_info' or 'get_top_posts', leaving the agent to infer usage based on the name alone.

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