stop_session
Terminate a running WhatsApp session gracefully to free up resources and avoid connection issues.
Instructions
Stop a running WhatsApp session gracefully
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sessionId | Yes | ID of the session to stop |
Implementation Reference
- src/tools/sessions.ts:54-57 (handler)The handler function for the 'stop_session' tool. It receives a 'sessionId' parameter, makes a POST request to the OpenWA API at /sessions/{sessionId}/stop to stop the session, and returns the API response as text.
async ({ sessionId }) => { const data = await openwaClient({ method: "POST", path: `/sessions/${sessionId}/stop` }); return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; } - src/tools/sessions.ts:48-52 (schema)Input schema for the 'stop_session' tool. Defines a required 'sessionId' string parameter describing the ID of the session to stop.
{ description: "Stop a running WhatsApp session gracefully", inputSchema: { sessionId: z.string().describe("ID of the session to stop"), }, - src/tools/sessions.ts:46-58 (registration)Registration of the 'stop_session' tool using server.registerTool(), with its schema and handler function. Part of the registerSessionTools() export.
server.registerTool( "stop_session", { description: "Stop a running WhatsApp session gracefully", inputSchema: { sessionId: z.string().describe("ID of the session to stop"), }, }, async ({ sessionId }) => { const data = await openwaClient({ method: "POST", path: `/sessions/${sessionId}/stop` }); return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; } ); - src/index.ts:15-15 (registration)The session tools (including 'stop_session') are registered on the MCP server by calling registerSessionTools(server) in the main entry point.
registerSessionTools(server);