Skip to main content
Glama

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
NameRequiredDescriptionDefault
session_idNoSession ID

Implementation Reference

  • 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), }), }, ], }; } }
  • Input schema for the 'detach' tool using Zod: optional session_id string.
    { session_id: z.string().optional().describe('Session ID'), },
  • 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), }), }, ], }; } } );
  • 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'); }
  • Higher-level registration call to registerExecutionTools (which registers 'detach' among others) in the registerAllTools function.
    registerExecutionTools(server, ctx.sessionManager);

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