apply_bullet_list
Format paragraphs in Word documents as bulleted lists using various bullet styles like circles, squares, dashes, or checkmarks to organize content clearly.
Instructions
Apply bullet list formatting to paragraphs.
Args: filepath: Path to the document paragraph_indices: List of paragraph indices to bullet bullet_style: Type of bullet ('bullet', 'circle', 'square', 'dash', 'check')
Returns: Dictionary with status
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filepath | Yes | ||
| paragraph_indices | Yes | ||
| bullet_style | No | bullet |
Implementation Reference
- src/docx_mcp/server.py:707-756 (handler)Handler implementation for the apply_bullet_list tool.
def apply_bullet_list( filepath: str, paragraph_indices: list[int], bullet_style: str = "bullet", ) -> dict[str, Any]: """ Apply bullet list formatting to paragraphs. Args: filepath: Path to the document paragraph_indices: List of paragraph indices to bullet bullet_style: Type of bullet ('bullet', 'circle', 'square', 'dash', 'check') Returns: Dictionary with status """ logger.info("Applying bullet list", extra={"tool": "apply_bullet_list", "filepath": filepath}) try: doc = safe_open_document(filepath) # Validate indices for idx in paragraph_indices: if idx < 0 or idx >= len(doc.paragraphs): raise InvalidParameterError("paragraph_indices", f"Index {idx} out of range") # Apply bullet formatting using list style for idx in paragraph_indices: paragraph = doc.paragraphs[idx] # Use list format (list_number is the built-in bullet style) paragraph.paragraph_format.left_indent = Inches(0.5) paragraph.style = "List Bullet" safe_save_document(doc, filepath) logger.info( f"Applied bullet list to {len(paragraph_indices)} paragraphs", extra={"filepath": filepath}, ) return { "status": "success", "filepath": filepath, "paragraphs_updated": len(paragraph_indices), "bullet_style": bullet_style, } except DocxMcpError as e: logger.warning(e.message, extra={"tool": "apply_bullet_list", "error_code": e.error_code}) return {"status": "error", "error": e.message, "error_code": e.error_code} except Exception as e: logger.error(f"Unexpected error applying bullet list: {str(e)}") - src/docx_mcp/server.py:706-706 (registration)Tool registration using the @app.tool() decorator.
@app.tool()