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);

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