Skip to main content
Glama

import_contract_from_folder

Destructive

Read ONE contract bundle and register it — rental contracts AND every other kind (service, maintenance, lease = leasing, insurance, supply/energy, license/software, loan, purchase, cooperation, employment, nda, other): the AI first decides the type (contract_type), rentals get the rental fields (landlord/tenant, property, rent), all others the general fields (client/contractor, subject, fee + period, notice); every party is listed separately with role and structured address, plus contact persons (property management, 'represented by'). OUR ROLE is computed from the parties against the tenant's own-company list (set_contract_scan_rules.own_companies; our_names adds to it). PARTIES (link_parties, default true): each counterparty is matched to an existing organisation (company) or person (contact) by normalised name, PLZ/city on ties, or created (note 'Angelegt beim Vertragsimport'); our own company becomes our_account_id; the main counterparty is written to account_id/contact_id ONLY if the contract has none yet (manual links stay); all parties with role go to the contract's party list. RE-EXTRACT: importing the same bundle again (same main-contract path) UPDATES the contract — use it to re-read contracts imported before 31.10.2026 with the old rental-only schema; manual account/contact links and custom fields you set stay. ASYNC (Ticket 8138bb37): this STARTS the run and returns IMMEDIATELY with { operation_id, state: "running" } — it does NOT wait for the ~1-minute extraction, so it never hits the request timeout. Poll get_contract_import({operation_id}) for per-file progress and, when done, the result (created/updated contract_id, or a per-file failure reason). The files (contract + amendments + annexes; digital PDFs, scans, Word, images) are read by the AI (default gpt-6-luna) and the key facts extracted — parties, property, term, notice periods, rent, deposit, index/stepped rent, special clauses — each with its source file, page and confidence, amendments applied in order (today's state). Writes the contract register (agreement with facts, deadlines, attached documents); a second run on the same bundle updates instead of duplicating. SIZE (Ticket 5317508f): files with role 'version' (other drafts) are only LINKED, not sent to the AI; digital PDFs go as text, big scans as a page excerpt; the total file input per AI call stays under 45 MB — what does not fit (lowest priority first) is left out and listed in zu_pruefen instead of failing. A stalled run (worker lost, no heartbeat for 5 min) is resumed by the next get_contract_import or scan_contract_folder from the last prepared file (max 3 resumes). reference = path of the main contract; area from set_contract_scan_rules.area_rules/default_area into custom field 'blatt'; a daily cap (max_imports_per_day) is enforced. STORAGE MODE (Ticket T3): modus 'referenz' (DEFAULT) stores only a LINK to the original file on the bridge (bridge://… + source_meta) and copies NO bytes into the document store — so an on-prem folder on \server\share makes no GB-scale duplicates; filename/size/MIME are kept as metadata and the file is fetched on demand via resolve_contract_file before viewing/analysis. modus 'kopie' copies the bytes into CallPilotAI (needed for a purely-cloud tenant with no persistent bridge, since a link only resolves while the bridge is online); 'verknuepfen' true/false is an alias (true=referenz). Required: scan_id + bundle_key (from scan_contract_folder) OR bridge + folder + files [{path, role}]. Optional: our_names (how we appear in contracts, e.g. ["Muster GmbH"] — decides landlord/tenant; default: the tenant name), model, modus ('referenz'|'kopie', default 'referenz'), verknuepfen (bool alias).

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": "import_contract_from_folder"
  }
}

Input Schema

