Skip to main content
Glama
wsapi-chat

WSAPI WhatsApp MCP Server

by wsapi-chat

whatsapp_update_api_key

Generate a new API key for your WhatsApp instance to maintain secure access and functionality within the WSAPI WhatsApp MCP Server.

Instructions

Generate a new API key for the instance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The ToolHandler implementation for 'whatsapp_update_api_key', including description, empty input schema, and handler that generates a new API key by PUT /instance/apikey.
    export const updateApiKey: ToolHandler = {
      name: 'whatsapp_update_api_key',
      description: 'Generate a new API key for the instance.',
      inputSchema: { type: 'object', properties: {} },
      handler: async () => {
        logger.info('Updating API key');
        const result = await wsapiClient.put('/instance/apikey', {});
        return { success: true, apiKey: result, message: 'API key updated successfully' };
      },
    };
  • src/server.ts:53-79 (registration)
    The setupToolHandlers method that registers instanceTools (containing whatsapp_update_api_key) along with other tool groups into the server's tools Map using the tool name as key.
    private setupToolHandlers(): void {
      logger.info('Setting up tool handlers');
    
      // Register all tool categories
      const toolCategories = [
        messagingTools,
        contactTools,
        groupTools,
        chatTools,
        sessionTools,
        instanceTools,
        accountTools,
      ];
    
      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}`);
        });
      });
    
      logger.info(`Registered ${this.tools.size} tools`);
    }
  • Export of instanceTools object grouping instance-related tools, including updateApiKey (whatsapp_update_api_key). This is imported and registered in server.ts.
    export const instanceTools = { getInstanceSettings, updateInstanceSettings, restartInstance, updateApiKey };

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