DigitalMicrograph MCP
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| DM_BRIDGE_HOST | No | The host of the DM bridge (default 127.0.0.1). | |
| DM_BRIDGE_PORT | No | The port of the DM bridge (default 8765). | |
| DM_MCP_TIMEOUT_MS | No | Timeout for MCP operations in milliseconds (e.g., 600000). | |
| DM_MCP_ALLOW_DMSCRIPT | No | Set to 0 to disable free script execution (default 0). |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| dm_statusA | 链路自检:桥接后端(digitalmicrograph/mock)、DM 版本、宿主 Python 与 numpy 版本、官方离线手册路径。DM 连接或原生操作出错时检查它;本地预览/报告依赖错误应检查 DM_ANALYSIS_PYTHON,不要因此重启 DM。 |
| dm_openB | 在 DigitalMicrograph 中打开本地数据文件(dm3/dm4 及其它 DM 支持的格式),返回该文档内的图像 id 列表。dm3/dm4 的采集元数据与标定会随文件一起载入。 |
| dm_datasetsA | 枚举当前 DM 中所有图像数据集:id、名称、形状、维度、dtype、类型提示(image / stack / spectrum image)、每维标定(scale/unit/origin)。分析前必查。 |
| dm_metadataA | 读取指定元数据子树。先检查 path_status(found/not_found/unavailable),再检查 complete 和 issues;先定位 prefix 再按子树预算读取,不把截断或读取失败当作标签缺失。 |
| dm_statsB | 区域统计:min/max/mean/stddev/分位数。可限定矩形区域。 |
| dm_profileA | 沿两点取强度剖面:直接传 x0/y0/x1/y1 原图像素中心坐标(不是 start/end;只有 dm_2d_preview 的 profile 对象用 start/end)。可指定 width,按标定返回距离。 |
| dm_fftB | 二维 FFT:返回去均值后的 DC、频谱格点坐标与按两个方向标定换算的空间频率/间距。d_pix 仅为频谱格点半径,不能当作 1/pixel 或晶格间距。 |
| dm_2d_captureA | 一次解析图像(默认 front),在新目录保存有界二维像素副本与标定;后续二维预览和分析固定读取该包。捕获期间请勿编辑源图;DM API 不提供像素与标定的原子快照。 |
| dm_2d_previewA | 从 dm_2d_capture 包生成线性显示 PNG 和准确源坐标映射;可叠加 ROI 与剖面条带。显示拉伸不用于计算,返回 MCP image block、本地 PNG 路径及捕获时的标定。只看图无需调用 dm_2d_analyze;不能显示图片时明确说明,不假装看见。 |
| dm_2d_analyzeA | 可选报告示例,不是使用 DM 的必经步骤。对捕获包组合统计、剖面和完整 FFT,在新目录保存数值、图、报告及复跑脚本。需要独立报告环境;简单测量优先用单独工具。operation_id + result_dir 用于查询,不自动重跑不确定任务。 |
| dm_2d_resultA | 只查询捕获或分析目录中的状态与输出哈希。running 返回 unknown,不判断计算已停止;不自动重发捕获或分析。两种目录参数恰选其一。 |
| dm_exportA | 导出到新文件,禁止覆盖。dm3/dm4 使用明确 DM writer;TIFF 使用保留原始 dtype 的无压缩科学数据 writer,附嵌入标定;所有格式附标定侧文件。支持 npy/csv/txt/tif/dm3/dm4,拒绝未经定义的 PNG 强度映射。 |
| dm_cropA | 在 DM 内原生裁出二维独立子图,返回新图像 id、标定与 NumPy 轴序 shape[y,x];右下边界不包含。原图保持不变;不支持三维/四维直接裁剪。 |
| dm_spectrum_infoA | 读取明确指定数据集的光谱轴、空间选择及能量标定信息。实验性基础接口;真实 EDS/EELS/SI 为 NOT_TESTED(未验证),仅合成数据覆盖。不自动识别谱种,不作背景扣除或元素/化学定量,不假定强度单位;拒绝 4D 衍射或 nm 标定能量轴。 |
| dm_spectrumA | 提取原始通道中心与 float64 强度,按空间范围作 sum/mean;能量窗采用 low<=E<high。实验性基础接口;真实 EDS/EELS/SI 为 NOT_TESTED(未验证),仅合成数据覆盖。不自动识别谱种,不作背景扣除或元素/化学定量,不假定强度单位;拒绝 4D 衍射或 nm 标定能量轴。 |
| dm_spectrum_integrateA | 对指定能量窗内原始通道作逐空间位置求和,保留其余空间轴。无 bin-width 或梯形权重;结果不能直接认定为元素/化学分布图。实验性基础接口;真实 EDS/EELS/SI 为 NOT_TESTED(未验证),仅合成数据覆盖。不自动识别谱种,不作背景扣除或元素/化学定量,不假定强度单位;拒绝 4D 衍射或 nm 标定能量轴。 |
| dm_spectrum_exportA | 按 dm_spectrum 的空间归约与能量选择导出新 CSV(energy_eV,intensity;强度为 float64)和元数据侧文件,禁止覆盖或写回原始数据。实验性基础接口;真实 EDS/EELS/SI 为 NOT_TESTED(未验证),仅合成数据覆盖。不自动识别谱种,不作背景扣除或元素/化学定量,不假定强度单位;拒绝 4D 衍射或 nm 标定能量轴。 |
| dm_4dstem_openB | 只读索引未压缩uint8 DM4中的唯一4D数据集。仅解析有界header,不整文件OpenImage;后续由Gatan原生只读binary stream按小块读取。显式NumPy轴scan_axes=[0,1]和detector_axes=[2,3]。 |
| dm_4dstem_readA | 用Gatan原生只读流读取最多256个扫描位置且不超过16MiB的小4D块,创建独立DM图像并复制四轴物理标定;不修改原文件。 |
| dm_4dstem_virtualA | 分块计算虚拟圆形BF/环形ADF、全探测器总强度与平均/总衍射图,发布独立DM图像。每次最多8192扫描位置,分批覆盖全scan;整数uint64求和,原生发布仅允许精确dtype转换;不是硬件角度标定或HAADF认定。 |
| dm_run_scriptA | 在 DM 内执行 DM-Script(等价于脚本窗口)。用于调用 DM 原生算法:滤波、漂移校正、EELS/EDS 定量、SI 处理、批量宏等。执行后会自动比对图像集合,报告新产生/被删除的图像 id,便于接着用其它工具量化。默认关闭,需环境变量 DM_MCP_ALLOW_DMSCRIPT=1。 |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 21 tools
Most tools have distinct roles, but several boundaries blur: dm_2d_analyze explicitly bundles the same stats/profile/FFT work as dm_stats/dm_profile/dm_fft; dm_spectrum_export overlaps heavily with the general dm_export (which already supports CSV); and dm_datasets vs dm_spectrum_info both report axis calibration. The long descriptions do help disambiguate, but an agent must read carefully to pick the right tool for export/analysis.
All names are snake_case with a consistent dm_ prefix and predictable domain_action structure (dm_2d_capture, dm_4dstem_virtual, dm_spectrum_integrate). The minor deviation is that core 2D operations (dm_stats, dm_profile, dm_fft, dm_crop) lack the dm_2d_ domain prefix used by their siblings, and dm_spectrum sits unsuffixed next to dm_spectrum_info.
21 tools is on the heavy side of the 16-25 borderline band. The breadth (2D imaging, 4D-STEM, spectroscopy, I/O, diagnostics) justifies many tools, but the dm_2d_* pipeline plus separate dm_stats/dm_profile/dm_fft adds redundancy rather than strictly earning each slot.
The surface covers open → enumerate → capture → analyze → export across 2D, 4D-STEM, and spectrum workflows, plus status/script escape hatches. Gaps are modest: no document close/delete, no ROI lifecycle management, and 4D-STEM lacks diffraction-level analysis (e.g. disk detection, center-of-mass) beyond virtual imaging, but agents can work around these via dm_run_script.