Skip to main content
Glama

create_docx

Create new blank Word documents with optional titles using the docx-mcp server. Specify filepath to generate documents for writing, editing, or content management.

Instructions

Create a new blank Word document.

Args: filepath: Path where to create the document title: Optional title for the document

Returns: Dictionary with status and document info

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filepathYes
titleNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The 'create_docx' tool handler function that creates a new blank Word document.
    @app.tool()
    def create_docx(filepath: str, title: Optional[str] = None) -> dict[str, Any]:
        """
        Create a new blank Word document.
    
        Args:
            filepath: Path where to create the document
            title: Optional title for the document
    
        Returns:
            Dictionary with status and document info
        """
        logger.info("Creating new document", extra={"tool": "create_docx", "filepath": filepath})
    
        try:
            path = normalize_path(filepath)
            path.parent.mkdir(parents=True, exist_ok=True)
    
            doc = Document()
    
            if title:
                doc.core_properties.title = title
    
            doc.save(str(path))
            logger.info("Document created successfully", extra={"filepath": filepath})
    
            return {
                "status": "success",
                "filepath": str(path),
                "message": f"Document created: {path.name}",
            }
        except DocxMcpError as e:
            logger.warning(e.message, extra={"tool": "create_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 creating document: {str(e)}")
            return {"status": "error", "error": str(e)}
Behavior2/5

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

With no annotations provided, the description carries full burden but lacks critical behavioral details. It doesn't disclose whether this operation requires file system permissions, if it overwrites existing files, what happens on failure, or any rate limits. The mention of 'Returns: Dictionary with status and document info' is minimal.

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 appropriately sized with three clear sections: purpose, args, returns. Each sentence earns its place, though the returns section could be more informative given the output schema exists.

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 2 parameters with 0% schema coverage, no annotations, but an output schema exists, the description is minimally adequate. It covers the basic purpose and parameters but lacks behavioral context, error handling, and comparison to siblings, leaving gaps for a file creation 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 adds basic meaning by explaining 'filepath: Path where to create the document' and 'title: Optional title for the document', which clarifies purpose beyond schema types. However, it doesn't provide format details, constraints, or examples.

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 creates a new blank Word document, specifying the verb 'Create' and resource 'Word document'. It distinguishes from siblings like 'copy_docx' or 'write_docx' by emphasizing 'new blank', but doesn't explicitly contrast with all alternatives.

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?

No guidance on when to use this tool versus alternatives like 'copy_docx' or 'write_docx' is provided. The description only states what it does, not when it's appropriate or what prerequisites might exist.

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