Tool & function calling
AuraScore 83/100

M&A Data Room Query Pipeline Builder

Creates a structured tool-calling Python script for querying virtual data rooms and extracting critical legal due diligence clauses.

Use this template when setting up automated legal and accounting workflows to search, extract, and structure contractual risks during corporate acquisitions.

Template

Role: Principal Legal Technology Automation Engineer specializing in M&A due diligence pipelines and function-calling architectures.

Context

  • Virtual data room provider: {{vdr_provider}}
  • Due diligence focus domain: {{due_diligence_domain}}
  • Target corporate structure: {{target_entity_type}}
  • Max text chunks per query: {{max_document_chunks}}
  • Semantic similarity cutoff: {{confidence_cutoff}}
  • Search operational mode: {{retrieval_mode}}

Task

Develop an agentic tool definition specification and Python dispatch script that allows an LLM agent to execute semantic searches, pull raw agreement clauses from {{vdr_provider}}, filter by confidence scores, and summarize compliance risks for {{due_diligence_domain}} reviews.

Method

  1. Define JSON schemas for two core tools: search_deal_room and extract_contract_clause.
  2. Configure search parameter arguments enforcing {{retrieval_mode}} and pagination limits set to {{max_document_chunks}}.
  3. Write Python client functions handling simulated API handshakes with {{vdr_provider}}.
  4. Build a filter mechanism that discards extracted clauses falling below {{confidence_cutoff}}.
  5. Structure output normalization logic to tag identified risks against {{target_entity_type}} standard warranties.
  6. Implement defensive validation to prevent prompt injection or out-of-scope document retrieval.
  7. Provide an executable demo showing the tool invocation cycle for an indemnification or termination clause search.

Constraints

  • Code MUST be written in clean Python 3 with strict dictionary typing.
  • MUST NOT process queries exceeding the specified chunk limit {{max_document_chunks}}.
  • Tool schemas must adhere precisely to JSON Schema Draft-07 conventions.
  • Returned payloads MUST include document metadata (document name, page number, confidence score).

Output format

1. Tool Declaration Specification

JSON schemas containing descriptive metadata and typed parameter definitions.

2. Orchestration Script

Executable Python script defining the tool handlers and dispatch registry (80-130 lines).

3. Sample Execution Log

A mock payload demonstrating an agent function call and the resulting normalized JSON response.

Self-review

  • Confirm that {{confidence_cutoff}} is used inside the clause filtering loop.
  • Verify metadata fields include page numbers and document identifiers.
  • Ensure schema parameter descriptions are sufficiently clear for zero-shot LLM tool selection.
AuraScore breakdown
83/100Provisional
Instruction clarity15/15 · Strong

Explicit role, a named task, and discrete steps the model can follow.

Context architecture12/12 · Strong

Background, inputs and variables the model needs before it starts.

Constraint engineering12/12 · Strong

Hard boundaries — what the model must and must not do.

Output specification6/14 · Thin

A named, field-level shape for the response.

Reasoning structure10/10 · Strong

Ordered work items that force analysis before an answer.

Model compatibility10/10 · Strong

Length and structure that travel across frontier models.

Token efficiency7/10 · Adequate

Signal density — instruction weight without padding.

Reusability7/7 · Strong

Documented variables so the scaffold adapts to new inputs.

Robustness3/5 · Adequate

Quality bar, assumptions and behaviour when inputs are thin.

Observed performance1/5 · Thin

How much real usage the template has behind it.

ai-agents
agents-tool-calling
professional-services
function-calling
legaltech
due-diligence