generate_docx
Create ATS-optimized DOCX resumes from structured CV data. Provides a visual editor for layout customization and alternative format downloads.
Instructions
Generate an ATS-optimized DOCX from CV data.
Takes a complete CV JSON object (same structure as generate_cv template). All required fields (personal, experience, education, skills) must be filled in.
Returns:
file: absolute path to the generated DOCX file (saved in system temp directory)
editor_url: URL to open in the browser (http://localhost:5000/?load=) where the user can preview their CV visually, adjust layout/colors, and download alternative formats. The link expires after 5 minutes.
Args: cv_data: Complete CV data dictionary with all sections filled in.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cv_data | Yes |
Implementation Reference
- mcp_server.py:379-415 (handler)The `generate_docx` tool handler, which takes CV data, sends it to the configured CV Forge backend, saves the returned DOCX file to a temporary location, and returns the file path and editor URL.
@mcp.tool() def generate_docx(cv_data: dict) -> str: """Generate an ATS-optimized DOCX from CV data. Takes a complete CV JSON object (same structure as generate_cv template). All required fields (personal, experience, education, skills) must be filled in. Returns: - file: absolute path to the generated DOCX file (saved in system temp directory) - editor_url: URL to open in the browser (http://localhost:5000/?load=<token>) where the user can preview their CV visually, adjust layout/colors, and download alternative formats. The link expires after 5 minutes. Args: cv_data: Complete CV data dictionary with all sections filled in. """ base = _get_base_url() r = httpx.post( f"{base}/api/generate/docx", json=cv_data, timeout=30, ) r.raise_for_status() name = cv_data.get("personal", {}).get("name", "CV").replace(" ", "_") path = os.path.join(tempfile.gettempdir(), f"CV_{name}.docx") with open(path, "wb") as f: f.write(r.content) editor_url = _post_load_data(cv_data) return json.dumps({ "file": path, "editor_url": editor_url, "message": f"DOCX saved to {path}. Open {editor_url} to edit visually.", })