Skip to main content
Glama
mcp-telegram-agent

mcp-telegram-agent

wait_for_reply

Wait for the next Telegram reply (message, button click, or poll answer) using long polling; returns matching updates or times out so AI agents can pause until a user responds.

Instructions

Wait for the next user reply (message, button click, or poll answer) via long polling.

長輪詢等待使用者下一則回覆(訊息/按鈕點擊/投票作答)。
連續長輪詢(每段最長 10 秒)直到 timeout 秒內出現符合項目或逾時;
poll_interval 僅用於網路錯誤後的退避等待(至少 1 秒),正常情況下不會隔段輪詢。
auto_answer=True(預設)時,回傳的 callback_query 會當下立即以通用提示
應答,payload 標記 auto_answered=True,不需也切勿再用 answer_callback_query
重複應答(將收到 query is too old);應答失敗時改標記 auto_answer_error。
需要自訂提示文字、show_alert 或 url 時設 auto_answer=False。
未設定白名單時回傳設定提示,請 AI 提醒使用者補上 TELEGRAM_ALLOWED_CHAT_IDS 後重啟。
注意:
- 首次呼叫(尚無狀態檔)時會先撈回全部 pending updates,最舊的先被
  比對回傳;建議先以 get_updates(mark_read=False) 預覽確認沒有積壓。
- types 以外的更新仍會被讀取推進(offset 單一串流,無法單獨保留);
  若等待訊息期間按鈕被點擊,該 callback_query 會被消耗而不回傳,
  需要接收點擊事件時請讓 types 涵蓋 callback_query。

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "wait_for_reply"
  }
}

Input Schema

NameRequiredDescriptionDefault
typesNo
chat_idNo
timeoutNo
auto_answerNo
poll_intervalNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.2.1

TDQS

A4.5/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so: it discloses segmented 10-second long polling until timeout, that poll_interval is only a backoff after network errors (minimum 1s), that auto_answer replies immediately and a repeat answer_callback_query yields 'query is too old', that the offset is a single stream so non-matching updates are consumed and lost, and that a missing whitelist returns a config prompt requiring TELEGRAM_ALLOWED_CHAT_IDS. These are non-obvious behavioral traits an agent could not infer elsewhere.

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 English summary is front-loaded in one sentence, and the caveat bullets are dense with actionable detail rather than filler. The main cost is the full bilingual duplication, which roughly doubles length without adding information for an English-reading agent.

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

Completeness5/5

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

For a blocking, stateful polling tool with an output schema available, the description covers the mechanics, the failure modes, the state-file pitfall, and the configuration prerequisite. Return-value semantics are correctly left to the output schema, so nothing essential is missing beyond the chat_id detail.

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?

Schema coverage is 0%, so the description must compensate, and it does for four of five parameters: types (must include callback_query to receive clicks), timeout (seconds bound), poll_interval (backoff only, minimum 1 second), and auto_answer (default true, flip to false for custom prompts). The chat_id parameter is never explained, which leaves a real gap at this coverage level.

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 opening line gives a specific verb and resource ('Wait for the next user reply (message, button click, or poll answer) via long polling'), which is clearly distinct from the polling-style siblings. It also names get_updates as the non-blocking preview alternative, though the differentiation is stated only in the caveat section rather than up front.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly tells the agent to preview with get_updates(mark_read=False) on first call to check for backlog, to set auto_answer=False when custom text/show_alert/url is needed, and to include callback_query in types if clicks must be received. These are concrete when-to-do-X instructions tied to alternatives, not vague hints.

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