get_logpoint_history
Retrieve log output history from Xdebug logpoints to debug PHP applications by accessing recorded debug data with configurable entry limits.
Instructions
Get the log output history from logpoints
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| logpoint_id | No | Specific logpoint ID (all if not specified) | |
| limit | No | Maximum entries to return |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"limit": {
"default": 50,
"description": "Maximum entries to return",
"type": "integer"
},
"logpoint_id": {
"description": "Specific logpoint ID (all if not specified)",
"type": "string"
}
},
"type": "object"
}
Implementation Reference
- src/tools/advanced.ts:197-217 (handler)MCP tool registration including schema and handler function. The handler fetches log history for a specific logpoint using LogpointManager.getLogHistory() or overall statistics if no logpoint_id provided, and returns JSON-formatted response.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 given logpoint ID, applying limit if specified by taking the most recent entries.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 computes and returns statistics for all logpoints (total count, total hits, per-logpoint summary), called 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, })), }; }