Skip to main content
Glama

list-events

Retrieve and filter all events by name using the Consul MCP Server, enabling efficient event monitoring and management.

Instructions

List all events

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNoFilter events by name

Implementation Reference

  • Registration of the 'list-events' tool, including inline schema and handler function.
        "list-events",
        "List all events",
        {
          name: z.string().default("").optional().describe("Filter events by name"),
        },
        async ({ name }) => {
          try {
            const events = await consul.event.list({ name });
            if (!events || events.length === 0) {
              return { content: [{ type: "text", text: "No events found" }] };
            }
            const eventsText = events.map(event => 
              `ID: ${event.ID}, Name: ${event.Name}, Payload: ${event.Payload || 'None'}`
            ).join("\n");
            return { content: [{ type: "text", text: `Events:\n\n${eventsText}` }] };
          } catch (error) {
            console.error("Error listing events:", error);
            return { content: [{ type: "text", text: "Error listing events" }] };
          }
        }
      );
    }
  • The handler function executes the tool logic: lists events from Consul (optionally filtered by name), formats them, and returns as text content.
      async ({ name }) => {
        try {
          const events = await consul.event.list({ name });
          if (!events || events.length === 0) {
            return { content: [{ type: "text", text: "No events found" }] };
          }
          const eventsText = events.map(event => 
            `ID: ${event.ID}, Name: ${event.Name}, Payload: ${event.Payload || 'None'}`
          ).join("\n");
          return { content: [{ type: "text", text: `Events:\n\n${eventsText}` }] };
        } catch (error) {
          console.error("Error listing events:", error);
          return { content: [{ type: "text", text: "Error listing events" }] };
        }
      }
    );
  • Input schema using Zod: optional 'name' parameter to filter events.
    {
      name: z.string().default("").optional().describe("Filter events by name"),
    },
  • src/server.ts:44-44 (registration)
    Top-level call to registerEventTools, which includes the 'list-events' tool registration.
    registerEventTools(server, consul);
  • Helper function that registers event-related tools, including 'list-events'.
    export function registerEventTools(server: McpServer, consul: Consul) {
      // Fire an event
      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}` }] };
          }
        }
      );
    
      // List events
      server.tool(
        "list-events",
        "List all events",
        {
          name: z.string().default("").optional().describe("Filter events by name"),
        },
        async ({ name }) => {
          try {
            const events = await consul.event.list({ name });
            if (!events || events.length === 0) {
              return { content: [{ type: "text", text: "No events found" }] };
            }
            const eventsText = events.map(event => 
              `ID: ${event.ID}, Name: ${event.Name}, Payload: ${event.Payload || 'None'}`
            ).join("\n");
            return { content: [{ type: "text", text: `Events:\n\n${eventsText}` }] };
          } catch (error) {
            console.error("Error listing events:", error);
            return { content: [{ type: "text", text: "Error listing events" }] };
          }
        }
      );
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. 'List all events' implies a read-only operation but doesn't disclose behavioral traits like whether it returns all events at once or uses pagination, what authentication is required, rate limits, or what happens when no events exist. It provides minimal behavioral context beyond the basic action.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise at three words with zero wasted language. It's front-loaded with the core action and resource, making it easy to parse quickly. This is an example of efficient minimalism that earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and a simple but potentially broad tool (listing events in a system with many event-related operations), the description is incomplete. It doesn't explain what 'events' are in this context, what format they're returned in, or any limitations. For a tool in this environment, more context is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with the single parameter 'name' documented as 'Filter events by name'. The description doesn't add any parameter semantics beyond what the schema provides, but since coverage is high, the baseline score of 3 is appropriate. No additional context about filtering behavior is given.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'List all events' clearly states the verb ('List') and resource ('events'), but it's vague about scope and doesn't differentiate from sibling tools like 'fire-event' or 'list-catalog-services'. It provides basic purpose but lacks specificity about what kind of events or system context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. With siblings like 'fire-event' (create events), 'list-catalog-services', and 'list-sessions', there's no indication of when this specific listing tool is appropriate or what distinguishes it from other list operations in the system.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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