Send Text
send_textSend a text message to any WhatsApp number or group using the pinned WhatsApp instance. Provide the recipient's phone number or JID and the message text.
Instructions
Send a text message via the pinned WhatsApp instance.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| number | Yes | Recipient JID or phone number (e.g. 5511999999999 or group@g.us) | |
| text | Yes | Message text to send |
Implementation Reference
- src/tools/send-text.ts:12-37 (handler)The registerSendText function registers the 'send_text' tool. The handler function (lines 20-35) calls the Evolution API endpoint /message/sendText/{instanceName} with the number and text args, then returns the response as JSON.
export function registerSendText(server: McpServer, client: EvolutionClient): void { server.registerTool( "send_text", { title: "Send Text", description: "Send a text message via the pinned WhatsApp instance.", inputSchema: schema, }, async (args) => { try { const data = await client.post(`/message/sendText/${client.instanceName}`, { number: args.number, text: args.text, }); 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; } } ); } - src/tools/send-text.ts:7-10 (schema)Input schema for the 'send_text' tool: expects 'number' (PhoneOrJidSchema - JID or phone number string) and 'text' (non-empty string for the message text).
const schema = { number: PhoneOrJidSchema, text: z.string().min(1).describe("Message text to send"), }; - src/tools/index.ts:83-83 (registration)Registration call that wires registerSendText into the MCP server via registerAllTools.
registerSendText(server, client); - src/schemas.ts:8-11 (helper)PhoneOrJidSchema used by the send_text tool: validates that the recipient field is a non-empty string (JID or phone number).
export const PhoneOrJidSchema = z .string() .min(1) .describe("Recipient JID or phone number (e.g. 5511999999999 or group@g.us)"); - src/evolution-client.ts:24-30 (helper)The post method on EvolutionClient used by the send_text handler to make the HTTP POST request.
async post<T = unknown>(path: string, body: unknown): Promise<T> { return this.request<T>("POST", path, body); } async delete<T = unknown>(path: string, body?: unknown): Promise<T> { return this.request<T>("DELETE", path, body); }