Skip to main content
Glama

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
NameRequiredDescriptionDefault
session_idNoSession ID
include_pendingNoInclude pending breakpoints in the list

Implementation Reference

  • 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), }, ], }; } );
  • 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'), },
  • 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), }, ], }; }
  • 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; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kpanuragh/xdebug-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server