create_document
Create a new Polarion document in a project space, specifying its unique identifier, title, type, and optional custom fields or homepage content. Establishes an empty document ready for content.
Instructions
Create a new Polarion document in a space.
First call list_documents and confirm module_name is unique in the
space (a duplicate returns HTTP 409). Supply only enum ids from
list_document_enum_options — unverified ids persist as ghosts.
custom_fields keys are validated against the document type's existing
schema; a key no document of that type uses is rejected.
Starts empty (or with optional home_page_content); add parts later via
update_document / move_work_item_to_document. module_name is the
persistent URL identifier.
home_page_content is Markdown → sanitized HTML; post-create round-trip is
raw HTML via get_document(include_homepage_content_html=True) ↔
update_document. Each block element is stamped a unique
id="polarion_mcp_N" (else the next read_document_parts 500s);
<h1>..<h4> are skipped (rewritten to macro form on save).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | Polarion project ID. | |
| space_id | Yes | Space ID (use '_default' for the default space). | |
| module_name | Yes | Polarion document identifier (e.g. 'MySpecV1'); must be unique within ``space_id`` and appears in the document URL. | |
| title | Yes | Human-readable document title (required, non-empty). | |
| type | Yes | Document type (e.g. 'req_specification', 'generic'). | |
| status | No | Optional initial workflow status (project default applies if omitted). | |
| home_page_content | No | Optional Markdown body; converted to sanitized HTML on write. | |
| custom_fields | No | Optional custom fields keyed by Polarion field ID; take keys from a sibling document via get_document to avoid ghost keys; rich-text values must be ``{'type':'text/html','value':...}``. | |
| dry_run | No | When True, return the payload preview without writing; the enum guard still calls Polarion's getAvailableOptions, so that endpoint must be reachable. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| created | Yes | ||
| dry_run | Yes | ||
| document_name | Yes | ||
| payload_preview | Yes |