Skip to main content
Glama

search_events

Filter and retrieve specific events from SEQ logs using customizable criteria such as query filters, date ranges, and log levels.

Instructions

Search for events in SEQ logs with powerful filtering

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countNo
fromDateNo
levelNo
queryNo
toDateNo

Implementation Reference

  • The main handler function for the 'search_events' MCP tool. It parses input arguments using the schema, builds a SEQ filter (combining query and level), calls SeqClient.searchEvents, formats the events, and returns a standardized MCP content response with JSON.
    private async searchEvents(args: unknown) { const params = searchEventsSchema.parse(args); let filter = params.query || ''; if (params.level) { const levelFilter = `Level = '${params.level}'`; filter = filter ? `${filter} and ${levelFilter}` : levelFilter; } const result = await this.seqClient.searchEvents({ filter, count: params.count, fromDateUtc: params.fromDate, toDateUtc: params.toDate }); const formattedEvents = result.Events.map(event => ({ id: event.Id, timestamp: event.TimeStamp, level: event.Level, message: event.RenderedMessage, properties: event.Properties, ...(event.Exception && { exception: event.Exception }) })); return { content: [ { type: 'text', text: JSON.stringify({ events: formattedEvents, count: formattedEvents.length, statistics: result.Statistics }, null, 2) } ] }; }
  • Zod schema for validating the input parameters of the 'search_events' tool.
    const searchEventsSchema = z.object({ query: z.string().optional().describe('SEQ query filter (e.g., "Level = \'Error\'" or "@Message like \'%failed%\'")'), count: z.number().min(1).max(1000).default(100).describe('Number of events to return'), fromDate: z.string().optional().describe('Start date in ISO format'), toDate: z.string().optional().describe('End date in ISO format'), level: z.enum(['Verbose', 'Debug', 'Information', 'Warning', 'Error', 'Fatal']).optional().describe('Filter by log level')
  • src/index.ts:66-74 (registration)
    Registration of the 'search_events' tool in the ListTools handler response, including name, description, and derived input schema.
    { name: 'search_events', description: 'Search for events in SEQ logs with powerful filtering', inputSchema: { type: 'object', properties: searchEventsSchema.shape, required: [] } },
  • Supporting SeqClient.searchEvents method that makes the HTTP GET request to SEQ's /api/events endpoint with constructed query parameters.
    async searchEvents(options: SearchOptions = {}): Promise<SeqSearchResult> { const params: Record<string, string | number | boolean> = { count: options.count || this.config.defaultLimit, render: options.render !== false }; if (options.filter) params.filter = options.filter; if (options.startAt) params.startAt = options.startAt; if (options.afterId) params.afterId = options.afterId; if (options.signal) params.signal = options.signal; if (options.fromDateUtc) params.fromDateUtc = options.fromDateUtc; if (options.toDateUtc) params.toDateUtc = options.toDateUtc; const response = await this.client.get<SeqSearchResult>('/api/events', { params }); return response.data; }

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

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