get_event_log
Retrieve system event log entries from Cisco CIMC to monitor hardware events, errors, and status changes for server health management.
Instructions
Get system event log (SEL) entries from the CIMC. Shows hardware events, errors, and status changes.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of entries to return (default 50) |
Implementation Reference
- src/tools/eventlog.ts:17-46 (handler)Main handler function for get_event_log tool. Fetches system event log entries from CIMC using resolveClass, supports limiting results, and returns formatted JSON with entry details (dn, id, severity, description, created, type, sensorType).
export async function getEventLog(input: { limit?: number }): Promise<string> { const entries = await resolveClass("syseventLog"); // If syseventLog doesn't return entries, try the individual log entries let logEntries = entries; if (logEntries.length === 0) { logEntries = await resolveClass("logEntry"); } const limit = input.limit || 50; const trimmed = logEntries.slice(0, limit); return JSON.stringify( { total: logEntries.length, showing: trimmed.length, entries: trimmed.map((e) => ({ dn: e.dn, id: e.id, severity: e.severity, description: e.descr || e.description, created: e.created || e.timeStamp, type: e.type, sensorType: e.sensorType, })), }, null, 2, ); } - src/tools/eventlog.ts:4-15 (schema)Tool definition with name 'get_event_log', description for system event log entries, and Zod input schema defining optional 'limit' parameter (defaults to 50).
export const getEventLogDef = { name: "get_event_log", description: "Get system event log (SEL) entries from the CIMC. Shows hardware events, errors, and status changes.", inputSchema: z.object({ limit: z .number() .optional() .default(50) .describe("Maximum number of entries to return (default 50)"), }), }; - src/index.ts:152-157 (registration)Registration of get_event_log tool with MCP server, using getEventLogDef properties and wrapping the handler with error handling.
server.tool( getEventLogDef.name, getEventLogDef.description, getEventLogDef.inputSchema.shape, wrapHandler(getEventLog), ); - src/utils/client.ts:49-56 (helper)Helper utility function resolveClass that queries all objects of a given class ID from the CIMC API. Used by getEventLog to fetch 'syseventLog' and 'logEntry' data.
export async function resolveClass( classId: string, hierarchical = false, ): Promise<Record<string, string>[]> { const xml = `<configResolveClass cookie="{cookie}" inHierarchical="${hierarchical}" classId="${classId}"/>`; const result = await authenticatedRequest(xml); return extractOutConfigs(result, "configResolveClass"); }