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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/consulTools.ts:657-671 (registration)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" }] }; } } );
- src/tools/consulTools.ts:661-670 (handler)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" }] }; } }
- src/tools/consulTools.ts:660-660 (schema)Empty input schema for 'get-peers' tool (no parameters required).{},