Skip to main content
Glama
luiso2

Evolution API WhatsApp MCP Server

by luiso2

list_templates

Retrieve available WhatsApp message templates for business messaging, with options to filter by category or tags to find suitable templates for order confirmations, appointment reminders, or promotional messages.

Instructions

List all message templates

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNoFilter by category
tagsNoFilter by tags

Implementation Reference

  • Main handler function for the 'list_templates' tool. It checks input arguments for category or tags filters and calls the appropriate TemplateService method to retrieve templates, then returns them as JSON text content.
    private async handleListTemplates(args: any) {
      let templates;
    
      if (args.category) {
        templates = templateService.getTemplatesByCategory(args.category);
      } else if (args.tags && args.tags.length > 0) {
        templates = templateService.getTemplatesByTags(args.tags);
      } else {
        templates = templateService.getAllTemplates();
      }
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(templates, null, 2)
          }
        ]
      };
    }
  • Input schema for the list_templates tool, defining optional category (string) and tags (array of strings) parameters for filtering templates.
    inputSchema: {
      type: 'object',
      properties: {
        category: { type: 'string', description: 'Filter by category' },
        tags: {
          type: 'array',
          items: { type: 'string' },
          description: 'Filter by tags'
        }
      }
    }
  • src/index.ts:197-211 (registration)
    Tool definition object registered in the 'tools' array, which is returned by the ListTools handler.
    {
      name: 'list_templates',
      description: 'List all message templates',
      inputSchema: {
        type: 'object',
        properties: {
          category: { type: 'string', description: 'Filter by category' },
          tags: {
            type: 'array',
            items: { type: 'string' },
            description: 'Filter by tags'
          }
        }
      }
    },
  • src/index.ts:508-509 (registration)
    Switch case in the CallToolRequest handler that dispatches 'list_templates' calls to the specific handleListTemplates method.
    case 'list_templates':
      return await this.handleListTemplates(args);
  • Core helper method in TemplateService that retrieves all templates from the internal map, used by the handler when no filters are specified.
    getAllTemplates(): MessageTemplate[] {
      return Array.from(this.templates.values());
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

C2.9/5.0
Behavior2/5

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

With no annotations, the description should disclose behavior like read-only nature or return format. It only states 'list', which implies a read operation, but does not confirm it or describe side effects, pagination, or response structure.

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 sentence with no unnecessary words, making it efficient. However, it omits important details without becoming verbose.

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 lack of annotations and no output schema, the description should provide more context, such as return format or that it retrieves templates. It is too brief to be fully useful for an AI agent.

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 covers both parameters (tags, category) with descriptions. The tool description adds no additional meaning beyond what the schema already provides, so baseline 3 applies.

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

Purpose4/5

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

The description 'List all message templates' clearly states the verb (list) and resource (message templates), but does not differentiate from sibling tools like search_templates. It implies a broad listing, which is clear but lacks distinction.

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 such as search_templates or get_template. There is no mention of prerequisites or exclusions.

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