detach
End debugging session to allow PHP script execution to continue normally without debugger interference.
Instructions
Detach from the debug session and let the script continue running without debugging
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | No | Session ID |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"session_id": {
"description": "Session ID",
"type": "string"
}
},
"type": "object"
}
Implementation Reference
- src/tools/execution.ts:297-338 (handler)The core handler function for the 'detach' MCP tool. It resolves the debug session using the provided session_id (or default), calls session.detach(), and returns a standardized MCP response with success or error details.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 using Zod for the 'detach' tool, defining an optional session_id parameter.{ session_id: z.string().optional().describe('Session ID'), },
- src/tools/execution.ts:291-339 (registration)Registration of the 'detach' tool on the MCP server within registerExecutionTools, specifying name, description, input schema, and handler.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)Supporting method on DebugSession class that sends the underlying DBGP 'detach' command to the debug connection.async detach(): Promise<void> { await this.connection.sendCommand('detach'); }
- src/tools/index.ts:57-57 (registration)Higher-level registration call to registerExecutionTools in the central tools registration function registerAllTools, which includes the 'detach' tool.registerExecutionTools(server, ctx.sessionManager);