Skip to main content
Glama
billyfranklim1

mcp-evolution

Handle Label

handle_label

Assign or unassign a WhatsApp label to a chat by providing the chat number, label ID, and action (add or remove). Requires WhatsApp Business instance.

Instructions

Add or remove a WhatsApp label from a chat via the pinned instance (requires WhatsApp Business).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
numberYesRecipient JID or phone number (e.g. 5511999999999 or group@g.us)
labelIdYesLabel ID to add or remove (get IDs from find_labels)
actionYesadd: assign label to chat; remove: unassign label from chat

Implementation Reference

  • Registration function (registerHandleLabel) that creates the 'handle_label' tool. The handler makes a POST request to /label/handleLabel/{instanceName} with number, labelId, and action (add/remove) to assign or unassign a WhatsApp label from a chat.
    export function registerHandleLabel(server: McpServer, client: EvolutionClient): void {
      server.registerTool(
        "handle_label",
        {
          title: "Handle Label",
          description: "Add or remove a WhatsApp label from a chat via the pinned instance (requires WhatsApp Business).",
          inputSchema: schema,
        },
        async (args) => {
          try {
            const data = await client.post(`/label/handleLabel/${client.instanceName}`, {
              number: args.number,
              labelId: args.labelId,
              action: args.action,
            });
            return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
          } catch (e) {
            if (e instanceof McpError) return { isError: true, content: [{ type: "text" as const, text: e.message }] };
            throw e;
          }
        }
      );
    }
  • Input schema for the handle_label tool: number (PhoneOrJidSchema), labelId (string), and action (enum: add/remove).
    const schema = {
      number: PhoneOrJidSchema,
      labelId: z.string().min(1).describe("Label ID to add or remove (get IDs from find_labels)"),
      action: z.enum(["add", "remove"]).describe("add: assign label to chat; remove: unassign label from chat"),
    };
  • Import of registerHandleLabel from handle-label.js.
    import { registerHandleLabel } from "./handle-label.js";
  • Call to registerHandleLabel(server, client) inside registerAllTools, registering the tool with the MCP server.
    registerHandleLabel(server, client);
  • PhoneOrJidSchema used as the type validator for the 'number' parameter of handle_label.
    export const PhoneOrJidSchema = z
      .string()
      .min(1)
      .describe("Recipient JID or phone number (e.g. 5511999999999 or group@g.us)");
Behavior3/5

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

With no annotations, the description bears the burden of behavioral disclosure. It states the tool mutates labels (add/remove) but does not specify idempotency, error behavior on invalid inputs, or side effects. Minimal additional context beyond schema.

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?

Single, well-structured sentence that conveys purpose and prerequisite efficiently. No superfluous words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 3 required parameters, no output schema, and no annotations, the description covers the essential purpose and a key prerequisite. However, it could mention success/failure behavior or rate limits, though not critical.

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?

Input schema has 100% description coverage with clear parameter descriptions. The tool description adds no new semantic information about parameters beyond what the schema already provides. Baseline rating applies.

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 explicitly states the action (add or remove) and resource (WhatsApp label from a chat), and mentions the prerequisite (requires WhatsApp Business) and context (via pinned instance). This clearly distinguishes it from sibling tools like find_labels.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description includes a prerequisite (requires WhatsApp Business) and implies usage for label management. However, it lacks explicit guidance on when to use vs alternatives, though no direct sibling for label mutation exists.

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/billyfranklim1/mcp-evolution'

If you have feedback or need assistance with the MCP directory API, please join our Discord server