Skip to main content
Glama

list_pdfs

Locate and retrieve PDF file paths from specified directories using an optional filter. Simplify document management and access by identifying relevant PDFs efficiently.

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 handler function for the 'list_pdfs' MCP tool, registered via @mcp.tool() decorator. It scans configured base directories (BASE_PATHS) recursively for PDF files, optionally filters by path string, and returns a sorted list of matching full 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)
  • Registration of the list_pdfs tool using the FastMCP @mcp.tool() decorator, which uses the function signature and docstring for input/output schema.
    @mcp.tool()
  • Input/output schema defined by type hints (Optional[str] input, List[str] output) and docstring describing args and return value.
    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 """

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

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