Skip to main content
Glama

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
NameRequiredDescriptionDefault
nameNoName of the event
payloadNoEvent payload

Implementation Reference

  • 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}` }] };
      }
    }
  • 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"),
    },
  • 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}` }] };
        }
      }
    );

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