Find Labels
find_labelsList all WhatsApp labels for the pinned instance. Returns normalized label IDs, names, and colors.
Instructions
List all WhatsApp labels for the pinned instance (requires WhatsApp Business). Returns normalized { id, name, color } array — nested chat blobs dropped to prevent overflow.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/find-labels.ts:12-36 (handler)The main handler/registration for the 'find_labels' tool. Calls the Evolution API endpoint /label/findLabels/{instanceName}, normalizes the raw response by extracting only id, name, and color fields, and returns JSON output.
export function registerFindLabels(server: McpServer, client: EvolutionClient): void { server.registerTool( "find_labels", { title: "Find Labels", description: "List all WhatsApp labels for the pinned instance (requires WhatsApp Business). " + "Returns normalized { id, name, color } array — nested chat blobs dropped to prevent overflow.", inputSchema: {}, }, async () => { try { const data = await client.get(`/label/findLabels/${client.instanceName}`); const raw: RawLabel[] = Array.isArray(data) ? data : []; const normalized = raw.map(({ id, name, color }) => ({ id, name, color })); return { content: [{ type: "text" as const, text: JSON.stringify(normalized, null, 2) }] }; } catch (e) { if (e instanceof McpError) return { isError: true, content: [{ type: "text" as const, text: e.message }] }; throw e; } } ); } - src/tools/find-labels.ts:5-10 (schema)Type definition for the raw label data returned from the API. The input schema is empty ({}) meaning no parameters are required.
interface RawLabel { id?: string; name?: string; color?: string | number; [key: string]: unknown; } - src/tools/index.ts:141-143 (registration)Registration call in the central registerAllTools function. The import is on line 69.
// Label registerFindLabels(server, client); registerHandleLabel(server, client); - src/tools/index.ts:68-70 (registration)Import of the registerFindLabels function from the find-labels module.
// Label import { registerFindLabels } from "./find-labels.js"; import { registerHandleLabel } from "./handle-label.js";