Skip to main content
Glama
workbackai

MCP NodeJS Debugger

by workbackai

get_location

Obtain the current execution location when the NodeJS debugger is paused, helping developers understand exactly where the code stopped.

Instructions

Gets the current execution location when paused

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Tool registration for 'get_location' on line 1010 using server.tool(), with empty schema on line 1013.
    // Get current location tool
    server.tool(
      "get_location",
      "Gets the current execution location when paused",
      {},
      async () => {
        try {
          // Ensure debugger is enabled
          if (!inspector.debuggerEnabled) {
            await inspector.enableDebugger();
          }
          
          if (!inspector.paused || inspector.currentCallFrames.length === 0) {
            return {
              content: [{
                type: "text",
                text: "Debugger is not paused at a breakpoint"
              }]
            };
          }
          
          const frame = inspector.currentCallFrames[0];
          const { url, lineNumber, columnNumber } = frame.location;
          
          // Get call stack
          const callstack = inspector.currentCallFrames.map(frame => {
            return {
              functionName: frame.functionName || '(anonymous)',
              url: frame.url,
              lineNumber: frame.location.lineNumber + 1,
              columnNumber: frame.location.columnNumber
            };
          });
          
          // Get source code for context
          let sourceContext = '';
          try {
            const scriptSource = await inspector.getScriptSource(frame.location.scriptId);
            if (scriptSource) {
              const lines = scriptSource.split('\n');
              const startLine = Math.max(0, lineNumber - 3);
              const endLine = Math.min(lines.length - 1, lineNumber + 3);
              
              for (let i = startLine; i <= endLine; i++) {
                const prefix = i === lineNumber ? '> ' : '  ';
                sourceContext += `${prefix}${i + 1}: ${lines[i]}\n`;
              }
            }
          } catch (err) {
            sourceContext = 'Unable to retrieve source code';
          }
          
          return {
            content: [{
              type: "text",
              text: JSON.stringify({
                url,
                lineNumber: lineNumber + 1,
                columnNumber,
                callstack,
                sourceContext
              }, null, 2)
            }]
          };
        } catch (err) {
          return {
            content: [{
              type: "text",
              text: `Error getting location: ${err.message}`
            }]
          };
        }
      }
    );
  • Handler function that gets current execution location when paused - reads call frame location, builds callstack, retrieves source context, and returns JSON with url, lineNumber, columnNumber, callstack, and sourceContext.
    async () => {
      try {
        // Ensure debugger is enabled
        if (!inspector.debuggerEnabled) {
          await inspector.enableDebugger();
        }
        
        if (!inspector.paused || inspector.currentCallFrames.length === 0) {
          return {
            content: [{
              type: "text",
              text: "Debugger is not paused at a breakpoint"
            }]
          };
        }
        
        const frame = inspector.currentCallFrames[0];
        const { url, lineNumber, columnNumber } = frame.location;
        
        // Get call stack
        const callstack = inspector.currentCallFrames.map(frame => {
          return {
            functionName: frame.functionName || '(anonymous)',
            url: frame.url,
            lineNumber: frame.location.lineNumber + 1,
            columnNumber: frame.location.columnNumber
          };
        });
        
        // Get source code for context
        let sourceContext = '';
        try {
          const scriptSource = await inspector.getScriptSource(frame.location.scriptId);
          if (scriptSource) {
            const lines = scriptSource.split('\n');
            const startLine = Math.max(0, lineNumber - 3);
            const endLine = Math.min(lines.length - 1, lineNumber + 3);
            
            for (let i = startLine; i <= endLine; i++) {
              const prefix = i === lineNumber ? '> ' : '  ';
              sourceContext += `${prefix}${i + 1}: ${lines[i]}\n`;
            }
          }
        } catch (err) {
          sourceContext = 'Unable to retrieve source code';
        }
        
        return {
          content: [{
            type: "text",
            text: JSON.stringify({
              url,
              lineNumber: lineNumber + 1,
              columnNumber,
              callstack,
              sourceContext
            }, null, 2)
          }]
        };
      } catch (err) {
        return {
          content: [{
            type: "text",
            text: `Error getting location: ${err.message}`
          }]
        };
      }
    }
  • Empty schema object (no parameters) for the get_location tool.
    {},
Behavior2/5

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

No annotations are provided, so the description carries full burden. It discloses the basic purpose but lacks details on side effects (none), permissions, failure modes, or what the location return value contains (e.g., file path, line number). Minimal behavioral disclosure.

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, 10 words, no redundant information. Front-loaded with the core action. Perfectly concise for this simple tool.

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

Completeness4/5

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

For a tool with no parameters and no output schema, the description provides the essential purpose. However, missing details on the return format (e.g., what constitutes a 'location') reduce completeness slightly. Overall adequate for low complexity.

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

Parameters4/5

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

No parameters exist, and schema coverage is 100%. The description adds nothing about parameters, but baseline for zero parameters is high (4). No additional semantics needed.

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 verb 'gets' and the resource 'current execution location when paused'. It distinguishes from sibling tools like continue or step_into, which are for execution control, while this is for querying state.

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?

The description implies use when paused, but does not explicitly state when to use versus alternatives (e.g., inspect_variables) or provide exclusions. Only implied usage context.

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/workbackai/mcp-nodejs-debugger'

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