Skip to main content
Glama
DLHellMe
by DLHellMe

scrape_group

Extract posts from Telegram groups and convert them to markdown format for analysis or archiving. Use authenticated sessions to access content with configurable post limits.

Instructions

Scrape a Telegram group and return posts in markdown format. Uses authenticated session if logged in.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesThe Telegram group URL (e.g., https://t.me/groupname)
max_postsNoMaximum number of posts to scrape (default: 100)

Implementation Reference

  • The handler function that executes the 'scrape_group' tool. It delegates to handleScrapeChannel since groups are handled identically to channels.
    private async handleScrapeGroup(args: any): Promise<any> {
      // Groups are handled the same way as channels
      return this.handleScrapeChannel(args);
    }
  • src/server.ts:166-184 (registration)
    Registration of the 'scrape_group' tool in the getTools() method, including name, description, and input schema.
    {
      name: 'scrape_group',
      description: 'Scrape a Telegram group and return posts in markdown format. Uses authenticated session if logged in.',
      inputSchema: {
        type: 'object',
        properties: {
          url: {
            type: 'string',
            description: 'The Telegram group URL (e.g., https://t.me/groupname)'
          },
          max_posts: {
            type: 'number',
            description: 'Maximum number of posts to scrape (default: 100)',
            default: 100
          }
        },
        required: ['url']
      }
    },
  • Core helper function called by scrape_group handler, performing the actual scraping logic using TelegramScraper instance and formatting the result as markdown.
    private async handleScrapeChannel(args: any): Promise<any> {
      // Check if authenticated and use authenticated scraper by default
      const isAuthenticated = await this.auth.isAuthenticated();
      const scraperToUse = isAuthenticated ? this.authScraper : this.scraper;
      
      if (isAuthenticated) {
        logger.info('Using authenticated scraper (logged in)');
      } else {
        logger.info('Using unauthenticated scraper (not logged in)');
      }
    
      const options: ScrapeOptions = {
        url: args.url,
        maxPosts: args.max_posts === undefined ? 0 : args.max_posts, // 0 means no limit
        includeReactions: args.include_reactions !== false
      };
    
      const result = await scraperToUse.scrape(options);
      const markdown = this.formatter.format(result);
    
      return {
        content: [
          {
            type: 'text',
            text: isAuthenticated 
              ? `${markdown}\n\n✅ *Scraped using authenticated session*`
              : markdown
          }
        ]
      };
    }
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 the authentication behavior and output format, but lacks details on rate limits, error handling, or what happens if not logged in. It adequately covers basic behavior but misses deeper operational context.

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 wasted words—it states the action, target, output, and authentication context directly, making it front-loaded and appropriately sized.

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 moderate complexity (scraping with authentication), no annotations, and no output schema, the description is minimally complete. It covers purpose and basic behavior but lacks details on output structure, errors, or performance limits, leaving gaps for an agent.

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 description coverage is 100%, so the schema already fully documents both parameters. The description adds no additional parameter semantics beyond what the schema provides, meeting the baseline for high coverage.

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 specific action ('scrape'), target resource ('Telegram group'), and output format ('posts in markdown format'), distinguishing it from sibling tools like 'scrape_channel' or 'scrape_channel_authenticated' by specifying group scraping rather than channel scraping.

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 on when to use it ('scrape a Telegram group') and mentions authentication behavior ('uses authenticated session if logged in'), but does not explicitly state when not to use it or name alternatives among the many sibling scraping 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/DLHellMe/telegram-mcp-server'

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