Skip to main content
Glama

Read a chat's recent messages

get_chat_history
Read-only

The latest messages of one chat, newest first: what your number received, what it sent from the phone or through us, and what WhatsApp sent when the phone was linked. Each message has the shape the message.created webhook delivers, so the same code reads both, and a webhook your server missed can be read back here.

We keep the latest 100 messages of each chat unless you change the number's historyPerChat with update_number; 0 keeps none. Media comes as its details, never the file. Free.

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": "<chat>"
    },
    "name": "get_chat_history"
  }
}

Input Schema

NameRequiredDescriptionDefault
chatYesThe chat: a phone number in international format (+5511988887777), or the address a webhook gave you for a group or for a contact whose number is hidden (…@g.us, …@lid).
limitNoHow many to return, newest first. Up to 100; 50 when left out.
numberNoWhich of your numbers kept the chat: its id or its phone. Optional when you have only one.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.3/5.0
Behavior5/5

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

Annotations already declare readOnly/no-destructive/no-open-world, and the description adds materially: a 100-message-per-chat retention window configurable via update_number (0 keeps none), media returned as metadata never the file, and zero cost. These are behavioral facts an agent cannot get from the annotations or schema.

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?

Front-loaded with the core purpose, then supporting detail in a second paragraph. Sentences carry real information, though 'Free.' as a fragment and the parenthetical webhook aside are slightly untidy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description compensates by describing the returned message shape, its parity with the message.created webhook, and media handling. Retention and pagination boundaries (what happens past 100 messages) are stated as retention, which is enough to call it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3; the description does not add new meaning to `chat`, `number`, or `limit` beyond what the schema documents. It mentions the 100-message retention ceiling that explains the limit maximum, but that is retention policy rather than parameter semantics.

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 first clause gives a specific verb and resource — the latest messages of one chat, newest first — and enumerates the three message sources (inbound, phone/API outbound, system notices) it returns. An agent can tell this is a chat-scoped read rather than a queue or list-chats tool from the description alone.

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?

It states a concrete use case: 'a webhook your server missed can be read back here,' and the parallel-shape claim ('the same code reads both') tells the agent when this substitutes for webhook payloads. It stops short of naming when not to use it or pointing at an explicit alternative for pagination or older history.

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