Skip to main content
Glama

waha_send_location

Send location coordinates to WhatsApp chats using latitude and longitude data, enabling location sharing in conversations.

Instructions

Send location coordinates to a WhatsApp chat.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chatIdYesChat ID (format: number@c.us)
latitudeYesLatitude coordinate
longitudeYesLongitude coordinate
titleNoOptional title/name for the location
replyToNoOptional message ID to reply to

Implementation Reference

  • Handler function that executes the waha_send_location MCP tool. Validates input parameters, calls the underlying WAHAClient.sendLocation method, formats the success response using formatSendMessageSuccess, and returns structured MCP content with location details.
    private async handleSendLocation(args: any) { const chatId = args.chatId; const latitude = args.latitude; const longitude = args.longitude; const title = args.title; const replyTo = args.replyTo; if (!chatId) { throw new Error("chatId is required"); } if (latitude === undefined || longitude === undefined) { throw new Error("latitude and longitude are required"); } const response = await this.wahaClient.sendLocation({ chatId, latitude, longitude, title, reply_to: replyTo, }); const formattedResponse = formatSendMessageSuccess( chatId, response.id, response.timestamp ); return { content: [ { type: "text", text: `${formattedResponse}\nLocation: ${latitude}, ${longitude}${title ? `\nTitle: ${title}` : ''}`, }, ], }; }
  • Input schema and metadata definition for the waha_send_location tool, returned by the ListToolsRequestSchema handler.
    name: "waha_send_location", description: "Send location coordinates to a WhatsApp chat.", inputSchema: { type: "object", properties: { chatId: { type: "string", description: "Chat ID (format: number@c.us)", }, latitude: { type: "number", description: "Latitude coordinate", }, longitude: { type: "number", description: "Longitude coordinate", }, title: { type: "string", description: "Optional title/name for the location", }, replyTo: { type: "string", description: "Optional message ID to reply to", }, }, required: ["chatId", "latitude", "longitude"], }, },
  • src/index.ts:1083-1084 (registration)
    Registration/dispatch case in the CallToolRequestSchema handler that routes calls to the waha_send_location tool to its handler function.
    case "waha_send_location": return await this.handleSendLocation(args);
  • WAHAClient.sendLocation helper method that performs the actual HTTP POST request to WAHA API endpoint /api/sendLocation to send the location message.
    async sendLocation(params: { chatId: string; latitude: number; longitude: number; title?: string; reply_to?: string; }): Promise<SendMessageResponse> { const { chatId, latitude, longitude, title, reply_to } = params; if (!chatId) { throw new WAHAError("chatId is required"); } if (latitude === undefined || longitude === undefined) { throw new WAHAError("latitude and longitude are required"); } const body = { chatId, latitude, longitude, title, session: this.session, reply_to, }; return this.request<SendMessageResponse>("/api/sendLocation", { method: "POST", body: JSON.stringify(body), }); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/seejux/waha-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server