Skip to main content
Glama

start_debug_session

Start a debug session to receive logs from instrumented code via a local HTTP server. Configure the port to monitor and analyze code execution in real-time.

Instructions

Start a debug session. This starts a local HTTP server to receive logs from instrumented code.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
portNoPort number for the debug server (default: 9876)

Implementation Reference

  • The main handler for the 'start_debug_session' tool. It extracts the port from arguments (default 9876), starts the debug session using SessionManager, initializes the Instrumenter, and returns a success message with session details.
    case 'start_debug_session': { const port = (args?.port as number) || 9876; const session = await sessionManager.startSession(port); instrumenter = new Instrumenter(port); return { content: [ { type: 'text', text: `Debug session started!\n\nSession ID: ${session.id}\nServer: http://localhost:${port}\nLog file: ${session.logFile}\n\nYou can now add instruments to capture variable values.`, }, ], }; }
  • The schema definition for the 'start_debug_session' tool, including name, description, and input schema for the optional 'port' parameter.
    { name: 'start_debug_session', description: 'Start a debug session. This starts a local HTTP server to receive logs from instrumented code.', inputSchema: { type: 'object', properties: { port: { type: 'number', description: 'Port number for the debug server (default: 9876)', default: 9876, }, }, }, },
  • The SessionManager.startSession method, which implements the core logic for starting the debug session: clears log file, starts DebugLogServer, and initializes the session object.
    async startSession(port: number = 9876): Promise<DebugSession> { if (this.session) { throw new Error('Debug session already active. Stop it first.'); } const logFile = resolve(this.workingDirectory, 'debug.log'); // Clear any existing log file if (existsSync(logFile)) { unlinkSync(logFile); } writeFileSync(logFile, ''); this.server = new DebugLogServer(port, logFile); await this.server.start(); this.session = { id: randomUUID(), port, startedAt: Date.now(), logFile, instruments: new Map() }; return this.session; }
  • The Instrumenter constructor, initialized with the port in the tool handler.
    constructor(port: number) { this.port = port; }

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/iarmankhan/agentic-debugger'

If you have feedback or need assistance with the MCP directory API, please join our Discord server