Skip to main content
Glama
signal-slot

MCP GDB Server

by signal-slot

gdb_load_core

Analyze core dump files in GDB sessions by specifying the program executable and core dump path, enabling structured debugging and issue diagnosis.

Instructions

Load a core dump file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
corePathYesPath to the core dump file
programYesPath to the program executable
sessionIdYesGDB session ID

Implementation Reference

  • Implements the gdb_load_core tool by loading the specified program and core dump file into an active GDB session using 'file' and 'core-file' commands, then displaying the backtrace.
    private async handleGdbLoadCore(args: any) {
      const { sessionId, program, corePath } = args;
      
      if (!activeSessions.has(sessionId)) {
        return {
          content: [
            {
              type: 'text',
              text: `No active GDB session with ID: ${sessionId}`
            }
          ],
          isError: true
        };
      }
      
      const session = activeSessions.get(sessionId)!;
      
      try {
        // First load the program
        const fileOutput = await this.executeGdbCommand(session, `file "${program}"`);
        
        // Then load the core file
        const coreOutput = await this.executeGdbCommand(session, `core-file "${corePath}"`);
        
        // Get backtrace to show initial state
        const backtraceOutput = await this.executeGdbCommand(session, "backtrace");
        
        return {
          content: [
            {
              type: 'text',
              text: `Core file loaded: ${corePath}\n\nOutput:\n${fileOutput}\n${coreOutput}\n\nBacktrace:\n${backtraceOutput}`
            }
          ]
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        return {
          content: [
            {
              type: 'text',
              text: `Failed to load core file: ${errorMessage}`
            }
          ],
          isError: true
        };
      }
    }
  • Defines the input schema and metadata for the gdb_load_core tool, specifying required parameters: sessionId, program, and corePath.
    name: 'gdb_load_core',
    description: 'Load a core dump file',
    inputSchema: {
      type: 'object',
      properties: {
        sessionId: {
          type: 'string',
          description: 'GDB session ID'
        },
        program: {
          type: 'string',
          description: 'Path to the program executable'
        },
        corePath: {
          type: 'string',
          description: 'Path to the core dump file'
        }
      },
      required: ['sessionId', 'program', 'corePath']
    }
  • src/index.ts:371-372 (registration)
    Registers the gdb_load_core tool in the CallToolRequestSchema handler switch statement, routing calls to the handleGdbLoadCore method.
    case 'gdb_load_core':
      return await this.handleGdbLoadCore(request.params.arguments);
  • src/index.ts:59-354 (registration)
    The tool is registered in the ListToolsRequestSchema response, making it discoverable by MCP clients.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [
        {
          name: 'gdb_start',
          description: 'Start a new GDB session',
          inputSchema: {
            type: 'object',
            properties: {
              gdbPath: {
                type: 'string',
                description: 'Path to the GDB executable (optional, defaults to "gdb")'
              },
              workingDir: {
                type: 'string',
                description: 'Working directory for GDB (optional)'
              }
            }
          }
        },
        {
          name: 'gdb_load',
          description: 'Load a program into GDB',
          inputSchema: {
            type: 'object',
            properties: {
              sessionId: {
                type: 'string',
                description: 'GDB session ID'
              },
              program: {
                type: 'string',
                description: 'Path to the program to debug'
              },
              arguments: {
                type: 'array',
                items: {
                  type: 'string'
                },
                description: 'Command-line arguments for the program (optional)'
              }
            },
            required: ['sessionId', 'program']
          }
        },
        {
          name: 'gdb_command',
          description: 'Execute a GDB command',
          inputSchema: {
            type: 'object',
            properties: {
              sessionId: {
                type: 'string',
                description: 'GDB session ID'
              },
              command: {
                type: 'string',
                description: 'GDB command to execute'
              }
            },
            required: ['sessionId', 'command']
          }
        },
        {
          name: 'gdb_terminate',
          description: 'Terminate a GDB session',
          inputSchema: {
            type: 'object',
            properties: {
              sessionId: {
                type: 'string',
                description: 'GDB session ID'
              }
            },
            required: ['sessionId']
          }
        },
        {
          name: 'gdb_list_sessions',
          description: 'List all active GDB sessions',
          inputSchema: {
            type: 'object',
            properties: {}
          }
        },
        {
          name: 'gdb_attach',
          description: 'Attach to a running process',
          inputSchema: {
            type: 'object',
            properties: {
              sessionId: {
                type: 'string',
                description: 'GDB session ID'
              },
              pid: {
                type: 'number',
                description: 'Process ID to attach to'
              }
            },
            required: ['sessionId', 'pid']
          }
        },
        {
          name: 'gdb_load_core',
          description: 'Load a core dump file',
          inputSchema: {
            type: 'object',
            properties: {
              sessionId: {
                type: 'string',
                description: 'GDB session ID'
              },
              program: {
                type: 'string',
                description: 'Path to the program executable'
              },
              corePath: {
                type: 'string',
                description: 'Path to the core dump file'
              }
            },
            required: ['sessionId', 'program', 'corePath']
          }
        },
        {
          name: 'gdb_set_breakpoint',
          description: 'Set a breakpoint',
          inputSchema: {
            type: 'object',
            properties: {
              sessionId: {
                type: 'string',
                description: 'GDB session ID'
              },
              location: {
                type: 'string',
                description: 'Breakpoint location (e.g., function name, file:line)'
              },
              condition: {
                type: 'string',
                description: 'Breakpoint condition (optional)'
              }
            },
            required: ['sessionId', 'location']
          }
        },
        {
          name: 'gdb_continue',
          description: 'Continue program execution',
          inputSchema: {
            type: 'object',
            properties: {
              sessionId: {
                type: 'string',
                description: 'GDB session ID'
              }
            },
            required: ['sessionId']
          }
        },
        {
          name: 'gdb_step',
          description: 'Step program execution',
          inputSchema: {
            type: 'object',
            properties: {
              sessionId: {
                type: 'string',
                description: 'GDB session ID'
              },
              instructions: {
                type: 'boolean',
                description: 'Step by instructions instead of source lines (optional)'
              }
            },
            required: ['sessionId']
          }
        },
        {
          name: 'gdb_next',
          description: 'Step over function calls',
          inputSchema: {
            type: 'object',
            properties: {
              sessionId: {
                type: 'string',
                description: 'GDB session ID'
              },
              instructions: {
                type: 'boolean',
                description: 'Step by instructions instead of source lines (optional)'
              }
            },
            required: ['sessionId']
          }
        },
        {
          name: 'gdb_finish',
          description: 'Execute until the current function returns',
          inputSchema: {
            type: 'object',
            properties: {
              sessionId: {
                type: 'string',
                description: 'GDB session ID'
              }
            },
            required: ['sessionId']
          }
        },
        {
          name: 'gdb_backtrace',
          description: 'Show call stack',
          inputSchema: {
            type: 'object',
            properties: {
              sessionId: {
                type: 'string',
                description: 'GDB session ID'
              },
              full: {
                type: 'boolean',
                description: 'Show variables in each frame (optional)'
              },
              limit: {
                type: 'number',
                description: 'Maximum number of frames to show (optional)'
              }
            },
            required: ['sessionId']
          }
        },
        {
          name: 'gdb_print',
          description: 'Print value of expression',
          inputSchema: {
            type: 'object',
            properties: {
              sessionId: {
                type: 'string',
                description: 'GDB session ID'
              },
              expression: {
                type: 'string',
                description: 'Expression to evaluate'
              }
            },
            required: ['sessionId', 'expression']
          }
        },
        {
          name: 'gdb_examine',
          description: 'Examine memory',
          inputSchema: {
            type: 'object',
            properties: {
              sessionId: {
                type: 'string',
                description: 'GDB session ID'
              },
              expression: {
                type: 'string',
                description: 'Memory address or expression'
              },
              format: {
                type: 'string',
                description: 'Display format (e.g., "x" for hex, "i" for instruction)'
              },
              count: {
                type: 'number',
                description: 'Number of units to display'
              }
            },
            required: ['sessionId', 'expression']
          }
        },
        {
          name: 'gdb_info_registers',
          description: 'Display registers',
          inputSchema: {
            type: 'object',
            properties: {
              sessionId: {
                type: 'string',
                description: 'GDB session ID'
              },
              register: {
                type: 'string',
                description: 'Specific register to display (optional)'
              }
            },
            required: ['sessionId']
          }
        }
      ],
    }));
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only states the basic action. It doesn't disclose behavioral traits such as whether this is a read-only operation, if it modifies the session state, potential errors (e.g., invalid paths), or what happens after loading (e.g., does it pause execution?). This leaves significant gaps for a tool with 3 required parameters.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, direct sentence with zero wasted words. It's appropriately sized for a simple action and front-loaded with the essential information, making it highly efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (3 required parameters, no annotations, no output schema), the description is incomplete. It doesn't explain the tool's role in debugging workflows, what 'loading a core dump' entails (e.g., analyzing crash state), or expected outcomes. This leaves the agent with insufficient context for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so all parameters are documented in the schema itself. The description adds no additional meaning about parameters beyond implying 'corePath' is needed, which is already clear from the schema. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Load') and the resource ('a core dump file'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'gdb_load' (which might load executables rather than core dumps), so it misses the highest score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an active GDB session), exclusions, or related tools like 'gdb_start' or 'gdb_attach' for different debugging scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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