Skip to main content
Glama
gfb-47

WhatsApp MCP Server

by gfb-47

check-whatsapp-status

Verify WhatsApp’s operational status programmatically using the WhatsApp MCP Server, enabling automated checks without manual UI interaction.

Instructions

Check if WhatsApp is currently running

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The server.tool registration and inline handler implementation for 'check-whatsapp-status'. It checks if WhatsApp is running by executing an AppleScript to query System Events for the WhatsApp process, and returns a text response indicating the status.
    server.tool( "check-whatsapp-status", "Check if WhatsApp is currently running", {}, async () => { try { const appleScript = ` tell application "System Events" return (exists process "WhatsApp") end tell `; const result = await runAppleScript(appleScript); const isRunning = result.toLowerCase() === 'true'; return { content: [ { type: "text", text: isRunning ? "WhatsApp is currently running." : "WhatsApp is not currently running. Please start WhatsApp before trying to send messages.", } ] }; } catch (error) { return { content: [ { type: "text", text: `Error checking WhatsApp status: ${error}`, } ], isError: true }; } } );
  • Helper function 'runAppleScript' used by the tool handler to execute AppleScript commands via osascript, with error handling.
    async function runAppleScript(script: string) { try { const { stdout } = await execPromise(`osascript -e '${script.replace(/'/g, "'\\''")}'`); return stdout.trim(); } catch (error) { console.error("AppleScript execution error:", error); throw new Error(`Failed to execute AppleScript: ${error}`); } }

Other Tools

Related Tools

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/gfb-47/whatsapp-mcp-server'

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