Skip to main content
Glama

scrape_channel_authenticated

Access and extract data from Telegram channels using authenticated sessions, including restricted content. Specify the channel URL and maximum posts to scrape.

Instructions

Scrape a Telegram channel using authenticated session (can access restricted content)

Input Schema

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

Implementation Reference

  • The core handler function for the 'scrape_channel_authenticated' tool. It verifies user authentication, constructs scrape options, invokes the authenticated TelegramScraper, formats the scraped data to markdown using MarkdownFormatter, and returns the result as MCP-formatted content with error handling.
    private async handleScrapeChannelAuthenticated(args: any): Promise<any> { // Check authentication first const isAuthenticated = await this.auth.isAuthenticated(); if (!isAuthenticated) { return { content: [ { type: 'text', text: '❌ Not authenticated. Please use telegram_login first to access restricted content.' } ] }; } const options: ScrapeOptions = { url: args.url, maxPosts: args.max_posts || 100, includeReactions: true }; try { const result = await this.authScraper.scrape(options); const markdown = this.formatter.format(result); return { content: [ { type: 'text', text: `# Authenticated Scrape Results ${markdown} ✅ Scraped using authenticated session - restricted content should be accessible.` } ] }; } catch (error) { return { content: [ { type: 'text', text: `❌ Authenticated scrape failed: ${error instanceof Error ? error.message : 'Unknown error'} This might happen if: - The authentication session expired - The channel requires additional permissions - There was a network error Try running telegram_login again if the problem persists.` } ] }; } }
  • src/server.ts:89-90 (registration)
    Tool dispatch/registration in the main switch statement within the CallToolRequestSchema handler, routing calls to the specific handler function.
    case 'scrape_channel_authenticated': return await this.handleScrapeChannelAuthenticated(args);
  • src/server.ts:253-271 (registration)
    Tool registration in the getTools() method, defining the tool name, description, and input schema for the MCP server.
    { name: 'scrape_channel_authenticated', description: 'Scrape a Telegram channel using authenticated session (can access restricted content)', inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'The Telegram channel URL (e.g., https://t.me/channelname)' }, max_posts: { type: 'number', description: 'Maximum number of posts to scrape (default: 100)', default: 100 } }, required: ['url'] } },
  • Input schema definition for the scrape_channel_authenticated tool, specifying required 'url' parameter and optional 'max_posts'.
    inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'The Telegram channel URL (e.g., https://t.me/channelname)' }, max_posts: { type: 'number', description: 'Maximum number of posts to scrape (default: 100)', default: 100 } }, required: ['url'] }

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