set_contract_scan_rules
Store this tenant's contract-scan patterns so scan_contract_folder uses them EVERY time (e.g. for the scheduled 15-minute run) without passing them as arguments. Fields: skip_folders (folder names whose contents are never a contract — ADDED to the built-in defaults archiv/archiv/alt); exclude_words (filename words that never belong to a contract); main_patterns (globs like MV / Mietvertrag that mark a MAIN contract — matched on a WORD BOUNDARY, so MV catches 24-1_MV….pdf but not ZMV187516/…MV…-substrings; default MV, Mietvertrag); addition_patterns (globs like Nachtrag / Zusatzvereinbarung / ERGÄNZENDE VEREINBARUNG that mark an amendment attaching to the nearest contract bundle); addition_folder_patterns (globs like nachtrag on FOLDER names — files inside such a folder count as amendments); exclusion_patterns (globs like Dauermietrechnung / Anschreiben / Übergabeprotokoll / Kündigung / SEPA / Lastschrift / Mandat that drop a file from every bundle; SEPA/Lastschrift/Mandat are ALSO never a contract built-in). For main/addition/exclusion an EMPTY stored list means 'use the built-in default', not 'match nothing'. area_rules (Ticket 795e2bd2): [{pattern, area}] path globs on the MAIN contract's path that set the contract's area on import — first match wins, written to the custom field 'blatt' that export_contracts_excel routes by; no match = default_area (empty = no area); also accepts ['X=Bereich A'] or {'X': 'Bereich A'}. export_sheets (Ticket c1c3b706): extra Excel sheets [{name, aliases?, default?, columns: [{header, source}]}] — a contract goes to the sheet whose name or alias matches its area; source is fact: | custom: | fact_or_custom:| | title_or_fact: | calc:objekt|plz_ort|mietdauer|kuendigung|index|staffel|miete_pro_m2|nk_pro_m2. fact_to_custom_fields: {custom_key: fact_field} — extracted values copied into EXISTING custom fields on import. max_imports_per_day (Ticket c7db227d): daily cap on import_contract_from_folder runs for this tenant (each is one AI extraction = cost); 0/null = no cap. own_companies (Ticket 448fa346): the tenant's OWN companies [{name, aliases?: ['ABC', 'Muster Verwaltung'], account_id?}] — the import decides our role (landlord/tenant, customer/provider) by matching the parties against this list, tolerant of hyphens, 'und'/'&', umlauts, legal form and spacing; short aliases match as whole words only; account_id becomes the contract's our_account_id. Replaces passing our_names on every call. Pass a field to replace it, omit it to keep the stored value. Returns the stored rules.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "set_contract_scan_rules"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| area_rules | No | Path globs on the main contract that set its area (custom field blatt); first match wins | |
| default_area | No | Area used when no area rule matches; empty = no area | |
| skip_folders | No | Folder names whose contents are never a contract (added to defaults) | |
| exclude_words | No | Filename words that never belong to a contract | |
| export_sheets | No | Extra Excel sheets for export_contracts_excel, routed by area | |
| main_patterns | No | Filename globs marking a main contract; empty = built-in default | |
| own_companies | No | The tenant's own companies, used to decide our role in a contract | |
| addition_patterns | No | Filename globs marking an amendment; empty = built-in default | |
| exclusion_patterns | No | Filename globs that drop a file from every bundle; empty = built-in default | |
| max_imports_per_day | No | Daily cap on contract imports (AI extractions); 0/null = no cap | |
| fact_to_custom_fields | No | Map custom_key -> fact_field to copy extracted values into existing custom fields | |
| addition_folder_patterns | No | Folder-name globs whose files count as amendments |