list_pdfs
Find PDF files across directories with optional filtering to locate specific documents quickly.
Instructions
List PDF files in configured base paths
Args:
path_filter: Optional string to filter PDF paths
Returns:
List of PDF paths matching the filter
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path_filter | No |
Implementation Reference
- mcp_pdf_forms/server.py:19-50 (handler)The main handler function for the 'list_pdfs' tool. It walks through configured base directories (BASE_PATHS), finds all PDF files, applies an optional path_filter, and returns a sorted list of matching PDF paths.@mcp.tool() def list_pdfs(path_filter: Optional[str] = None) -> List[str]: """ List PDF files in configured base paths Args: path_filter: Optional string to filter PDF paths Returns: List of PDF paths matching the filter """ results = [] for base_path in BASE_PATHS: base = Path(base_path) if not base.exists(): continue for root, _, files in os.walk(base): root_path = Path(root) for file in files: if file.lower().endswith(".pdf"): pdf_path = root_path / file path_str = str(pdf_path) # Apply filter if provided if path_filter and path_filter not in path_str: continue results.append(path_str) return sorted(results)