Skip to content

Commit 23b7ef4

Browse files
d0nghyunclaude
andauthored
Fix duplicate kernel creation bug in use_notebook tool (#162)
Fixed a bug where kernel_id variable was not being updated after creating a new kernel in JUPYTER_SERVER mode. This caused create_session() to receive None as kernel_id, which resulted in creating a second kernel while the first kernel remained unused. The fix ensures that when a new kernel is created via _start_kernel_local(), the kernel_id variable is properly assigned from the returned kernel dictionary. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
1 parent 35c6323 commit 23b7ef4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

jupyter_mcp_server/tools/use_notebook_tool.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ async def execute(
213213
kernel = {"id": kernel_id}
214214
else:
215215
kernel = await self._start_kernel_local(kernel_manager)
216-
216+
kernel_id = kernel['id']
217+
217218
info_list.append(f"[INFO] Connected to kernel '{kernel_id}'.")
218219
# Create a Jupyter session to associate the kernel with the notebook
219220
# This is CRITICAL for JupyterLab to recognize the kernel-notebook connection

0 commit comments

Comments
 (0)