deregister-health-check
Remove a health check from Consul by specifying its ID to maintain accurate service monitoring and system health management.
Instructions
Deregister a health check from Consul
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | ID of the health check to deregister |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"id": {
"default": "",
"description": "ID of the health check to deregister",
"type": "string"
}
},
"type": "object"
}
Implementation Reference
- src/tools/consulTools.ts:159-171 (handler)The handler function executes the deregistration of a health check by calling consul.agent.check.deregister(id) and returns success or error messages.async ({ id }) => { try { const success = await consul.agent.check.deregister(id); if (!success) { return { content: [{ type: "text", text: `Failed to deregister health check with ID: ${id}` }] }; } return { content: [{ type: "text", text: `Successfully deregistered health check with ID: ${id}` }] }; } catch (error) { console.error("Error deregistering health check:", error); return { content: [{ type: "text", text: `Error deregistering health check with ID: ${id}` }] }; } }
- src/tools/consulTools.ts:156-158 (schema)Zod schema defining the input parameter 'id' for the tool.{ id: z.string().default("").describe("ID of the health check to deregister"), },
- src/tools/consulTools.ts:153-172 (registration)McpServer.tool registration call that defines and registers the deregister-health-check tool with its schema and handler.server.tool( "deregister-health-check", "Deregister a health check from Consul", { id: z.string().default("").describe("ID of the health check to deregister"), }, async ({ id }) => { try { const success = await consul.agent.check.deregister(id); if (!success) { return { content: [{ type: "text", text: `Failed to deregister health check with ID: ${id}` }] }; } return { content: [{ type: "text", text: `Successfully deregistered health check with ID: ${id}` }] }; } catch (error) { console.error("Error deregistering health check:", error); return { content: [{ type: "text", text: `Error deregistering health check with ID: ${id}` }] }; } } );
- src/server.ts:37-37 (registration)Invocation of registerHealthChecks function which includes the registration of the deregister-health-check tool.registerHealthChecks(server, consul);