Skip to main content
Glama
bobidk91-ops

Telegram MCP Server

by bobidk91-ops

send_poll

Create and send interactive polls to Telegram channels with customizable questions, multiple options, and anonymous voting settings for gathering feedback and engagement.

Instructions

Create and send a poll to the Telegram channel

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
is_anonymousNoWhether the poll is anonymous
optionsYesPoll options (2-10 items)
questionYesPoll question
typeNoPoll typeregular

Implementation Reference

  • The switch case handler that executes the 'send_poll' tool. It destructures arguments, validates the number of options, sends the poll via Telegram bot, and returns a formatted success response.
    case 'send_poll': {
      const { question, options, is_anonymous = true, type = 'regular' } = args as {
        question: string;
        options: string[];
        is_anonymous?: boolean;
        type?: string;
      };
      
      if (options.length < 2 || options.length > 10) {
        throw new Error('Poll must have between 2 and 10 options');
      }
      
      const result = await bot.sendPoll(CHANNEL_ID, question, options, {
        is_anonymous,
        type: type as any,
      });
      
      return {
        content: [
          {
            type: 'text',
            text: `βœ… Poll created successfully!\n\nπŸ“± Channel: ${CHANNEL_ID}\nπŸ“ Message ID: ${result.message_id}\n❓ Question: ${question}\nπŸ“Š Options: ${options.length}\nπŸ”’ Anonymous: ${is_anonymous ? 'Yes' : 'No'}\nπŸ“‹ Type: ${type}`,
          },
        ],
      };
    }
  • src/index.ts:103-132 (registration)
    The tool registration in the ListToolsRequestSchema handler, defining the name, description, and input schema for 'send_poll'.
    {
      name: 'send_poll',
      description: 'Create and send a poll to the Telegram channel',
      inputSchema: {
        type: 'object',
        properties: {
          question: {
            type: 'string',
            description: 'Poll question',
          },
          options: {
            type: 'array',
            items: { type: 'string' },
            minItems: 2,
            maxItems: 10,
            description: 'Poll options (2-10 items)',
          },
          is_anonymous: {
            type: 'boolean',
            description: 'Whether the poll is anonymous (default: true)',
          },
          type: {
            type: 'string',
            enum: ['quiz', 'regular'],
            description: 'Poll type (default: regular)',
          },
        },
        required: ['question', 'options'],
      },
    },
  • The detailed input schema for the 'send_poll' tool, specifying properties, types, descriptions, and required fields.
    inputSchema: {
      type: 'object',
      properties: {
        question: {
          type: 'string',
          description: 'Poll question',
        },
        options: {
          type: 'array',
          items: { type: 'string' },
          minItems: 2,
          maxItems: 10,
          description: 'Poll options (2-10 items)',
        },
        is_anonymous: {
          type: 'boolean',
          description: 'Whether the poll is anonymous (default: true)',
        },
        type: {
          type: 'string',
          enum: ['quiz', 'regular'],
          description: 'Poll type (default: regular)',
        },
      },
      required: ['question', 'options'],
    },

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