Skip to main content
Glama
block

Jupyter MCP Server

by block

execute_notebook_code

Execute code cells or install packages in a Jupyter notebook. Requires prior notebook setup to specify the server URL.

Instructions

Execute code in a Jupyter notebook on the user-provided server.

This consolidates all code execution operations into a single tool following MCP best practices.

IMPORTANT: Server URL Configuration

This tool requires that you first call setup_notebook with the correct server URL:

Required setup: setup_notebook("my_notebook", server_url="http://localhost:9999")

Then you can use this tool: execute_notebook_code("my_notebook", "execute_cell", position_index=0)

Without setup_notebook, this will try to connect to http://localhost:8888 by default.

Args: notebook_path: Path to the notebook file (.ipynb extension will be added if missing), relative to the Jupyter server root. execution_type: Type of execution operation. Options: - 'execute_cell': Execute an existing code cell - 'install_packages': Install packages using uv pip in the notebook environment position_index: (For execute_cell) Positional index of cell to execute package_names: (For install_packages) Space-separated list of package names to install

Returns

Union[dict, str]:
    - execute_cell: dict with execution_count, outputs, status
    - install_packages: str with installation result message

Raises

ValueError: If invalid execution_type or missing required parameters
McpError: If there's an error connecting to the Jupyter server
IndexError: If position_index is out of range
RuntimeError: If kernel execution fails

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
notebook_pathYes
execution_typeYes
position_indexNo
package_namesNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

With no annotations, the description covers setup dependency, default URL, execution types, return types, and errors. However, it does not disclose side effects (modifying notebook state) or safety considerations (e.g., code execution risks). Good but not fully comprehensive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well-structured with sections for setup, args, returns, raises. Front-loaded with purpose. Example code block is helpful. Minor bloat: redundant 'MCP best practices' line and repeated text. Still efficient for the complexity.

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?

Covers all parameters, returns, errors, and setup dependency. Output schema exists, so return details not required. Lacks explanation of invalid notebook_path handling or deeper return structure usage. Adequate for a tool with moderate complexity.

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

Parameters5/5

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

Schema coverage is 0%, so description compensates fully. Explains notebook_path with .ipynb addition, execution_type with two named options, position_index for execute_cell, and package_names for install_packages. Adds critical meaning beyond types and defaults.

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?

Clearly states 'Execute code in a Jupyter notebook on the user-provided server.' Differentiates from sibling tools (modify_notebook_cells, query_notebook, setup_notebook) by focusing on execution operations. Consolidates all execution types into one tool.

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?

Provides explicit setup requirement (must call setup_notebook first) and describes default behavior. Lists two execution types with corresponding parameters. Lacks explicit alternatives (e.g., when to use modify_notebook_cells instead), but the context is strong enough for an agent to infer.

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

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