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; }

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