Skip to main content
Glama
DLHellMe

Telegram MCP Server

by DLHellMe

telegram_login

Authenticate with Telegram Web to access restricted content, enabling interaction with channels and groups through API access and web scraping.

Instructions

Authenticate with Telegram Web to access restricted content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
phone_numberNoPhone number in international format (optional, for automated login)

Implementation Reference

  • The main handler function for the 'telegram_login' tool. It extracts the phone number from arguments, calls this.auth.login(), and returns success or error messages in MCP content format.
      private async handleTelegramLogin(args: any): Promise<any> {
        const phoneNumber = args.phone_number;
        
        try {
          const success = await this.auth.login(phoneNumber);
          
          if (success) {
            return {
              content: [
                {
                  type: 'text',
                  text: `✅ Successfully authenticated with Telegram!
    
    You can now use the authenticated scraping tools to access restricted content.
    
    Use 'scrape_channel_authenticated' to scrape channels with full access.`
                }
              ]
            };
          } else {
            return {
              content: [
                {
                  type: 'text',
                  text: `❌ Authentication failed. Please try again.
    
    Make sure to:
    1. Complete the login process in the browser window
    2. Enter the verification code if prompted
    3. Allow sufficient time for the login to complete`
                }
              ]
            };
          }
        } catch (error) {
          return {
            content: [
              {
                type: 'text',
                text: `❌ Login error: ${error instanceof Error ? error.message : 'Unknown error'}
    
    Please check:
    - Chrome is installed and accessible
    - You have a stable internet connection
    - The phone number is in international format (if provided)`
              }
            ]
          };
        }
      }
  • src/server.ts:221-234 (registration)
    The tool registration entry in the getTools() method, which lists 'telegram_login' for the ListToolsRequestSchema, including its description and input schema.
    {
      name: 'telegram_login',
      description: 'Authenticate with Telegram Web to access restricted content',
      inputSchema: {
        type: 'object',
        properties: {
          phone_number: {
            type: 'string',
            description: 'Phone number in international format (optional, for automated login)'
          }
        },
        required: []
      }
    },
  • Dispatch case in the main tool call handler switch statement that routes 'telegram_login' calls to the handleTelegramLogin method.
    case 'telegram_login':
      return await this.handleTelegramLogin(args);
  • Input schema definition for the 'telegram_login' tool, specifying optional phone_number parameter.
    inputSchema: {
      type: 'object',
      properties: {
        phone_number: {
          type: 'string',
          description: 'Phone number in international format (optional, for automated login)'
        }
      },
      required: []

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?

With no annotations, the description must carry the full burden of behavioral disclosure. It only states intent and does not explain side effects such as session creation, potential manual confirmation (e.g., OTP), or impact on other tools.

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, concise sentence with no unnecessary words. It front-loads the verb and resource, making it easy to parse.

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?

The tool is simple, but the description omits key context such as whether authentication requires manual steps, how login state affects other tools, or what the agent should expect after successful authentication. No output schema mitigates this gap.

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%, and the description adds no additional parameter semantics. According to the baseline for high coverage, a score of 3 is appropriate.

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 ('Authenticate'), resource ('Telegram Web'), and purpose ('to access restricted content'). It suggests a web-based method, which hints at distinction from 'telegram_api_login', though it does not explicitly name the alternative.

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 siblings like 'telegram_api_login' or 'scrape_channel_authenticated'. It does not mention prerequisites, context, or exclusions, leaving the agent without decision support.

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