Skip to main content
Glama

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
NameRequiredDescriptionDefault
filepathYes
paragraph_indicesYes
bullet_styleNobullet

Implementation Reference

  • 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)}")
  • Tool registration using the @app.tool() decorator.
    @app.tool()

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Andrew82106/LLM_Docx_Agent_MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server