draw_molecule
Convert a molecule's SMILES into a standalone CDXML document with 2D coordinates and optional label, ready for ChemDraw.
Instructions
Render a single molecule to a standalone CDXML document.
Takes a molecule dict (at minimum {"smiles": "..."}) and generates a self-contained CDXML string with 2D coordinates in ACS Document 1996 style (BondLength=14.40, Arial 10pt). Optionally places a text label below the structure using the "label", "name", or "iupac_name" field (in that order).
IMPORTANT: Do NOT construct {"smiles": "..."} with hand-edited SMILES. Always get mol_json from another tool (resolve_name, modify_molecule, parse_reaction, etc.). If you need to edit a SMILES, use modify_molecule(operation="set_smiles") first — it gives you an MCS diff to verify the edit was correct before drawing.
Args: mol_json: Molecule dict with at least {"smiles": "..."}. Optional display fields: "label" (used verbatim), "name", "iupac_name". Should come from another tool's output, not hand-constructed. output_path: If given, also write CDXML to this file path.
Returns: Dict with keys: ok, cdxml (CDXML document string), and output_path if a path was specified. Returns {ok: False, error: "..."} on failure.
Safety override: Draw a molecule through a validated no-overwrite staging file.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mol_json | Yes | ||
| output_path | No |