list_breakpoints
Retrieve all active and pending breakpoints from Xdebug debugging sessions to monitor and manage code execution pauses.
Instructions
List all breakpoints including both active session breakpoints and pending breakpoints
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | No | Session ID | |
| include_pending | No | Include pending breakpoints in the list |
Implementation Reference
- src/tools/breakpoints.ts:449-559 (registration)Registration of the 'list_breakpoints' MCP tool, including input schema and the full handler implementation that lists active and pending breakpoints.server.tool( 'list_breakpoints', 'List all breakpoints including both active session breakpoints and pending breakpoints', { session_id: z.string().optional().describe('Session ID'), include_pending: z.boolean().default(true).describe('Include pending breakpoints in the list'), }, async ({ session_id, include_pending }) => { const session = sessionManager.resolveSession(session_id); const pending = pendingBreakpoints.getAllPendingBreakpoints(); // If no session, just return pending breakpoints if (!session) { if (pending.length === 0) { return { content: [ { type: 'text', text: JSON.stringify({ message: 'No active debug session and no pending breakpoints', breakpoints: [], pendingBreakpoints: [], totalCount: 0, }), }, ], }; } return { content: [ { type: 'text', text: JSON.stringify( { message: 'No active debug session - showing pending breakpoints only', breakpoints: [], pendingBreakpoints: pending.map((bp) => ({ id: bp.id, type: bp.type, file: bp.file, line: bp.line, condition: bp.condition, hitValue: bp.hitValue, hitCondition: bp.hitCondition, exception: bp.exception, functionName: bp.functionName, enabled: bp.enabled, createdAt: bp.createdAt, })), totalCount: pending.length, }, null, 2 ), }, ], }; } const breakpoints = await session.listBreakpoints(); const result: { breakpoints: object[]; pendingBreakpoints?: object[]; totalCount: number; } = { breakpoints: breakpoints.map((bp) => ({ id: bp.id, type: bp.type, state: bp.state, resolved: bp.resolved, file: bp.filename, line: bp.lineno, function: bp.function, exception: bp.exception, expression: bp.expression, hitCount: bp.hitCount, hitValue: bp.hitValue, hitCondition: bp.hitCondition, })), totalCount: breakpoints.length, }; if (include_pending && pending.length > 0) { result.pendingBreakpoints = pending.map((bp) => ({ id: bp.id, type: bp.type, file: bp.file, line: bp.line, condition: bp.condition, hitValue: bp.hitValue, hitCondition: bp.hitCondition, exception: bp.exception, functionName: bp.functionName, enabled: bp.enabled, createdAt: bp.createdAt, })); result.totalCount += pending.length; } return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } );
- src/tools/breakpoints.ts:452-455 (schema)Input schema for the list_breakpoints tool using Zod.{ session_id: z.string().optional().describe('Session ID'), include_pending: z.boolean().default(true).describe('Include pending breakpoints in the list'), },
- src/tools/breakpoints.ts:456-558 (handler)The handler function for the list_breakpoints tool. It fetches breakpoints from the debug session and pending breakpoints manager, formats them, and returns a JSON response.async ({ session_id, include_pending }) => { const session = sessionManager.resolveSession(session_id); const pending = pendingBreakpoints.getAllPendingBreakpoints(); // If no session, just return pending breakpoints if (!session) { if (pending.length === 0) { return { content: [ { type: 'text', text: JSON.stringify({ message: 'No active debug session and no pending breakpoints', breakpoints: [], pendingBreakpoints: [], totalCount: 0, }), }, ], }; } return { content: [ { type: 'text', text: JSON.stringify( { message: 'No active debug session - showing pending breakpoints only', breakpoints: [], pendingBreakpoints: pending.map((bp) => ({ id: bp.id, type: bp.type, file: bp.file, line: bp.line, condition: bp.condition, hitValue: bp.hitValue, hitCondition: bp.hitCondition, exception: bp.exception, functionName: bp.functionName, enabled: bp.enabled, createdAt: bp.createdAt, })), totalCount: pending.length, }, null, 2 ), }, ], }; } const breakpoints = await session.listBreakpoints(); const result: { breakpoints: object[]; pendingBreakpoints?: object[]; totalCount: number; } = { breakpoints: breakpoints.map((bp) => ({ id: bp.id, type: bp.type, state: bp.state, resolved: bp.resolved, file: bp.filename, line: bp.lineno, function: bp.function, exception: bp.exception, expression: bp.expression, hitCount: bp.hitCount, hitValue: bp.hitValue, hitCondition: bp.hitCondition, })), totalCount: breakpoints.length, }; if (include_pending && pending.length > 0) { result.pendingBreakpoints = pending.map((bp) => ({ id: bp.id, type: bp.type, file: bp.file, line: bp.line, condition: bp.condition, hitValue: bp.hitValue, hitCondition: bp.hitCondition, exception: bp.exception, functionName: bp.functionName, enabled: bp.enabled, createdAt: bp.createdAt, })); result.totalCount += pending.length; } return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
- src/session/session.ts:272-283 (helper)Underlying session method called by the tool handler to list breakpoints from the DBGP protocol.async listBreakpoints(): Promise<Breakpoint[]> { const response = await this.connection.sendCommand('breakpoint_list'); const breakpoints = this.connection.parseBreakpoints(response); // Update local cache this.breakpoints.clear(); for (const bp of breakpoints) { this.breakpoints.set(bp.id, bp); } return breakpoints; }