Skip to main content
Glama

set_document_properties

Set metadata like title, author, and keywords in Microsoft Word documents to organize and identify files effectively.

Instructions

Set document properties and metadata.

Args: filepath: Path to the document title: Document title subject: Document subject author: Document author keywords: Document keywords comments: Document comments

Returns: Dictionary with status

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filepathYes
titleNo
subjectNo
authorNo
keywordsNo
commentsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The set_document_properties tool handler function is registered with @app.tool() and manages the updating of core document properties using the python-docx library.
    @app.tool()
    def set_document_properties(
        filepath: str,
        title: Optional[str] = None,
        subject: Optional[str] = None,
        author: Optional[str] = None,
        keywords: Optional[str] = None,
        comments: Optional[str] = None,
    ) -> dict[str, Any]:
        """
        Set document properties and metadata.
    
        Args:
            filepath: Path to the document
            title: Document title
            subject: Document subject
            author: Document author
            keywords: Document keywords
            comments: Document comments
    
        Returns:
            Dictionary with status
        """
        logger.info(
            "Setting document properties",
            extra={"tool": "set_document_properties", "filepath": filepath},
        )
    
        try:
            doc = safe_open_document(filepath)
            props = doc.core_properties
    
            if title is not None:
                props.title = title
            if subject is not None:
                props.subject = subject
            if author is not None:
                props.author = author
            if keywords is not None:
                props.keywords = keywords
            if comments is not None:
                props.comments = comments
    
            safe_save_document(doc, filepath)
            logger.info("Document properties updated", extra={"filepath": filepath})
    
            return {
                "status": "success",
                "filepath": filepath,
                "message": "Document properties updated",
            }
        except DocxMcpError as e:
            logger.warning(
                e.message,
                extra={"tool": "set_document_properties", "error_code": e.error_code},
            )
            return {"status": "error", "error": e.message, "error_code": e.error_code}
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'Set' implies a mutation operation, the description doesn't specify whether this requires write permissions, if changes are destructive or reversible, what happens to existing properties not mentioned, or any rate limits. It mentions a return value ('Dictionary with status'), but doesn't explain what that status indicates (e.g., success/failure, error details).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and appropriately sized. It starts with a clear purpose statement, then lists parameters with brief semantics, and ends with return information. Every sentence earns its place, though the 'Args:' and 'Returns:' formatting could be more integrated into natural language for better flow.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that this is a mutation tool with 6 parameters, 0% schema description coverage, no annotations, but an output schema exists, the description is moderately complete. It covers the purpose and parameters adequately, but lacks behavioral context (permissions, side effects) and doesn't leverage the output schema to explain return values beyond 'Dictionary with status'. For a tool that modifies documents, more safety and usage context would be helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description lists all 6 parameters with brief explanations (e.g., 'filepath: Path to the document'), adding meaningful context beyond the schema. Since schema description coverage is 0%, this compensates well by clarifying what each parameter represents. However, it doesn't explain parameter interactions (e.g., that null values might leave properties unchanged) or format details (e.g., filepath syntax).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Set document properties and metadata.' This specifies the verb ('Set') and resource ('document properties and metadata'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'get_document_properties' or 'write_docx', which would require more specific context about when to use each.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With sibling tools like 'get_document_properties' (for reading properties) and 'write_docx' (which might also modify content), there's no indication of when this specific metadata-setting tool is appropriate. The description lacks any context about prerequisites, file formats supported, or typical use cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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