NameRequiredDescriptionDefault
filesNoFiles of the bundle with their role, instead of scan_id + bundle_key
modelNoAI model for the extraction (default gpt-6-luna)
modusNoreferenz = store only a link to the file (default), kopie = copy the bytes
bridgeNoBridge slug, when passing files directly instead of scan_id
folderNoAllowed folder of the bridge the files are in
scan_idNoID of the scan
our_namesNoHow we appear in contracts; added to the own-company list
bundle_keyNoKey of the bundle from scan_contract_folder (with scan_id)
verknuepfenNoAlias for modus: true = referenz, false = kopie
link_partiesNoMatch or create organisations/persons for the parties (default true)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed12 schema fields changed
    • addedInput schema / properties / bridge / description
      Added value: +"Bridge slug, when passing files directly instead of scan_id"
    • addedInput schema / properties / bundle_key / description
      Added value: +"Key of the bundle from scan_contract_folder (with scan_id)"
    • addedInput schema / properties / files / description
      Added value: +"Files of the bundle with their role, instead of scan_id + bundle_key"
    • addedInput schema / properties / files / items / properties / path / description
      Added value: +"Path of the file within folder"
    • addedInput schema / properties / files / items / properties / role / description
      Added value: +"Role of the file, e.g. contract, amendment, annex, version"
    • addedInput schema / properties / folder / description
      Added value: +"Allowed folder of the bridge the files are in"
    • addedInput schema / properties / link_parties / description
      Added value: +"Match or create organisations/persons for the parties (default true)"
    • addedInput schema / properties / model / description
      Added value: +"AI model for the extraction (default gpt-6-luna)"
    • addedInput schema / properties / modus / description
      Added value: +"referenz = store only a link to the file (default), kopie = copy the bytes"
    • addedInput schema / properties / our_names / description
      Added value: +"How we appear in contracts; added to the own-company list"
    • addedInput schema / properties / scan_id / description
      Added value: +"ID of the scan"
    • addedInput schema / properties / verknuepfen / description
      Added value: +"Alias for modus: true = referenz, false = kopie"
  2. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Goes far beyond the annotations: the call is async and returns { operation_id, state: "running" } immediately rather than blocking for ~1 minute; a second run updates instead of duplicating; parties are matched or created with a note 'Angelegt beim Vertragsimport'; main counterparty is only written if unlinked; version-role files are linked not sent to the AI; 45 MB input cap drops lowest-priority files into zu_pruefen rather than failing; stalled runs resume with a max of 3; daily cap max_imports_per_day. This is exactly the kind of side-effect and limit disclosure a destructive write tool needs. The statement that re-imports update rather than duplicate is a nuance, not a contradiction, of idempotentHint=false.

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 first sentence front-loads the core action well and ALL-CAPS section markers (RE-EXTRACT, ASYNC, SIZE, STORAGE MODE) help scanning. However, the text is a very dense ~450-word block that mixes purpose, schema rules, storage semantics, worker-resume behavior and ticket IDs, and the update-not-duplicate behavior is stated twice (RE-EXTRACT and again in the extraction paragraph). It earns most of its length but not all of it, and an agent must read a lot before reaching the invocation contract.

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?

For a high-complexity, destructive async import with no output schema, the description covers the return shape, the polling companion, storage modes, file handling limits, failure and resume behavior, and permission-adjacent context (own companies, area rules, daily cap). An agent has everything needed to invoke it correctly and to interpret the immediate response.

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 real meaning: the schema declares no required fields while the description supplies the actual required combination (scan_id + bundle_key OR bridge + folder + files); modus 'referenz' stores only a bridge:// link and copies no bytes versus 'kopie' which copies bytes into the store; verknuepfen is an alias for modus; our_names decides landlord/tenant and extends the own-company list; link_parties default true triggers match-or-create. None of this is recoverable from the schema alone.

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?

States a specific verb+resource ("Read ONE contract bundle and register it") and immediately scopes it beyond rentals to all contract kinds. It is clearly distinguishable from scan_contract_folder (prepares the bundle) and get_contract_import (polls the run), both of which it names explicitly.

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

Usage Guidelines5/5

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

Gives concrete when-to-use rules: pass scan_id + bundle_key from scan_contract_folder OR bridge + folder + files; re-import the same bundle to re-extract contracts imported before 31.10.2026 under the old schema; poll get_contract_import for progress. It also states what is preserved on re-run (manual links, custom fields), removing the main ambiguity about re-invoking a destructive tool.

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.