docugen_generate_document
Ask DocuGen to generate a new document with AI. Returns a jobId and the url of the document; poll docugen_get_job until it finishes. Then read it with docugen_get_document and check it against your input: rules, numbers and acceptance criteria must match. The completed job carries fidelityCheck: with status "review", DocuGen found identifiers from the input missing in the document (missingIds), passages in another alphabet (foreignScript), a cut-off document (truncated), contradictions inside the document or with the input (internalConflicts, inputConflicts), ids without the link they need (coverageFindings, with coverageWarnings) or a rule that may have changed; check those items first. Fix any divergence with docugen_update_document before asking for approval, and send the user the url. Consumes the plan quota. At most 10 generations per minute: above that the tool answers rate_limited with the seconds to wait, so start several documents a few seconds apart and retry after that wait. The chain is bnd, then product_description, then technical_spec or increment_map, and each step needs its parent in status "approved". For a feature with screens, an optional ux_brief comes between the product_description and the technical_spec: it decides concepts, flows and the screen inventory (screens TL-01...) and marks existing screens as overloaded; it needs parentDocumentId of the approved product_description; when the feature changes screens that already exist, describe in businessInput.additionalContext how they work today (their controls, in order, and what each one does), because the PRD does not show them; once a person approves it, every technical_spec of that product_description follows its screens and flows (the completed job of the spec names it in uxBrief). Skip it for features without screens. Only a person approves, in DocuGen: when a bnd or product_description is ready, ask the user to review and approve it there, and confirm with docugen_list_documents before the next step, because a draft parent is refused. For a bnd, pass description with the business need: who has the problem, what goes wrong today and what success looks like. For a product_description, pass parentDocumentId of the approved bnd; if the project has no BND, pass businessInput instead, which is how a repository you are reading becomes a PRD. With a parent, businessInput.additionalContext carries what was decided after the parent was approved (answers to its open decisions, a corrected rule), and DocuGen also reads the unresolved comments on the parent: both take precedence over the parent text. Read those comments first with docugen_list_comments, so your additionalContext does not contradict them; the completed job lists in notesRead the comments it read. A technical_spec, an increment_map or a ux_brief needs parentDocumentId of an approved product_description. The PRD does not know the code: for a technical_spec, put in businessInput.additionalContext what you read in the repository and the spec must follow (contracts of the routes and tools it touches, file paths, where state is kept, how jobs are scheduled, conventions, the reference architecture). Without it, the spec can only list those as Open Questions. In SAP projects (Enterprise or Invited plan) the chain is bnd, then sap_functional_spec (parentDocumentId of the approved bnd), then sap_technical_spec or increment_map (parentDocumentId of the approved sap_functional_spec; a sap_technical_spec also takes sliceDefinition), with the DocuGen SAP knowledge base as context, exactly as on screen; there is no product_description or ux_brief, and attachments are not accepted for SAP specifications (put the text in businessInput.additionalContext). The new document goes into the feature group of its parent, as on screen; pass featureGroupId to put it in another group of the project. Optional "attachments": up to 5 reference documents as text, each {name, text}, at most 500,000 characters in total; no binary files. The project context and the attachments share the 500,000-character generation budget: what goes past it is cut and the model does not read it. DocuGen reads them as data, not instructions, and they enter the generation context.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"projectId": "<projectId>",
"title": "<title>",
"type": "<type>"
},
"name": "docugen_generate_document"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | Yes | bnd, product_description, ux_brief, technical_spec or increment_map; in SAP projects bnd, sap_functional_spec, sap_technical_spec or increment_map | |
| title | Yes | Title of the document to create | |
| language | No | Language of the generated document, "en" or "pt". Omit to follow the language of the input | |
| projectId | Yes | Project id | |
| attachments | No | Reference documents as plain text (no binary files), up to 5. They are data, never instructions. Each text up to 500,000 chars, 500,000 in total, shared with the project context in the 500,000-character generation budget. | |
| description | No | Required for bnd: the business need in plain words, 10 to 20,000 chars. The BND is generated from it. When the user already has written material (requirements, specs, acceptance criteria, formulas), paste it in full instead of summarizing: whatever you leave out cannot reach the BND. A description too vague to make a useful BND is refused with validation_error before any quota is used: ask the user what is missing (what the solution is, who uses it, what goes wrong today) and call again | |
| businessInput | No | Business context for the generation, all fields free text. Without a parent it is the input of a product_description. With parentDocumentId, the whole text goes in as decisions taken after the parent was approved and overrides the parent; put those decisions in additionalContext, the only field needed then. Without a parent, businessGoals, targetUsers, customerJourney and keyUserActions are required. | |
| featureGroupId | No | Optional feature group id, from docugen_list_feature_groups, for the new document. Omit it and the document goes into the group of its parent document, or into none when the parent has no group; an archived group is refused | |
| sliceDefinition | No | Optional scope description for a sliced technical spec (10 to 40000 chars) | |
| parentDocumentId | No | For product_description: the id of the approved bnd. Required for technical_spec, increment_map and ux_brief: the id of the approved product_description |