Skip to main content
Glama
DLHellMe
by DLHellMe

scrape_channel_full

Extract all posts from a Telegram channel and save them to files for analysis or archiving.

Instructions

Scrape ALL posts from a Telegram channel and save to file. Uses authenticated session if logged in. Returns file location.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesThe Telegram channel URL (e.g., https://t.me/channelname)
save_to_fileNoSave results to MD and JSON files

Implementation Reference

  • Main handler function that executes the scrape_channel_full tool logic: determines scraper based on auth, scrapes all posts (maxPosts:0), formats sample, reports file save locations.
      private async handleScrapeChannelFull(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 for full channel scrape (logged in)');
        } else {
          logger.info('Using unauthenticated scraper for full channel scrape (not logged in)');
        }
    
        const options: ScrapeOptions = {
          url: args.url,
          maxPosts: 0, // No limit - get ALL posts
          includeReactions: true
        };
    
        const result = await scraperToUse.scrape(options);
        
        // The scraper already saves to file, so we just need to inform about it
        const channelName = result.channel.username;
        const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, -5);
        const windowsPath = `C:\\Users\\User\\AppData\\Roaming\\Claude\\telegram_scraped_data\\${channelName}_${timestamp}_full.md`;
        
        // Also return a sample of the content for immediate analysis
        const samplePosts = result.posts.slice(0, 5); // First 5 posts as sample
        const sampleResult = { ...result, posts: samplePosts };
        const sampleMarkdown = this.formatter.format(sampleResult);
        
        return {
          content: [
            {
              type: 'text',
              text: `Successfully scraped ${result.totalPosts} posts from @${channelName}
    
    Files saved to:
    - Markdown: ${windowsPath}
    - JSON: ${windowsPath.replace('.md', '.json')}
    
    Total posts: ${result.totalPosts}
    Date range: ${result.posts.length > 0 ? `${result.posts[result.posts.length - 1]?.date.toISOString().split('T')[0]} to ${result.posts[0]?.date.toISOString().split('T')[0]}` : 'N/A'}
    
    The full channel history has been saved. Here's a sample of the first 5 posts:
    
    ${sampleMarkdown}
    
    To analyze all ${result.totalPosts} posts, open the saved markdown file and copy its contents to Claude.
    
    ${isAuthenticated ? '✅ Scraped using authenticated session - all content including restricted posts should be accessible.' : '⚠️ Scraped without authentication - some restricted content may not be accessible.'}`
            }
          ]
        };
      }
  • src/server.ts:148-165 (registration)
    Tool registration in getTools() method, defining name, description, and input schema for scrape_channel_full.
      name: 'scrape_channel_full',
      description: 'Scrape ALL posts from a Telegram channel and save to file. Uses authenticated session if logged in. Returns file location.',
      inputSchema: {
        type: 'object',
        properties: {
          url: {
            type: 'string',
            description: 'The Telegram channel URL (e.g., https://t.me/channelname)'
          },
          save_to_file: {
            type: 'boolean',
            description: 'Save results to MD and JSON files',
            default: true
          }
        },
        required: ['url']
      }
    },
  • Input schema definition for the scrape_channel_full tool, specifying parameters like url and save_to_file.
    inputSchema: {
      type: 'object',
      properties: {
        url: {
          type: 'string',
          description: 'The Telegram channel URL (e.g., https://t.me/channelname)'
        },
        save_to_file: {
          type: 'boolean',
          description: 'Save results to MD and JSON files',
          default: true
        }
      },
      required: ['url']
    }
  • Dispatcher case in the CallToolRequestSchema handler that routes to the specific tool handler.
    case 'scrape_channel_full':
      return await this.handleScrapeChannelFull(args);
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 and discloses key behavioral traits: it performs data extraction (scraping), saves to files (implied mutation/write operation), and mentions authentication dependency. However, it lacks details on rate limits, error handling, or file formats beyond 'MD and JSON'.

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 front-loaded with the core purpose in the first sentence, followed by authentication and return details in two additional concise sentences, with zero wasted words—every sentence earns its place efficiently.

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

Completeness4/5

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

Given the tool's complexity (scraping and file saving) and lack of annotations or output schema, the description is mostly complete: it covers purpose, authentication, and output location. However, it could improve by detailing file paths, error cases, or performance constraints for full contextual understanding.

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 documents both parameters fully. The description adds no additional meaning beyond what the schema provides, such as explaining URL format nuances or file-saving implications, 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 ALL posts'), target resource ('from a Telegram channel'), and outcome ('save to file'), distinguishing it from siblings like 'scrape_channel' or 'scrape_date_range' by emphasizing comprehensive scraping and file saving.

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?

It provides clear context for usage by mentioning authentication ('Uses authenticated session if logged in'), but does not explicitly state when to use this tool versus alternatives like 'scrape_channel' or 'scrape_channel_authenticated', leaving some ambiguity in sibling differentiation.

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