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 )

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