Skip to main content
Glama
DLHellMe
by DLHellMe

telegram_auth_status

Verify Telegram authentication status to determine if the user is logged in and can access channels and groups through the MCP server.

Instructions

Check if authenticated with Telegram

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Executes the telegram_auth_status tool by calling this.auth.isAuthenticated() and returning a formatted text response indicating authentication status.
    private async handleAuthStatus(): Promise<any> {
      const isAuthenticated = await this.auth.isAuthenticated();
      
      return {
        content: [
          {
            type: 'text',
            text: isAuthenticated 
              ? '✅ Authenticated with Telegram. You can access restricted content.'
              : '❌ Not authenticated. Use telegram_login to authenticate.'
          }
        ]
      };
    }
  • Defines the tool schema with name, description, and empty input schema.
      name: 'telegram_auth_status',
      description: 'Check if authenticated with Telegram',
      inputSchema: {
        type: 'object',
        properties: {},
        required: []
      }
    },
  • src/server.ts:86-87 (registration)
    Switch case that routes calls to telegram_auth_status to the handleAuthStatus handler.
    case 'telegram_auth_status':
      return await this.handleAuthStatus();
  • Checks authentication by verifying if cookie manager has stored cookies/auth data.
    async isAuthenticated(): Promise<boolean> {
      // For Telegram Web K, we just check if auth data exists
      // The actual verification happens when we try to use it
      const hasCookies = await this.cookieManager.hasCookies();
      
      if (hasCookies) {
        logger.debug('Authentication data found');
        return true;
      }
      
      return false;
    }
  • Implements the core check for existence of authentication data files (cookies, localStorage, auth_data).
    async hasCookies(): Promise<boolean> {
      try {
        // Check for auth data file (Telegram Web K)
        const authPath = this.cookieFilePath.replace('telegram_cookies.json', 'telegram_auth_data.json');
        logger.debug(`Checking auth path: ${authPath}`);
        try {
          await access(authPath);
          const authData = await readFile(authPath, 'utf8');
          const auth = JSON.parse(authData);
          if (Object.keys(auth).length > 0) {
            logger.info(`Found auth_data.json with ${Object.keys(auth).length} keys`);
            return true;
          }
        } catch (error) {
          logger.debug(`Auth file check failed: ${error}`);
          // Continue to check cookies
        }
        
        // Check traditional cookies
        await access(this.cookieFilePath);
        const cookieData = await readFile(this.cookieFilePath, 'utf8');
        const cookies = JSON.parse(cookieData);
        
        // Also check localStorage file
        if (Array.isArray(cookies) && cookies.length === 0) {
          const localStoragePath = this.cookieFilePath.replace('.json', '_localStorage.json');
          try {
            await access(localStoragePath);
            const lsData = await readFile(localStoragePath, 'utf8');
            const localStorage = JSON.parse(lsData);
            return Object.keys(localStorage).length > 0;
          } catch {
            // No localStorage file
          }
        }
        
        return Array.isArray(cookies) && cookies.length > 0;
      } catch {
        return false;
      }
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Check') but does not reveal any behavioral traits, such as whether it requires network calls, returns a boolean or detailed status, has rate limits, or handles errors. This leaves significant gaps for a tool that interacts with an external service like Telegram.

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, clear sentence with zero waste, front-loading the core purpose ('Check if authenticated with Telegram'). It is appropriately sized for a simple tool and earns its place by directly stating the action without unnecessary elaboration.

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

Completeness3/5

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

Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is minimally complete but lacks depth. It covers the basic purpose but does not address behavioral aspects like return values or error handling, which are important for an authentication status check. With no output schema, the description should ideally hint at what is returned, but it does not, leaving room for improvement.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description does not add parameter details, which is appropriate, but it could have mentioned any implicit inputs (e.g., session context), though not required. Baseline is 4 as it adequately handles the lack of parameters without introducing confusion.

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 'Check if authenticated with Telegram' clearly states the verb ('Check') and resource ('authenticated with Telegram'), making the purpose specific and understandable. However, it does not explicitly differentiate from sibling tools like 'telegram_api_login' or 'telegram_logout', which handle authentication actions rather than status checking, so it lacks sibling differentiation for a perfect score.

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?

The description provides no guidance on when to use this tool versus alternatives, such as before performing authenticated operations like 'scrape_channel_authenticated' or after login attempts. It implies usage for checking authentication status but offers no explicit context, exclusions, or named alternatives, leaving the agent to infer based on tool names alone.

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

Install Server

Other Tools

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