Skip to main content
Glama
luiso2

Evolution API WhatsApp MCP Server

by luiso2

search_templates

Find predefined WhatsApp message templates for business scenarios like order confirmations, appointment reminders, and promotional messages by entering search terms.

Instructions

Search templates by text

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query

Implementation Reference

  • The handler function for the 'search_templates' tool. It calls templateService.searchTemplates with the query argument and returns the results as a JSON-formatted text response.
    private async handleSearchTemplates(args: any) {
      const templates = templateService.searchTemplates(args.query);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(templates, null, 2)
          }
        ]
      };
    }
  • Input schema definition for the 'search_templates' tool, specifying a required 'query' string parameter.
    inputSchema: {
      type: 'object',
      properties: {
        query: { type: 'string', description: 'Search query' }
      },
      required: ['query']
  • src/index.ts:294-304 (registration)
    Registration of the 'search_templates' tool in the MCP tools array, including name, description, and input schema.
    {
      name: 'search_templates',
      description: 'Search templates by text',
      inputSchema: {
        type: 'object',
        properties: {
          query: { type: 'string', description: 'Search query' }
        },
        required: ['query']
      }
    },
  • The core helper method in TemplateService that performs the actual template search by filtering on name, description, tags, and category.
    searchTemplates(query: string): MessageTemplate[] {
      const lowerQuery = query.toLowerCase();
      return Array.from(this.templates.values()).filter(template => {
        return (
          template.name.toLowerCase().includes(lowerQuery) ||
          template.description?.toLowerCase().includes(lowerQuery) ||
          template.tags?.some(tag => tag.toLowerCase().includes(lowerQuery)) ||
          template.category?.toLowerCase().includes(lowerQuery)
        );
      });
    }

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?

No annotations provided; description does not disclose behavioral traits such as partial match behavior, case sensitivity, pagination, or response format. For a search tool, these are critical gaps.

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?

Single sentence, efficient and front-loaded. No wasted words, but could be expanded without harming conciseness.

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?

Despite simple schema, the description lacks context on what fields are searched (name, content?), how results are presented, and any limitations. With no output schema, more details are needed.

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 coverage is 100% with one parameter 'query' described as 'Search query'. Tool description adds no further meaning beyond that, so baseline of 3 is appropriate.

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?

Description states verb 'search', resource 'templates', and method 'by text'. It distinguishes from siblings like list_templates (list all) and get_template (by ID), though could be more specific.

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 on when to use search_templates versus list_templates or get_template. Does not mention that search is text-based and filtering differs from listing.

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