Skip to main content
Glama

close_session

Terminate an active Xdebug debugging session to end PHP application debugging and release debugger resources.

Instructions

Close and terminate a debug session

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idNoSession ID to close (uses active session if not specified)

Implementation Reference

  • Executes the close_session tool: resolves session by ID or active, closes it via sessionManager, returns JSON success or error message.
    async ({ session_id }) => { const session = sessionManager.resolveSession(session_id); if (!session) { return { content: [ { type: 'text', text: JSON.stringify({ error: 'No session found', message: session_id ? `Session "${session_id}" not found` : 'No active debug session', }), }, ], }; } const closedId = session.id; sessionManager.closeSession(closedId); return { content: [ { type: 'text', text: JSON.stringify({ success: true, message: `Session "${closedId}" closed`, }), }, ], }; }
  • Zod input schema: optional session_id string.
    { session_id: z .string() .optional() .describe('Session ID to close (uses active session if not specified)'), },
  • Registers the close_session tool using server.tool() with name, description, schema, and handler.
    // Close a session server.tool( 'close_session', 'Close and terminate a debug session', { session_id: z .string() .optional() .describe('Session ID to close (uses active session if not specified)'), }, async ({ session_id }) => { const session = sessionManager.resolveSession(session_id); if (!session) { return { content: [ { type: 'text', text: JSON.stringify({ error: 'No session found', message: session_id ? `Session "${session_id}" not found` : 'No active debug session', }), }, ], }; } const closedId = session.id; sessionManager.closeSession(closedId); return { content: [ { type: 'text', text: JSON.stringify({ success: true, message: `Session "${closedId}" closed`, }), }, ], }; } );
  • SessionManager.closeSession(id): closes the session by calling session.close() and returns boolean success.
    closeSession(id: string): boolean { const session = this.sessions.get(id); if (session) { session.close(); // The 'close' event handler will remove it from the map return true; } return false; }

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