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
| Name | Required | Description | Default |
|---|---|---|---|
| directory | No |
Implementation Reference
- src/main.py:178-202 (handler)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'])
- src/main.py:125-151 (helper)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()
- src/main.py:180-188 (schema)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 """