get-leader
Retrieve the current leader node in the Consul MCP Server to monitor or manage cluster leadership and ensure system consistency.
Instructions
Get the current leader
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get-leader"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/consulTools.ts:640-654 (registration)Registration of the 'get-leader' tool, including its inline handler function that retrieves the current Consul leader using consul.status.leader().
server.tool( "get-leader", "Get the current leader", {}, async () => { try { // @ts-ignore - The Consul type definitions are incomplete const leader = await consul.status.leader(); return { content: [{ type: "text", text: `Current leader: ${leader}` }] }; } catch (error) { console.error("Error getting leader:", error); return { content: [{ type: "text", text: "Error getting leader" }] }; } } );