Introduction¶
For those doing protein structure or molecular docking, the typical workflow is this: the model calculates the results for you, you save the PDB file, switch to PyMOL or a web tool to open it, and then take a screenshot to paste back into the discussion. Files are passed back and forth between the session and external software, switching environments and breaking your train of thought.
In DSH (DeepSeek Harness), it is not difficult for the model to read a molecular file, but it is hard to make the structure itself appear in the session interface. The dsh-molecule-viewer plugin solves this step: by passing in a file path or molecular data, it renders an interactive 3D molecular viewer directly within the session.
What is it¶
dsh-molecule-viewer is a molecular structure viewer plugin for DSH, maintained by PandaAIDD, licensed under MIT, with the npm package name @dsh-plugins/dsh-molecule-viewer and current version 0.2.0.
Its positioning can be summarized in one sentence: pass in a molecular file path or PDB/SDF/MOL2/MOL format data, and render an interactive 3D molecular viewer in the session interface. The rendering capabilities come from 3Dmol.js. DSH’s philosophy is “everything is a plugin.” This type of client-side plugin is a product of that philosophy—adding no functionality to the core, but allowing you to install it when needed.
Core Features¶
Four Molecular Formats¶
Supports PDB, SDF, MOL2, and MOL formats. PDB supports .pdb and .ent extensions, while SDF supports .sdf and .sd. PDB corresponds to proteins and large molecular structures, while SDF can hold multiple molecules.
Note that SMILES is not supported yet; the plugin requires formats containing 3D coordinates.
Path First, Server-side Reading¶
You can directly pass the file path to the tool, allowing the server to read the file without needing to paste the file content first. Path syntax is made compatible: Windows syntax (D:\dir\x.pdb), WSL syntax (/mnt/d/dir/x.pdb), and syntax starting with ~/ are all automatically recognized and converted. Just write it as you usually do.
Interactive Viewer¶
The rendered viewer supports rotation and zoom and can switch between cartoon / stick / line / sphere styles in real-time. It also allows changing the background color and molecular coloring method. The default style is stick; cartoon is recommended for viewing proteins.
Recoverable after Restart¶
The viewer payload persists with the tool/result event. This means that after restarting DSH and loading a historical session, the previous molecular viewer renders as usual without needing to call the tool again. This relies on the official slot implementation; the original harness can be installed directly without modifying the core.
Lightweight Parsing and Bundled 3Dmol.js¶
The Host side only performs atomic counting and validation, while the real parsing and rendering are handed over to the browser-side 3Dmol.js. 3Dmol.js is included in the client bundle at build time as vendor/3Dmol-min.cjs (2.4.2) and does not request a CDN at runtime. It loads fast, works offline, and is not affected by browser tracking protections.
Installation and Enablement¶
Use the official installation command:
dsh plugin --profile web add git+https://github.com/PandaAIDD/dsh-molecule-viewer.git
A restart is required after installation to take effect:
dsh --profile web
After restarting, the view_molecule tool is automatically available, and the model will call it automatically according to the tool description. No extra registration or configuration is needed. During installation, dsh plugin clones the repository, installs it to the profile’s node_modules, and automatically adds it to dsh.profile.bundles after detecting the dsh.bundle.patch declaration.
Typical Usage¶
The most direct way is to describe the requirement in the conversation, and the model will automatically call the tool:
帮我可视化这个分子:D:\project\Dock\data\3IPQ.pdb
You can also explicitly specify which tool to use, for example, by pasting a snippet of SDF data that hasn’t been saved to disk:
用 view_molecule 工具查看这段 SDF 数据:...
The tool’s parameter rules are as follows:
pathanddataare mutually exclusive, withpathprioritized. If the file exists on the disk, pass the path (write it as the user originally does);datais used for cases where there is no file on the disk (e.g., pasted content in the chat). Pass plain text, do not base64 encode.format(pdb | sdf | mol2 | mol) is mandatory when passingdata; when passingpath, it is inferred automatically from the extension and can be omitted.nameis the display name (e.g.,"1CRN"), used as the viewer title, and is optional.styleis the initial rendering style (stick | line | sphere | cartoon), default isstick,cartoonis recommended for proteins.
A supplementary note: molecular content over 2 MB will not be inlined into the session log. In this case, a summary card will appear in the viewer location, displaying the atom count and format.
Use Cases and Notes¶
This plugin is suitable for developers doing structure-related work in DSH: after completing docking and wanting to immediately view the conformation, checking the active pocket when reading a PDB file, or quickly verifying molecular shape with an SDF file can all be completed directly in the session without switching to external software.
A few notes:
- SMILES is not supported yet; formats containing 3D coordinates are required.
- Must restart DSH after installation for it to take effect.
- Although path syntax is compatible with Windows/WSL conversion, remember to specify
formatwhen passingdata. - These plugins run with the permissions of the current dsh process. It is recommended to check the source code and license on the repository before installing.
Conclusion¶
What dsh-molecule-viewer does is not complicated: it integrates 3Dmol.js rendering capabilities into the DSH session, turning “calculate and view” into an action that doesn’t require switching tools. Design features like direct path passing, recoverability after restart, and offline availability make it suitable as a permanent plugin in structure-related workflows.
Plugin page on the community directory: https://www.skillhub.cn/plugins/PandaAIDD/dsh-molecule-viewer . The directory is an independent site, with no official affiliation with DeepSeek or Xiaohuanshi. Source code repository: https://github.com/PandaAIDD/dsh-molecule-viewer .