Skip to main content
Glama

set_active_session

Select a specific debug session as the active session for PHP debugging operations in Xdebug MCP Server.

Instructions

Set which debug session should be the active/default session for subsequent commands

Input Schema

NameRequiredDescriptionDefault
session_idYesSession ID to set as active

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "session_id": { "description": "Session ID to set as active", "type": "string" } }, "required": [ "session_id" ], "type": "object" }

Implementation Reference

  • Registration of the set_active_session MCP tool, including input schema (session_id: string), description, and inline asynchronous handler that delegates to SessionManager.setActiveSession and formats the 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`, }), }, ], }; } );
  • Inline handler function for set_active_session tool: validates session_id, calls sessionManager.setActiveSession, returns JSON-formatted success or error message in MCP content format.
    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`, }), }, ], }; }
  • Zod input schema for the tool: requires session_id as string.
    { session_id: z.string().describe('Session ID to set as active'), },
  • Helper method in SessionManager that implements the core logic of setting the active session by ID, returning true if session exists.
    setActiveSession(id: string): boolean { if (this.sessions.has(id)) { this.activeSessionId = id; 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