destroy-session
Terminate a Consul session by its ID to release associated locks and resources. This tool is essential for managing distributed system states and ensuring cleanup.
Instructions
Destroy a session in Consul
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | ID of the session to destroy |
Implementation Reference
- src/tools/consulTools.ts:466-485 (registration)Registration of the 'destroy-session' tool, including inline schema for the session ID parameter and the handler function that destroys the Consul session using consul.session.destroy(id).server.tool( "destroy-session", "Destroy a session in Consul", { id: z.string().default("").describe("ID of the session to destroy"), }, async ({ id }) => { try { const success = await consul.session.destroy(id); if (!success) { return { content: [{ type: "text", text: `Failed to destroy session with ID: ${id}` }] }; } return { content: [{ type: "text", text: `Successfully destroyed session with ID: ${id}` }] }; } catch (error) { console.error("Error destroying session:", error); return { content: [{ type: "text", text: `Error destroying session with ID: ${id}` }] }; } } );