Skip to main content
Glama

copy_document

Duplicate a Word document by specifying source and optional destination filenames. Enables quick replication of content for editing, sharing, or backup purposes within a Word document management system.

Instructions

Create a copy of a Word document.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
destination_filenameNo
source_filenameYes

Implementation Reference

  • MCP tool registration for 'copy_document'. This is the entrypoint where the tool is registered with the FastMCP server using @mcp.tool() decorator. It delegates to the implementation in document_tools.
    async def copy_document(source_filename: str, destination_filename: Optional[str] = None):
        """Create a copy of a Word document."""
        return await document_tools.copy_document(source_filename, destination_filename)
  • The main handler function that executes the copy_document tool logic. Ensures .docx extensions and calls the file_utils helper to perform the copy.
    async def copy_document(source_filename: str, destination_filename: Optional[str] = None) -> str:
        """Create a copy of a Word document.
        
        Args:
            source_filename: Path to the source document
            destination_filename: Optional path for the copy. If not provided, a default name will be generated.
        """
        source_filename = ensure_docx_extension(source_filename)
        
        if destination_filename:
            destination_filename = ensure_docx_extension(destination_filename)
        
        success, message, new_path = create_document_copy(source_filename, destination_filename)
        if success:
            return message
        else:
            return f"Failed to copy document: {message}"
  • Supporting utility function that performs the actual file copying using shutil.copy2, generates destination name if needed, and handles errors.
    def create_document_copy(source_path: str, dest_path: Optional[str] = None) -> Tuple[bool, str, Optional[str]]:
        """
        Create a copy of a document.
        
        Args:
            source_path: Path to the source document
            dest_path: Optional path for the new document. If not provided, will use source_path + '_copy.docx'
            
        Returns:
            Tuple of (success, message, new_filepath)
        """
        if not os.path.exists(source_path):
            return False, f"Source document {source_path} does not exist", None
        
        if not dest_path:
            # Generate a new filename if not provided
            base, ext = os.path.splitext(source_path)
            dest_path = f"{base}_copy{ext}"
        
        try:
            # Simple file copy
            shutil.copy2(source_path, dest_path)
            return True, f"Document copied to {dest_path}", dest_path
        except Exception as e:
            return False, f"Failed to copy document: {str(e)}", None
  • Import registration in tools package __init__.py, exposing copy_document for use in main.py.
    from word_document_server.tools.document_tools import (
        create_document, get_document_info, get_document_text, 
        get_document_outline, list_available_documents, 
        copy_document, merge_documents
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the tool creates a copy, implying a write operation, but does not disclose behavioral traits such as permissions needed, whether it overwrites existing files, error handling, or output format. This leaves significant gaps 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.

Conciseness5/5

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

The description is a single, efficient sentence with no wasted words, making it easy to parse and front-loaded with the core action. It appropriately sized for the tool's apparent simplicity.

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

Completeness2/5

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

Given the complexity of a mutation tool with no annotations, 2 parameters, 0% schema coverage, and no output schema, the description is incomplete. It lacks details on behavior, error cases, output, and how it integrates with other document tools, making it inadequate for safe and effective use by an AI agent.

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 implies parameters for source and destination but does not explain their semantics, such as filename formats, path requirements, or default behaviors. Since there are 2 parameters and no schema descriptions, the baseline is 3, as the description adds minimal value beyond the schema's structure.

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 action ('Create a copy') and resource ('Word document'), making the purpose evident. However, it does not differentiate from siblings like 'create_document' or 'convert_to_pdf', which also involve document operations, so it lacks sibling distinction.

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 is provided on when to use this tool versus alternatives. For example, it does not specify if this is for duplicating existing documents versus creating new ones from scratch, or how it differs from 'create_document' or other document manipulation tools in the sibling list.

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

Related 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/franlealp1/mcp-word'

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