Skip to main content
Glama
DLHellMe

Telegram MCP Server

by DLHellMe

api_get_channel_info

Retrieve detailed information about any Telegram channel by providing its URL, enabling users to access channel data through API integration.

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 implements the core logic of the 'api_get_channel_info' tool: checks API connection, parses channel URL, retrieves channel information using the Telegram API client, and returns formatted details.
      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 'api_get_channel_info' tool with the MCP server, including its description and input schema requiring a 'url' parameter.
    {
      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 the tool call handler that dispatches '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 (registration)
    Binds the handler function from apiHandlers to the server class instance for use in tool dispatching.
    private handleApiGetChannelInfo = apiHandlers.handleApiGetChannelInfo.bind(this);

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description says only 'Get detailed information', which implies a read operation, but no annotations are provided. It does not disclose output format, authentication needs, rate limits, potential errors, or what 'detailed information' includes. The tool's behavioral profile is largely opaque.

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, front-loaded sentence with no redundant words. It efficiently conveys the core purpose, making it appropriately concise for the tool's simplicity.

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

Completeness2/5

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

With no annotations, no output schema, and only one parameter, the description carries a heavy burden for context, yet it fails to explain the return value, authentication requirements, or how this tool differs from its sibling 'get_channel_info'. The tool's minimal footprint in a crowded sibling set makes this lack of context problematic.

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?

The input schema covers 100% of the single parameter (url) with a description, and the tool description does not add any additional meaning beyond that. The baseline of 3 is appropriate since the schema handles the parameter semantics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action (get) and resource (detailed information about a Telegram channel), but it does not differentiate from the sibling tool 'get_channel_info' which likely serves the same purpose. The phrase 'using the API' hints at a specific backend but is not sufficiently distinguishing.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives such as 'scrape_channel' or 'get_channel_info'. There are no explicit conditions, prerequisites, or exclusions, leaving the agent to infer usage from the name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.