Skip to main content
Glama

list-catalog-services

Retrieve a complete list of services registered in the Consul MCP Server catalog to monitor and manage service discovery efficiently.

Instructions

List all services in the catalog

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Inline handler function for the 'list-catalog-services' tool. Fetches the list of services from the Consul catalog using `consul.catalog.service.list()`, formats them with their tags, and returns a formatted text response.
    async () => { try { const data = await consul.catalog.service.list(); if (!data) { return { content: [{ type: "text", text: "Failed to retrieve catalog services list" }] }; } // Format the services data const servicesText = Object.entries(data) .map(([name, tags]) => `${name}: ${(tags as string[]).join(", ") || "No tags"}`) .join("\n"); return { content: [{ type: "text", text: `Catalog services:\n\n${servicesText}` }] }; } catch (error) { console.error("Error listing catalog services:", error); return { content: [{ type: "text", text: "Error listing catalog services" }] }; } } );
  • Direct registration of the 'list-catalog-services' tool using `server.tool()`, including description, empty input schema, and inline handler.
    server.tool( "list-catalog-services", "List all services in the catalog", {}, async () => { try { const data = await consul.catalog.service.list(); if (!data) { return { content: [{ type: "text", text: "Failed to retrieve catalog services list" }] }; } // Format the services data const servicesText = Object.entries(data) .map(([name, tags]) => `${name}: ${(tags as string[]).join(", ") || "No tags"}`) .join("\n"); return { content: [{ type: "text", text: `Catalog services:\n\n${servicesText}` }] }; } catch (error) { console.error("Error listing catalog services:", error); return { content: [{ type: "text", text: "Error listing catalog services" }] }; } } );
  • src/server.ts:39-39 (registration)
    High-level registration invocation of `registerCatalogServices` during server setup, which registers the 'list-catalog-services' tool among others.
    registerCatalogServices(server, consul);
  • Empty input schema (no parameters) for the 'list-catalog-services' tool.
    {},

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