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;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states 'Update' which implies mutation, but doesn't cover critical aspects like required permissions, whether updates are partial or full, idempotency, error conditions, or response format. This leaves significant gaps for a mutation tool.

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 a single, efficient sentence with no wasted words. It's appropriately sized for a basic tool description and gets straight to the point without unnecessary elaboration.

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 mutation tool with 5 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what happens during updates (e.g., partial vs. full updates), what the response contains, or error handling. The context demands more completeness than provided.

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 all parameters are documented in the schema. The description doesn't add any parameter-specific information beyond what's in the schema. This meets the baseline for high schema coverage but doesn't provide additional value.

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 'Update an existing template' clearly states the action (update) and resource (template), distinguishing it from sibling tools like create_template, delete_template, get_template, and search_templates. However, it doesn't specify what aspects of a template can be updated, which prevents a perfect score.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a templateId), contrast with create_template for new templates, or specify use cases like modifying template content versus metadata.

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