Skip to main content
Glama

notebook_as_script

Read-only

Convert a Jupyter notebook into a single Python script string with # %% cell markers for analysis, diffing, or programmatic use.

Instructions

Return the entire notebook as a single Python script string.

Each cell is preceded by a # %% marker (the convention used by VSCode, Spyder, and nbconvert) so the script can be analysed, diffed, or reasoned about as a complete program.

  • Code cells: source pasted verbatim under their marker.

  • Markdown cells: each line prefixed with "# " under their marker. Omitted entirely when include_markdown=False.

  • Raw cells: always skipped.

The script is returned in the response; no file is written to disk.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
include_markdownNo
Behavior5/5

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

Annotations already declare readOnlyHint=true. The description adds detailed behavior: each cell preceded by # %%, markdown cells prefixed with '# ', raw cells skipped, and no file written. Fully discloses behavior beyond annotations without contradiction.

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?

The description is reasonably concise and well-structured with bullet points, though slightly verbose in explaining the marker format. It front-loads the core purpose and uses clear sections.

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

Completeness5/5

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

Given the simple tool (2 parameters, no output schema), the description fully covers all relevant aspects: input parameters, behavior for each cell type, return format, and side-effect statement. No gaps remain.

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?

With 0% schema description coverage, the description compensates by explaining include_markdown's effect. However, the 'name' parameter is not explicitly defined beyond context; the description could be clearer about its role (e.g., notebook identifier). Good but not perfect.

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 tool returns the entire notebook as a Python script string, detailing the format with # %% markers and handling of code, markdown, and raw cells. This distinct purpose differentiates it from siblings like notebook_get or cell_execute.

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?

The description explains when to use the tool for analysis, diffing, or reasoning, and that no file is written. It implicitly contrasts with execution or other retrieval tools, but lacks explicit 'do not use if' statements.

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/Try3D/JupyterMCP'

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