get_labels
Retrieve all labels and tags assigned to a WhatsApp session. Use a session ID to get a complete list of labels for organizing chats.
Instructions
List all labels/tags in the WhatsApp session
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sessionId | Yes | Session ID |
Implementation Reference
- src/tools/labels.ts:5-18 (registration)Registers the 'get_labels' tool via server.registerTool with its schema and handler.
export function registerLabelTools(server: McpServer) { server.registerTool( "get_labels", { description: "List all labels/tags in the WhatsApp session", inputSchema: { sessionId: z.string().describe("Session ID"), }, }, async ({ sessionId }) => { const data = await openwaClient({ method: "GET", path: `/sessions/${sessionId}/labels` }); return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; } ); - src/tools/labels.ts:7-7 (handler)The tool name 'get_labels' is the identifier string passed to registerTool.
"get_labels", - src/tools/labels.ts:8-13 (schema)Input schema definition for 'get_labels': requires a sessionId (string) parameter.
{ description: "List all labels/tags in the WhatsApp session", inputSchema: { sessionId: z.string().describe("Session ID"), }, }, - src/tools/labels.ts:14-17 (handler)Handler function for 'get_labels' that calls openwaClient with GET /sessions/{sessionId}/labels and returns the response as JSON text.
async ({ sessionId }) => { const data = await openwaClient({ method: "GET", path: `/sessions/${sessionId}/labels` }); return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; } - src/index.ts:10-10 (registration)Imports registerLabelTools from the labels module.
import { registerLabelTools } from "./tools/labels.js";