Skip to main content
Glama

stop_debug_session

End the current debugging session and shut down the log server to complete the debugging process.

Instructions

Stop the current debug session and shut down the log server.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler for the 'stop_debug_session' tool. Checks if a session is active, retrieves all instruments, removes them using the Instrumenter, stops the session via SessionManager, nullifies the instrumenter, and returns a success message.
    case 'stop_debug_session': { if (!sessionManager.isActive()) { return { content: [{ type: 'text', text: 'No active debug session to stop.' }], }; } // Remove all instruments from files before stopping const instruments = sessionManager.getInstruments(); if (instrumenter) { for (const instrument of instruments) { instrumenter.removeInstrument(instrument); } } await sessionManager.stopSession(); instrumenter = null; return { content: [ { type: 'text', text: `Debug session stopped. Removed ${instruments.length} instrument(s) from code.`, }, ], }; }
  • Schema definition for the 'stop_debug_session' tool, including name, description, and empty input schema (no parameters required).
    { name: 'stop_debug_session', description: 'Stop the current debug session and shut down the log server.', inputSchema: { type: 'object', properties: {}, }, },
  • src/index.ts:31-126 (registration)
    Registration of the 'stop_debug_session' tool in the ListToolsRequestSchema handler, where it is listed among available tools.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ { 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, }, }, }, }, { name: 'stop_debug_session', description: 'Stop the current debug session and shut down the log server.', inputSchema: { type: 'object', properties: {}, }, }, { name: 'add_instrument', description: 'Add a debug instrument at a specific line in a file. The instrument will log variable values when executed.', inputSchema: { type: 'object', properties: { file: { type: 'string', description: 'Path to the file to instrument (relative to working directory)', }, line: { type: 'number', description: 'Line number where to insert the instrument (1-indexed)', }, capture: { type: 'array', items: { type: 'string' }, description: 'Variable names to capture and log', default: [], }, }, required: ['file', 'line'], }, }, { name: 'remove_instruments', description: 'Remove debug instruments from files.', inputSchema: { type: 'object', properties: { file: { type: 'string', description: 'Path to file to remove instruments from. If not specified, removes from all instrumented files.', }, }, }, }, { name: 'list_instruments', description: 'List all active debug instruments.', inputSchema: { type: 'object', properties: {}, }, }, { name: 'read_debug_logs', description: 'Read the collected debug logs from the current session.', inputSchema: { type: 'object', properties: { format: { type: 'string', enum: ['raw', 'pretty'], description: 'Output format (default: pretty)', default: 'pretty', }, }, }, }, { name: 'clear_debug_logs', description: 'Clear all collected debug logs.', inputSchema: { type: 'object', properties: {}, }, }, ], }; });
  • SessionManager.stopSession() method called by the tool handler to stop the debug log server and clear the session state.
    async stopSession(): Promise<void> { if (this.server) { await this.server.stop(); this.server = null; } this.session = null; }
  • Instrumenter.removeInstrument() method used in the loop to remove each instrument's code region from the respective files.
    removeInstrument(instrument: Instrument): boolean { if (!existsSync(instrument.file)) { return false; } const content = readFileSync(instrument.file, 'utf-8'); const regionId = `${REGION_PREFIX}-${instrument.id}`; const newContent = this.removeRegion(content, regionId, instrument.language); if (newContent !== content) { writeFileSync(instrument.file, newContent); 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/iarmankhan/agentic-debugger'

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