Skip to main content
Glama
kitan23

Dedalus MCP Documentation Server

by kitan23

list_docs

Browse available documentation files to locate specific resources or explore content structure within the Dedalus MCP Documentation Server.

Instructions

List all available documentation files

Args:
    directory: Optional subdirectory to list (relative to docs root)

Returns:
    List of document metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directoryNo

Implementation Reference

  • The handler function for the 'list_docs' tool. It lists all markdown documentation files recursively from the specified directory (defaulting to DOCS_DIR), retrieves metadata for each, and returns a sorted list.
    @mcp.tool()
    def list_docs(directory: Optional[str] = None) -> List[Dict[str, Any]]:
        """
        List all available documentation files
    
        Args:
            directory: Optional subdirectory to list (relative to docs root)
    
        Returns:
            List of document metadata
        """
        search_dir = DOCS_DIR
        if directory:
            search_dir = DOCS_DIR / directory
    
        if not search_dir.exists():
            return []
    
        docs = []
        for file_path in search_dir.rglob('*.md'):
            if file_path.is_file():
                docs.append(get_doc_metadata(file_path))
    
        return sorted(docs, key=lambda x: x['path'])
  • Helper utility function used by list_docs to extract metadata (title, path, modified date, size, hash) from each documentation file, with caching.
    def get_doc_metadata(file_path: Path) -> Dict[str, Any]:
        """Extract metadata from markdown files"""
        if file_path in METADATA_CACHE:
            return METADATA_CACHE[file_path]
    
        metadata = {
            'title': file_path.stem.replace('-', ' ').title(),
            'path': str(file_path.relative_to(DOCS_DIR)),
            'modified': datetime.fromtimestamp(file_path.stat().st_mtime).isoformat(),
            'size': file_path.stat().st_size,
            'hash': hashlib.md5(file_path.read_bytes()).hexdigest(),
        }
    
        # Try to extract title from first # heading
        try:
            content = file_path.read_text()
            lines = content.split('\n')
            for line in lines[:10]:  # Check first 10 lines
                if line.startswith('# '):
                    metadata['title'] = line[2:].strip()
                    break
        except (OSError, UnicodeDecodeError):
            pass
    
        METADATA_CACHE[file_path] = metadata
        return metadata
  • src/main.py:178-178 (registration)
    The @mcp.tool() decorator that registers the list_docs function as an MCP tool.
    @mcp.tool()
  • Docstring providing schema description: input parameter 'directory' (optional str), output List[Dict[str, Any]] of document metadata.
    """
    List all available documentation files
    
    Args:
        directory: Optional subdirectory to list (relative to docs root)
    
    Returns:
        List of document metadata
    """

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/kitan23/Python_MCP_Server_Example_2'

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