Get recent events from a source
get_recent_eventsFetch recent log events for a source to tail logs and triage incidents in real time.
Instructions
Fetch the most recent log events for a source. Useful for tailing and incident triage.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source_token | No | Source token. Falls back to LOGFLARE_DEFAULT_SOURCE_TOKEN if omitted. |
Implementation Reference
- src/logflare.ts:90-94 (handler)The actual handler/API call for getRecentEvents. Makes a GET request to /api/sources/{token}/recent and returns the JSON response with a data array.
getRecentEvents(token: string) { return this.request<{ data: unknown[] }>( `/api/sources/${encodeURIComponent(token)}/recent`, ) } - src/index.ts:101-106 (schema)Input schema for get_recent_events: takes an optional source_token string (falls back to LOGFLARE_DEFAULT_SOURCE_TOKEN).
inputSchema: { source_token: z .string() .optional() .describe('Source token. Falls back to LOGFLARE_DEFAULT_SOURCE_TOKEN if omitted.'), }, - src/index.ts:95-115 (registration)Registration of the 'get_recent_events' tool with title, description, input schema, and async handler that calls client.getRecentEvents.
server.registerTool( 'get_recent_events', { title: 'Get recent events from a source', description: 'Fetch the most recent log events for a source. Useful for tailing and incident triage.', inputSchema: { source_token: z .string() .optional() .describe('Source token. Falls back to LOGFLARE_DEFAULT_SOURCE_TOKEN if omitted.'), }, }, async ({ source_token }) => { try { return text(await client.getRecentEvents(client.resolveSourceToken(source_token))) } catch (err) { return errorText(err) } }, )