Convert legacy MT940 to camt.053
convert_mt940_to_camt053Convert legacy SWIFT MT940 statements into camt.053 JSON structure. Enables downstream processing of MT940 data until its retirement in 2028.
Instructions
Convert a legacy SWIFT MT940 statement into a camt.053 structure.
Use this as the Phase-1 migration wedge: SWIFT MT940 customer statements
retire in **November 2028**, so this tool bridges the gap by turning raw
MT940 text into the same JSON-serialisable camt.053 document shape that
``parse_statement`` returns (group header plus statements, each with its
account, balances, and entries). Downstream tools (``list_entries``,
``filter_entries``, ``classify_entry``, ``export_journal``) then work on the
result unchanged.
Wraps the ``camt053-loader-mt940`` library's ``parse_mt940``; the MT parsing
itself is delegated (no MT grammar is reimplemented here). The resulting
``ParsedDocument`` is serialised with the same ``to_dict()`` the server's
other parse tools use, so agents get a consistent structure. Nothing is read
from or written to disk.
Returns the converted document as a JSON-serialisable dict, or an
``{"error": ...}`` payload if the MT940 text cannot be parsed (e.g. a
missing ``:20:`` reference or a malformed balance / statement line).
Args:
mt940_text: The raw MT940 statement text as a string.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mt940_text | Yes | The raw legacy SWIFT MT940 statement text as a string (``:20:`` / ``:25:`` / ``:28C:`` / ``:60F:`` / ``:61:`` / ``:86:`` / ``:62F:`` fields). Passed verbatim from the bank or ERP; no file path is accepted. |