Skip to main content
Glama

WaPulse WhatsApp MCP Server

by Quegenx
deleteInstance.ts•2.23 kB
import { z } from "zod"; import { makeApiRequest } from "../../utils/helpers.js"; import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js'; import type { DeleteInstanceRequest, DeleteInstanceResponse } from "../../types/api.js"; export const deleteInstanceSchema = z.object({ token: z.string().min(1, "Token is required"), instanceID: z.string().min(1, "Instance ID is required"), }); export async function handleDeleteInstance( args: z.infer<typeof deleteInstanceSchema>, context?: { log?: (level: string, message: string, meta?: any) => void } ): Promise<{ content: Array<{ type: string; text: string }> }> { const { token, instanceID } = args; const { log } = context || {}; try { if (log) { log("info", "Deleting WhatsApp instance", { instanceID, token: token.substring(0, 8) + "..." }); } const requestBody: DeleteInstanceRequest = { token, instanceID }; const response = await makeApiRequest('/api/deleteInstance', requestBody) as DeleteInstanceResponse; if (log) { log("info", "Instance deleted successfully", { instanceID, message: response.message }); } return { content: [{ type: "text", text: `šŸ—‘ļø WhatsApp Instance Deleted Successfully! šŸ’¬ Message: ${response.message} šŸ†” Deleted Instance ID: ${instanceID} āš ļø PERMANENT ACTION COMPLETED šŸ“± Instance has been permanently removed 🚫 All associated data and connections have been deleted šŸ’” To use WhatsApp again: 1. Create a new instance using 'create_instance' 2. Get QR code using 'get_qr_code' 3. Scan QR code with WhatsApp mobile app 4. Start the new instance using 'start_instance' šŸ“‹ Full Response: ${JSON.stringify(response, null, 2)}` }] }; } catch (error) { if (log) { log("error", "Failed to delete instance", { error: (error as Error).message, instanceID, token: token.substring(0, 8) + "..." }); } if (error instanceof McpError) { throw error; } throw new McpError(ErrorCode.InternalError, `Failed to delete WhatsApp instance ${instanceID}: ${(error as Error).message}`); } }

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/Quegenx/wapulse-mcp'

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