Extensions
This module contains optional extensions for InstrMCP.
Database Extension
Database Resources
Query Tools
Key Functions
list_experiments
get_dataset_info
get_database_stats
MeasureIt Extension
MeasureIt Templates
Template Functions
get_sweep0d_template
get_sweep1d_template
get_sweep2d_template
get_simulsweep_template
get_sweepqueue_template
get_common_patterns
get_all_examples
JupyterLab Extension
The JupyterLab extension is implemented in TypeScript and provides:
Active cell content bridging
Cell execution
Cell manipulation
Cursor movement
Source location: instrmcp/extensions/jupyterlab/src/index.ts
Key Components
Extension Activation
The extension is activated when JupyterLab loads and registers:
Comm message handlers
Cell operation handlers
Response message handlers
Comm Protocol
Messages sent from Python kernel to frontend:
get_cell: Request current cell contentupdate_cell: Update cell contentexecute_cell: Execute cell codeadd_cell: Add new celldelete_cell: Delete cellapply_patch: Apply text patchmove_cursor: Change active cell
Response messages from frontend to kernel:
cell_data: Cell content responseupdate_response: Update confirmationexecute_response: Execution confirmationadd_cell_response: Addition confirmationdelete_cell_response: Deletion confirmationapply_patch_response: Patch confirmationmove_cursor_response: Cursor movement confirmation
Building the Extension
cd instrmcp/extensions/jupyterlab
jlpm run build
The build process:
Compiles TypeScript to JavaScript
Bundles with webpack
Copies files to labextension directory
Updates package.json with build metadata
See Jupyter Integration for more details on the extension architecture.