Skip to main content
Glama

api_get_channel_info

Retrieve comprehensive details about a Telegram channel by inputting its URL, enabling users to analyze channel-specific data via API interaction.

Instructions

Get detailed information about a Telegram channel using the API

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesThe Telegram channel URL

Implementation Reference

  • The handler function that executes the tool: checks API connection, extracts channel username, fetches info via client.getChannelInfo, formats response.
    async handleApiGetChannelInfo(this: any, args: any): Promise<any> { if (!this._apiScraper || !this._apiScraper.isConnected()) { return { content: [{ type: 'text', text: '❌ Not connected to Telegram API. Please use telegram_api_login first.' }] }; } try { const channelUrl = args.url || args.channel; const channelUsername = channelUrl.match(/(?:t\.me\/|@)([^/?]+)/)?.[1]; if (!channelUsername) { return { content: [{ type: 'text', text: '❌ Invalid channel URL or username' }] }; } const client = (this._apiScraper as any).client; const info = await client.getChannelInfo(channelUsername); return { content: [{ type: 'text', text: `# Channel Information **Name:** ${info.title} **Username:** @${info.username} **Type:** ${info.about} **Members:** ${info.participantsCount?.toLocaleString() || 'N/A'} **ID:** ${info.id} ✅ Retrieved using Telegram API` }] }; } catch (error) { return { content: [{ type: 'text', text: `❌ Failed to get channel info: ${error instanceof Error ? error.message : 'Unknown error'}` }] }; } },
  • src/server.ts:359-372 (registration)
    Registers the tool in getTools() with name, description, and inputSchema.
    { name: 'api_get_channel_info', description: 'Get detailed information about a Telegram channel using the API', inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'The Telegram channel URL' } }, required: ['url'] } },
  • src/server.ts:104-105 (registration)
    Switch case in tool call handler that routes 'api_get_channel_info' calls to the bound handler method.
    case 'api_get_channel_info': return await this.handleApiGetChannelInfo(args);
  • Binds the apiHandlers.handleApiGetChannelInfo method to the server class instance for use in the switch case.
    private handleApiGetChannelInfo = apiHandlers.handleApiGetChannelInfo.bind(this);

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