detach
End debugging while allowing the PHP script to continue running normally, useful for resuming execution without debugger interference.
Instructions
Detach from the debug session and let the script continue running without debugging
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | No | Session ID |
Implementation Reference
- src/tools/execution.ts:297-338 (handler)The handler function for the 'detach' MCP tool. It resolves the debug session by optional session_id, calls session.detach() if session exists, and returns a text content response with success or error JSON.async ({ session_id }) => { const session = sessionManager.resolveSession(session_id); if (!session) { return { content: [ { type: 'text', text: JSON.stringify({ error: 'No active debug session' }), }, ], }; } try { await session.detach(); return { content: [ { type: 'text', text: JSON.stringify({ success: true, message: 'Detached from debug session. Script will continue running.', }), }, ], }; } catch (error) { return { content: [ { type: 'text', text: JSON.stringify({ error: 'Detach failed', message: error instanceof Error ? error.message : String(error), }), }, ], }; } }
- src/tools/execution.ts:294-296 (schema)Input schema for the 'detach' tool using Zod: optional session_id string.{ session_id: z.string().optional().describe('Session ID'), },
- src/tools/execution.ts:290-339 (registration)Registration of the 'detach' tool on the MCP server within registerExecutionTools function, specifying name, description, input schema, and handler.// Detach from session (let script continue without debugging) server.tool( 'detach', 'Detach from the debug session and let the script continue running without debugging', { session_id: z.string().optional().describe('Session ID'), }, async ({ session_id }) => { const session = sessionManager.resolveSession(session_id); if (!session) { return { content: [ { type: 'text', text: JSON.stringify({ error: 'No active debug session' }), }, ], }; } try { await session.detach(); return { content: [ { type: 'text', text: JSON.stringify({ success: true, message: 'Detached from debug session. Script will continue running.', }), }, ], }; } catch (error) { return { content: [ { type: 'text', text: JSON.stringify({ error: 'Detach failed', message: error instanceof Error ? error.message : String(error), }), }, ], }; } } );
- src/session/session.ts:312-314 (helper)Helper method on DebugSession class that implements detach by sending the DBGP 'detach' command to the connection.async detach(): Promise<void> { await this.connection.sendCommand('detach'); }
- src/tools/index.ts:57-57 (registration)Higher-level registration call to registerExecutionTools (which registers 'detach' among others) in the registerAllTools function.registerExecutionTools(server, ctx.sessionManager);