get_updates
Fetches pending Telegram updates once without waiting—messages, button clicks, and poll answers—with optional read-offset control and automatic callback answering.
Instructions
Fetch pending user updates (messages, button clicks, poll answers) once without waiting.
一次性拉取待處理的更新並歸一化回傳,不等待新訊息。
chat_id 未傳時使用 TELEGRAM_DEFAULT_CHAT_ID;未設定白名單時回傳設定提示。
types 可選 message、callback_query、poll_answer,預設全部。
mark_read=False 時不移動 offset,同一批訊息下次仍會回傳(預設會讀取並推進)。
auto_answer=True(預設,僅 mark_read=True 時生效)時,回傳的 callback_query
會當下立即以通用提示應答,payload 標記 auto_answered=True,消除取回後
手動應答超過有效窗口(query is too old)的競態;應答失敗時改標記
auto_answer_error,不影響更新回傳。需要自訂提示文字、show_alert 或 url
時設 auto_answer=False,改以 answer_callback_query 手動應答。
limit 只限制單次回傳筆數:offset 僅推進到實際回傳的最後一筆,
截斷的其餘符合項目會留待下次呼叫(因此其應答也延後到下一頁取回時);
無符合項時整批消耗(含白名單外與 types 以外的更新)以免積壓堆積——
offset 為單一串流,無法單獨保留某個型別或某間聊天室的更新。
注意:首次呼叫(尚無狀態檔)時 Telegram 會回傳全部未確認的 pending
updates,且 mark_read 預設 true 會將其讀取推進;若不想消耗歷史積壓,
第一次呼叫請先以 mark_read=False 預覽。
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": "get_updates"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| types | No | ||
| chat_id | No | ||
| mark_read | No | ||
| auto_answer | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |