Skip to main content
Glama
Decodo

Decodo MCP Server

reddit_post

Read-only

Scrapes a specific Reddit post by URL to extract its content and metadata.

Instructions

Scrape a specific Reddit post

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesreddit post URL (eg. https://www.reddit.com/r/hometheater/comments/1jz9xk5/lg_ubk90_only_works_when_plugged_into_tv_via)

Implementation Reference

  • The RedditPostTool class that contains the handler logic: it registers a tool named 'reddit_post', accepts a Reddit post URL, calls the scraper API with target 'reddit_post', transforms the response by removing high-character-count fields (author_flair_richtext), and returns the result as text.
    export class RedditPostTool extends Tool {
      toolset = TOOLSET.SOCIAL_MEDIA;
    
      private static FIELDS_WITH_HIGH_CHAR_COUNT = ['author_flair_richtext'];
    
      transformResponse = ({ data }: { data: object }) => {
        for (const fieldToRemove of RedditPostTool.FIELDS_WITH_HIGH_CHAR_COUNT) {
          data = removeKeyFromNestedObject({ obj: data, keyToRemove: fieldToRemove });
        }
    
        return { data: JSON.stringify(data) };
      };
    
      register = ({ server, sapiClient, auth }: ToolRegistrationArgs) => {
        server.registerTool(
          'reddit_post',
          {
            description: 'Scrape a specific Reddit post',
            inputSchema: {
              url: z
                .string()
                .describe(
                  'reddit post URL (eg. https://www.reddit.com/r/hometheater/comments/1jz9xk5/lg_ubk90_only_works_when_plugged_into_tv_via)'
                ),
            },
            annotations: {
              readOnlyHint: true,
              openWorldHint: true,
            },
          },
          async (scrapingParams: ScrapingMCPParams, extra: ProgressExtra) => {
            const params = {
              ...scrapingParams,
              target: SCRAPER_API_TARGETS.REDDIT_POST,
            } satisfies ScraperAPIParams;
    
            const { data } = await sapiClient.scrape<object>({ auth, scrapingParams: params, extra });
    
            const { data: text } = this.transformResponse({ data });
    
            return {
              content: [
                {
                  type: 'text',
                  text,
                },
              ],
            };
          }
        );
      };
    }
  • Input schema for the reddit_post tool: requires a 'url' string describing the Reddit post URL, with readOnlyHint and openWorldHint annotations.
    {
      description: 'Scrape a specific Reddit post',
      inputSchema: {
        url: z
          .string()
          .describe(
            'reddit post URL (eg. https://www.reddit.com/r/hometheater/comments/1jz9xk5/lg_ubk90_only_works_when_plugged_into_tv_via)'
          ),
      },
      annotations: {
        readOnlyHint: true,
        openWorldHint: true,
      },
    },
  • Registration in the base server: RedditPostTool is instantiated in the allTools array (line 91) and registered via registerAllTools (line 113-117) or registerTools based on toolsets.
    registerAllTools() {
      for (const tool of ScraperAPIBaseServer.allTools) {
        tool.register({ server: this.server, sapiClient: this.sapiClient, auth: this.auth });
      }
    }
  • Registration logic: if no toolsets specified, all tools including RedditPostTool are registered; otherwise tools are filtered by toolset (SOCIAL_MEDIA for RedditPostTool).
    registerTools({ toolsets }: { toolsets: TOOLSET[] }) {
      if (toolsets.length === 0) {
        this.registerAllTools();
        return;
      }
    
      for (const toolset of toolsets) {
        const tools = ScraperAPIBaseServer.allTools.filter(tool => tool.toolset === toolset);
        for (const tool of tools) {
          tool.register({ server: this.server, sapiClient: this.sapiClient, auth: this.auth });
        }
      }
    }
    
    registerAllTools() {
      for (const tool of ScraperAPIBaseServer.allTools) {
        tool.register({ server: this.server, sapiClient: this.sapiClient, auth: this.auth });
      }
    }
  • The removeKeyFromNestedObject utility used by RedditPostTool.transformResponse to strip the 'author_flair_richtext' field from the response data recursively.
    export const removeKeyFromNestedObject = ({
      obj,
      keyToRemove,
    }: {
      obj: object;
      keyToRemove: string;
    }): object => {
      if (typeof obj !== 'object' || obj === null) {
        return obj;
      }
    
      if (Array.isArray(obj)) {
        return obj.map(item => removeKeyFromNestedObject({ obj: item, keyToRemove }));
      }
    
      const record = obj as Record<string, unknown>;
      const newObj: Record<string, unknown> = {};
    
      for (const key in record) {
        if (key === keyToRemove) {
          continue;
        }
    
        newObj[key] = removeKeyFromNestedObject({ obj: record[key] as object, keyToRemove });
      }
    
      return newObj;
    };
Behavior3/5

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

Annotations already declare readOnlyHint=true and openWorldHint=true, indicating read-only behavior and variable output. The description adds minimal value beyond 'Scrape' which implies data extraction, but no details on rate limits, data structure, or side effects.

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

Conciseness4/5

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

The description is concise (4 words) and front-loaded, but could be more structured. It is not verbose but leaves room for improvement in informativeness.

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 simple tool (1 param, no output schema), the description is minimally adequate. However, it does not mention what data is returned (e.g., post content, comments) or any limitations, which would help the agent assess completeness.

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?

Schema coverage is 100% for the single parameter 'url', with a clear description including an example. The tool description does not add any additional semantic meaning beyond what the schema provides.

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 'Scrape a specific Reddit post' clearly states the action (scrape) and the resource (specific Reddit post), distinguishing it from siblings like 'reddit_subreddit' and 'reddit_user'.

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 (e.g., reddit_subreddit for multiple posts, reddit_user for user content). No mention of context, exclusions, or prerequisites.

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

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

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