Skip to main content
Glama
ahmad2x4

Seq MCP Server

by ahmad2x4

get-events

Retrieve and analyze structured log events from Seq server using filters like time range, signal IDs, or custom expressions to investigate patterns and frequencies.

Instructions

Retrieve and analyze a list of event filtered by parameters. Use this tool when you need to:

  • Investigate events that are being logged in the SEQ server

  • Details of each event is a structured log and can provide usefull information

  • Events could be information, error, debug, or critical

  • Analyze error patterns and frequencies

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
signalNoComma-separated list of signal IDs
filterNoFilter expression for events
countNoNumber of events to return (max 20)
fromDateUtcNoStart date/time in UTC
toDateUtcNoEnd date/time in UTC
rangeNoTime range (e.g., 1m, 15m, 1h, 1d, 7d)

Implementation Reference

  • Handler function that fetches events from the Seq API endpoint '/api/events' using the provided parameters (signal, filter, count, dates, range), formats the request, and returns the JSON events or error.
    async ({ signal, filter, count, fromDateUtc, toDateUtc, range }) => {
      try {
        const params: Record<string, string> = {};
        
        // Handle date range parameters
        if (range) {
          // If range is provided, it takes precedence over fromDateUtc/toDateUtc
          params.range = range;
        } else if (fromDateUtc || toDateUtc) {
          // Only add date parameters if they're provided
          if (fromDateUtc) params.fromDateUtc = fromDateUtc;
          if (toDateUtc) params.toDateUtc = toDateUtc;
        } else {
          // Default to last hour if no time parameters provided
          params.range = '1h';
        }
    
        // Add other optional parameters
        if (signal) params.signal = signal;
        if (filter) params.filter = filter;
        if (count) params.count = count.toString();
    
        const events = await makeSeqRequest<Event[]>('/api/events', params);
        
        return {
          content: [{
            type: "text",
            text: JSON.stringify(events)
          }]
        };
      } catch (error) {
        const err = error as Error;
        return {
          content: [{
            type: "text",
            text: `Error fetching events: ${err.message}`
          }],
          isError: true
        };
      }
    }
  • Input schema definition using Zod for the get-events tool parameters.
    {
      signal: z.string().optional()
        .describe('Comma-separated list of signal IDs'),
      filter: z.string().optional()
        .describe('Filter expression for events'),
      count: z.number().min(1).max(MAX_EVENTS).optional()
        .default(MAX_EVENTS)
        .describe(`Number of events to return (max ${MAX_EVENTS})`),
      fromDateUtc: z.string().optional()
        .describe('Start date/time in UTC'),
      toDateUtc: z.string().optional()
        .describe('End date/time in UTC'),
      range: timeRangeSchema.optional()
        .describe('Time range (e.g., 1m, 15m, 1h, 1d, 7d)')
    },
  • Registration of the 'get-events' tool on the MCP server using server.tool() with description, input schema, and handler function.
    server.tool(
      "get-events",
      `Retrieve and analyze a list of event filtered by parameters. Use this tool when you need to:
      - Investigate events that are being logged in the SEQ server
      - Details of each event is a structured log and can provide usefull information
      - Events could be information, error, debug, or critical
      - Analyze error patterns and frequencies  
      `,
      {
        signal: z.string().optional()
          .describe('Comma-separated list of signal IDs'),
        filter: z.string().optional()
          .describe('Filter expression for events'),
        count: z.number().min(1).max(MAX_EVENTS).optional()
          .default(MAX_EVENTS)
          .describe(`Number of events to return (max ${MAX_EVENTS})`),
        fromDateUtc: z.string().optional()
          .describe('Start date/time in UTC'),
        toDateUtc: z.string().optional()
          .describe('End date/time in UTC'),
        range: timeRangeSchema.optional()
          .describe('Time range (e.g., 1m, 15m, 1h, 1d, 7d)')
      },
      async ({ signal, filter, count, fromDateUtc, toDateUtc, range }) => {
        try {
          const params: Record<string, string> = {};
          
          // Handle date range parameters
          if (range) {
            // If range is provided, it takes precedence over fromDateUtc/toDateUtc
            params.range = range;
          } else if (fromDateUtc || toDateUtc) {
            // Only add date parameters if they're provided
            if (fromDateUtc) params.fromDateUtc = fromDateUtc;
            if (toDateUtc) params.toDateUtc = toDateUtc;
          } else {
            // Default to last hour if no time parameters provided
            params.range = '1h';
          }
    
          // Add other optional parameters
          if (signal) params.signal = signal;
          if (filter) params.filter = filter;
          if (count) params.count = count.toString();
    
          const events = await makeSeqRequest<Event[]>('/api/events', params);
          
          return {
            content: [{
              type: "text",
              text: JSON.stringify(events)
            }]
          };
        } catch (error) {
          const err = error as Error;
          return {
            content: [{
              type: "text",
              text: `Error fetching events: ${err.message}`
            }],
            isError: true
          };
        }
      }
    );
  • Shared helper function makeSeqRequest used by get-events tool to make authenticated HTTP requests to the Seq API.
    async function makeSeqRequest<T>(endpoint: string, params: Record<string, string> = {}): Promise<T> {
      const url = new URL(`${SEQ_BASE_URL}${endpoint}`);
      
      // Add API key as query parameter
      url.searchParams.append('apiKey', SEQ_API_KEY);
      
      // Add additional query parameters
      Object.entries(params).forEach(([key, value]) => {
        if (value !== undefined && value !== null) {
          url.searchParams.append(key, value);
        }
      });
    
      const headers: Record<string, string> = {
        'Accept': 'application/json',
        'X-Seq-ApiKey': SEQ_API_KEY
      };
    
      const response = await fetch(url.toString(), { headers });
    
      if (!response.ok) {
        throw new Error(`SEQ API error: ${response.statusText} (${response.status})`);
      }
    
      return response.json();
    }
  • Zod enum schema for valid time ranges used in the get-events input schema.
    const timeRangeSchema = z.enum(['1m', '15m', '30m', '1h', '2h', '6h', '12h', '1d', '7d', '14d', '30d']);
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions that events are 'structured logs' and can be of types like 'information, error, debug, or critical,' but fails to specify critical details such as authentication requirements, rate limits, pagination behavior, or whether this is a read-only operation. The description adds some context but leaves significant gaps for a tool with 6 parameters.

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

