Skip to main content
Glama

deregister-service

Remove a service from Consul by its ID using this tool. Simplifies service deregistration to maintain clean and accurate service registries in the Consul MCP Server.

Instructions

Deregister a service from Consul

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNoID of the service to deregister

Implementation Reference

  • Full handler implementation for 'deregister-service' tool, including Zod input schema and async execution logic that deregisters the service via consul.agent.service.deregister(id)
    server.tool(
      "deregister-service",
      "Deregister a service from Consul",
      {
        id: z.string().default("").describe("ID of the service to deregister"),
      },
      async ({ id }) => {
        try {
          await consul.agent.service.deregister(id);
          //if (!success) {
          //  return { content: [{ type: "text", text: `Failed to deregister service with ID: ${id}` }] };
          //}
          
          return { content: [{ type: "text", text: `Successfully deregistered service with ID: ${id}` }] };
        } catch (error) {
          console.error("Error deregistering service:", error);
          return { content: [{ type: "text", text: `Error deregistering service with ID: ${id}` }] };
        }
      }
    );
  • src/server.ts:40-40 (registration)
    Registration of agent services tools, including 'deregister-service', by calling registerAgentServices(server, consul)
    registerAgentServices(server, consul);
  • Zod schema for input parameters of deregister-service tool: requires 'id' as string
    {
      id: z.string().default("").describe("ID of the service to deregister"),
    },

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