scan_contract_folder
Go through a folder on a connected computer (local bridge, e.g. a network drive) and propose CONTRACT BUNDLES: which file is the contract, which are amendments (Nachträge), rent changes (Mieterhöhung), annexes, terminations, handover protocols, and which belong together — from file and folder names, recursively. ONE bundle per OBJECT folder: all versions of a contract in that folder merge (the signed/newest is the main, the rest are 'version'); a 'Mietvertrag'/'Haupt-MV' wrapper subfolder is treated as the object = its parent, so a sibling 'Nachtrag …' folder folds into the same object bundle; PDF and DOCX of the same name count once (PDF preferred); archive/backup folders are skipped. A parent folder over several object subfolders is NEVER itself a bundle (no pull-up), and a bundle with >30 files is flagged (warnung). UNTERMIETVERTRÄGE (a untermiet folder) become one own bundle per file with our_role='landlord', linked_to the main object — never merged into it. 'MV' counts as Mietvertrag only as a real filename token (not 'ZMV…', 'BV MV', '-MV', 'auf MV', folder 'Haupt-MV'); SEPA/Lastschrift/Mandat are never a contract. Fast enumeration via list_tree with a list_directory fallback (field 'enumeration' says which ran). Required: bridge (slug, see the br_filesystem* tools), folder (an allowed folder of that bridge, see list_allowed_directories). Optional: path (subfolder), max_files (default 3000), skip_folders (extra folder names to skip entirely, in addition to archiv/_archiv/alt/_xsicherung/01_allgemein/02_corona/03_nebenkostenabrechnungen/staatliche genehmigungen), exclude_words (extra filename words that never belong to a contract). Nothing is read or uploaded yet. Returns scan_id (keeps the full result for import_contract_from_folder and export_contracts_excel), the bundles with a confidence AND bereits_erfasst each, counts neu/bereits_erfasst, and the files that fit no contract. bereits_erfasst matches by bridge + the NORMALIZED main-contract path (independent of which start folder was scanned). For a scheduled auto-scan let a server_job agent (run_every_minutes=15, run_from 07, run_to 19) call this and import only the bundles with bereits_erfasst=false — import is idempotent, so re-runs update instead of duplicating.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"bridge": "<bridge>",
"folder": "<folder>"
},
"name": "scan_contract_folder"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Subfolder inside folder to scan | |
| bridge | Yes | Bridge slug of the connected computer (see br_<slug>__filesystem__* tools) | |
| folder | Yes | Allowed folder of that bridge (see list_allowed_directories) | |
| max_files | No | Maximum number of files to enumerate (default 3000) | |
| skip_folders | No | Extra folder names to skip entirely, in addition to the defaults | |
| exclude_words | No | Extra filename words that never belong to a contract |