Conciseness3/5

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

The description is front-loaded with the core purpose but includes a bulleted list that repeats concepts (e.g., 'analyze error patterns' appears twice). Some sentences could be more efficient, and the structure is somewhat repetitive, though it remains reasonably focused.

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

Completeness3/5

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

Given the tool's complexity (6 parameters, no annotations, no output schema), the description is moderately complete. It covers purpose and usage context but lacks details on behavioral traits, output format, and explicit sibling tool differentiation. It's adequate for basic understanding but has clear gaps for effective agent use.

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?

The schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds minimal value beyond the schema by implying filtering and analysis capabilities, but doesn't provide additional syntax, format details, or usage examples for parameters. This meets the baseline for high schema coverage.

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

Purpose4/5

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

The description clearly states the tool's purpose as 'Retrieve and analyze a list of events filtered by parameters,' which specifies the verb (retrieve/analyze) and resource (events). It distinguishes from sibling tools by focusing on events rather than alerts or signals, though it doesn't explicitly contrast with them.

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

Usage Guidelines4/5

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

The description provides explicit usage scenarios (investigate logged events, analyze error patterns) and implies context (SEQ server events). However, it lacks explicit guidance on when to use this tool versus sibling tools like 'get-alertstate' or 'get-signals,' and doesn't mention exclusions or prerequisites.

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

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/ahmad2x4/mcp-server-seq'

If you have feedback or need assistance with the MCP directory API, please join our Discord server