Document Generation
Approach
Use python-docx + Jinja2 templates stored in ~/personal/servers/estate-planning-mcp/templates/.
This is more flexible than Docassemble for family office documents that require
customization per entity and jurisdiction.
Tool Routing
estate-planning: entity/person/ownership context and document linkage metadata
paperless: uploaded document storage, tags, correspondents, and retrieval
household-tax: only when tax-language assumptions are required for narrative sections
finance-graph: only when valuation history must be cited inside a document appendix
- Do not write finance-fact payloads into estate-planning document metadata
Template Types
| Template |
Use Case |
Key Variables |
| trust-amendment |
Modify trust provisions |
trust_name, amendment_number, changes, effective_date |
| llc-operating-agreement |
New LLC formation |
llc_name, members, percentages, jurisdiction, manager |
| power-of-attorney |
Grant POA |
principal, agent, scope, jurisdiction, effective_date |
| certificate-of-trust |
Prove trust existence |
trust_name, trustee, formation_date, jurisdiction |
| assignment-of-assets |
Transfer assets to entity |
asset_description, from_party, to_entity, date |
| beneficiary-designation |
Designate beneficiaries |
account, primary_beneficiary, contingent, percentages |
Generation Workflow
Step 1: Gather Data from Estate Graph
Query estate-planning for:
- Entity details:
get_entity (name, type, jurisdiction, formation date, grantor, trustee)
- People details:
get_person (legal name, address, tax ID)
- Ownership:
get_ownership_graph (current ownership structure)
- Existing documents: linked docs to avoid duplication
Step 2: Select Template
Match the document need to a template. If no template exists:
- Note the gap
- Generate the document from scratch using python-docx
- Save the new template for future use
Step 3: Fill Template Variables
Map estate-planning data to template variables:
- Legal names (not preferred names)
- Full addresses
- Tax IDs (only when required by the document type)
- Dates in jurisdiction-appropriate format
- Entity-specific terms (e.g., "Member" for LLC, "Beneficiary" for trust)
Step 4: Generate Document
Execute python-docx code to render the template with variables.
Apply formatting:
- Professional formatting (margins, fonts, spacing)
- Page numbers
- Signature blocks with date lines
- Notary acknowledgment blocks where required
Step 5: Upload to Paperless-ngx
Via paperless tools:
- Upload the generated .docx as a new document
- Title:
[Doc Type] - [Entity Name] - YYYY-MM-DD
- Tags:
legal, appropriate secondary tags
- Correspondent: The entity or attorney
- Link in estate-planning:
link_document (or upsert_document_metadata) to associate with entity/asset
Output Contract
Return:
- Generated document filename and template used
- Linked
paperless_doc_id
- Linked estate object IDs (
entity_id / asset_id / person_id)
- Open attorney-review flags (witness/notary/jurisdiction-specific checks)
Important Constraints
- Not legal advice: All generated documents should be reviewed by a qualified attorney
- Wet signatures required: Estate docs (wills, trusts, deeds) require wet signatures and often notarization — e-sign is insufficient
- Jurisdiction-specific: Templates must account for jurisdiction-specific requirements (e.g., witness requirements, notary formats differ by state)
- Version control: Always include amendment number and effective date; never overwrite prior versions
- Confidential: Generated documents contain sensitive information (tax IDs, ownership, valuations)
1---2name: document-generation3description: Generate estate planning documents using python-docx and Jinja2 templates. Covers trust amendments, LLC agreements, powers of attorney, and other estate documents. Generated docs are uploaded to Paperless-ngx.4---56# Document Generation78## Approach910Use python-docx + Jinja2 templates stored in `~/personal/servers/estate-planning-mcp/templates/`.11This is more flexible than Docassemble for family office documents that require12customization per entity and jurisdiction.1314## Tool Routing1516- `estate-planning`: entity/person/ownership context and document linkage metadata17- `paperless`: uploaded document storage, tags, correspondents, and retrieval18- `household-tax`: only when tax-language assumptions are required for narrative sections19- `finance-graph`: only when valuation history must be cited inside a document appendix20- Do not write finance-fact payloads into estate-planning document metadata2122## Template Types2324| Template | Use Case | Key Variables |25|----------|----------|---------------|26| trust-amendment | Modify trust provisions | trust_name, amendment_number, changes, effective_date |27| llc-operating-agreement | New LLC formation | llc_name, members, percentages, jurisdiction, manager |28| power-of-attorney | Grant POA | principal, agent, scope, jurisdiction, effective_date |29| certificate-of-trust | Prove trust existence | trust_name, trustee, formation_date, jurisdiction |30| assignment-of-assets | Transfer assets to entity | asset_description, from_party, to_entity, date |31| beneficiary-designation | Designate beneficiaries | account, primary_beneficiary, contingent, percentages |3233## Generation Workflow3435### Step 1: Gather Data from Estate Graph3637Query `estate-planning` for:38- Entity details: `get_entity` (name, type, jurisdiction, formation date, grantor, trustee)39- People details: `get_person` (legal name, address, tax ID)40- Ownership: `get_ownership_graph` (current ownership structure)41- Existing documents: linked docs to avoid duplication4243### Step 2: Select Template4445Match the document need to a template. If no template exists:46- Note the gap47- Generate the document from scratch using python-docx48- Save the new template for future use4950### Step 3: Fill Template Variables5152Map estate-planning data to template variables:53- Legal names (not preferred names)54- Full addresses55- Tax IDs (only when required by the document type)56- Dates in jurisdiction-appropriate format57- Entity-specific terms (e.g., "Member" for LLC, "Beneficiary" for trust)5859### Step 4: Generate Document6061Execute python-docx code to render the template with variables.62Apply formatting:63- Professional formatting (margins, fonts, spacing)64- Page numbers65- Signature blocks with date lines66- Notary acknowledgment blocks where required6768### Step 5: Upload to Paperless-ngx6970Via paperless tools:711. Upload the generated .docx as a new document722. Title: `[Doc Type] - [Entity Name] - YYYY-MM-DD`733. Tags: `legal`, appropriate secondary tags744. Correspondent: The entity or attorney755. Link in estate-planning: `link_document` (or `upsert_document_metadata`) to associate with entity/asset7677## Output Contract7879Return:80- Generated document filename and template used81- Linked `paperless_doc_id`82- Linked estate object IDs (`entity_id` / `asset_id` / `person_id`)83- Open attorney-review flags (witness/notary/jurisdiction-specific checks)8485## Important Constraints8687- **Not legal advice**: All generated documents should be reviewed by a qualified attorney88- **Wet signatures required**: Estate docs (wills, trusts, deeds) require wet signatures and often notarization — e-sign is insufficient89- **Jurisdiction-specific**: Templates must account for jurisdiction-specific requirements (e.g., witness requirements, notary formats differ by state)90- **Version control**: Always include amendment number and effective date; never overwrite prior versions91- **Confidential**: Generated documents contain sensitive information (tax IDs, ownership, valuations)