get_logpoint_history
Retrieve log output history from Xdebug logpoints to analyze debugging data and track application behavior during PHP debugging sessions.
Instructions
Get the log output history from logpoints
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| logpoint_id | No | Specific logpoint ID (all if not specified) | |
| limit | No | Maximum entries to return |
Implementation Reference
- src/tools/advanced.ts:197-217 (registration)Registration of the 'get_logpoint_history' tool, including input schema, description, and inline handler function that calls LogpointManager methods.server.tool( 'get_logpoint_history', 'Get the log output history from logpoints', { logpoint_id: z.string().optional().describe('Specific logpoint ID (all if not specified)'), limit: z.number().int().default(50).describe('Maximum entries to return'), }, async ({ logpoint_id, limit }) => { if (logpoint_id) { const history = ctx.logpointManager.getLogHistory(logpoint_id, limit); return { content: [{ type: 'text', text: JSON.stringify({ logpoint_id, history }, null, 2) }], }; } const stats = ctx.logpointManager.getStatistics(); return { content: [{ type: 'text', text: JSON.stringify(stats, null, 2) }], }; } );
- Core helper method that retrieves the log history entries for a specific logpoint ID, with optional limit.getLogHistory(id: string, limit?: number): LogEntry[] { const logpoint = this.logpoints.get(id); if (!logpoint) return []; const history = logpoint.logHistory; if (limit && limit < history.length) { return history.slice(-limit); } return history; }
- Helper method that returns statistics for all logpoints, used when no specific logpoint_id is provided.getStatistics(): { totalLogpoints: number; totalHits: number; logpoints: Array<{ id: string; file: string; line: number; hitCount: number; lastHitAt?: Date; }>; } { const logpoints = this.getAllLogpoints(); const totalHits = logpoints.reduce((sum, lp) => sum + lp.hitCount, 0); return { totalLogpoints: logpoints.length, totalHits, logpoints: logpoints.map((lp) => ({ id: lp.id, file: lp.file, line: lp.line, hitCount: lp.hitCount, lastHitAt: lp.lastHitAt, })), }; }
- Type definition for LogEntry, which structures the log history data returned by the tool.export interface LogEntry { timestamp: Date; message: string; variables: Record<string, unknown>; stackDepth: number; }