Skip to main content
Glama
wganalytics

mcp-whatsapp-giulia-ai

by wganalytics

PRJ-06 — WhatsApp via Evolution API (servidor MCP)

Servidor MCP (FastMCP, stdio) que dá a um agente LLM tools para operar o WhatsApp através da Evolution API (gateway self-hosted). Corresponde ao Capítulo 7 do livro Model Context Protocol (Sandeco).

As implementações mock originais (grupos/mensagens fake e envio via print) foram substituídas por chamadas reais à Evolution API (src/evolution_client.py).

Tools

Tool

Endpoint Evolution

O que faz

get_groups

GET /group/fetchAllGroups/{instance}

Lista os grupos reais da instância.

get_group_messages(group_id, start, end)

POST /chat/findMessages/{instance}

Histórico de um grupo (recorte por data feito client-side).

send_message_to_group(group_id, message)

POST /message/sendText/{instance}

Envia texto a um grupo (...@g.us).

send_message_to_phone(cellphone, message)

POST /message/sendText/{instance}

Envia texto a um número (5511...).

Related MCP server: WhatsApp Cloud API MCP Server

Configuração

Requer uma instância Evolution API rodando com um número de WhatsApp pareado.

uv sync
cp .env.example .env     # preencha com os dados da SUA instância
uv run python src/evoapi_mcp.py   # ou: uv run python src/main.py

Variáveis (.env, fora do git):

Variável

Descrição

EVOLUTION_BASE_URL

