Skip to main content
Glama
signal-slot

MCP GDB Server

by signal-slot

gdb_set_breakpoint

Set breakpoints during GDB debugging sessions by specifying a session ID and location, enabling precise control over code execution for debugging workflows.

Instructions

Set a breakpoint

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
conditionNoBreakpoint condition (optional)
locationYesBreakpoint location (e.g., function name, file:line)
sessionIdYesGDB session ID

Implementation Reference

  • The handler function that implements the gdb_set_breakpoint tool. It checks for an active GDB session, executes the 'break' command at the specified location, optionally sets a condition on the breakpoint by parsing the breakpoint number from output, and returns the result or error.
    private async handleGdbSetBreakpoint(args: any) {
      const { sessionId, location, condition } = 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 {
        // Set breakpoint
        let command = `break ${location}`;
        const output = await this.executeGdbCommand(session, command);
        
        // Set condition if provided
        let conditionOutput = '';
        if (condition) {
          // Extract breakpoint number from output (assumes format like "Breakpoint 1 at...")
          const match = output.match(/Breakpoint (\d+)/);
          if (match && match[1]) {
            const bpNum = match[1];
            const conditionCommand = `condition ${bpNum} ${condition}`;
            conditionOutput = await this.executeGdbCommand(session, conditionCommand);
          }
        }
        
        return {
          content: [
            {
              type: 'text',
              text: `Breakpoint set at: ${location}${condition ? ` with condition: ${condition}` : ''}\n\nOutput:\n${output}${conditionOutput ? '\n' + conditionOutput : ''}`
            }
          ]
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        return {
          content: [
            {
              type: 'text',
              text: `Failed to set breakpoint: ${errorMessage}`
            }
          ],
          isError: true
        };
      }
    }
  • The input schema for the gdb_set_breakpoint tool, defining the required parameters sessionId and location, and optional condition parameter.
    {
      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']
      }
    },
  • src/index.ts:373-374 (registration)
    The switch case in the CallToolRequestSchema handler that registers and routes calls to the gdb_set_breakpoint handler function.
    case 'gdb_set_breakpoint':
      return await this.handleGdbSetBreakpoint(request.params.arguments);
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. 'Set a breakpoint' implies a mutation operation that modifies debugging state, but it doesn't describe what happens when invoked (e.g., whether it pauses execution immediately, returns a breakpoint ID, or affects session persistence). It lacks critical details like error conditions, permission requirements, or side effects that would help the agent understand the tool's behavior.

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 extremely concise at just three words, with zero wasted language. It's front-loaded with the core action ('Set a breakpoint') and contains no unnecessary elaboration. While under-specified for completeness, it earns full marks for conciseness as every word serves the minimal purpose.

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 of a debugging tool with mutation behavior, no annotations, and no output schema, the description is inadequate. It doesn't explain what a breakpoint does, what happens after setting one, return values, error conditions, or relationships to other GDB operations. For a tool that modifies debugging state in a technical context, this leaves too many gaps for effective agent 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?

Schema description coverage is 100%, with all three parameters (condition, location, sessionId) well-documented in the schema. The description adds no parameter information beyond what the schema already provides. According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in the description, which applies here.

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

Purpose2/5

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

The description 'Set a breakpoint' is a tautology that merely restates the tool name without adding specificity. It doesn't explain what a breakpoint is in the GDB context, what resource it affects (e.g., debugging session), or how it differs from sibling tools like gdb_continue or gdb_step. This provides minimal value beyond the tool name itself.

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

Usage Guidelines1/5

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

The description offers no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an active GDB session), timing considerations (e.g., when the program is paused), or relationships to sibling tools like gdb_continue (to resume after breakpoint) or gdb_step (for step-by-step execution). This leaves the agent with no contextual usage information.

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