Skip to main content
Glama
workbackai

MCP NodeJS Debugger

by workbackai

get_console_output

Retrieve the most recent console output from a Node.js process being debugged, with an option to limit the number of entries returned.

Instructions

Gets the most recent console output from the debugged process

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of console entries to return. Defaults to 20

Implementation Reference

  • Registration of the 'get_console_output' tool on the MCP server with a 'limit' parameter (default 20)
    // Add a tool specifically for getting console output
    server.tool(
      "get_console_output",
      "Gets the most recent console output from the debugged process",
      {
        limit: z.number().optional().describe("Maximum number of console entries to return. Defaults to 20")
      },
      async ({ limit = 20 }) => {
        try {
          if (!inspector.consoleOutput || inspector.consoleOutput.length === 0) {
            return {
              content: [{
                type: "text",
                text: "No console output captured yet"
              }]
            };
          }
    
          // Get the most recent console output entries
          const recentOutput = inspector.consoleOutput.slice(-limit);
          const formattedOutput = recentOutput.map(output => {
            const timestamp = new Date(output.timestamp).toISOString();
            return `[${timestamp}] [${output.type}] ${output.message}`;
          }).join('\n');
    
          return {
            content: [{
              type: "text",
              text: `Console output (most recent ${recentOutput.length} entries):\n\n${formattedOutput}`
            }]
          };
        } catch (err) {
          return {
            content: [{
              type: "text",
              text: `Error getting console output: ${err.message}`
            }]
          };
        }
      }
    );
  • Handler function that retrieves the most recent console output entries from inspector.consoleOutput, formats them with timestamps and types, and returns them as text
    async ({ limit = 20 }) => {
      try {
        if (!inspector.consoleOutput || inspector.consoleOutput.length === 0) {
          return {
            content: [{
              type: "text",
              text: "No console output captured yet"
            }]
          };
        }
    
        // Get the most recent console output entries
        const recentOutput = inspector.consoleOutput.slice(-limit);
        const formattedOutput = recentOutput.map(output => {
          const timestamp = new Date(output.timestamp).toISOString();
          return `[${timestamp}] [${output.type}] ${output.message}`;
        }).join('\n');
    
        return {
          content: [{
            type: "text",
            text: `Console output (most recent ${recentOutput.length} entries):\n\n${formattedOutput}`
          }]
        };
      } catch (err) {
        return {
          content: [{
            type: "text",
            text: `Error getting console output: ${err.message}`
          }]
        };
      }
    }
  • Input schema for the tool: optional 'limit' parameter (number, defaults to 20) defining max console entries to return
    {
      limit: z.number().optional().describe("Maximum number of console entries to return. Defaults to 20")
  • Console log capture in Inspector.handleEvent - stores Runtime.consoleAPICalled events into inspector.consoleOutput array (keeps last 100 entries)
    // Store console logs to make them available to the MCP tools
    if (!this.consoleOutput) {
    	this.consoleOutput = [];
    }
    this.consoleOutput.push({
    	type: event.params.type,
    	message: args,
    	timestamp: Date.now(),
    	raw: event.params.args
    });
    
    // Keep only the last 100 console messages to avoid memory issues
    if (this.consoleOutput.length > 100) {
    	this.consoleOutput.shift();
    }
  • Initialization of the consoleOutput array on the inspector instance
    inspector.consoleOutput = [];
Behavior2/5

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

Without annotations, the description must disclose behavior. It does not state whether the operation is read-only, whether it affects console state, or whether it requires the process to be stopped. The meaning of 'most recent' is ambiguous—does it clear the output? It also doesn't specify return format.

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 sentence with no superfluous words. It is front-loaded and efficient, earning its place.

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 that there is no output schema and no annotations, the description is too brief. It fails to explain the output format (e.g., is it a list of strings? JSON?). It also doesn't mention prerequisites (e.g., must have a debugged process). The tool is simple but still leaves gaps.

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?

The input schema has 100% coverage for the single optional parameter 'limit', which is described in the schema. The description does not add any further meaning to the parameter beyond what is already in the schema, so it meets the baseline expectation.

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 it gets the most recent console output from the debugged process, which is a specific verb+resource. It distinguishes from sibling tools like continue or evaluate, which are for control flow or expression evaluation.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. For example, it doesn't clarify that this is for retrieving log output, while 'inspect_variables' is for watching variables, or that it might require the process to be paused.

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