URL do servidor Evolution (ex.: http://host:8080)

EVOLUTION_API_KEY

API key (header apikey)

EVOLUTION_INSTANCE

Nome da instância pareada

Testado contra Evolution API v2. Conforme a versão, algum nome de campo na resposta (ex.: subject, pushName, formato de findMessages) pode variar — o cliente já normaliza os formatos mais comuns.

Ciclo de vida do cliente HTTP

O EvolutionClient é compartilhado entre as tools, via get_client().

Antes, cada chamada de tool instanciava GroupController()EvolutionClient() → um httpx.Client novo que nunca era fechado. Num servidor MCP de vida longa isso vaza um pool de conexões por chamada: 10 chamadas, 10 pools abertos.

Como o servidor atende uma única instância da Evolution, um cliente reaproveitado é o formato correto — mantém o keep-alive e não acumula sockets. A criação é preguiçosa (o erro de configuração aparece no primeiro uso, não na subida do servidor) e close_client() está registrado em atexit.

GroupController e SendGiuliaAI aceitam um cliente injetado, o que permite testar sem rede.

Testes

uv run pytest        # 35 testes, sem tocar a rede (httpx.MockTransport)

Cobrem o reuso do cliente, o fechamento do pool, a validação de configuração, a normalização dos formatos de resposta da Evolution, a extração de texto por tipo de mensagem e o recorte por data.

Available Tools

4 tools
get_group_messagesA

Recupera as mensagens enviadas em um grupo do WhatsApp dentro de um intervalo de datas especificado. Esta ferramenta permite ao agente acessar o histórico de conversas de um grupo, retornando as mensagens publicadas entre 'start_date' e 'end_date', com detalhes como remetente, horário, tipo da mensagem e conteúdo textual. Args: group_id (str): Identificador único do grupo do WhatsApp. start_date (str): Data e hora de início no formato 'YYYY-MM-DD HH:MM:SS'. end_date (str): Data e hora de término no formato 'YYYY-MM-DD HH:MM:SS'. Returns: str: Lista de mensagens formatadas, com os campos: - Usuário - Data e hora - Tipo da mensagem - Texto Cada mensagem é separada por um delimitador visual.

ParametersJSON Schema
NameRequiredDescriptionDefault
end_dateYes
group_idYes
start_dateYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.4/5.0
Behavior3/5

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

No annotations are provided, so the description must carry the full behavioral burden. It discloses the return format (list of messages with user, datetime, type, text) and the date-range filtering, but does not mention any potential side effects, rate limits, or limitations. Since this is a read operation, the lack of explicit safety disclosure is a minor gap.

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 well-structured and front-loaded with purpose, followed by parameter details and return format. It contains no redundant sentences; every sentence contributes useful information about what the tool does, how to use it, and what it returns.

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?

The description covers the tool's input parameters, date format, and output structure (including fields and delimiter). Even though an output schema is indicated, the Returns section adds extra clarity. For a moderate-complexity read tool, this is complete and self-sufficient.

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

Parameters5/5

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

The schema only provides types and titles, with 0% description coverage, but the description's Args section gives each parameter meaningful explanations: group_id as unique group identifier, and start_date/end_date with explicit format 'YYYY-MM-DD HH:MM:SS'. This fully compensates for the schema's lack of detail.

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 clearly states the tool 'Recupera as mensagens enviadas em um grupo do WhatsApp' (retrieves sent messages in a WhatsApp group), using a specific verb and resource. It distinguishes from siblings like get_groups (which lists groups) and send_* tools (which send messages).

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?

The description explains the tool's purpose as accessing group conversation history within a date range, clearly implying its use for read operations. It does not explicitly name alternatives or exclusions, but the context is unambiguous and adequate.

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

get_groupsA
Recupera e retorna uma lista formatada de
grupos do WhatsApp disponíveis.
Esta ferramenta permite ao agente obter os
grupos cadastrados, exibindo
informações relevantes como o ID do grupo e
seu nome, em formato textual.
A resposta pode ser usada para seleção
posterior de um grupo para envio
de mensagens.
Returns:
    str: Lista de grupos no formato:
    "Grupo ID: <id>, Nome: <nome>

"

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.2/5.0
Behavior4/5

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

Sem anotações, a descrição assume o fardo comportamental ao usar verbos como 'Recupera e retorna' e ao detalhar o formato de saída ('Grupo ID: <id>, Nome: <nome>'). Não menciona efeitos colaterais, mas para uma ferramenta de listagem, o comportamento principal é claro e não parece destrutivo.

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

Conciseness3/5

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

A descrição contém redundância: a primeira e a segunda frase reafirmam a mesma ação de obter grupos. A estrutura com seção 'Returns' é útil, mas o texto poderia ser mais enxuto sem perder informações.

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?

Para uma ferramenta sem parâmetros e com saída previsível, a descrição cobre o propósito, o conteúdo e o formato de retorno. No entanto, não menciona comportamentos de borda, como lista vazia ou possíveis falhas de autenticação, o que seria útil, mas não crítico para um caso simples.

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?

O esquema não possui parâmetros, então a descrição não precisa compensar lacunas. A baseline para zero parâmetros é 4, e a descrição não adiciona ambiguidade, já que não há entradas a explicar.

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?

A descrição afirma claramente que a ferramenta 'Recupera e retorna uma lista formatada de grupos do WhatsApp', especificando o conteúdo (ID e nome). Diferencia-se dos irmãos get_group_messages, send_message_to_group e send_message_to_phone, que focam em mensagens, enquanto esta lida com listagem de grupos.

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?

A descrição indica que a resposta 'pode ser usada para seleção posterior de um grupo para envio de mensagens', contextualizando o uso. Não menciona quando evitar a ferramenta nem alternativas explícitas, mas o propósito é claro o suficiente para uso básico.

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

send_message_to_groupA

Envia uma mensagem de texto para um grupo específico do WhatsApp. Esta ferramenta permite ao agente enviar mensagens para grupos do WhatsApp utilizando a API do WhatsApp. A mensagem será entregue ao grupo identificado pelo group_id fornecido. Args: group_id (str): Identificador único do grupo do WhatsApp no formato 'XXXXXXXXXXXXXXXXX@g.us'. Este ID pode ser obtido através da ferramenta get_groups(). message (str): Conteúdo da mensagem a ser enviada. Pode conter texto formatado, emojis e quebras de linha. Returns: str: Mensagem indicando o resultado da operação: - "Mensagem enviada com sucesso" em caso de êxito - "Erro ao enviar mensagem: <descrição>" em caso de falha Raises: Exception: Possíveis erros durante o envio da mensagem, como: - Grupo não encontrado - Problemas de conexão - Falha na autenticação - Formato inválido de mensagem

ParametersJSON Schema
NameRequiredDescriptionDefault
messageYes
group_idYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.4/5.0
Behavior4/5

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

There are no annotations, so the description carries the full burden. It discloses the return value format ('Mensagem enviada com sucesso' or 'Erro ao enviar mensagem...') and lists possible error conditions (group not found, connection, authentication, invalid message). It does not mention rate limits or idempotency, but for a send-message tool this is adequate behavioral context.

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 description is well-structured with purpose, Args, Returns, and Raises sections. It is front-loaded with the main purpose. However, it contains some redundancy (e.g., 'Esta ferramenta permite...' repeats the first sentence) and the Returns/Raises sections may be unnecessary if the output schema already covers them. Still, it is appropriately sized and each section adds value.

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?

Given the tool's simplicity and the lack of annotations or schema descriptions, the description covers the essential aspects: purpose, parameters, return values, and error cases. It also provides a cross-reference to get_groups() for obtaining the group_id. It does not mention prerequisites like authentication, but it lists authentication failure as an error, implying auth is needed. Overall, it is complete enough for an agent to select and invoke the tool.

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

Parameters5/5

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

The schema provides zero descriptions for the parameters, and the description fully compensates. It explains group_id's format ('XXXXXXXXXXXXXXXXX@g.us') and how to obtain it via get_groups(), and it details message content possibilities including formatted text, emojis, and line breaks. This adds significant meaning beyond the bare 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 clearly states the tool's function: 'Envia uma mensagem de texto para um grupo específico do WhatsApp' (sends a text message to a specific WhatsApp group). It uses a specific verb and resource, and distinguishes itself from sibling tools like send_message_to_phone and get_groups by focusing on group messaging and referencing the group_id format.

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?

The description provides usage context by explaining that group_id can be obtained via the get_groups() tool, guiding the agent on the prerequisite step. It implicitly differentiates from send_message_to_phone by targeting groups, but it does not explicitly state 'use this only for groups, not phones,' so there is no clear exclusion.

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

send_message_to_phoneA

Envia uma mensagem de texto para um número de telefone específico via WhatsApp. Esta ferramenta permite ao agente enviar mensagens diretamente para números de telefone individuais utilizando a API do WhatsApp. A mensagem será entregue ao destinatário somente se o número estiver registrado no WhatsApp. Args: cellphone (str): Número do telefone no formato internacional, incluindo código do país e DDD, sem caracteres especiais. se por acaso falta o 55, coloque 55 coloque o 55 na frente do numero. Mas o usuário tem que informa o DDD obrigatoriamente. Exemplo: '5511999999999' para um nú mero de São Paulo, Brasil. message (str): Conteúdo da mensagem a ser enviada. Pode conter texto formatado, emojis e quebras de linha. Returns: str: Mensagem indicando o resultado da operação: - "Mensagem enviada com sucesso" em caso de êxito - "Erro ao enviar mensagem: <descrição>" em caso de falha Raises: Exception: Possíveis erros durante o envio da mensagem, como: - Número inválido ou mal formatado - Número não registrado no WhatsApp - Problemas de conexão - Falha na autenticação - Formato inválido de mensagem

ParametersJSON Schema
NameRequiredDescriptionDefault
messageYes
cellphoneYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.5/5.0
Behavior4/5

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

With no annotations provided, the description fully discloses the delivery condition (only if registered), the success/error return messages, and a list of possible exceptions (invalid number, not registered, connection issues, authentication failure, invalid message format). This goes beyond basic operation and gives the agent a realistic expectation of behavior.

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 description is well-structured with clear Args, Returns, and Raises sections, making it easy to scan. It contains a slight redundancy in the opening sentences but every section adds meaningful information without excessive verbosity.

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?

For a 2-parameter tool with no annotations and no schema descriptions, the description is remarkably complete. It covers purpose, parameter semantics, return values, and error conditions, leaving little ambiguity about how to invoke the tool and what to expect.

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

Parameters5/5

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

The schema provides only type strings with no descriptions, so the parameter details in the description are essential. It thoroughly explains 'cellphone' format (international, country code, DDD, no special characters, example) and 'message' content (text, emojis, line breaks), including the specific rule to prepend 55 if missing.

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 clearly states it sends a text message to a specific phone number via WhatsApp, using the verb 'Envia' and resource 'mensagem de texto para um número de telefone específico'. It distinguishes from the sibling tool 'send_message_to_group' by emphasizing 'números de telefone individuais'.

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?

The description provides context that the message will only be delivered if the number is registered on WhatsApp, which is a key usage condition. It also implies the tool is for individual numbers, differentiating it from group messaging, though it does not explicitly name alternatives or state when not to use it.

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

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 4 tool updatesv0.1.0
    • First observedget_group_messages
    • First observedget_groups
    • First observedsend_message_to_group
    • First observedsend_message_to_phone

TDQS

A4.4/5.0
Disambiguation5/5

Each tool has a distinct purpose: listing groups, retrieving group messages, sending to a group, and sending to a phone number. The descriptions clearly differentiate the targets and actions, leaving no ambiguity.

Naming Consistency5/5

All tools follow a consistent snake_case naming convention with a clear verb (get or send) followed by the object. The pattern is predictable and uniform across the set.

Tool Count5/5

With 4 tools, the server is well-scoped for its purpose of reading and sending WhatsApp messages. Each tool addresses a necessary function without bloat, and the count falls comfortably within the ideal range.

Completeness4/5

The tool set covers the core workflows: listing groups, reading group history, and sending messages to both groups and individual phones. While it lacks features like media sending or listing individual chats, these are non-essential for the apparent primary use case.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

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/wganalytics/mcp-whatsapp-giulia-ai'

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