Skip to main content
Glama

gdb_terminate

End a GDB debugging session by specifying its session ID, enabling efficient management of debugging processes in the MCP GDB Server.

Instructions

Terminate a GDB session

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesGDB session ID

Implementation Reference

  • The handler function that executes the gdb_terminate tool logic. It validates the sessionId, calls the terminateGdbSession helper, and returns success or error response.
    private async handleGdbTerminate(args: any) { const { sessionId } = args; if (!activeSessions.has(sessionId)) { return { content: [ { type: 'text', text: `No active GDB session with ID: ${sessionId}` } ], isError: true }; } try { await this.terminateGdbSession(sessionId); return { content: [ { type: 'text', text: `GDB session terminated: ${sessionId}` } ] }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [ { type: 'text', text: `Failed to terminate GDB session: ${errorMessage}` } ], isError: true }; } }
  • Tool definition including name, description, and input schema requiring 'sessionId' string for the gdb_terminate tool.
    { name: 'gdb_terminate', description: 'Terminate a GDB session', inputSchema: { type: 'object', properties: { sessionId: { type: 'string', description: 'GDB session ID' } }, required: ['sessionId'] } },
  • src/index.ts:365-366 (registration)
    Switch case in CallToolRequestSchema handler that routes gdb_terminate calls to the handleGdbTerminate method.
    case 'gdb_terminate': return await this.handleGdbTerminate(request.params.arguments);
  • Supporting helper method that performs the actual termination: sends quit to GDB, kills process, closes readline interface, and removes session from active map.
    private async terminateGdbSession(sessionId: string): Promise<void> { if (!activeSessions.has(sessionId)) { throw new Error(`No active GDB session with ID: ${sessionId}`); } const session = activeSessions.get(sessionId)!; // Send quit command to GDB try { await this.executeGdbCommand(session, 'quit'); } catch (error) { // Ignore errors from quit command, we'll force kill if needed } // Force kill the process if it's still running if (!session.process.killed) { session.process.kill(); } // Close the readline interface session.rl.close(); // Remove from active sessions activeSessions.delete(sessionId); }

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/signal-slot/mcp-gdb'

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