Skip to main content
Glama
wsapi-chat
by wsapi-chat

whatsapp_send_location

Send location coordinates to WhatsApp contacts or groups to share real-time positions or meeting points using latitude and longitude data.

Instructions

Send a location message to a WhatsApp contact or group.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toYesRecipient phone number (with @s.whatsapp.net) or group ID (with @g.us)
latitudeYesLatitude coordinate
longitudeYesLongitude coordinate
nameNoName of the location (max 1000 characters)
addressNoAddress of the location (max 1000 characters)
urlNoURL related to the location (e.g., Google Maps link)

Implementation Reference

  • The handler function that validates the input using sendLocationMessageSchema and sends the location message via wsapiClient.post('/messages/location', input). Returns success with message ID.
    handler: async (args: any) => { const input = validateInput(sendLocationMessageSchema, args) as SendLocationMessageInput; logger.info('Sending location message', { to: input.to, latitude: input.latitude, longitude: input.longitude, hasName: !!input.name, hasAddress: !!input.address, }); const result = await wsapiClient.post('/messages/location', input); logger.info('Location message sent successfully', { messageId: result.id }); return { success: true, messageId: result.id, message: 'Location message sent successfully', }; },
  • Zod schema used for input validation in the whatsapp_send_location handler. Defines properties like to, latitude, longitude, etc.
    export const sendLocationMessageSchema = z.object({ to: chatIdSchema, latitude: z.number().min(-90).max(90), longitude: z.number().min(-180).max(180), name: z.string().max(1000).optional(), address: z.string().max(1000).optional(), url: urlSchema.optional(), });
  • src/server.ts:67-76 (registration)
    Registration loop in setupToolHandlers() that adds all tools from messagingTools (which includes whatsapp_send_location) to the server's tools Map.
    toolCategories.forEach(category => { Object.values(category).forEach(tool => { if (this.tools.has(tool.name)) { logger.warn(`Tool ${tool.name} already registered, skipping`); return; } this.tools.set(tool.name, tool); logger.debug(`Registered tool: ${tool.name}`); }); });
  • TypeScript type definition for the input parameters inferred from the Zod schema.
    export type SendLocationMessageInput = z.infer<typeof sendLocationMessageSchema>;
  • Full ToolHandler definition including name, description, inputSchema (for MCP), and handler reference. Exported and included in advancedMessagingTools.
    export const sendLocationMessage: ToolHandler = { name: 'whatsapp_send_location', description: 'Send a location message to a WhatsApp contact or group.', inputSchema: { type: 'object', properties: { to: { type: 'string', description: 'Recipient phone number (with @s.whatsapp.net) or group ID (with @g.us)', }, latitude: { type: 'number', minimum: -90, maximum: 90, description: 'Latitude coordinate', }, longitude: { type: 'number', minimum: -180, maximum: 180, description: 'Longitude coordinate', }, name: { type: 'string', description: 'Name of the location (max 1000 characters)', optional: true, }, address: { type: 'string', description: 'Address of the location (max 1000 characters)', optional: true, }, url: { type: 'string', description: 'URL related to the location (e.g., Google Maps link)', optional: true, }, }, required: ['to', 'latitude', 'longitude'], }, handler: async (args: any) => { const input = validateInput(sendLocationMessageSchema, args) as SendLocationMessageInput; logger.info('Sending location message', { to: input.to, latitude: input.latitude, longitude: input.longitude, hasName: !!input.name, hasAddress: !!input.address, }); const result = await wsapiClient.post('/messages/location', input); logger.info('Location message sent successfully', { messageId: result.id }); return { success: true, messageId: result.id, message: 'Location message sent successfully', }; }, };

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/wsapi-chat/wsapi-mcp'

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