Skip to main content
Glama

list_documents

Retrieve a list of all currently loaded documents with their metadata to manage and navigate document collections within the DocNav-MCP server.

Instructions

List all currently loaded documents.

Returns:
    List of loaded documents with their metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler for 'list_documents' that retrieves the list of loaded documents from the navigator, computes additional stats like heading count, and formats a human-readable output listing all documents with their metadata.
    @mcp.tool()
    def list_documents() -> str:
        """List all currently loaded documents.
    
        Returns:
            List of loaded documents with their metadata
        """
        documents = navigator.list_documents()
        if not documents:
            return "No documents currently loaded."
    
        output = "Loaded documents:\n"
        for doc in documents:
            document = navigator.get_document(doc["id"])
            headings_count = 0
            if document and document.index:
                headings = [
                    node for node in document.index.values() if node.type == "heading"
                ]
                headings_count = len(headings)
    
            output += (
                f"- {doc['title']} (ID: {doc['id']})\n"
                f"  Format: {doc['format']}, Sections: {headings_count}\n"
                f"  Source: {doc['source_type']}\n\n"
            )
    
        return output
  • Core helper method in DocumentNavigator class that returns a list of dictionaries, each containing the ID and metadata for all currently loaded documents.
    def list_documents(self) -> List[Dict[str, str]]:
        """List all loaded documents with their metadata.
    
        Returns:
            List of document info dictionaries
        """
        documents = []
        for doc_id, metadata in self.document_metadata.items():
            documents.append({"id": doc_id, **metadata})
        return documents
Behavior3/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 mentions that it returns 'List of loaded documents with their metadata', which adds some context about the output. However, it doesn't describe important behavioral aspects like whether this is a read-only operation, if it requires specific permissions, or if there are rate limits. The description provides basic output information but lacks comprehensive behavioral details.

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 extremely concise and well-structured. It uses just two sentences: one stating the purpose and one describing the return value. Every word earns its place with no wasted text, and the information is front-loaded with the core purpose stated first.

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

Completeness4/5

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

Given that the tool has 0 parameters, 100% schema coverage, and an output schema exists, the description is reasonably complete. It explains what the tool does and what it returns, which is sufficient for a simple list operation. However, it could benefit from more behavioral context (like whether it's safe to call frequently) since no annotations are provided.

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?

The tool has 0 parameters, and the input schema has 100% description coverage (though empty). The description doesn't need to explain any parameters, which is appropriate. Since there are no parameters to document, the description correctly focuses on the tool's function and output rather than parameter details.

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's purpose: 'List all currently loaded documents.' This specifies the verb ('List') and resource ('currently loaded documents'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'get_document_stats' or 'search_document', which prevents 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. With sibling tools like 'get_document_stats' (for statistics) and 'search_document' (for searching), there's no indication of when 'list_documents' is appropriate versus these other options. The description only states what it does, not when to use it.

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/shenyimings/DocNav-MCP'

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