Skip to main content
Glama
workbackai

MCP NodeJS Debugger

by workbackai

get_location

Retrieves the current execution point when debugging is paused in a NodeJS server, showing where code execution has stopped for inspection.

Instructions

Gets the current execution location when paused

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'get_location' tool. It checks if the debugger is paused, retrieves the current call frame location, builds the call stack, fetches surrounding source code for context, and returns this information as JSON.
      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}`
            }]
          };
        }
      }
    );
  • Registration of the 'get_location' tool with server.tool, including name, description, empty input schema, and inline handler function.
    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}`
            }]
          };
        }
      }
    );
  • Empty input schema for the 'get_location' tool (no parameters required).
    {},
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states the tool's action but lacks behavioral details such as whether this is a read-only operation, what format the location is returned in, or any limitations (e.g., only works in specific debugging modes). The description is minimal and doesn't compensate for the absence of annotations.

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, efficient sentence that front-loads the core purpose without any wasted words. It's appropriately sized for a simple tool with no parameters.

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 simplicity (0 parameters, no output schema, no annotations), the description is adequate but minimal. It covers the basic purpose and context but lacks details on return values or behavioral traits, which could be helpful for an agent in a debugging scenario.

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?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description doesn't add parameter details, but this is appropriate given the lack of parameters. A baseline of 4 is applied since the schema fully covers the parameter semantics.

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 tool's purpose with a specific verb ('Gets') and resource ('current execution location'), and specifies the context ('when paused'). It doesn't explicitly differentiate from siblings like 'inspect_variables' or 'get_console_output', but the focus on execution location is reasonably distinct.

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 usage context ('when paused'), suggesting this tool is for debugging scenarios where execution is halted. However, it doesn't provide explicit guidance on when to use this versus alternatives like 'inspect_variables' or 'step_into', nor does it mention prerequisites or exclusions.

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