Skip to main content
Glama
azharlabs
by azharlabs

read_notebook_with_outputs

Read Jupyter notebooks with cell outputs to review code execution results and analysis data from .ipynb files.

Instructions

Read a Jupyter notebook including cell outputs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
notebook_pathYesAbsolute path to the Jupyter notebook file

Implementation Reference

  • The main handler function that reads the Jupyter notebook file, processes each cell to include source code and any outputs (handling streams, results, images, errors), formats into readable text separated by cells, and returns as MCP tool response content.
    async readNotebookWithOutputs(notebookPath) {
      const notebook = await this.readNotebook(notebookPath);
      
      const cellsContent = notebook.cells.map((cell, index) => {
        const source = Array.isArray(cell.source) ? cell.source.join('') : cell.source;
        let content = `Cell with ID: ${cell.id || index}\n${source}`;
        
        // Add outputs if it's a code cell with outputs
        if (cell.cell_type === 'code' && cell.outputs && cell.outputs.length > 0) {
          content += '\nOutput of cell ' + (cell.id || index) + ':';
          
          for (const output of cell.outputs) {
            if (output.output_type === 'stream') {
              const text = Array.isArray(output.text) ? output.text.join('') : output.text;
              content += '\n' + text;
            } else if (output.output_type === 'execute_result' || output.output_type === 'display_data') {
              if (output.data) {
                if (output.data['text/plain']) {
                  const text = Array.isArray(output.data['text/plain']) 
                    ? output.data['text/plain'].join('')
                    : output.data['text/plain'];
                  content += '\n' + text;
                }
                if (output.data['image/png']) {
                  content += '\n[Image output available]';
                }
              }
            } else if (output.output_type === 'error') {
              content += '\nError: ' + output.ename + ': ' + output.evalue;
            }
          }
        }
        
        return content;
      });
    
      return {
        content: [
          {
            type: "text",
            text: cellsContent.join('\n\n')
          }
        ]
      };
    }
  • The tool schema definition specifying the name, description, and input schema requiring 'notebook_path' as a string.
    {
      name: "read_notebook_with_outputs",
      description: "Read a Jupyter notebook including cell outputs",
      inputSchema: {
        type: "object",
        properties: {
          notebook_path: {
            type: "string",
            description: "Absolute path to the Jupyter notebook file"
          }
        },
        required: ["notebook_path"]
      }
    },
  • src/index.js:375-376 (registration)
    The registration case in the main tool request handler switch statement that routes calls to this tool to the jupyterHandler's readNotebookWithOutputs method.
    case "read_notebook_with_outputs":
      return await this.jupyterHandler.readNotebookWithOutputs(args.notebook_path);
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 mentions reading 'including cell outputs,' which implies it returns more than just source code, but it doesn't disclose critical behaviors: whether it's read-only (implied but not stated), what format the output is in (e.g., JSON, raw text), error handling, or performance considerations. For a tool with no annotations, this is insufficient.

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 directly states the tool's function. It's front-loaded with the core action and includes the key detail about cell outputs. There's no wasted verbiage or redundancy, making it highly concise and well-structured.

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 no annotations and no output schema, the description is incomplete. It doesn't explain what 'read' entails (e.g., returns notebook content as structured data), how outputs are handled, or potential errors. For a tool that likely returns complex notebook data, more context is needed to guide an agent effectively.

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% description coverage, with 'notebook_path' clearly documented as an absolute path. The description adds no additional parameter semantics beyond what the schema provides. Since schema coverage is high, the baseline score is 3, as the description doesn't compensate but also doesn't detract.

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 verb ('Read') and resource ('a Jupyter notebook'), specifying that it includes cell outputs. However, it doesn't explicitly differentiate from siblings like 'get_cell_source' (which might read only source code) or 'list_cells' (which might list metadata). The purpose is clear but lacks sibling differentiation.

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?

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'get_cell_source' (which might read only source) and 'list_cells' (which might list metadata), there's no indication of when this tool is preferred or what its specific use cases are. No exclusions or prerequisites are mentioned.

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/azharlabs/mcp-jupyter-server'

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