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
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | The Telegram channel URL |
Implementation Reference
- src/server-api-handlers.ts:203-251 (handler)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);
- src/server.ts:766-766 (helper)Binds the apiHandlers.handleApiGetChannelInfo method to the server class instance for use in the switch case.private handleApiGetChannelInfo = apiHandlers.handleApiGetChannelInfo.bind(this);