send_poll
Create and send interactive polls to Telegram chats to gather feedback, conduct surveys, or engage users with quiz questions.
Instructions
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.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chat_id | Yes | ||
| question | Yes | ||
| options | Yes | ||
| is_anonymous | No | ||
| type | No | regular | |
| allows_multiple_answers | No | ||
| disable_notification | No |
Implementation Reference
- aiogram_mcp/tools/media.py:521-580 (handler)The implementation of the send_poll MCP tool, which sends a poll to a Telegram chat.
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, ) - aiogram_mcp/tools/media.py:19-22 (schema)The response schema for the send_poll tool.
class SendPollResult(ToolResponse): message_id: int | None = None chat_id: int | None = None poll_id: str | None = None