set_active_session
Set the active debug session for Xdebug MCP Server to control which PHP debugging session receives subsequent commands like breakpoints and variable inspection.
Instructions
Set which debug session should be the active/default session for subsequent commands
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | Yes | Session ID to set as active |
Implementation Reference
- src/tools/session.ts:131-166 (handler)MCP tool registration and handler for 'set_active_session'. Validates input with Zod schema, calls SessionManager.setActiveSession(session_id), and returns formatted success or error response.server.tool( 'set_active_session', 'Set which debug session should be the active/default session for subsequent commands', { session_id: z.string().describe('Session ID to set as active'), }, async ({ session_id }) => { const success = sessionManager.setActiveSession(session_id); if (!success) { return { content: [ { type: 'text', text: JSON.stringify({ error: 'Session not found', session_id, }), }, ], }; } return { content: [ { type: 'text', text: JSON.stringify({ success: true, message: `Session "${session_id}" is now active`, }), }, ], }; } );
- src/session/manager.ts:102-108 (helper)SessionManager method that sets the active session ID if the session exists in the map, returns boolean success.setActiveSession(id: string): boolean { if (this.sessions.has(id)) { this.activeSessionId = id; return true; } return false; }
- src/tools/session.ts:135-136 (schema)Zod schema for the 'set_active_session' tool input parameter.session_id: z.string().describe('Session ID to set as active'), },