Skip to main content
Glama
kocierik
by kocierik

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");
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided; description only says 'Get information' without disclosing behavioral traits such as read-only nature, required permissions, error behavior, or what happens if the service does not exist. Minimal transparency beyond the operation itself.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, no extraneous words, efficiently conveys the core purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simplicity (one optional parameter, no output schema), the description is minimally adequate. However, it lacks behavioral details that would fully inform an agent, especially given no annotations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with parameter description 'Name of the service to get information for'. The description adds no additional meaning beyond what is already in the schema, so baseline score of 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states 'Get information about a specific service from the catalog', specifying the verb (get), resource (specific service), and source (catalog). Differentiates from sibling 'list-catalog-services' which lists all services.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool vs alternatives like 'get-services' or 'list-catalog-services'. The description does not mention when to prefer this tool over siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.