Skip to main content
Glama
bobidk91-ops

Telegram MCP Server

by bobidk91-ops

send_photo

Send photos to Telegram channels using a URL or file path, with optional caption formatting in HTML or Markdown for automated bot messaging.

Instructions

Send a photo to the Telegram channel

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
captionNoPhoto caption
parse_modeNoParse mode for caption
photoYesPhoto URL or file path

Implementation Reference

  • The handler function for the 'send_photo' tool. It extracts photo_url, caption, and parse_mode from arguments, sends the photo to the Telegram channel using bot.sendPhoto, and returns a success message with details.
    case 'send_photo': {
      const { photo_url, caption, parse_mode = 'HTML' } = args as {
        photo_url: string;
        caption?: string;
        parse_mode?: string;
      };
      
      const result = await bot.sendPhoto(CHANNEL_ID, photo_url, {
        caption,
        parse_mode: parse_mode as any,
      });
      
      return {
        content: [
          {
            type: 'text',
            text: `โœ… Photo sent successfully!\n\n๐Ÿ“ฑ Channel: ${CHANNEL_ID}\n๐Ÿ“ Message ID: ${result.message_id}\n๐Ÿ“ท Photo: ${result.photo?.[0]?.file_id}\n๐Ÿ“„ Caption: ${caption || 'No caption'}`,
          },
        ],
      };
    }
  • src/index.ts:80-102 (registration)
    Registers the 'send_photo' tool in the list of available tools, including its description and input schema definition.
    {
      name: 'send_photo',
      description: 'Send a photo to the Telegram channel',
      inputSchema: {
        type: 'object',
        properties: {
          photo_url: {
            type: 'string',
            description: 'URL of the photo to send',
          },
          caption: {
            type: 'string',
            description: 'Photo caption',
          },
          parse_mode: {
            type: 'string',
            enum: ['HTML', 'Markdown'],
            description: 'Parse mode for the caption',
          },
        },
        required: ['photo_url'],
      },
    },
  • Defines the input schema for the 'send_photo' tool, specifying photo_url as required, and optional caption and parse_mode.
    inputSchema: {
      type: 'object',
      properties: {
        photo_url: {
          type: 'string',
          description: 'URL of the photo to send',
        },
        caption: {
          type: 'string',
          description: 'Photo caption',
        },
        parse_mode: {
          type: 'string',
          enum: ['HTML', 'Markdown'],
          description: 'Parse mode for the caption',
        },
      },
      required: ['photo_url'],
    },

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/bobidk91-ops/telegram-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server