Skip to main content
Glama

get_document_properties

Extract document properties and metadata from Microsoft Word files to analyze file details and content information.

Instructions

Get document properties and metadata.

Args: filepath: Path to the document

Returns: Dictionary with document properties

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filepathYes

Implementation Reference

  • The implementation of the get_document_properties tool, which retrieves document metadata using python-docx and registers the function with the FastMCP application.
    @app.tool()
    def get_document_properties(filepath: str) -> dict[str, Any]:
        """
        Get document properties and metadata.
    
        Args:
            filepath: Path to the document
    
        Returns:
            Dictionary with document properties
        """
        logger.info(
            "Getting document properties",
            extra={"tool": "get_document_properties", "filepath": filepath},
        )
    
        try:
            doc = safe_open_document(filepath)
            props = doc.core_properties
    
            return {
                "status": "success",
                "filepath": filepath,
                "properties": {
                    "title": props.title or "",
                    "subject": props.subject or "",
                    "author": props.author or "",
                    "keywords": props.keywords or "",
                    "comments": props.comments or "",
                    "category": props.category or "",
                    "created": str(props.created) if props.created else None,
                    "modified": str(props.modified) if props.modified else None,
                },
            }
        except DocxMcpError as e:
            logger.warning(
                e.message,
                extra={"tool": "get_document_properties", "error_code": e.error_code},
            )
            return {"status": "error", "error": e.message, "error_code": e.error_code}

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