Skip to main content
Glama
luiso2

Evolution API WhatsApp MCP Server

by luiso2

send_template

Send pre-approved WhatsApp Business template messages with dynamic variables for order confirmations, appointment reminders, and promotional communications.

Instructions

Send a message using a template

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instanceNameYesInstance name
numberYesRecipient phone number
templateIdYesTemplate ID
variablesYesVariables to replace in template

Implementation Reference

  • The handler function that implements the core logic for the 'send_template' tool. Retrieves the template, validates and processes variables, then sends the message via appropriate API calls.
    private async handleSendTemplate(args: any) {
      const template = templateService.getTemplate(args.templateId);
      if (!template) {
        throw new Error(`Template ${args.templateId} not found`);
      }
    
      // Validate variables
      const missingVars = templateService.validateVariables(template, args.variables);
      if (missingVars.length > 0) {
        throw new Error(`Missing variables: ${missingVars.join(', ')}`);
      }
    
      // Process template
      const processedContent = templateService.processTemplate(template, args.variables);
    
      // Send message based on content type
      let result;
      if (processedContent.text) {
        result = await evolutionAPI.sendText(args.instanceName, {
          number: args.number,
          text: processedContent.text
        });
      } else if (processedContent.listMessage) {
        result = await evolutionAPI.sendList(args.instanceName, {
          number: args.number,
          ...processedContent.listMessage
        });
      } else if (processedContent.buttons) {
        result = await evolutionAPI.sendButtons(args.instanceName, {
          number: args.number,
          buttons: processedContent.buttons
        });
      }
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2)
          }
        ]
      };
    }
  • The tool definition including name, description, and input schema for 'send_template', used for tool listing and validation.
    {
      name: 'send_template',
      description: 'Send a message using a template',
      inputSchema: {
        type: 'object',
        properties: {
          instanceName: { type: 'string', description: 'Instance name' },
          number: { type: 'string', description: 'Recipient phone number' },
          templateId: { type: 'string', description: 'Template ID' },
          variables: {
            type: 'object',
            description: 'Variables to replace in template'
          }
        },
        required: ['instanceName', 'number', 'templateId', 'variables']
      }
    },
  • src/index.ts:514-515 (registration)
    The dispatch case in the CallToolRequest handler that routes 'send_template' calls to the specific handler method.
    case 'send_template':
      return await this.handleSendTemplate(args);
Behavior2/5

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

With no annotations, the description carries full burden but only states the action without disclosing behavioral traits. It doesn't mention permissions, rate limits, side effects (e.g., message delivery status), or response format, which are critical for a send operation with potential mutations.

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 a single, efficient sentence with no wasted words. It's front-loaded and clear, though slightly under-specified given the tool's complexity. It earns a 4 for brevity but loses a point for lacking necessary detail.

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?

For a 4-parameter tool with no annotations and no output schema, the description is incomplete. It doesn't cover behavioral aspects, usage context, or output expectations, leaving significant gaps for an agent to understand how to invoke 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 description coverage is 100%, so parameters are documented in the schema. The description adds no meaning beyond the schema, such as explaining how variables map to templates or format requirements. Baseline 3 is appropriate as the schema handles parameter documentation.

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 'Send a message using a template' clearly states the action (send) and resource (message/template), but it's vague about scope and doesn't differentiate from siblings like send_text, send_buttons, or send_list. It lacks specificity about what type of message or platform is involved.

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?

No guidance is provided on when to use this tool versus alternatives like send_text or send_media. The description implies template-based messaging but doesn't specify prerequisites (e.g., needing a pre-defined template) or exclusions, leaving usage context unclear.

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