Skip to main content
Glama

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

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

  • 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), }), }, ], }; } }
  • Input schema using Zod for the 'detach' tool, defining an optional session_id parameter.
    { session_id: z.string().optional().describe('Session ID'), },
  • 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), }), }, ], }; } } );
  • 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'); }
  • Higher-level registration call to registerExecutionTools in the central tools registration function registerAllTools, which includes the 'detach' tool.
    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