search_messages
Search permitted Telegram chats for messages by keyword, date range, chat or folder, sender, link presence, content type, or direction, with cursor-based pagination.
Instructions
Search permitted chats with early results, sorted within each page by default.
ordering=page visits sources fairly without waiting for every source. Ordering
between pages is not guaranteed. Use ordering=global for a strictly ordered
traversal, which can require empty preparation pages. The response reports the
actual ordering guarantee. order chooses newest_first or oldest_first. Repeat
both parameters with a cursor. Restricted searches only fetch permitted chats.
Dates include a timezone; interval is [date_from, date_to). Folder IDs form a union;
explicit chat_ids intersect that union. Omitted selectors use all permitted dialogs.
has_link=true selects URL-bearing posts, independently of content_type.
include_button_urls=true also matches links in buttons and implies has_link=true.
Supply chat_ids or folder_ids and both dates. Keywords still search the post text.
An empty query also permits direction=incoming/outgoing with explicit chat_ids or
folder_ids. Direction uses Telegram's outgoing flag; repeat it with the cursor.
has_link=false excludes links. Omit it for either kind.
Uses Telegram keyword search, not semantic search. Native sender search and local
date/content filtering are combined. Partial/empty pages may carry next_cursor.
Configured public-channel access applies only to explicit chat_ids, never implicit scope.
Temporary failures retain next_cursor; respect retry_after_seconds before continuing.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"query": "<query>"
},
"name": "search_messages"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| order | No | newest_first | |
| query | Yes | ||
| cursor | No | ||
| date_to | No | ||
| chat_ids | No | ||
| has_link | No | ||
| ordering | No | page | |
| date_from | No | ||
| direction | No | all | |
| sender_id | No | ||
| folder_ids | No | ||
| content_type | No | ||
| include_button_urls | No |