Read around a message
get_message_contextRetrieves the conversation around a specific message, returning older and newer messages from the same chat so you can understand replies and see the full context of a search hit.
Instructions
Read the conversation around one message: the message itself with up to before older and after newer messages of the same chat, oldest first. Use it after search_messages or search_all_chats finds a hit, or to see what a reply_to_msg_id points at.
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>",
"message_id": "<message_id>"
},
"name": "get_message_context"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| after | No | Newer messages to include, 0 to 50 (default 5). | |
| before | No | Older messages to include, 0 to 50 (default 5). | |
| chat_id | Yes | The chat's ref, as list_chats or search_all_chats returns it (an opaque string; not the numeric Telegram id). | |
| message_id | Yes | Id of the message to centre on (a message's id field). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| after | Yes | How many newer messages came back (fewer than asked at the end of the chat). | |
| before | Yes | How many older messages came back (fewer than asked at the start of the chat). | |
| messages | Yes | Oldest first: the older messages, the message itself, then the newer ones, with the same fields as get_messages. | |
| message_id | Yes | The message asked for; it is in messages. |