convert_cdx_cdxml
Convert CDX and CDXML files bidirectionally, with automatic direction detection from file extension and backend selection for accurate chemical data conversion.
Instructions
Convert bidirectionally between CDX (binary) and CDXML (XML) formats.
Direction is detected from the file extension:
.cdx input → .cdxml output
.cdxml input → .cdx output
Uses available backends in order: ChemDraw COM (best fidelity, Windows) → pycdxml (pure Python, partial support) → OpenBabel.
ChemDraw COM requires ChemDraw to be installed and closed before running.
Args: input_path: Path to .cdx or .cdxml file. output_path: Output file path. If not given, same directory as input with the swapped extension (e.g. foo.cdx → foo.cdxml).
Returns: Dict with keys: ok, input, output (absolute path to written file). Returns {ok: False, error: "..."} if conversion fails.
Safety override: Convert CDX/CDXML through a validated no-overwrite staging file.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input_path | Yes | ||
| output_path | No |