Skip to main content
Glama

get-peers

Retrieve the current list of peers directly through the Consul MCP Server, enabling real-time monitoring and coordination of distributed system participants.

Instructions

Get the current peers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registration of the 'get-peers' tool, including inline handler that calls consul.status.peers() and formats the response as text.
    server.tool(
      "get-peers",
      "Get the current peers",
      {},
      async () => {
        try {
          // @ts-ignore - The Consul type definitions are incomplete
          const peers = await consul.status.peers();
          return { content: [{ type: "text", text: `Current peers:\n\n${peers.join("\n")}` }] };
        } catch (error) {
          console.error("Error getting peers:", error);
          return { content: [{ type: "text", text: "Error getting peers" }] };
        }
      }
    );
  • Handler function for 'get-peers' tool: retrieves peers using consul.status.peers() and returns formatted list or error.
    async () => {
      try {
        // @ts-ignore - The Consul type definitions are incomplete
        const peers = await consul.status.peers();
        return { content: [{ type: "text", text: `Current peers:\n\n${peers.join("\n")}` }] };
      } catch (error) {
        console.error("Error getting peers:", error);
        return { content: [{ type: "text", text: "Error getting peers" }] };
      }
    }
  • Empty input schema for 'get-peers' tool (no parameters required).
    {},

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