Skip to main content
Glama

remove_breakpoint

Remove debugging breakpoints by ID from PHP applications using Xdebug's DBGp protocol to control debugging sessions.

Instructions

Remove a breakpoint by its ID. Works for both active session breakpoints and pending breakpoints.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
breakpoint_idYesThe breakpoint ID to remove (session breakpoint ID or pending_* ID)
session_idNoSession ID

Implementation Reference

  • The core handler function for the 'remove_breakpoint' MCP tool. It determines if the breakpoint is pending or active in a session and delegates to the appropriate removal method, returning JSON-formatted success status.
    async ({ breakpoint_id, session_id }) => {
      // Check if it's a pending breakpoint
      if (breakpoint_id.startsWith('pending_')) {
        const success = pendingBreakpoints.removeBreakpoint(breakpoint_id);
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                success,
                breakpoint_id,
                message: success
                  ? 'Pending breakpoint removed'
                  : 'Failed to remove pending breakpoint (may not exist)',
              }),
            },
          ],
        };
      }
    
      const session = sessionManager.resolveSession(session_id);
    
      if (!session) {
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({ error: 'No active debug session' }),
            },
          ],
        };
      }
    
      const success = await session.removeBreakpoint(breakpoint_id);
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              success,
              breakpoint_id,
              message: success
                ? 'Breakpoint removed'
                : 'Failed to remove breakpoint (may not exist)',
            }),
          },
        ],
      };
    }
  • Zod schema defining the input parameters for the remove_breakpoint tool: breakpoint_id (required string) and optional session_id.
      breakpoint_id: z.string().describe('The breakpoint ID to remove (session breakpoint ID or pending_* ID)'),
      session_id: z.string().optional().describe('Session ID'),
    },
  • Registration of the 'remove_breakpoint' tool on the MCP server within registerBreakpointTools, including name and description.
    server.tool(
      'remove_breakpoint',
      'Remove a breakpoint by its ID. Works for both active session breakpoints and pending breakpoints.',
  • Helper method in PendingBreakpointsManager to remove a pending breakpoint by ID from the internal Map.
    removeBreakpoint(id: string): boolean {
      const removed = this.pendingBreakpoints.delete(id);
      if (removed) {
        logger.info(`Pending breakpoint removed: ${id}`);
        this.emit('breakpointRemoved', id);
      }
      return removed;
  • Helper method in DebugSession to remove an active breakpoint by sending DBGP 'breakpoint_remove' command and updating local cache.
    async removeBreakpoint(breakpointId: string): Promise<boolean> {
      const response = await this.connection.sendCommand('breakpoint_remove', {
        d: breakpointId,
      });
    
      if (!response.error) {
        this.breakpoints.delete(breakpointId);
        logger.debug(`Breakpoint removed: ${breakpointId}`);
        return true;
      }
      return false;

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