How to ask questions across a folder of contracts with an AI agent
Leave feedback
On this page
Index the contracts folder once with the GroupDocs.Search MCP server, running locally in Docker, and your agent can answer which contracts say X with the clause quoted — PDF, Word and text contracts in the same index, nothing uploaded:
docker run --rm -i -v $(pwd)/documents:/data \
ghcr.io/groupdocs-search/search-net-mcp:latest
Which of my contracts mention a termination penalty? Quote the clause for each one.
Note
The commands and config snippets on this page are for the .NET build of the server, which ships as a Docker image only. Installation and client setup: MCP server for .NET. Other platforms will expose the same tools with their own launch command; everything else on this page applies unchanged.
Prerequisites
The server registered in your AI client, the contracts folder inside the folder mounted at /data — quick start.
The calls
user agent Search MCP server
| "Which contracts mention a termination penalty?" |
|---------------->| |
| |-- add_to_index ------------------------->| reads the
| | {"documentsPath":"contracts", | files once,
| | "indexName":"contracts"} | stores text
| |<- "5 document(s) added, 5 in the index" --|
| |-- search ------------------------------->|
| | {"query":"termination AND penalty"} |
| |<- {"documentsFound":3, "documents":[ ... | which files
| | "contracts/acme-...-agreement.pdf", |
| | "contracts/globex-...-agreement.docx",|
| | "contracts/initech-nda.docx" ]} |
| |-- get_text_fragments ------------------->|
| | {"query":"\"termination penalty\""} |
| |<- === contracts/acme-...-agreement.pdf ===| the passages
| | ...a termination penalty of three |
| | monthly fees applies... |
|<- "Two contracts carry one: Acme (3 monthly fees, 12.3), |
| Globex (50% of the remaining fees). Initech excludes it."|
What the agent sees
Captured from server 26.10.1 against five synthetic contracts — two with a penalty, one that mentions both words but excludes it:
-> search {"query":"termination penalty","indexName":"contracts"}
<- { "documentsFound": 0,
"hint": "Unquoted words separated by spaces do not match. Search the
phrase as \"termination penalty\", or combine the words with
AND / OR, e.g. termination AND penalty." }
-> search {"query":"termination AND penalty","indexName":"contracts"}
<- documentsFound 3: acme-master-services-agreement.pdf,
globex-consulting-agreement.docx, initech-nda.docx
-> get_text_fragments {"query":"\"termination penalty\"",
"indexName":"contracts"}
<- 2 document(s) match.
=== contracts/acme-master-services-agreement.pdf ===
…a termination penalty of three monthly fees applies, payable
within 30…
=== contracts/globex-consulting-agreement.docx ===
…Early termination penalty: the Client pays 50 percent of the fees…
Three things to notice:
The first query missed — unquoted words do not match — and the hint told the agent how to fix it. Agents usually correct themselves on the next call.
AND found three files, the phrase found two.AND is evaluated per document: the Initech NDA contains both words in the sentence “There is no fee and no penalty associated with termination”. The fragments call is what tells a match from a mention.
One index, three formats — PDF, DOCX and TXT answer the same query.
More questions that work
Which contracts have a force majeure clause?
"force majeure" → the Acme agreement only.
Which contracts can the client terminate for convenience, and with how much notice?
terminat? AND notice (the ? matches terminate), then fragments with termsAfter: 20 to read the notice period.
Which leases renew automatically?
renewal OR renews → the Umbrella lease; the passage says “renews automatically for 12 months unless notice is given”.
Expected result
A list of contract files with the quoted clause under each — and, when you ask for it, the contracts that mention the words without the clause. Answers arrive in seconds after the first indexing.
Troubleshooting
Symptom
Cause
Fix
A clause you know is there is not found
the contract is a scan — no text layer
OCR it first; the index has its file properties only
A contract matches but does not contain the clause
AND matched the words in different places
read the fragments; search the exact phrase in quotes
"…is inside the indexed folder ‘contracts’" when removing one file
Is this legal advice? No — it finds and quotes text. The agent’s summary is only as good as the passage it read; check the quote against the contract.
Does it handle 300 contracts? Licensed, yes: index once, and each question is two calls. Evaluation mode stops at 100 documents per index and 10 results per search.
Can I search contract metadata, such as the date signed? Dates written in the text: content: daterange(2026-01-01 ~~ 2026-06-30). File dates: modificationdate: daterange(…).
Add to your CLAUDE.md or AGENTS.md
Agents follow project instructions about when to use a tool. Paste this into the instruction file your agent reads (CLAUDE.md, AGENTS.md, .github/copilot-instructions.md, .cursorrules):
For questions about contracts in ./documents/contracts, use the groupdocs-search
MCP server: search with quoted phrases, then get_text_fragments to quote the
clause. Report contracts that mention the words without the clause separately.
Honest limits
Evaluation mode: an index holds at most 100 documents and a search returns at most 10 — the response says so in its evaluation field. Licensing.
Full-text, not semantic: it matches words, not meaning. Ask the agent to try variants (OR, fuzzy: true).
No OCR: scans without a text layer are indexed by their file properties only.
Docker only: there is no dnx channel for this product (why).