Skip to main content
Glama

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
NameRequiredDescriptionDefault
path_filterNo

Implementation Reference

  • 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)

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/Wildebeest/mcp_pdf_forms'

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