send_location_message
Share location coordinates with WhatsApp contacts by sending a map pin containing latitude, longitude, optional name, and address information.
Instructions
Send a location pin to a WhatsApp number.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"to": "<to>",
"latitude": "<latitude>",
"longitude": "<longitude>"
},
"name": "send_location_message"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | Recipient phone number | |
| latitude | Yes | Location latitude | |
| longitude | Yes | Location longitude | |
| name | No | Location name | |
| address | No | Location address |
Implementation Reference
- src/whatsapp-client.ts:179-189 (handler)The actual implementation of sending a location message via the WhatsApp API.
async sendLocationMessage( to: string, location: { latitude: number; longitude: number; name?: string; address?: string } ) { return this.request(`/${this.config.phoneNumberId}/messages`, "POST", { messaging_product: "whatsapp", to, type: "location", location, }); } - src/index.ts:233-247 (registration)MCP tool registration for 'send_location_message' which validates input and calls the WhatsApp client.
server.tool( "send_location_message", "Send a location pin to a WhatsApp number.", { to: z.string().describe("Recipient phone number"), latitude: z.number().describe("Location latitude"), longitude: z.number().describe("Location longitude"), name: z.string().optional().describe("Location name"), address: z.string().optional().describe("Location address"), }, async ({ to, latitude, longitude, name, address }) => executeWithHooks("send_location_message", { to, latitude, longitude }, config, () => wa.sendLocationMessage(to, { latitude, longitude, name, address }) ) );