Skip to main content
Glama

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
NameRequiredDescriptionDefault
idNoID of the session to destroy

Implementation Reference

  • 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}` }] };
        }
      }
    );

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/kocierik/consul-mcp-server'

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