Skip to main content
Glama

append_docx

Add text to existing Word documents. Use this tool to append content to DOCX files by specifying the file path and text to add.

Instructions

Append text content to an existing document.

Args: filepath: Path to the document content: Text content to append

Returns: Dictionary with status

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filepathYes
contentYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The implementation of the append_docx tool. It uses safe_open_document to open the existing document, appends paragraphs, and then saves it using safe_save_document.
    @app.tool()
    def append_docx(filepath: str, content: str) -> dict[str, Any]:
        """
        Append text content to an existing document.
    
        Args:
            filepath: Path to the document
            content: Text content to append
    
        Returns:
            Dictionary with status
        """
        logger.info("Appending to document", extra={"tool": "append_docx", "filepath": filepath})
    
        try:
            doc = safe_open_document(filepath)
    
            for paragraph_text in content.split("\n"):
                if paragraph_text.strip():
                    doc.add_paragraph(paragraph_text)
    
            safe_save_document(doc, filepath)
            logger.info("Content appended successfully", extra={"filepath": filepath})
    
            return {
                "status": "success",
                "filepath": filepath,
                "message": "Content appended successfully",
            }
        except DocxMcpError as e:
            logger.warning(e.message, extra={"tool": "append_docx", "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 appending to document: {str(e)}")
            return {"status": "error", "error": str(e)}
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. It states the action 'Append text content' but lacks details on behavioral traits such as permissions needed, whether the operation is idempotent, error handling, or effects on document formatting. This is a significant gap for a mutation tool.

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 front-loaded with the core purpose in the first sentence, followed by structured Args and Returns sections. It is efficient with minimal waste, though the 'Returns' section could be more informative beyond 'Dictionary with status'.

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 no annotations, 0% schema coverage, and an output schema exists (though unspecified), the description is moderately complete. It covers the basic action and parameters but lacks details on behavioral context, error cases, and output specifics, making it adequate but with clear gaps for a document mutation tool.

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

Parameters3/5

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

Schema description coverage is 0%, so the description must compensate. It lists parameters 'filepath' and 'content' with brief explanations, adding some meaning beyond the bare schema. However, it does not provide details like filepath format constraints or content handling (e.g., encoding, size limits), leaving gaps in parameter understanding.

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 verb 'Append' and the resource 'text content to an existing document', making the purpose understandable. However, it does not explicitly differentiate from sibling tools like 'write_docx' or 'create_docx', which might have overlapping functions, so it lacks sibling differentiation for a perfect score.

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. It does not mention prerequisites (e.g., document must exist), exclusions, or comparisons to siblings like 'write_docx' or 'create_docx', leaving usage context unclear.

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