Skip to main content
Glama

list_documents

Retrieve a list of all currently loaded documents and their metadata within the DocNav-MCP server. Simplify document management and analysis for enhanced navigation.

Instructions

List all currently loaded documents.

Returns: List of loaded documents with their metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler for 'list_documents' that retrieves document list from navigator, computes heading counts, and formats a human-readable output listing all loaded documents with 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 containing metadata for all 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

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

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