AI to Word Document Generator

    Shared 12/3/2025

    258 views

    Visual Workflow

    JSON Code

    {
      "id": "8r85wSudwrm9NDHX",
      "meta": {
        "instanceId": "9d644af8fe730dfb972042f018ed45ff1dc2e7905a9737d59584dbe5b8c7f571",
        "templateCredsSetupCompleted": true
      },
      "name": "generate_full_word_documents_with_ai",
      "tags": [],
      "nodes": [
        {
          "id": "cd6f351e-33b6-4043-b7ce-80f13daa065a",
          "name": "On form submission",
          "type": "n8n-nodes-base.formTrigger",
          "position": [
            -176,
            -336
          ],
          "webhookId": "30e627b2-c325-4903-b942-48121ac7b880",
          "parameters": {
            "options": {},
            "formTitle": "Generate docx",
            "formFields": {
              "values": [
                {
                  "fieldType": "textarea",
                  "fieldLabel": "Prompt",
                  "placeholder": "Generate a template for an annual report",
                  "requiredField": true
                }
              ]
            },
            "formDescription": "Generate a Word file (docx) with company branding"
          },
          "typeVersion": 2.3
        },
        {
          "id": "f4723573-1ede-47f4-8079-425a8d754661",
          "name": "Download Docx",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            1696,
            352
          ],
          "parameters": {
            "url": "=https://api.json2doc.com/api/v1/files/{{ $json.data.outputFileId }}/download",
            "options": {
              "redirect": {
                "redirect": {}
              }
            },
            "sendHeaders": true,
            "authentication": "genericCredentialType",
            "genericAuthType": "httpHeaderAuth",
            "headerParameters": {
              "parameters": [
                {
                  "name": "Accept",
                  "value": "application/octet-stream"
                }
              ]
            }
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "h6bzgCoOBp1IylkJ",
              "name": "Json2Doc Public"
            }
          },
          "typeVersion": 4.3
        },
        {
          "id": "be6a0bb4-3234-4d7b-97d3-52f699a83954",
          "name": "Wait for Document Generation",
          "type": "n8n-nodes-base.wait",
          "position": [
            1200,
            352
          ],
          "webhookId": "590ddb1a-b901-412c-9ef4-3f176ba4a553",
          "parameters": {
            "amount": 3
          },
          "typeVersion": 1.1
        },
        {
          "id": "837a3ebb-1440-4895-96d8-e7a5d97de1cc",
          "name": "is Completed?",
          "type": "n8n-nodes-base.if",
          "position": [
            1520,
            352
          ],
          "parameters": {
            "options": {},
            "conditions": {
              "options": {
                "version": 2,
                "leftValue": "",
                "caseSensitive": true,
                "typeValidation": "strict"
              },
              "combinator": "and",
              "conditions": [
                {
                  "id": "27c14f40-8e32-4115-88f7-56098d814e71",
                  "operator": {
                    "type": "string",
                    "operation": "equals"
                  },
                  "leftValue": "={{ $json.data.status }}",
                  "rightValue": "COMPLETED"
                }
              ]
            }
          },
          "typeVersion": 2.2
        },
        {
          "id": "8fa8b24a-2c51-47ee-a135-558a1fc8a3a3",
          "name": "Sticky Note",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            -272,
            -416
          ],
          "parameters": {
            "color": 5,
            "width": 256,
            "height": 240,
            "content": "## Input Form\nTakes a Promt as input"
          },
          "typeVersion": 1
        },
        {
          "id": "89f33e7a-b32a-488e-8487-521eb750dbc7",
          "name": "Sticky Note1",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            16,
            -416
          ],
          "parameters": {
            "width": 304,
            "height": 288,
            "content": "## Create Json2Doc Session with Styling\n"
          },
          "typeVersion": 1
        },
        {
          "id": "dc5cbc80-5d04-4e98-a3c1-dcba1930e868",
          "name": "Sticky Note3",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            912,
            240
          ],
          "parameters": {
            "color": 6,
            "width": 1040,
            "height": 352,
            "content": "# **Create Document & Download**\n"
          },
          "typeVersion": 1
        },
        {
          "id": "f5183740-ffd5-4e48-a9cd-0f199f70ed65",
          "name": "Plan Document Structure",
          "type": "@n8n/n8n-nodes-langchain.agent",
          "position": [
            992,
            -320
          ],
          "parameters": {
            "text": "=The user wants to create a document with the following prompt:\n```\n {{ $('On form submission').item.json.Prompt }}\n```",
            "options": {
              "maxIterations": 10,
              "systemMessage": "=You are a professional document creator using only the Json2Doc MCP tool to get the correct schemas and create documents.\n\nCheck the user input and contiue working here:\n\nCreate an outline based on the user’s input. The output must be a JSON array.\nEach item in the array must be an object with:\n\n\"heading\" — the title of the section (Only top level sections)\n\"description\" — a markdown string with a detailed description of what this chapter should contain (which subchapters, relevant tables, etc.) \n\nLIMIT TO 5 CHAPTERS\n\nRequirements:\n\nOnly produce the JSON array, no explanations.\nAll descriptions must be short and concise."
            },
            "promptType": "define",
            "hasOutputParser": true
          },
          "typeVersion": 3
        },
        {
          "id": "91ff0049-e9c4-4c74-a2fa-cc0015eeaad1",
          "name": "Structured Output Parser1",
          "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
          "position": [
            1072,
            -112
          ],
          "parameters": {
            "autoFix": true,
            "schemaType": "manual",
            "inputSchema": "{\n  \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n  \"title\": \"SimpleOutline\",\n  \"type\": \"array\",\n  \"items\": {\n    \"type\": \"object\",\n    \"required\": [\"heading\", \"description\"],\n    \"properties\": {\n      \"heading\": {\n        \"type\": \"string\"\n      },\n      \"description\": {\n        \"type\": \"string\"\n      }\n    }\n  }\n}\n"
          },
          "typeVersion": 1.3
        },
        {
          "id": "4fc877d0-24ea-4ad2-ad88-57b42511331c",
          "name": "OpenRouter Chat Model1",
          "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
          "position": [
            1072,
            16
          ],
          "parameters": {
            "model": "openai/gpt-5-mini",
            "options": {}
          },
          "credentials": {
            "openRouterApi": {
              "id": "xyUU2VsFqfh6K7OQ",
              "name": "OpenRouter account"
            }
          },
          "typeVersion": 1
        },
        {
          "id": "29aded10-74c7-43ee-b13a-d538efec42c1",
          "name": "OpenRouter Chat Model2",
          "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
          "position": [
            960,
            -112
          ],
          "parameters": {
            "model": "openai/gpt-5.1-chat",
            "options": {}
          },
          "credentials": {
            "openRouterApi": {
              "id": "xyUU2VsFqfh6K7OQ",
              "name": "OpenRouter account"
            }
          },
          "typeVersion": 1
        },
        {
          "id": "98a3215d-e84d-408d-ac6e-0c85e67c5621",
          "name": "AI Agent",
          "type": "@n8n/n8n-nodes-langchain.agent",
          "position": [
            1840,
            -304
          ],
          "parameters": {
            "text": "=Now add the next chapter with the following headline and comprehensive content that matches the description. If necessary, subchapters may also be created:\n\nHeading: {{ $json.output.heading }}\nDescription: {{ $json.output.description }}",
            "options": {
              "maxIterations": 6,
              "systemMessage": "=You are a professional document creator using only the Json2Doc MCP tool to get the correct schemas and create sections. Your job is it to create one section based on the user Input and add this section to the jobSession\n\nCheck the user input and generate based on the information a new Section that should be added to the session with the id:\n```\n{{ $('Create new Json2Doc Session').first().json.data.sessionId }}\n```\n\n\nhow to proceed :\n1. if images are useful generate them with the Workflow tool first and reuse the output url in step 3 (limit to max 1 images)\n2. get the schema for sections from the Json2Doc tool\n3. generate ONE Json Definition for the section based on the schema from 2 containing all relevant elements and informations for this section. Always add numbering of headings. NOTE: DONT ADD CUSTOM STYLING, AS THIS IS ALREADY DEFINED GLOBAL (also applies to image width and height)\n\n4. Add the new section to the session with the json from 3 (if vaidation returns invalid retry until its valid and you get the job id).\n5. return just \"success\" after the response of 4\n\nBE STRICT FOLLOWING THESE STEPS\n\nfor context, here the complete planned document structure. Ensure that you do not create duplicate content form this refrence:\n```\n{{ $('Plan Document Structure').first().json.output.toJsonString() }}\n```"
            },
            "promptType": "define"
          },
          "executeOnce": false,
          "typeVersion": 3
        },
        {
          "id": "7f2f1b8a-ebf7-450a-974b-ebba09e10c1f",
          "name": "MCP Client",
          "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
          "position": [
            1904,
            -112
          ],
          "parameters": {
            "include": "selected",
            "options": {},
            "endpointUrl": "https://mcp.json2doc.com/mcp",
            "includeTools": [
              "Get_section_schema",
              "Add_a_section_to_the_document"
            ],
            "authentication": "headerAuth"
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "h6bzgCoOBp1IylkJ",
              "name": "Json2Doc Public"
            }
          },
          "typeVersion": 1.2
        },
        {
          "id": "ee9afe13-4772-43e1-b134-6660766cdcee",
          "name": "Generate Document from Session",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            992,
            352
          ],
          "parameters": {
            "url": "=https://api.json2doc.com/api/v1/document-builder/{{ $('Create new Json2Doc Session').first().json.data.sessionId }}\n/build",
            "method": "POST",
            "options": {},
            "authentication": "genericCredentialType",
            "genericAuthType": "httpHeaderAuth"
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "h6bzgCoOBp1IylkJ",
              "name": "Json2Doc Public"
            }
          },
          "typeVersion": 4.3
        },
        {
          "id": "2faa47aa-363c-419b-9b15-37a7fd0a0380",
          "name": "Anthropic Chat Model1",
          "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
          "position": [
            1744,
            -128
          ],
          "parameters": {
            "model": {
              "__rl": true,
              "mode": "list",
              "value": "claude-haiku-4-5-20251001",
              "cachedResultName": "Claude Haiku 4.5"
            },
            "options": {
              "maxTokensToSample": 8000
            }
          },
          "credentials": {
            "anthropicApi": {
              "id": "Z42XVzspYjSpsh7A",
              "name": "Anthropic account"
            }
          },
          "typeVersion": 1.3
        },
        {
          "id": "8b9126a6-6ad4-45b7-916d-bd0bc6ad79c7",
          "name": "Get Job Status",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            1360,
            352
          ],
          "parameters": {
            "url": "=https://api.json2doc.com/api/v1/jobs/{{ $('Generate Document from Session').item.json.data.jobId }}",
            "options": {
              "redirect": {
                "redirect": {}
              }
            },
            "sendHeaders": true,
            "authentication": "genericCredentialType",
            "genericAuthType": "httpHeaderAuth",
            "headerParameters": {
              "parameters": [
                {}
              ]
            }
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "h6bzgCoOBp1IylkJ",
              "name": "Json2Doc Public"
            }
          },
          "typeVersion": 4.3
        },
        {
          "id": "3b1efea0-fde7-4b3b-ba32-378faaa6b74c",
          "name": "Sticky Note4",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            896,
            -416
          ],
          "parameters": {
            "color": 3,
            "width": 1312,
            "height": 560,
            "content": "# Generate the Chapters"
          },
          "typeVersion": 1
        },
        {
          "id": "95ef978e-db7f-4f86-a10e-bd76fc21bdbe",
          "name": "When Executed by Another Workflow",
          "type": "n8n-nodes-base.executeWorkflowTrigger",
          "position": [
            80,
            224
          ],
          "parameters": {
            "workflowInputs": {
              "values": [
                {
                  "name": "prompt"
                }
              ]
            }
          },
          "typeVersion": 1.1
        },
        {
          "id": "5eacbdc1-454e-4712-8dad-7463530ef8e8",
          "name": "Generate an image",
          "type": "@n8n/n8n-nodes-langchain.googleGemini",
          "position": [
            256,
            224
          ],
          "parameters": {
            "prompt": "={{ $json.prompt }}, (format 16:9, white background)",
            "modelId": {
              "__rl": true,
              "mode": "list",
              "value": "models/imagen-4.0-generate-preview-06-06",
              "cachedResultName": "models/imagen-4.0-generate-preview-06-06"
            },
            "options": {},
            "resource": "image"
          },
          "credentials": {
            "googlePalmApi": {
              "id": "UKLaAhgWyM0Oi3hv",
              "name": "Google Gemini Api account - Free Credits"
            }
          },
          "typeVersion": 1
        },
        {
          "id": "08f0038f-e10c-4c47-9940-1e7cd12cde60",
          "name": "Upload Image",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            464,
            224
          ],
          "parameters": {
            "url": "https://api.json2doc.com/api/v1/files/upload",
            "method": "POST",
            "options": {},
            "sendBody": true,
            "contentType": "multipart-form-data",
            "authentication": "genericCredentialType",
            "bodyParameters": {
              "parameters": [
                {
                  "name": "ttlHours",
                  "value": "1"
                },
                {
                  "name": "file",
                  "parameterType": "formBinaryData",
                  "inputDataFieldName": "data"
                }
              ]
            },
            "genericAuthType": "httpHeaderAuth"
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "h6bzgCoOBp1IylkJ",
              "name": "Json2Doc Public"
            }
          },
          "typeVersion": 4.3
        },
        {
          "id": "67a0131b-3357-4387-8e70-57ed30deeae4",
          "name": "Edit Fields",
          "type": "n8n-nodes-base.set",
          "position": [
            608,
            224
          ],
          "parameters": {
            "options": {},
            "assignments": {
              "assignments": [
                {
                  "id": "f7cd820b-d554-4e3e-a60e-f311de6db783",
                  "name": "data.storageUrl",
                  "type": "string",
                  "value": "={{ $json.data.storageUrl }}"
                }
              ]
            }
          },
          "typeVersion": 3.4
        },
        {
          "id": "3a7d2e01-a04f-432a-be14-b567def25637",
          "name": "Call '1_generate_full_word_documents_with_ai_extended'1",
          "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
          "position": [
            2032,
            -32
          ],
          "parameters": {
            "workflowId": {
              "__rl": true,
              "mode": "list",
              "value": "8r85wSudwrm9NDHX",
              "cachedResultUrl": "/workflow/8r85wSudwrm9NDHX",
              "cachedResultName": "1r_generate_full_word_documents_with_ai_extended"
            },
            "description": "Call this tool to generate an image and get its local path to use in a document section",
            "workflowInputs": {
              "value": {
                "prompt": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('prompt', ``, 'string') }}"
              },
              "schema": [
                {
                  "id": "prompt",
                  "type": "string",
                  "display": true,
                  "required": false,
                  "displayName": "prompt",
                  "defaultMatch": false,
                  "canBeUsedToMatch": true
                }
              ],
              "mappingMode": "defineBelow",
              "matchingColumns": [
                "prompt"
              ],
              "attemptToConvertTypes": false,
              "convertFieldsToString": false
            }
          },
          "typeVersion": 2.2
        },
        {
          "id": "730a1e36-8bff-48dc-9cca-4554bf2f5fdc",
          "name": "Create new Json2Doc Session",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            112,
            -336
          ],
          "parameters": {
            "url": "https://api.json2doc.com/api/v1/document-builder",
            "method": "POST",
            "options": {
              "redirect": {
                "redirect": {}
              }
            },
            "jsonBody": "{\n  \"config\": {\n  \"document\": {\n    \"type\": \"docx\",\n    \"filename\": \"generated-docx\",\n    \"title\": \"generated-docx\"\n  },\n  \"defaults\": \n  {\n    \"fontFamily\": \"Arial\",\n    \"fontSize\": 11,\n    \"color\": \"#333333\",\n    \"lineHeight\": 1.5,\n    \"spacing\": {\n      \"before\": {\n        \"h1\": 24,\n        \"h2\": 18,\n        \"h3\": 14,\n        \"text\": 0,\n        \"table\": 15,\n        \"list\": 10,\n        \"image\": 15\n      },\n      \"after\": {\n        \"h1\": 18,\n        \"h2\": 14,\n        \"h3\": 10,\n        \"text\": 12,\n        \"table\": 15,\n        \"list\": 10,\n        \"image\": 15\n      }\n    },\n    \"styles\": {\n      \"h1\": {\n        \"fontSize\": 28,\n        \"fontWeight\": \"bold\",\n        \"color\": \"#0066cc\",\n        \"align\": \"center\"\n      },\n      \"h2\": {\n        \"fontSize\": 22,\n        \"fontWeight\": \"bold\",\n        \"color\": \"#0077dd\"\n      },\n      \"h3\": {\n        \"fontSize\": 18,\n        \"fontWeight\": \"bold\",\n        \"color\": \"#333333\"\n      },\n      \"text\": {\n        \"fontSize\": 11,\n        \"lineHeight\": 1.4,\n        \"align\": \"justify\"\n      },\n      \"text2\": {\n        \"fontSize\": 9,\n        \"color\": \"#666666\",\n        \"align\": \"center\"\n      },\n      \"table\": {\n        \"borders\": {\n          \"outer\": {\n            \"width\": 1,\n            \"color\": \"#333333\",\n            \"style\": \"solid\"\n          },\n          \"inner\": {\n            \"width\": 0.5,\n            \"color\": \"#999999\",\n            \"style\": \"solid\"\n          }\n        },\n        \"header\": {\n          \"backgroundColor\": \"#f0f0f0\",\n          \"color\": \"#000000\",\n          \"fontSize\": 12,\n          \"fontWeight\": \"bold\",\n          \"fontStyle\": \"normal\",\n          \"align\": \"center\"\n        },\n        \"rows\": {\n          \"backgroundColor\": \"#ffffff\",\n          \"color\": \"#333333\",\n          \"fontSize\": 11,\n          \"fontWeight\": \"normal\",\n          \"fontStyle\": \"normal\",\n          \"align\": \"left\",\n          \"alternateBackgroundColor\": \"#f8f9fa\"\n        },\n        \"cellPadding\": {\n          \"top\": 8,\n          \"right\": 8,\n          \"bottom\": 8,\n          \"left\": 8\n        }\n      },\n      \"image\": {\n        \"width\": 300\n      }\n    },\n    \"header\": {\n      \"left\": \"Documents LLC\",\n      \"right\": {\n        \"type\": \"image\",\n        \"src\": \"https://img.icons8.com/cotton/64/business-group.png\",\n        \"width\": 32,\n        \"alt\": \"Company Logo\"\n      },\n      \"excludeFirstPage\": false\n    },\n    \"footer\": {\n      \"center\": \"Page {{pageNumber}} of {{totalPages}}\",\n      \"align\": \"center\",\n      \"excludeFirstPage\": false\n    }\n  },\n  \"sections\": []\n}\n}",
            "sendBody": true,
            "specifyBody": "json",
            "authentication": "genericCredentialType",
            "genericAuthType": "httpHeaderAuth"
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "h6bzgCoOBp1IylkJ",
              "name": "Json2Doc Public"
            }
          },
          "typeVersion": 4.3
        },
        {
          "id": "31501467-dd17-4d60-aca1-775677f03124",
          "name": "Loop Over Items",
          "type": "n8n-nodes-base.splitInBatches",
          "position": [
            1632,
            -320
          ],
          "parameters": {
            "options": {
              "reset": false
            }
          },
          "typeVersion": 3
        },
        {
          "id": "67cab999-41e5-4b2a-bfef-434c52cf4568",
          "name": "Split Out",
          "type": "n8n-nodes-base.splitOut",
          "position": [
            1424,
            -320
          ],
          "parameters": {
            "include": "allOtherFields",
            "options": {},
            "fieldToSplitOut": "output"
          },
          "typeVersion": 1
        },
        {
          "id": "8c732fa5-fe0c-488a-b6c3-82075b19e2ec",
          "name": "Aggregate",
          "type": "n8n-nodes-base.aggregate",
          "position": [
            1424,
            0
          ],
          "parameters": {
            "options": {},
            "aggregate": "aggregateAllItemData"
          },
          "typeVersion": 1
        },
        {
          "id": "15af17f0-8ec2-4dd4-ac96-e6f3df5a83ba",
          "name": "Sticky Note2",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            16,
            176
          ],
          "parameters": {
            "width": 816,
            "height": 224,
            "content": "## Image Generation for Agent"
          },
          "typeVersion": 1
        },
        {
          "id": "2308b92e-ab3f-47d5-beb0-4fe28ed42ed3",
          "name": "MCP Client1",
          "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
          "position": [
            576,
            -128
          ],
          "parameters": {
            "include": "selected",
            "options": {},
            "endpointUrl": "https://mcp.json2doc.com/mcp",
            "includeTools": [
              "Get_section_schema",
              "Add_a_section_to_the_document"
            ],
            "authentication": "headerAuth"
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "h6bzgCoOBp1IylkJ",
              "name": "Json2Doc Public"
            }
          },
          "typeVersion": 1.2
        },
        {
          "id": "73a07c3c-d1da-48d0-8f7e-486fbb6744ed",
          "name": "Anthropic Chat Model",
          "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
          "position": [
            416,
            -144
          ],
          "parameters": {
            "model": {
              "__rl": true,
              "mode": "list",
              "value": "claude-haiku-4-5-20251001",
              "cachedResultName": "Claude Haiku 4.5"
            },
            "options": {
              "maxTokensToSample": 8000
            }
          },
          "credentials": {
            "anthropicApi": {
              "id": "Z42XVzspYjSpsh7A",
              "name": "Anthropic account"
            }
          },
          "typeVersion": 1.3
        },
        {
          "id": "aad4a9c9-9523-4556-96be-383711e9d61e",
          "name": "Call '1_generate_full_word_documents_with_ai_extended'",
          "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
          "position": [
            704,
            -48
          ],
          "parameters": {
            "workflowId": {
              "__rl": true,
              "mode": "list",
              "value": "qR9AoAFPqlhoPOqn",
              "cachedResultUrl": "/workflow/qR9AoAFPqlhoPOqn",
              "cachedResultName": "1_generate_full_word_documents_with_ai_extended"
            },
            "description": "Call this tool to generate an image and get its local path to use in a document section",
            "workflowInputs": {
              "value": {
                "prompt": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('prompt', ``, 'string') }}"
              },
              "schema": [
                {
                  "id": "prompt",
                  "type": "string",
                  "display": true,
                  "removed": false,
                  "required": false,
                  "displayName": "prompt",
                  "defaultMatch": false,
                  "canBeUsedToMatch": true
                }
              ],
              "mappingMode": "defineBelow",
              "matchingColumns": [
                "prompt"
              ],
              "attemptToConvertTypes": false,
              "convertFieldsToString": false
            }
          },
          "typeVersion": 2.2
        },
        {
          "id": "16de3917-b02f-44d0-bd13-eba0c1e38273",
          "name": "Generate Title Page",
          "type": "@n8n/n8n-nodes-langchain.agent",
          "position": [
            528,
            -336
          ],
          "parameters": {
            "text": "=The user wants to create a document with the following prompt:\n```\n {{ $('On form submission').item.json.Prompt }}\n```",
            "options": {
              "maxIterations": 6,
              "systemMessage": "=You are a professional document creator using only the Json2Doc MCP tool to get the correct schemas and create sections. Your job is it to create one section based on the user Input and add this section to the jobSession. You only genereate the Title page With centered Content and a Title Image\n\nCheck the user input and generate based on the information a new Section that should be added to the session with the id:\n```\n{{ $('Create new Json2Doc Session').first().json.data.sessionId }}\n```\n\n\nhow to proceed :\n1. Generate the title page image with the Workflow tool first and reuse the output url in step 3 (limit to max 1 images)\n2. get the schema for sections from the Json2Doc tool\n3. generate ONE Json Definition for the section based on the schema from 2 containing a headline and a sub header as well as an image for the title page. Use the type \"page\" for this section.\nHere is an example:\n```\n{\n      \"type\": \"page\",\n      \"align\": \"center\",\n      \"content\": [\n        {\n          \"type\": \"h1\",\n          \"text\": \"company name\",\n          \"fontSize\": 28,\n          \"color\": \"#0066cc\",\n          \"align\": \"center\"\n        },\n        {\n          \"type\": \"h2\",\n          \"text\": \"sub heading\",\n          \"fontSize\": 20,\n          \"color\": \"#333333\",\n          \"align\": \"center\"\n        },\n        {\n          \"type\": \"text\",\n          \"text\": \"*more informations*\",\n          \"fontSize\": 16,\n          \"color\": \"#666666\",\n          \"align\": \"center\"\n        },\n        {\n          \"type\": \"image\",\n          \"src\": \"/image/2025-10-31/cmh107bik0001116um9xyurjo/efa92fae-411c-489b-b71e-d6fca197ca65.png\",\n          \"height\": 100,\n          \"align\": \"center\"\n        }\n      ]\n    }\n```\n\n4. Add the new section to the session with the json from 3 (if vaidation returns invalid retry until its valid and you get the job id).\n5. return just \"success\" after the response of 4\n\nBE STRICT FOLLOWING THESE STEPS"
            },
            "promptType": "define"
          },
          "executeOnce": false,
          "typeVersion": 3
        },
        {
          "id": "22f408b1-7b49-4805-8092-678bf9e61c62",
          "name": "Sticky Note5",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            352,
            -416
          ],
          "parameters": {
            "color": 3,
            "width": 480,
            "height": 528,
            "content": "# Generate first page"
          },
          "typeVersion": 1
        }
      ],
      "active": false,
      "pinData": {},
      "settings": {
        "executionOrder": "v1"
      },
      "versionId": "a6e056f2-969b-4412-99b7-3dce2633672d",
      "connections": {
        "AI Agent": {
          "main": [
            [
              {
                "node": "Loop Over Items",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Aggregate": {
          "main": [
            [
              {
                "node": "Generate Document from Session",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Split Out": {
          "main": [
            [
              {
                "node": "Loop Over Items",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "MCP Client": {
          "ai_tool": [
            [
              {
                "node": "AI Agent",
                "type": "ai_tool",
                "index": 0
              }
            ]
          ]
        },
        "MCP Client1": {
          "ai_tool": [
            [
              {
                "node": "Generate Title Page",
                "type": "ai_tool",
                "index": 0
              }
            ]
          ]
        },
        "Upload Image": {
          "main": [
            [
              {
                "node": "Edit Fields",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "is Completed?": {
          "main": [
            [
              {
                "node": "Download Docx",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Wait for Document Generation",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Get Job Status": {
          "main": [
            [
              {
                "node": "is Completed?",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Loop Over Items": {
          "main": [
            [
              {
                "node": "Aggregate",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "AI Agent",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Generate an image": {
          "main": [
            [
              {
                "node": "Upload Image",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "On form submission": {
          "main": [
            [
              {
                "node": "Create new Json2Doc Session",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Generate Title Page": {
          "main": [
            [
              {
                "node": "Plan Document Structure",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Anthropic Chat Model": {
          "ai_languageModel": [
            [
              {
                "node": "Generate Title Page",
                "type": "ai_languageModel",
                "index": 0
              }
            ]
          ]
        },
        "Anthropic Chat Model1": {
          "ai_languageModel": [
            [
              {
                "node": "AI Agent",
                "type": "ai_languageModel",
                "index": 0
              }
            ]
          ]
        },
        "OpenRouter Chat Model1": {
          "ai_languageModel": [
            [
              {
                "node": "Structured Output Parser1",
                "type": "ai_languageModel",
                "index": 0
              }
            ]
          ]
        },
        "OpenRouter Chat Model2": {
          "ai_languageModel": [
            [
              {
                "node": "Plan Document Structure",
                "type": "ai_languageModel",
                "index": 0
              }
            ]
          ]
        },
        "Plan Document Structure": {
          "main": [
            [
              {
                "node": "Split Out",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Structured Output Parser1": {
          "ai_outputParser": [
            [
              {
                "node": "Plan Document Structure",
                "type": "ai_outputParser",
                "index": 0
              }
            ]
          ]
        },
        "Create new Json2Doc Session": {
          "main": [
            [
              {
                "node": "Generate Title Page",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Wait for Document Generation": {
          "main": [
            [
              {
                "node": "Get Job Status",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Generate Document from Session": {
          "main": [
            [
              {
                "node": "Wait for Document Generation",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "When Executed by Another Workflow": {
          "main": [
            [
              {
                "node": "Generate an image",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Call '1_generate_full_word_documents_with_ai_extended'": {
          "ai_tool": [
            [
              {
                "node": "Generate Title Page",
                "type": "ai_tool",
                "index": 0
              }
            ]
          ]
        },
        "Call '1_generate_full_word_documents_with_ai_extended'1": {
          "ai_tool": [
            [
              {
                "node": "AI Agent",
                "type": "ai_tool",
                "index": 0
              }
            ]
          ]
        }
      }
    }