Mandala
Tools

Jupyter

Manage files, notebooks, kernels, and sessions on a Jupyter server

Usage Instructions

Integrate a self-hosted Jupyter server into the workflow. Browse, read, create, upload, rename, copy, and delete files and notebooks; start, stop, restart, and interrupt kernels; and manage sessions that bind notebooks to kernels.

Tools

jupyter_list_contents

List files, notebooks, and subdirectories at a path on a Jupyter server

Input

ParameterTypeRequiredDescription
serverUrlstringYesBase URL of the Jupyter server (e.g. http://localhost:8888\)
tokenstringYesJupyter server authentication token
pathstringNoDirectory path to list, relative to the server root. Leave blank for root.

Output

ParameterTypeDescription
itemsarrayDirectory entries at the requested path
pathstringThe listed directory path

jupyter_get_content

Read a file or notebook from a Jupyter server

Input

ParameterTypeRequiredDescription
serverUrlstringYesBase URL of the Jupyter server (e.g. http://localhost:8888\)
tokenstringYesJupyter server authentication token
pathstringYesPath of the file or notebook to read, relative to the server root

Output

ParameterTypeDescription
namestringFile or notebook name
pathstringPath relative to the server root
mimetypestringMIME type of the content
textstringText content, for text files and notebooks (JSON-stringified)
filefileBinary content stored as a file, for base64-format content

jupyter_create_file

Create a file, notebook, or directory on a Jupyter server

Input

ParameterTypeRequiredDescription
serverUrlstringYesBase URL of the Jupyter server (e.g. http://localhost:8888\)
tokenstringYesJupyter server authentication token
pathstringYesPath to create, relative to the server root
typestringYesType of entry to create: file, notebook, or directory
contentstringNoContent to write. For a file, plain text. For a notebook, a JSON-stringified nbformat document (defaults to an empty notebook). Ignored for directories.

Output

ParameterTypeDescription
namestringCreated entry name
pathstringCreated entry path
typestringdirectory, file, or notebook
createdAtstringCreation timestamp
lastModifiedstringLast modified timestamp

jupyter_upload_file

Upload a file to a Jupyter server

Input

ParameterTypeRequiredDescription
serverUrlstringYesBase URL of the Jupyter server (e.g. http://localhost:8888\)
tokenstringYesJupyter server authentication token
directorystringNoDestination directory, relative to the server root. Leave blank to upload to the root directory.
filefileNoThe file to upload (UserFile object)
fileNamestringNoOptional filename override

Output

ParameterTypeDescription
namestringUploaded file name
pathstringUploaded file path
sizenumberFile size in bytes
lastModifiedstringLast modified timestamp

jupyter_rename_content

Rename or move a file, notebook, or directory on a Jupyter server

Input

ParameterTypeRequiredDescription
serverUrlstringYesBase URL of the Jupyter server (e.g. http://localhost:8888\)
tokenstringYesJupyter server authentication token
pathstringYesCurrent path of the entry, relative to the server root
newPathstringYesNew path for the entry, relative to the server root

Output

ParameterTypeDescription
namestringNew entry name
pathstringNew entry path
lastModifiedstringLast modified timestamp

jupyter_delete_content

Delete a file, notebook, or directory on a Jupyter server

Input

ParameterTypeRequiredDescription
serverUrlstringYesBase URL of the Jupyter server (e.g. http://localhost:8888\)
tokenstringYesJupyter server authentication token
pathstringYesPath of the entry to delete, relative to the server root

Output

ParameterTypeDescription
successbooleanWhether the entry was deleted
pathstringDeleted entry path

jupyter_copy_content

Duplicate a file or notebook into a directory on a Jupyter server

Input

ParameterTypeRequiredDescription
serverUrlstringYesBase URL of the Jupyter server (e.g. http://localhost:8888\)
tokenstringYesJupyter server authentication token
pathstringYesDestination directory path, relative to the server root
copyFromPathstringYesPath of the file or notebook to copy, relative to the server root

Output

ParameterTypeDescription
namestringName of the copied entry
pathstringPath of the copied entry
createdAtstringCreation timestamp

jupyter_list_kernels

List running kernels on a Jupyter server

Input

ParameterTypeRequiredDescription
serverUrlstringYesBase URL of the Jupyter server (e.g. http://localhost:8888\)
tokenstringYesJupyter server authentication token

Output

ParameterTypeDescription
kernelsarrayRunning kernels

jupyter_start_kernel

Start a new kernel on a Jupyter server

Input

ParameterTypeRequiredDescription
serverUrlstringYesBase URL of the Jupyter server (e.g. http://localhost:8888\)
tokenstringYesJupyter server authentication token
kernelNamestringNoKernel spec name to start (e.g. python3). Defaults to the server default.

Output

ParameterTypeDescription
idstringKernel ID
namestringKernel spec name
lastActivitystringLast activity timestamp
executionStatestringKernel execution state
connectionsnumberActive connection count

jupyter_stop_kernel

Shut down a running kernel on a Jupyter server

Input

ParameterTypeRequiredDescription
serverUrlstringYesBase URL of the Jupyter server (e.g. http://localhost:8888\)
tokenstringYesJupyter server authentication token
kernelIdstringYesID of the kernel to shut down

Output

ParameterTypeDescription
successbooleanWhether the kernel was shut down
kernelIdstringShut down kernel ID

jupyter_restart_kernel

Restart a running kernel on a Jupyter server

Input

ParameterTypeRequiredDescription
serverUrlstringYesBase URL of the Jupyter server (e.g. http://localhost:8888\)
tokenstringYesJupyter server authentication token
kernelIdstringYesID of the kernel to restart

Output

ParameterTypeDescription
idstringKernel ID
namestringKernel spec name
lastActivitystringLast activity timestamp
executionStatestringKernel execution state
connectionsnumberActive connection count

jupyter_interrupt_kernel

Interrupt a running kernel on a Jupyter server

Input

ParameterTypeRequiredDescription
serverUrlstringYesBase URL of the Jupyter server (e.g. http://localhost:8888\)
tokenstringYesJupyter server authentication token
kernelIdstringYesID of the kernel to interrupt

Output

ParameterTypeDescription
successbooleanWhether the interrupt was sent
kernelIdstringInterrupted kernel ID

jupyter_list_kernelspecs

List available kernel specs (languages/runtimes) on a Jupyter server

Input

ParameterTypeRequiredDescription
serverUrlstringYesBase URL of the Jupyter server (e.g. http://localhost:8888\)
tokenstringYesJupyter server authentication token

Output

ParameterTypeDescription
defaultKernelNamestringDefault kernel spec name
kernelspecsarrayAvailable kernel specs

jupyter_list_sessions

List active sessions (notebook-to-kernel bindings) on a Jupyter server

Input

ParameterTypeRequiredDescription
serverUrlstringYesBase URL of the Jupyter server (e.g. http://localhost:8888\)
tokenstringYesJupyter server authentication token

Output

ParameterTypeDescription
sessionsarrayActive sessions

jupyter_create_session

Create a session that binds a notebook path to a (new or existing) kernel

Input

ParameterTypeRequiredDescription
serverUrlstringYesBase URL of the Jupyter server (e.g. http://localhost:8888\)
tokenstringYesJupyter server authentication token
pathstringYesNotebook path to bind the session to, relative to the server root
kernelNamestringNoKernel spec name to start for this session (e.g. python3)
namestringNoOptional session name
typestringNoSession type, defaults to 'notebook'

Output

ParameterTypeDescription
idstringSession ID
pathstringNotebook path bound to this session
namestringSession name
typestringSession type
kernelobjectKernel bound to this session

jupyter_delete_session

Delete a session on a Jupyter server (does not shut down its kernel)

Input

ParameterTypeRequiredDescription
serverUrlstringYesBase URL of the Jupyter server (e.g. http://localhost:8888\)
tokenstringYesJupyter server authentication token
sessionIdstringYesID of the session to delete

Output

ParameterTypeDescription
successbooleanWhether the session was deleted
sessionIdstringDeleted session ID

Notes

  • Category: tools
  • Type: jupyter
Jupyter