Skip to main content
Glama

Get chat messages

get_chat_messages
Read-only

A chat's messages, oldest first in the page, by cursor: the newest page by default; 'before' a message id reads further back, 'after' one reads forward (what came since). 'more' says the page stopped short — pass the first message's id as 'before' for the page before it. Each message: author (absent when an agent wrote it — then 'agent' names the role and whom it answered), Markdown body (absent once deleted, with 'deleted' true), 'replyTo' (with 'edited' when the message answered was changed after), 'quote' — the words of it this message quotes, as they were quoted, with 'edited' / 'deleted' when the source changed or went since — 'reactions' (each emoji with its 'count', whether you are one of them ('me') and 'users' who pressed it, named only while they are in the chat), files by address, 'issues' made of it that you may open. Reading here does not mark the chat read — mark_chat_read does. 'working' lists the agents answering in it now. A secret chat ('secret' true) is end to end: its words open on its people's devices only, so here every message has an empty body — who wrote when, and nothing of what; it cannot be written to from here either.

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": {
      "chatId": "<chatId>"
    },
    "name": "get_chat_messages"
  }
}

Input Schema

NameRequiredDescriptionDefault
afterNoRead the messages after this id, going forward. Wins over 'before'.
limitNoHow many, 1–100. Default 50.
beforeNoRead the messages before this id, going back.
chatIdYesThe chat's id, as list_chats gives it.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.6/5.0
Behavior5/5

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

Annotations only say read-only, non-destructive, non-open-world; the description adds substantial behavior beyond that: reads do not mark the chat read, secret chats return empty bodies and cannot be written to from here, and 'working' lists agents currently answering. It also discloses field-level semantics (author absent for agent messages, body absent once deleted, 'replyTo'/'edited', 'quote' with 'deleted', reaction 'me'/'users' scoping, files, issues).

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 cursor mechanics are correctly front-loaded before the return-field inventory, so the agent gets the pagination contract first. It is a dense single paragraph with heavy nested quoting that would scan better as short bullets, but nearly every clause carries information an agent needs.

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?

There is no output schema, so the description must carry return-value semantics — and it does, enumerating author/agent, body/deleted, replyTo/edited, quote, reactions, files, issues, and 'working'. It also covers the important edge case of end-to-end secret chats returning empty bodies, leaving nothing essential for a correct call unexplained.

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 100%, so the schema already documents all four parameters, setting the baseline at 3. The description exceeds that by explaining the interaction semantics of 'before' vs 'after' (backward vs forward, "what came since") and how the 'more' flag plus the first message's id drives the next 'before' call; only 'limit' is left entirely to the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a precise resource and ordering contract: "A chat's messages, oldest first in the page, by cursor." It is immediately distinguishable from mutation siblings (send_chat_message, delete_chat_message) and from the read-marking sibling (mark_chat_read), and it states the default page is the newest one.

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

Usage Guidelines4/5

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

Gives concrete operating instructions: default newest page, 'before' reads back, 'after' reads forward, and 'more' means pass the first message's id as 'before' to get the prior page. It also names the alternative for the related-but-different task ("Reading here does not mark the chat read — mark_chat_read does"). No explicit when-not-to-use guidance beyond the secret-chat limitation, so it falls just short of a 5.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources