update_breakpoint
Modify breakpoint behavior in PHP debugging sessions by enabling/disabling or adjusting hit conditions and values for precise control over execution flow.
Instructions
Update a breakpoint (enable/disable or change hit conditions). Works for both active session and pending breakpoints.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| breakpoint_id | Yes | The breakpoint ID to update | |
| state | No | Enable or disable the breakpoint | |
| hit_value | No | New hit count value | |
| hit_condition | No | New hit condition | |
| session_id | No | Session ID |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"breakpoint_id": {
"description": "The breakpoint ID to update",
"type": "string"
},
"hit_condition": {
"description": "New hit condition",
"enum": [
">=",
"==",
"%"
],
"type": "string"
},
"hit_value": {
"description": "New hit count value",
"type": "integer"
},
"session_id": {
"description": "Session ID",
"type": "string"
},
"state": {
"description": "Enable or disable the breakpoint",
"enum": [
"enabled",
"disabled"
],
"type": "string"
}
},
"required": [
"breakpoint_id"
],
"type": "object"
}
Implementation Reference
- src/tools/breakpoints.ts:362-446 (handler)Primary MCP tool registration, input schema (Zod), and handler logic for 'update_breakpoint'. Dispatches to pending breakpoints or active session.server.tool( 'update_breakpoint', 'Update a breakpoint (enable/disable or change hit conditions). Works for both active session and pending breakpoints.', { breakpoint_id: z.string().describe('The breakpoint ID to update'), state: z .enum(['enabled', 'disabled']) .optional() .describe('Enable or disable the breakpoint'), hit_value: z.number().int().optional().describe('New hit count value'), hit_condition: z .enum(['>=', '==', '%']) .optional() .describe('New hit condition'), session_id: z.string().optional().describe('Session ID'), }, async ({ breakpoint_id, state, hit_value, hit_condition, session_id }) => { // Check if it's a pending breakpoint if (breakpoint_id.startsWith('pending_')) { const enabled = state === undefined ? undefined : state === 'enabled'; if (enabled !== undefined) { const success = pendingBreakpoints.setBreakpointEnabled(breakpoint_id, enabled); return { content: [ { type: 'text', text: JSON.stringify({ success, breakpoint_id, updates: { state }, message: success ? 'Pending breakpoint updated' : 'Failed to update pending breakpoint (may not exist)', }), }, ], }; } return { content: [ { type: 'text', text: JSON.stringify({ success: false, breakpoint_id, message: 'Only enable/disable is supported for pending breakpoints', }), }, ], }; } const session = sessionManager.resolveSession(session_id); if (!session) { return { content: [ { type: 'text', text: JSON.stringify({ error: 'No active debug session' }), }, ], }; } const success = await session.updateBreakpoint(breakpoint_id, { state: state as 'enabled' | 'disabled' | undefined, hitValue: hit_value, hitCondition: hit_condition as HitCondition | undefined, }); return { content: [ { type: 'text', text: JSON.stringify({ success, breakpoint_id, updates: { state, hit_value, hit_condition }, }), }, ], }; } );
- src/session/session.ts:243-259 (helper)Session class helper method implementing the core DBGP 'breakpoint_update' command to modify breakpoint properties.async updateBreakpoint( breakpointId: string, options: { state?: 'enabled' | 'disabled'; hitValue?: number; hitCondition?: HitCondition; } ): Promise<boolean> { const args: Record<string, string> = { d: breakpointId }; if (options.state) args['s'] = options.state; if (options.hitValue !== undefined) args['h'] = options.hitValue.toString(); if (options.hitCondition) args['o'] = options.hitCondition; const response = await this.connection.sendCommand('breakpoint_update', args); return !response.error; }
- src/tools/breakpoints.ts:365-376 (schema)Input schema validation using Zod for the update_breakpoint tool parameters.{ breakpoint_id: z.string().describe('The breakpoint ID to update'), state: z .enum(['enabled', 'disabled']) .optional() .describe('Enable or disable the breakpoint'), hit_value: z.number().int().optional().describe('New hit count value'), hit_condition: z .enum(['>=', '==', '%']) .optional() .describe('New hit condition'), session_id: z.string().optional().describe('Session ID'),
- src/tools/breakpoints.ts:362-446 (registration)Explicit registration of the 'update_breakpoint' tool with MCP server.server.tool( 'update_breakpoint', 'Update a breakpoint (enable/disable or change hit conditions). Works for both active session and pending breakpoints.', { breakpoint_id: z.string().describe('The breakpoint ID to update'), state: z .enum(['enabled', 'disabled']) .optional() .describe('Enable or disable the breakpoint'), hit_value: z.number().int().optional().describe('New hit count value'), hit_condition: z .enum(['>=', '==', '%']) .optional() .describe('New hit condition'), session_id: z.string().optional().describe('Session ID'), }, async ({ breakpoint_id, state, hit_value, hit_condition, session_id }) => { // Check if it's a pending breakpoint if (breakpoint_id.startsWith('pending_')) { const enabled = state === undefined ? undefined : state === 'enabled'; if (enabled !== undefined) { const success = pendingBreakpoints.setBreakpointEnabled(breakpoint_id, enabled); return { content: [ { type: 'text', text: JSON.stringify({ success, breakpoint_id, updates: { state }, message: success ? 'Pending breakpoint updated' : 'Failed to update pending breakpoint (may not exist)', }), }, ], }; } return { content: [ { type: 'text', text: JSON.stringify({ success: false, breakpoint_id, message: 'Only enable/disable is supported for pending breakpoints', }), }, ], }; } const session = sessionManager.resolveSession(session_id); if (!session) { return { content: [ { type: 'text', text: JSON.stringify({ error: 'No active debug session' }), }, ], }; } const success = await session.updateBreakpoint(breakpoint_id, { state: state as 'enabled' | 'disabled' | undefined, hitValue: hit_value, hitCondition: hit_condition as HitCondition | undefined, }); return { content: [ { type: 'text', text: JSON.stringify({ success, breakpoint_id, updates: { state, hit_value, hit_condition }, }), }, ], }; } );