Skip to main content
Glama

scan_contract_folder

Destructive

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

NameRequiredDescriptionDefault
pathNoSubfolder inside folder to scan
bridgeYesBridge slug of the connected computer (see br_<slug>__filesystem__* tools)
folderYesAllowed folder of that bridge (see list_allowed_directories)
max_filesNoMaximum number of files to enumerate (default 3000)
skip_foldersNoExtra folder names to skip entirely, in addition to the defaults
exclude_wordsNoExtra filename words that never belong to a contract

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changed
    • addedInput schema / properties / bridge / description
      Added value: +"Bridge slug of the connected computer (see br_<slug>__filesystem__* tools)"
    • addedInput schema / properties / exclude_words / description
      Added value: +"Extra filename words that never belong to a contract"
    • addedInput schema / properties / folder / description
      Added value: +"Allowed folder of that bridge (see list_allowed_directories)"
    • addedInput schema / properties / max_files / description
      Added value: +"Maximum number of files to enumerate (default 3000)"
    • addedInput schema / properties / path / description
      Added value: +"Subfolder inside folder to scan"
    • addedInput schema / properties / skip_folders / description
      Added value: +"Extra folder names to skip entirely, in addition to the defaults"
  2. First observed

TDQS

A4.3/5.0
Behavior4/5

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

Discloses a lot beyond the annotations: the enumeration strategy and its fallback (list_tree with a list_directory fallback, reported in the 'enumeration' field), the fixed skip list, the >30-file warnung, the no-pull-up rule, and that bereits_erfasst matches on a normalized main-contract path independent of the start folder. The one unexplained element is the destructiveHint=true annotation, which sits oddly against the explicit claim that nothing is read or uploaded; the description never clarifies whether any state other than the stored scan_id is written.

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 purpose is front-loaded, but the rest is a single dense paragraph of ALL-CAPS emphasis, em-dashes and parenthetical rules with no line breaks or field list, which makes it hard to scan. Nearly every sentence carries real information given the tool's complexity, so the problem is packaging rather than padding.

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

Completeness5/5

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

There is no output schema, yet the description fully accounts for the return value: scan_id, per-bundle confidence plus bereits_erfasst, counts of neu/bereits_erfasst, and the files that fit no contract. For a heuristic scanner with six parameters and non-obvious merge rules, nothing an agent needs to call it or to interpret the response is missing.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3; the description goes further by pointing to the br_<slug>__filesystem__* tools for bridge, list_allowed_directories for folder, and crucially by spelling out the default skip set that skip_folders extends (archiv/_archiv/alt/_xsicherung/01_allgemein/02_corona/03_nebenkostenabrechnungen/staatliche genehmigungen). It also restates max_files' default of 3000, though it adds no format hints for path beyond 'subfolder'.

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?

Opens with a specific verb and resource: 'Go through a folder ... and propose CONTRACT BUNDLES', then defines exactly what a bundle is (main contract, Nachtrag, Mieterhöhung, annexes, terminations, handover protocols). It distinguishes itself from downstream siblings by naming import_contract_from_folder and export_contracts_excel as consumers of the returned scan_id, so an agent knows this is the analysis step, not the import step.

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?

Gives clear workflow context: 'Nothing is read or uploaded yet', returns a scan_id to feed import_contract_from_folder/export_contracts_excel, and even prescribes a scheduled auto-scan pattern calling this then importing only bereits_erfasst=false bundles. It never states when NOT to use it (e.g. versus scan_contract_files, which is a sibling), so the alternative-selection guidance is incomplete rather than absent.

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.