Skip to main content
Glama

setBreakpoint

Set a breakpoint at a specified file and line number to pause program execution. Optionally add a condition to trigger the breakpoint only when true.

Instructions

Set a breakpoint in the debugged program

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesID of the debug session
fileYesFile path where to set the breakpoint
lineYesLine number for the breakpoint
conditionNoOptional condition for the breakpoint

Implementation Reference

  • The actual handler for the 'setBreakpoint' tool. It extracts file, line, and condition arguments, sends a 'CreateBreakpoint' command to Delve via the session, creates a Breakpoint object, stores it in the session's breakpoints map, and returns a success message.
    case "setBreakpoint": {
      const { file, line, condition } = args;
      const response = await sendDelveCommand(session, "CreateBreakpoint", {
        file,
        line,
        cond: condition
      });
    
      const bp: Breakpoint = {
        id: response.id,
        file,
        line,
        condition
      };
      session.breakpoints.set(bp.id, bp);
    
      return {
        content: [{
          type: "text",
          text: `Set breakpoint ${bp.id} at ${file}:${line}`
        }]
      };
    }
  • src/server.ts:136-397 (registration)
    Tool registration in ListToolsRequestSchema. Defines the 'setBreakpoint' tool with its name, description, and inputSchema (sessionId, file, line required; condition optional).
          // Control tools
          {
            name: "setBreakpoint",
            description: "Set a breakpoint in the debugged program",
            inputSchema: {
              type: "object",
              properties: {
                sessionId: {
                  type: "string",
                  description: "ID of the debug session"
                },
                file: {
                  type: "string",
                  description: "File path where to set the breakpoint"
                },
                line: {
                  type: "number",
                  description: "Line number for the breakpoint"
                },
                condition: {
                  type: "string",
                  description: "Optional condition for the breakpoint"
                }
              },
              required: ["sessionId", "file", "line"]
            }
          },
          {
            name: "removeBreakpoint",
            description: "Remove a breakpoint",
            inputSchema: {
              type: "object",
              properties: {
                sessionId: {
                  type: "string",
                  description: "ID of the debug session"
                },
                breakpointId: {
                  type: "number",
                  description: "ID of the breakpoint to remove"
                }
              },
              required: ["sessionId", "breakpointId"]
            }
          },
          {
            name: "continue",
            description: "Continue program execution",
            inputSchema: {
              type: "object",
              properties: {
                sessionId: {
                  type: "string",
                  description: "ID of the debug session"
                }
              },
              required: ["sessionId"]
            }
          },
          {
            name: "next",
            description: "Step over to next line",
            inputSchema: {
              type: "object",
              properties: {
                sessionId: {
                  type: "string",
                  description: "ID of the debug session"
                }
              },
              required: ["sessionId"]
            }
          },
          {
            name: "step",
            description: "Step into function call",
            inputSchema: {
              type: "object",
              properties: {
                sessionId: {
                  type: "string",
                  description: "ID of the debug session"
                }
              },
              required: ["sessionId"]
            }
          },
          {
            name: "stepout",
            description: "Step out of current function",
            inputSchema: {
              type: "object",
              properties: {
                sessionId: {
                  type: "string",
                  description: "ID of the debug session"
                }
              },
              required: ["sessionId"]
            }
          },
          {
            name: "variables",
            description: "List local variables in current scope",
            inputSchema: {
              type: "object",
              properties: {
                sessionId: {
                  type: "string",
                  description: "ID of the debug session"
                }
              },
              required: ["sessionId"]
            }
          },
          {
            name: "evaluate",
            description: "Evaluate an expression in current scope",
            inputSchema: {
              type: "object",
              properties: {
                sessionId: {
                  type: "string",
                  description: "ID of the debug session"
                },
                expr: {
                  type: "string", 
                  description: "Expression to evaluate"
                }
              },
              required: ["sessionId", "expr"]
            }
          },
          // Advanced debug tools
          {
            name: "core",
            description: "Examine a core dump",
            inputSchema: {
              type: "object",
              properties: {
                executable: {
                  type: "string",
                  description: "Path to the executable that produced the core dump"
                },
                corePath: {
                  type: "string",
                  description: "Path to the core dump file"
                }
              },
              required: ["executable", "corePath"]
            }
          },
          {
            name: "dap",
            description: "Start a DAP (Debug Adapter Protocol) server",
            inputSchema: {
              type: "object",
              properties: {
                clientAddr: {
                  type: "string",
                  description: "Optional address where DAP client is waiting for connection"
                }
              }
            }
          },
          {
            name: "replay",
            description: "Replay an rr trace",
            inputSchema: {
              type: "object",
              properties: {
                tracePath: {
                  type: "string",
                  description: "Path to the rr trace directory"
                },
                onProcess: {
                  type: "number",
                  description: "Optional PID to pass to rr"
                }
              },
              required: ["tracePath"]
            }
          },
          {
            name: "trace",
            description: "Trace program execution",
            inputSchema: {
              type: "object",
              properties: {
                regexp: {
                  type: "string",
                  description: "Regular expression to match functions to trace"
                },
                pkg: {
                  type: "string",
                  description: "Package to trace (defaults to .)"
                },
                ebpf: {
                  type: "boolean",
                  description: "Use eBPF for tracing (experimental)"
                },
                stack: {
                  type: "number",
                  description: "Show stack trace with given depth"
                },
                pid: {
                  type: "number",
                  description: "Pid to attach to"
                }
              },
              required: ["regexp"]
            }
          },
          // Configuration tools
          {
            name: "version",
            description: "Get Delve version information",
            inputSchema: {
              type: "object",
              properties: {}
            }
          },
          {
            name: "setBackend",
            description: "Set the backend for debugging",
            inputSchema: {
              type: "object",
              properties: {
                backend: {
                  type: "string",
                  description: "Backend to use (default, native, lldb, or rr)",
                  enum: ["default", "native", "lldb", "rr"]
                }
              },
              required: ["backend"]
            }
          },
          {
            name: "configureLogging",
            description: "Configure debug logging",
            inputSchema: {
              type: "object",
              properties: {
                components: {
                  type: "array",
                  items: {
                    type: "string",
                    enum: ["debugger", "gdbwire", "lldbout", "debuglineerr", "rpc", "dap", "fncall", "minidump", "stack"]
                  },
                  description: "Components to enable logging for"
                },
                destination: {
                  type: "string",
                  description: "Log destination (file path or file descriptor)"
                }
              },
              required: ["components"]
            }
          }
        ]
      };
    });
  • src/server.ts:399-421 (registration)
    CallToolRequestSchema handler that routes 'setBreakpoint' to handleControlCommands along with other control commands.
    /**
     * Handler for debug tools
     */
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args } = request.params;
    
      // Debug commands
      if (["debug", "attach", "exec", "test", "core", "dap", "replay", "trace"].includes(name)) {
        return handleDebugCommands(name, args);
      }
    
      // Control commands
      if (["setBreakpoint", "removeBreakpoint", "continue", "next", "step", "stepout", "variables", "evaluate"].includes(name)) {
        return handleControlCommands(name, args);
      }
    
      // Configuration commands
      if (["setBackend", "configureLogging", "version"].includes(name)) {
        return handleConfigCommands(name, args);
      }
    
      throw new Error("Unknown tool");
    });
  • Breakpoint type definition used by the setBreakpoint handler. Defines id, file, line, and optional condition fields.
    export interface Breakpoint {
      id: number;
      file: string;
      line: number;
      condition?: string;
    }
  • The sendDelveCommand helper function used by the setBreakpoint handler to send the 'CreateBreakpoint' API command to the Delve debugger session.
    export async function sendDelveCommand(session: DebugSession, command: string, args: any = {}): Promise<any> {
      const { stdout } = await exec(`curl -s -X POST http://localhost:${session.port}/api/v2/${command} -d '${JSON.stringify(args)}'`);
      return JSON.parse(stdout);
    }
Behavior2/5

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

No annotations provided, and the description fails to disclose behavioral traits such as whether execution halts, if multiple breakpoints are allowed, or error handling. The description carries the full burden but is too minimal.

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?

Single sentence, front-loaded with the purpose, no wasted words. Extremely concise.

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?

For a debugging tool with no output schema and complex behavior (e.g., interaction with other debug commands), the description is too sparse. It lacks context on what happens after setting a breakpoint or return values.

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?

Input schema has 100% coverage with descriptions for all 4 parameters. The description adds no additional meaning beyond the schema, so baseline of 3 is appropriate.

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

Purpose5/5

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

The description clearly states 'Set a breakpoint in the debugged program' with a specific verb and resource. It distinguishes from sibling tools like removeBreakpoint or continue.

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

Usage Guidelines3/5

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

No guidance on when to use this tool versus alternatives (e.g., when to set vs. remove breakpoints, or step). Usage is implied but not explicitly stated.

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

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/dwisiswant0/delve-mcp'

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