list_loaded_pdfs
View all PDF files currently loaded in the PDF Redaction MCP Server to manage document processing workflows.
Instructions
List all currently loaded PDF files.
Returns: List of loaded PDF file paths
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/redact_mcp/server.py:360-377 (handler)The core handler function for the 'list_loaded_pdfs' tool. It iterates over the global _loaded_pdfs dictionary to list all loaded PDF paths with their page counts. Decorated with @mcp.tool for automatic registration.@mcp.tool async def list_loaded_pdfs(ctx: Context = None) -> str: """List all currently loaded PDF files. Returns: List of loaded PDF file paths """ if not _loaded_pdfs: return "No PDFs currently loaded." loaded_list = "\n".join( f"- {path} ({len(doc)} pages)" for path, doc in _loaded_pdfs.items() ) await ctx.info(f"Currently {len(_loaded_pdfs)} PDF(s) loaded") return f"Currently loaded PDFs:\n{loaded_list}"
- src/redact_mcp/server.py:16-17 (helper)Global dictionary that stores loaded PDF documents by their file paths. This is the key data structure used by the list_loaded_pdfs handler and other PDF-related tools.# Store for loaded PDFs (in-memory, keyed by file path) _loaded_pdfs: dict[str, fitz.Document] = {}
- src/redact_mcp/server.py:360-360 (registration)The @mcp.tool decorator registers the list_loaded_pdfs function as an MCP tool.@mcp.tool