fire-event
Trigger and manage custom events by specifying a name and payload, enabling real-time communication and updates within the Consul MCP Server framework.
Instructions
Fire a new event
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Name of the event | |
| payload | No | Event payload |
Implementation Reference
- src/tools/consulTools.ts:547-556 (handler)The handler function for the 'fire-event' tool. It takes name and optional payload, calls consul.event.fire, and returns success or error message.async ({ name, payload }) => { try { // @ts-ignore - The Consul type definitions are incomplete const event = await consul.event.fire(name, payload || ""); return { content: [{ type: "text", text: `Fired event: ${event.ID}` }] }; } catch (error) { console.error("Error firing event:", error); return { content: [{ type: "text", text: `Error firing event: ${name}` }] }; } }
- src/tools/consulTools.ts:543-546 (schema)Input schema for the 'fire-event' tool using Zod validation: name (string, required), payload (string, optional).{ name: z.string().default("").describe("Name of the event"), payload: z.string().default("").optional().describe("Event payload"), },
- src/tools/consulTools.ts:540-557 (registration)Registration of the 'fire-event' tool using server.tool, including description, input schema, and handler function.server.tool( "fire-event", "Fire a new event", { name: z.string().default("").describe("Name of the event"), payload: z.string().default("").optional().describe("Event payload"), }, async ({ name, payload }) => { try { // @ts-ignore - The Consul type definitions are incomplete const event = await consul.event.fire(name, payload || ""); return { content: [{ type: "text", text: `Fired event: ${event.ID}` }] }; } catch (error) { console.error("Error firing event:", error); return { content: [{ type: "text", text: `Error firing event: ${name}` }] }; } } );