Skip to main content
Glama

get-catalog-service

Retrieve detailed information about a specific service from the catalog using Consul MCP Server, enabling efficient service discovery and management.

Instructions

Get information about a specific service from the catalog

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serviceNoName of the service to get information for

Implementation Reference

  • Full tool registration and handler implementation for 'get-catalog-service'. Includes input schema using Zod, fetches service nodes from Consul catalog, handles errors, and formats output with formatCatalogNode.
    server.tool( "get-catalog-service", "Get information about a specific service from the catalog", { service: z.string().default("").describe("Name of the service to get information for"), }, async ({ service }) => { try { const data = await consul.catalog.service.nodes(service); if (!data || data.length === 0) { return { content: [{ type: "text", text: `No information found for service: ${service}` }] }; } const serviceText = `Service information for ${service}:\n\n${data.map(formatCatalogNode).join("\n")}`; return { content: [{ type: "text", text: serviceText }] }; } catch (error) { console.error("Error getting service information:", error); return { content: [{ type: "text", text: `Error getting information for service: ${service}` }] }; } } );
  • Input schema for the get-catalog-service tool defining the 'service' parameter as a string.
    { service: z.string().default("").describe("Name of the service to get information for"), },
  • src/server.ts:39-39 (registration)
    Invocation of registerCatalogServices function which registers the get-catalog-service tool among others.
    registerCatalogServices(server, consul);
  • Utility function to format individual CatalogNode objects into readable strings, used in the tool's output formatting.
    export function formatCatalogNode(node: CatalogNode): string { return [ `Node: ${node.Node || "Unknown"}`, `Address: ${node.Address || "Unknown"}`, `ServiceID: ${node.ServiceID || "Unknown"}`, `ServiceName: ${node.ServiceName || "Unknown"}`, `ServicePort: ${node.ServicePort || "Unknown"}`, `ServiceTags: ${node.ServiceTags?.join(", ") || "None"}`, "---", ].join("\n"); }

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