format_lab_entry
Convert structured entry lists into formatted lab book text, auto-filling exact LCMS retention times, areas, and m/z values from linked PDFs.
Instructions
Format a list of entry dicts into a structured lab book text entry.
Takes a list of typed entry dicts (or a JSON string) and produces a formatted lab book entry. The tool re-parses LCMS PDFs to fill in exact numbers — you only provide peak identifications (name, approximate RT, ion) as search keys.
IMPORTANT: Do NOT write free-form LCMS text. Use the structured entry types below. The tool will look up the actual RT, area%, m/z, and UV from the PDF.
Entry types and their required fields:
{"type": "text", "content": "Procedure paragraph or section header..."}
{"type": "lcms-species", "file": "path/to/report.pdf", "label": "t = 0 min", "peaks": [ {"name": "Product", "rt": 1.02, "ion": {"mode": "ES-", "mz": 444.1}}, {"name": "SM", "rt": 0.65, "ion": {"mode": "ES+", "mz": 275.1}}, {"name": "TPPO", "rt": 1.02, "ion": {"mode": "ES+", "mz": 279.1}} ]}
{"type": "lcms-areas", "file": "path/to/report.pdf", "label": "t = 10 min", "peaks": [ {"name": "Product", "rt": 1.03, "compound_related": true}, {"name": "Byproduct", "rt": 1.26, "compound_related": false} ]}
{"type": "lcms-species", "file": "path/to/report.pdf", "label": "Purified product", "peaks": [ {"name": "Product", "rt": 1.01, "ion": {"mode": "ES-", "mz": 444.2}, "purity": true, "detector": "220nm"} ]}
{"type": "lcms-manual", "file": "path/to/manual_integration.pdf", "label": "Manual LC", "peaks": [ {"name": "Product", "rt": 1.01, "compound_related": true} ]}
{"type": "nmr", "content": "1H NMR (400 MHz, DMSO-d6): ..."}
Workflow: First call parse_analysis_file on each PDF to see peaks/masses. Then build entries referencing those PDFs with approximate RT and ion as search keys. This tool re-reads the PDF and fills in exact numbers.
Args: entries_json: List of entry dicts, or a JSON string, or {"entries": [...]}. output_path: If given, write the formatted text to this file and return {ok, output_path, size} instead of {ok, text}.
Returns: Dict with keys: ok, text (formatted lab book entry string). When output_path is provided, returns {ok, output_path, size} instead.
Safety override: Format a lab entry and atomically publish verified text.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| output_path | No | ||
| entries_json | Yes |