Skip to main content
Glama

set_contract_scan_rules

DestructiveIdempotent

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

NameRequiredDescriptionDefault
area_rulesNoPath globs on the main contract that set its area (custom field blatt); first match wins
default_areaNoArea used when no area rule matches; empty = no area
skip_foldersNoFolder names whose contents are never a contract (added to defaults)
exclude_wordsNoFilename words that never belong to a contract
export_sheetsNoExtra Excel sheets for export_contracts_excel, routed by area
main_patternsNoFilename globs marking a main contract; empty = built-in default
own_companiesNoThe tenant's own companies, used to decide our role in a contract
addition_patternsNoFilename globs marking an amendment; empty = built-in default
exclusion_patternsNoFilename globs that drop a file from every bundle; empty = built-in default
max_imports_per_dayNoDaily cap on contract imports (AI extractions); 0/null = no cap
fact_to_custom_fieldsNoMap custom_key -> fact_field to copy extracted values into existing custom fields
addition_folder_patternsNoFolder-name globs whose files count as amendments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed23 schema fields changed
    • addedInput schema / properties / addition_folder_patterns / description
      Added value: +"Folder-name globs whose files count as amendments"
    • addedInput schema / properties / addition_patterns / description
      Added value: +"Filename globs marking an amendment; empty = built-in default"
    • addedInput schema / properties / area_rules / description
      Added value: +"Path globs on the main contract that set its area (custom field blatt); first match wins"
    • addedInput schema / properties / area_rules / items / properties / area / description
      Added value: +"Area value written when the pattern matches"
    • addedInput schema / properties / area_rules / items / properties / pattern / description
      Added value: +"Glob matched against the main contract's path"
    • addedInput schema / properties / default_area / description
      Added value: +"Area used when no area rule matches; empty = no area"
    • addedInput schema / properties / exclude_words / description
      Added value: +"Filename words that never belong to a contract"
    • addedInput schema / properties / exclusion_patterns / description
      Added value: +"Filename globs that drop a file from every bundle; empty = built-in default"
    • addedInput schema / properties / export_sheets / description
      Added value: +"Extra Excel sheets for export_contracts_excel, routed by area"
    • addedInput schema / properties / export_sheets / items / properties / aliases / description
      Added value: +"Further area values routed to this sheet"
    • addedInput schema / properties / export_sheets / items / properties / columns / description
      Added value: +"Columns of the sheet (header and value source)"
    • addedInput schema / properties / export_sheets / items / properties / columns / items / properties / header / description
      Added value: +"Column heading"
    • addedInput schema / properties / export_sheets / items / properties / columns / items / properties / source / description
      Added value: +"Value source, e.g. fact:<field>, custom:<key> or calc:miete_pro_m2"
    • addedInput schema / properties / export_sheets / items / properties / default / description
      Added value: +"true = sheet for contracts whose area matches no sheet"
    • addedInput schema / properties / export_sheets / items / properties / name / description
      Added value: +"Sheet name; contracts whose area matches it go here"
    • addedInput schema / properties / fact_to_custom_fields / description
      Added value: +"Map custom_key -> fact_field to copy extracted values into existing custom fields"
    • addedInput schema / properties / main_patterns / description
      Added value: +"Filename globs marking a main contract; empty = built-in default"
    • addedInput schema / properties / max_imports_per_day / description
      Added value: +"Daily cap on contract imports (AI extractions); 0/null = no cap"
    • addedInput schema / properties / own_companies / description
      Added value: +"The tenant's own companies, used to decide our role in a contract"
    • addedInput schema / properties / own_companies / items / properties / account_id / description
      Added value: +"ID of the account (company)"
    • addedInput schema / properties / own_companies / items / properties / aliases / description
      Added value: +"Other names of the company; short aliases match as whole words"
    • addedInput schema / properties / own_companies / items / properties / name / description
      Added value: +"Name of the own company"
    • addedInput schema / properties / skip_folders / description
      Added value: +"Folder names whose contents are never a contract (added to defaults)"
  2. First observed

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already flag destructiveHint=true and idempotentHint=true, and the description adds genuinely non-obvious behavior beyond that: partial replace-by-omission semantics, the rule that an EMPTY stored list means 'use the built-in default' rather than 'match nothing', folder adds being additive ('ADDED to the built-in defaults'), and that the call returns the stored rules. It does not explicitly warn about lost prior values when a list is replaced, but 'replace' plus the destructive annotation makes the risk legible.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The content is front-loaded and the per-field enumeration is useful, but it is a single dense wall of text with long clauses and internal ticket IDs ('Ticket 795e2bd2', 'c1c3b706', '448fa346') that add no value for the caller. Splitting into short per-field bullets and dropping ticket references would improve scanability without losing meaning.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 12-parameter, all-optional, nested mutation tool with no output schema, the definition covers every parameter's meaning, defaults, and update semantics, and closes with 'Returns the stored rules.' What it leaves out is minor: where rules are stored, and whether reads/verification should go through get_contract_scan_rules before overwriting.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline would be 3, but the description adds substantial semantics the schema lacks: word-boundary matching for main_patterns with a concrete counter-example, built-in defaults per field, the exact source mini-language for export_sheets (fact:/custom:/fact_or_custom:/title_or_fact:/calc: with enumerated calc keys), first-match-wins ordering for area_rules plus its alternative encodings, and alias-matching tolerance for own_companies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Uses a specific verb and resource — 'Store this tenant's contract-scan patterns' — and immediately ties the effect to a named consumer ('so scan_contract_folder uses them EVERY time ... without passing them as arguments'). This cleanly separates it from the read-side sibling get_contract_scan_rules and from per-call argument passing.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Clearly states the condition for using it (persist rules once instead of re-passing them on every scan/import, including scheduled 15-minute runs) and explains the partial-update contract: 'Pass a field to replace it, omit it to keep the stored value.' It does not name get_contract_scan_rules as the counterpart for inspecting current values, so an agent has to infer the read path.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.