Skip to main content
Glama

get-services

Retrieve active services using the standardized Model Context Protocol interface for Consul, enabling efficient access to service data and health checks.

Instructions

Get running services

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes the tool logic: lists running services from Consul agent using consul.agent.service.list(), formats them with formatService, and returns formatted text.
    async () => {
      const data = await consul.agent.service.list();
      if (!data) {
        return { content: [{ type: "text", text: "Failed to retrieve services list data" }] };
      }
      const dataText = `List of services:\n\n${Object.values(data).map(formatService).join("\n")}`;
    
      return { content: [{ type: "text", text: dataText }] };
    }
  • Registration of the 'get-services' tool on the MCP server within the registerServiceList function.
    server.tool(
      "get-services",
      "Get running services",
      {},
      async () => {
        const data = await consul.agent.service.list();
        if (!data) {
          return { content: [{ type: "text", text: "Failed to retrieve services list data" }] };
        }
        const dataText = `List of services:\n\n${Object.values(data).map(formatService).join("\n")}`;
    
        return { content: [{ type: "text", text: dataText }] };
      }
    );
  • Helper function to format a single Consul service object into a multi-line string for display.
    export function formatService(feature: ServiceList): string {
      const props = feature;
      return [
        `ID: ${props.ID || "Unknown"}`,
        `Port: ${props.Port || "Unknown"}`,
        `Service: ${props.Service || "Unknown"}`,
        `Tags: ${props.Tags || "Unknown"}`,
        "---",
      ].join("\n");
    }
  • TypeScript interface defining the structure of a Consul service list entry, used by the formatService helper.
    export interface ServiceList {
      ID: string;
      Service: string;
      Tags: string[];
      Port: number;
    }
  • src/server.ts:36-36 (registration)
    Top-level call to registerServiceList function, attaching the 'get-services' tool to the MCP server instance.
    registerServiceList(server, consul);
Behavior2/5

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

With no annotations provided, the description carries full burden but only states the basic action. It doesn't disclose behavioral traits such as whether this is a read-only operation, if it requires specific permissions, rate limits, or what the output format might be. This leaves significant gaps for a tool with no annotation coverage.

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?

The description is extremely concise with just three words, front-loaded to the core purpose without any wasted text. Every word earns its place, making it efficient and easy to parse.

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

Completeness2/5

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

Given the complexity implied by sibling tools (e.g., in a service catalog or Consul-like system), no annotations, and no output schema, the description is insufficient. It doesn't explain what 'running services' means, how results are returned, or any behavioral context, leaving the agent with inadequate information for proper use.

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

Parameters4/5

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

The tool has 0 parameters with 100% schema description coverage, so the schema fully documents the lack of inputs. The description doesn't need to add parameter details, and it appropriately doesn't mention any, making it complete in this regard. A baseline of 4 is applied as it handles the zero-parameter case correctly.

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

Purpose3/5

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

The description 'Get running services' clearly states the action (get) and resource (running services), but it's somewhat vague about what 'running services' specifically refers to in this context. It doesn't distinguish itself from sibling tools like 'list-catalog-services' or 'get-catalog-service', leaving ambiguity about scope and differentiation.

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 is provided on when to use this tool versus alternatives like 'list-catalog-services' or 'get-catalog-service'. The description lacks context about prerequisites, timing, or exclusions, offering no help in tool selection among siblings.

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

Install Server

Other Tools

Related Tools

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