Search one chat
search_messagesSearch a specific Telegram chat for a keyword, newest first, returning matching messages; use each hit's id to read surrounding context.
Instructions
Search the messages of one chat for a keyword, newest first, and return the matching messages with the same fields as get_messages. Use search_all_chats when you do not know the chat. To read the conversation around a hit, pass its id to get_message_context.
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": {
"chat_id": "<chat_id>",
"query": "<query>"
},
"name": "search_messages"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum messages to return, 1 to 200 (default 20). | |
| query | Yes | Text to find in the message text (e.g. "invoice"). | |
| chat_id | Yes | The chat's ref, as list_chats or search_all_chats returns it (an opaque string; not the numeric Telegram id). | |
| topic_id | No | Forum topic id from get_topics; keeps only that topic's messages. 1 is the General topic. Omit for the whole chat. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| messages | No | Archived messages as the viewer returns them: id, date (naive UTC), text, sender fields, reply_to_msg_id, media and more. |