Skip to main content
Glama

list_available_documents

Retrieve a list of all .docx files in a specified directory using this tool. Easily identify and manage Word documents for AI-assisted operations like editing, merging, or converting documents.

Instructions

List all .docx files in the specified directory.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directoryNo.

Implementation Reference

  • The main asynchronous handler function that lists all .docx files in the specified directory (default current directory), including their sizes in KB. Returns a formatted string with the list or error message.
    async def list_available_documents(directory: str = ".") -> str:
        """List all .docx files in the specified directory.
        
        Args:
            directory: Directory to search for Word documents
        """
        try:
            if not os.path.exists(directory):
                return f"Directory {directory} does not exist"
            
            docx_files = [f for f in os.listdir(directory) if f.endswith('.docx')]
            
            if not docx_files:
                return f"No Word documents found in {directory}"
            
            result = f"Found {len(docx_files)} Word documents in {directory}:\n"
            for file in docx_files:
                file_path = os.path.join(directory, file)
                size = os.path.getsize(file_path) / 1024  # KB
                result += f"- {file} ({size:.2f} KB)\n"
            
            return result
        except Exception as e:
            return f"Failed to list documents: {str(e)}"
  • Registration/Export of the list_available_documents tool function from document_tools.py, making it available as part of the tools package for the MCP server.
    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 the full burden of behavioral disclosure. It states the tool lists files but does not mention critical behaviors like whether it requires read permissions, how it handles errors (e.g., invalid directories), or if it includes subdirectories. For a tool with zero annotation coverage, this leaves significant gaps in understanding its operational traits.

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, direct sentence that efficiently conveys the core functionality without unnecessary words. It is front-loaded with the main action and resource, making it easy to parse and understand quickly, which is ideal for conciseness.

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 the tool's low complexity (one parameter, no output schema, no annotations), the description is minimally adequate but incomplete. It covers the basic purpose and parameter intent but lacks details on behavior, error handling, or output format, which are important for a tool interacting with a file system. This results in a description that meets the bare minimum but could be more informative.

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?

With 0% schema description coverage and only one parameter ('directory'), the description adds value by specifying that it lists '.docx files' and uses 'the specified directory'. This clarifies the parameter's purpose beyond the schema's generic 'Directory' title, though it does not detail format constraints (e.g., absolute vs. relative paths). Since there are no parameters beyond this, the description adequately compensates for the low schema coverage.

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 ('List') and resource ('.docx files in the specified directory'), making the tool's purpose immediately understandable. However, it does not explicitly differentiate from sibling tools like 'get_document_info' or 'get_document_text', which might also retrieve document information but in different ways.

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, such as 'get_document_info' for metadata or 'find_text_in_document' for content-based searches. It lacks context about prerequisites, exclusions, or specific use cases, leaving the agent to infer usage from the purpose alone.

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