Skip to main content
Glama

send_poll

Create and send a poll to a Telegram chat with a question, answer options, and configurable anonymity, quiz mode, or multiple answers.

Instructions

Send a poll to a Telegram chat.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chat_idYesTarget chat ID.
questionYesPoll question (1-300 characters).
optionsYesList of answer options (2-10 strings).
is_anonymousNoWhether the poll is anonymous.
typeNo"regular" or "quiz".regular
allows_multiple_answersNoAllow multiple answers (regular polls only).
disable_notificationNoSend silently.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYes
errorNo
message_idNo
chat_idNo
poll_idNo

Implementation Reference

  • The async handler function for the send_poll MCP tool. Validates chat permissions, enforces rate limiting, sends the poll via aiogram's bot.send_poll, and returns a SendPollResult with message_id, chat_id, and poll_id on success.
    async def send_poll(
        chat_id: int,
        question: str,
        options: list[str],
        is_anonymous: bool = True,
        type: str = "regular",
        allows_multiple_answers: bool = False,
        disable_notification: bool = False,
    ) -> SendPollResult:
        """Send a poll to a Telegram chat.
    
        Args:
            chat_id: Target chat ID.
            question: Poll question (1-300 characters).
            options: List of answer options (2-10 strings).
            is_anonymous: Whether the poll is anonymous.
            type: "regular" or "quiz".
            allows_multiple_answers: Allow multiple answers (regular polls only).
            disable_notification: Send silently.
        """
        if not ctx.is_chat_allowed(chat_id):
            result = SendPollResult(ok=False, error=f"Chat {chat_id} is not allowed.")
            if ctx.audit_logger:
                ctx.audit_logger.log(
                    "send_poll",
                    {"chat_id": chat_id, "question": question},
                    result.ok,
                    result.error,
                )
            return result
    
        try:
            if ctx.rate_limiter:
                await ctx.rate_limiter.acquire()
            poll_options: list[InputPollOption | str] = [InputPollOption(text=opt) for opt in options]
            msg = await ctx.bot.send_poll(
                chat_id=chat_id,
                question=question,
                options=poll_options,
                is_anonymous=is_anonymous,
                type=type,
                allows_multiple_answers=allows_multiple_answers,
                disable_notification=disable_notification,
            )
            result = SendPollResult(
                ok=True,
                message_id=msg.message_id,
                chat_id=msg.chat.id,
                poll_id=msg.poll.id if msg.poll else None,
            )
        except (TelegramBadRequest, TelegramForbiddenError) as exc:
            result = SendPollResult(ok=False, error=str(exc))
    
        if ctx.audit_logger:
            ctx.audit_logger.log(
                "send_poll",
                {"chat_id": chat_id, "question": question},
                result.ok,
                result.error,
            )
        return result
  • Pydantic result model for the send_poll tool, extending ToolResponse with message_id, chat_id, and poll_id fields.
    class SendPollResult(ToolResponse):
        message_id: int | None = None
        chat_id: int | None = None
        poll_id: str | None = None
  • The send_poll tool is registered via the @mcp.tool decorator inside the register_media_tools function, conditionally based on allowed_tools. This function is called from server.py line 102.
    if allowed_tools is None or "send_poll" in allowed_tools:
    
        @mcp.tool
        async def send_poll(
            chat_id: int,
            question: str,
            options: list[str],
            is_anonymous: bool = True,
            type: str = "regular",
            allows_multiple_answers: bool = False,
            disable_notification: bool = False,
        ) -> SendPollResult:
            """Send a poll to a Telegram chat.
    
            Args:
                chat_id: Target chat ID.
                question: Poll question (1-300 characters).
                options: List of answer options (2-10 strings).
                is_anonymous: Whether the poll is anonymous.
                type: "regular" or "quiz".
                allows_multiple_answers: Allow multiple answers (regular polls only).
                disable_notification: Send silently.
            """
            if not ctx.is_chat_allowed(chat_id):
                result = SendPollResult(ok=False, error=f"Chat {chat_id} is not allowed.")
                if ctx.audit_logger:
                    ctx.audit_logger.log(
                        "send_poll",
                        {"chat_id": chat_id, "question": question},
                        result.ok,
                        result.error,
                    )
                return result
    
            try:
                if ctx.rate_limiter:
                    await ctx.rate_limiter.acquire()
                poll_options: list[InputPollOption | str] = [InputPollOption(text=opt) for opt in options]
                msg = await ctx.bot.send_poll(
                    chat_id=chat_id,
                    question=question,
                    options=poll_options,
                    is_anonymous=is_anonymous,
                    type=type,
                    allows_multiple_answers=allows_multiple_answers,
                    disable_notification=disable_notification,
                )
                result = SendPollResult(
                    ok=True,
                    message_id=msg.message_id,
                    chat_id=msg.chat.id,
                    poll_id=msg.poll.id if msg.poll else None,
                )
            except (TelegramBadRequest, TelegramForbiddenError) as exc:
                result = SendPollResult(ok=False, error=str(exc))
    
            if ctx.audit_logger:
                ctx.audit_logger.log(
                    "send_poll",
                    {"chat_id": chat_id, "question": question},
                    result.ok,
                    result.error,
                )
            return result
  • Top-level call that triggers registration of the send_poll tool (among other media tools) in the AiogramMCP server initialization.
    register_media_tools(self._mcp, self._ctx, allowed_tools=at)
  • Permission mapping declaring send_poll at MESSAGING level, used by get_allowed_tools to determine if the tool should be registered.
    "send_poll": PermissionLevel.MESSAGING,
Behavior2/5

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

No annotations are provided, and the description does not disclose any behavioral traits such as permissions needed, rate limits, side effects, or failure handling. For a tool that sends content, basic safety or requirement info is missing.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence, concise and front-loaded with the action. It avoids unnecessary words. However, for a tool with 7 parameters, some additional context could be added without becoming verbose.

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?

Despite having an output schema, the description does not mention the return value or any prerequisites (e.g., bot must be a member of the chat). It also lacks constraints on poll question length (1-300) and option count (2-10) which are in the schema but not highlighted. The description is too bare for a complex tool.

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?

All 7 parameters have descriptions in the schema (100% coverage). The description adds no additional meaning beyond what the schema already provides. For instance, it does not explain the difference between 'regular' and 'quiz' types or that 'allows_multiple_answers' only applies to regular polls.

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?

Description clearly states the action ('send') and resource ('poll') and destination ('to a Telegram chat'). It effectively distinguishes from sibling tools like 'send_message' or 'send_photo' by specifying 'poll'. However, it does not elaborate on poll structure (question, options) which is implicit.

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 when-to-use or when-not-to-use guidance is provided. There is no comparison to alternatives like 'send_message' or 'send_interactive_message'. The description does not help the agent decide between this and other send tools.

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/Py2755/aiogram-mcp'

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