Skip to main content
Glama
qckfx

Node.js Debugger MCP Server

by qckfx

set_breakpoint

Pause Node.js code execution at specific lines to inspect variables and debug issues by setting conditional or unconditional breakpoints in files.

Instructions

Set a breakpoint in the debugged process. Use full file:// URLs for reliable breakpoint hits.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYesFile URL or path (use file:///absolute/path/to/file.js for best results)
lineYesLine number (1-based)
conditionNoOptional condition for the breakpoint

Implementation Reference

  • The handler function for the 'set_breakpoint' tool. It checks for an active debug session, then uses the Chrome DevTools Protocol (CDP) Debugger.setBreakpointByUrl to set a breakpoint at the specified file URL and line number (converting to 0-based), optionally with a condition. Stores the breakpoint ID and returns success or error.
    private async setBreakpoint(args: { file: string; line: number; condition?: string }) {
      if (!this.debugSession.connected || !this.debugSession.client) {
        return {
          content: [
            {
              type: "text",
              text: "No active debug session. Please attach debugger first.",
            },
          ],
          isError: true,
        };
      }
    
      try {
        const { Debugger } = this.debugSession.client;
        
        // Use CDP to set the breakpoint
        const result = await Debugger.setBreakpointByUrl({
          lineNumber: args.line - 1, // CDP uses 0-based line numbers
          url: args.file,
          condition: args.condition
        });
    
        if (result.breakpointId) {
          // Store the breakpoint mapping
          const breakpointKey = `${args.file}:${args.line}`;
          this.debugSession.breakpoints!.set(breakpointKey, result.breakpointId);
    
          return {
            content: [
              {
                type: "text",
                text: `Set breakpoint at ${args.file}:${args.line}${args.condition ? ` (condition: ${args.condition})` : ""} - ID: ${result.breakpointId}`,
              },
            ],
          };
        } else {
          return {
            content: [
              {
                type: "text", 
                text: `Failed to set breakpoint at ${args.file}:${args.line}`,
              },
            ],
            isError: true,
          };
        }
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error setting breakpoint: ${error}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Tool registration including name, description, and input schema definition for 'set_breakpoint'.
    {
      name: "set_breakpoint",
      description: "Set a breakpoint in the debugged process. Use full file:// URLs for reliable breakpoint hits.",
      inputSchema: {
        type: "object",
        properties: {
          file: { 
            type: "string", 
            description: "File URL or path (use file:///absolute/path/to/file.js for best results)" 
          },
          line: { type: "number", description: "Line number (1-based)" },
          condition: { type: "string", description: "Optional condition for the breakpoint" }
        },
        required: ["file", "line"],
      },
    },
  • src/index.ts:256-257 (registration)
    Registration of the tool handler dispatch in the CallToolRequest switch statement.
    case "set_breakpoint":
      return await this.setBreakpoint(args as { file: string; line: number; condition?: string });
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions that breakpoints are set 'in the debugged process' and advises on URL usage for reliability, but lacks details on permissions, side effects (e.g., whether it affects execution immediately), error handling, or what happens if the breakpoint already exists. This is a significant gap for a mutation tool with zero annotation coverage.

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—two sentences that are front-loaded with the core purpose and followed by practical advice. Every word earns its place, with no redundancy or unnecessary elaboration, making it efficient and easy to parse.

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

Completeness3/5

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

Given the tool's complexity (a mutation operation with 3 parameters) and the absence of both annotations and an output schema, the description is incomplete. It covers the basic purpose and usage tip but lacks critical behavioral details (e.g., effects, error cases) and return value information. However, the high schema coverage partially compensates for parameter documentation.

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%, so the schema already documents all three parameters (file, line, condition) thoroughly. The description adds minimal value by reinforcing the use of 'full file:// URLs' for the file parameter, but doesn't provide additional syntax, format details, or examples beyond what the schema specifies. 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.

Purpose5/5

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

The description clearly states the specific action ('Set a breakpoint') and target ('in the debugged process'), distinguishing it from sibling tools like 'pause_execution' or 'step_debug' that control execution flow rather than setting breakpoints. It provides a verb+resource combination that is precise and unambiguous.

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

Usage Guidelines4/5

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

The description includes guidance on when to use this tool ('Use full file:// URLs for reliable breakpoint hits'), which helps differentiate it from tools like 'evaluate_expression' or 'list_processes'. However, it doesn't explicitly state when not to use it or mention specific alternatives among siblings, such as using 'pause_execution' for immediate halting instead.

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/qckfx/node-debugger-mcp'

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