Send Location
send_locationSend a location pin to a WhatsApp contact or group by providing coordinates, name, and address. Ideal for sharing precise locations in chats.
Instructions
Send a location pin 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) | |
| latitude | Yes | Latitude in decimal degrees | |
| longitude | Yes | Longitude in decimal degrees | |
| name | No | Location name/title | |
| address | No | Location address |
Implementation Reference
- src/tools/send-location.ts:15-40 (handler)The registerSendLocation function that registers the 'send_location' tool handler. It builds a payload with number, latitude, longitude, and optional name/address, then POSTs to /message/sendLocation/{instanceName}. Errors are handled with McpError.
export function registerSendLocation(server: McpServer, client: EvolutionClient): void { server.registerTool( "send_location", { title: "Send Location", description: "Send a location pin message via the pinned WhatsApp instance.", inputSchema: schema, }, async (args) => { try { const payload: Record<string, unknown> = { number: args.number, latitude: args.latitude, longitude: args.longitude, }; if (args.name) payload["name"] = args.name; if (args.address) payload["address"] = args.address; const data = await client.post(`/message/sendLocation/${client.instanceName}`, payload); 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-location.ts:7-13 (schema)Input schema for send_location: number (PhoneOrJidSchema), latitude (number), longitude (number), and optional name and address strings.
const schema = { number: PhoneOrJidSchema, latitude: z.number().describe("Latitude in decimal degrees"), longitude: z.number().describe("Longitude in decimal degrees"), name: z.string().optional().describe("Location name/title"), address: z.string().optional().describe("Location address"), }; - src/tools/index.ts:18-23 (registration)Import of registerSendLocation from ./send-location.js
import { registerSendLocation } from "./send-location.js"; import { registerSendContact } from "./send-contact.js"; import { registerSendReaction } from "./send-reaction.js"; import { registerSendPoll } from "./send-poll.js"; import { registerSendList } from "./send-list.js"; import { registerSendButton } from "./send-button.js"; - src/tools/index.ts:91-91 (registration)Registration call: registerSendLocation(server, client) invoked inside registerAllTools.
registerSendLocation(server, client); - src/schemas.ts:8-11 (helper)PhoneOrJidSchema helper: a zod string schema for recipient JID or phone number, used by the send_location schema.
export const PhoneOrJidSchema = z .string() .min(1) .describe("Recipient JID or phone number (e.g. 5511999999999 or group@g.us)");