Skip to main content
Glama
luiso2

Evolution API WhatsApp MCP Server

by luiso2

update_template

Modify an existing WhatsApp Business message template by updating its name, description, text content, or variables to maintain accurate and current messaging for business communications.

Instructions

Update an existing template

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionNoNew description
nameNoNew name
templateIdYesTemplate ID
textNoNew text
variablesNoNew variables list

Implementation Reference

  • Main handler function for 'update_template' tool. Processes input arguments, constructs updates object, calls template service to update, handles errors, and formats MCP response.
    private async handleUpdateTemplate(args: any) {
      const updates: any = {};
      if (args.name) updates.name = args.name;
      if (args.description) updates.description = args.description;
      if (args.text) updates.content = { text: args.text };
      if (args.variables) updates.variables = args.variables;
    
      const updated = await templateService.updateTemplate(args.templateId, updates);
      if (!updated) {
        throw new Error(`Template ${args.templateId} not found`);
      }
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(updated, null, 2)
          }
        ]
      };
    }
  • Input schema/JSON Schema for validating parameters of the update_template tool.
    inputSchema: {
      type: 'object',
      properties: {
        templateId: { type: 'string', description: 'Template ID' },
        name: { type: 'string', description: 'New name' },
        description: { type: 'string', description: 'New description' },
        text: { type: 'string', description: 'New text' },
        variables: {
          type: 'array',
          items: { type: 'string' },
          description: 'New variables list'
        }
      },
      required: ['templateId']
    }
  • src/index.ts:275-293 (registration)
    Tool definition object in the static 'tools' array returned by ListTools handler, registering name, description, and schema.
    {
      name: 'update_template',
      description: 'Update an existing template',
      inputSchema: {
        type: 'object',
        properties: {
          templateId: { type: 'string', description: 'Template ID' },
          name: { type: 'string', description: 'New name' },
          description: { type: 'string', description: 'New description' },
          text: { type: 'string', description: 'New text' },
          variables: {
            type: 'array',
            items: { type: 'string' },
            description: 'New variables list'
          }
        },
        required: ['templateId']
      }
    },
  • src/index.ts:518-519 (registration)
    Dispatch registration in the CallTool request handler switch statement, routing 'update_template' calls to the specific handler method.
    case 'update_template':
      return await this.handleUpdateTemplate(args);
  • Supporting service method implementing the core template update logic: retrieves, merges updates, persists to storage, returns updated template.
    async updateTemplate(id: string, updates: Partial<MessageTemplate>): Promise<MessageTemplate | null> {
      const template = this.templates.get(id);
      if (!template) return null;
    
      const updatedTemplate = {
        ...template,
        ...updates,
        id, // Preserve ID
        updatedAt: new Date()
      };
    
      this.templates.set(id, updatedTemplate);
      await this.saveCustomTemplates();
      return updatedTemplate;
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.1/5.0
Behavior2/5

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

Without annotations, the description must disclose behavioral traits, but it only says 'Update' without explaining merge vs replace behavior, required permissions, or side effects.

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 concise and directly states the purpose, but it could be slightly more informative without adding much length.

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 no output schema and no annotations, the description is insufficiently complete, lacking details on return values or partial update behavior.

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%, so the schema fully documents parameters; the description adds no extra value beyond what the schema already provides.

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 action ('Update') and the resource ('an existing template'), distinguishing it from siblings like 'create_template' and 'delete_template'.

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 this tool versus alternatives or any prerequisites; the description is too minimal.

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