Skip to main content
Glama
luiso2

Evolution API WhatsApp MCP Server

by luiso2

get_messages

Retrieve messages from a WhatsApp chat by specifying the instance name and chat JID, with optional limit for number of messages to fetch.

Instructions

Get messages from a chat

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instanceNameYesInstance name
limitNoNumber of messages to retrieve
remoteJidYesChat JID

Implementation Reference

  • The handler function that implements the core logic of the 'get_messages' tool. It calls evolutionAPI.findMessages with instanceName, remoteJid, and optional limit, then returns the messages as a JSON-formatted text content block.
    private async handleGetMessages(args: any) {
      const messages = await evolutionAPI.findMessages(
        args.instanceName,
        args.remoteJid,
        args.limit || 20
      );
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(messages, null, 2)
          }
        ]
      };
    }
  • src/index.ts:413-425 (registration)
    Registers the 'get_messages' tool in the tools array, including its name, description, and input schema. This list is used by the MCP server for tool discovery.
    {
      name: 'get_messages',
      description: 'Get messages from a chat',
      inputSchema: {
        type: 'object',
        properties: {
          instanceName: { type: 'string', description: 'Instance name' },
          remoteJid: { type: 'string', description: 'Chat JID' },
          limit: { type: 'number', description: 'Number of messages to retrieve' }
        },
        required: ['instanceName', 'remoteJid']
      }
    },
  • Defines the input schema for the 'get_messages' tool, specifying required instanceName and remoteJid, with optional limit.
    inputSchema: {
      type: 'object',
      properties: {
        instanceName: { type: 'string', description: 'Instance name' },
        remoteJid: { type: 'string', description: 'Chat JID' },
        limit: { type: 'number', description: 'Number of messages to retrieve' }
      },
      required: ['instanceName', 'remoteJid']
    }
  • src/index.ts:542-543 (registration)
    Dispatches calls to the 'get_messages' tool to its handler function in the main CallToolRequestSchema handler switch statement.
    case 'get_messages':
      return await this.handleGetMessages(args);
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('Get messages') but does not describe key behaviors such as whether this is a read-only operation, if it requires authentication, how messages are ordered, if there are rate limits, or what the output format looks like (e.g., list of messages with metadata). This leaves significant gaps for an agent to understand the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence ('Get messages from a chat') that is front-loaded with the core action. It avoids unnecessary words and gets straight to the point, making it easy to parse quickly. Every word earns its place by conveying the essential purpose without redundancy.

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

Completeness2/5

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

Given the complexity of a tool with 3 parameters, no annotations, and no output schema, the description is incomplete. It lacks details on behavioral aspects (e.g., read-only nature, authentication needs), usage context, and output expectations. While the schema covers parameters well, the overall context for safe and effective use by an AI agent is insufficient, especially for a data retrieval tool in a messaging system.

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?

The input schema has 100% description coverage, with clear parameter descriptions (e.g., 'Instance name', 'Number of messages to retrieve', 'Chat JID'). The description does not add any meaning beyond this, such as explaining what a 'Chat JID' is or how the 'limit' parameter behaves (e.g., default values or constraints). With high schema coverage, the baseline score of 3 is appropriate, as the schema handles the heavy lifting.

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

Purpose3/5

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

The description 'Get messages from a chat' clearly states the verb ('Get') and resource ('messages from a chat'), making the purpose understandable. However, it lacks specificity about scope (e.g., recent messages, all messages, or filtered by criteria) and does not differentiate from sibling tools like 'get_chats' or 'read_message', which might retrieve chat metadata or mark messages as read, respectively.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It does not mention prerequisites (e.g., needing an active instance), exclusions (e.g., not for group chats if that applies), or comparisons to siblings like 'get_chats' (for chat lists) or 'read_message' (for marking as read). Usage is implied only by the tool name.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/luiso2/mcp-evolution-api'

If you have feedback or need assistance with the MCP directory API, please join our Discord server