Skip to main content
Glama
marc-hanheide

PDF Redaction MCP Server

list_applied_redactions

View all text redactions applied to PDF documents to prevent duplicate redactions and track processed content.

Instructions

List all redactions that have been applied to loaded PDF(s).

This tool shows which texts have been marked for redaction in each PDF, helping to avoid duplicate redactions and track what has already been processed.

Args: pdf_path: Optional path to a specific PDF. If not provided, lists all PDFs. ctx: MCP context for logging

Returns: List of applied redactions for the specified PDF(s)

Raises: ToolError: If a specific PDF path is provided but not loaded

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pdf_pathNoOptional path to a specific PDF file. If not provided, lists redactions for all loaded PDFs

Implementation Reference

  • The handler function for the 'list_applied_redactions' tool. It retrieves and formats the list of texts that have been redacted from one or all loaded PDFs using the global _applied_redactions dictionary. Includes input schema via Annotated[Field]. Registered via @mcp.tool decorator.
    @mcp.tool async def list_applied_redactions( pdf_path: Annotated[str | None, Field( description="Optional path to a specific PDF file. If not provided, lists redactions for all loaded PDFs" )] = None, ctx: Context = None ) -> str: """List all redactions that have been applied to loaded PDF(s). This tool shows which texts have been marked for redaction in each PDF, helping to avoid duplicate redactions and track what has already been processed. Args: pdf_path: Optional path to a specific PDF. If not provided, lists all PDFs. ctx: MCP context for logging Returns: List of applied redactions for the specified PDF(s) Raises: ToolError: If a specific PDF path is provided but not loaded """ try: if pdf_path: # List redactions for a specific PDF path = Path(pdf_path).resolve() path_str = str(path) if path_str not in _loaded_pdfs: raise ToolError(f"PDF not loaded: {path}") redactions = _applied_redactions.get(path_str, []) if not redactions: await ctx.info(f"No redactions applied to: {path}") return f"No redactions have been applied to: {path}" redaction_list = "\n".join(f" - '{text}'" for text in redactions) result = ( f"Applied redactions for: {path}\n" f"Total: {len(redactions)} text(s) redacted\n\n" f"{redaction_list}" ) await ctx.info(f"Listed {len(redactions)} redaction(s) for {path}") return result else: # List redactions for all loaded PDFs if not _applied_redactions: await ctx.info("No redactions applied to any PDF") return "No redactions have been applied to any loaded PDFs." results = [] total_count = 0 for pdf_path_str, redactions in _applied_redactions.items(): if redactions: # Only show PDFs with redactions redaction_list = "\n".join(f" - '{text}'" for text in redactions) results.append( f" {pdf_path_str}:\n" f" Total: {len(redactions)} text(s)\n" f"{redaction_list}" ) total_count += len(redactions) if not results: await ctx.info("No redactions applied to any PDF") return "No redactions have been applied to any loaded PDFs." result = ( f"Applied redactions across all loaded PDFs:\n" f"Total PDFs with redactions: {len(results)}\n" f"Total texts redacted: {total_count}\n\n" + "\n\n".join(results) ) await ctx.info(f"Listed redactions for {len(results)} PDF(s), {total_count} total texts") return result except ToolError: raise except Exception as e: await ctx.error(f"Failed to list redactions: {str(e)}") raise ToolError(f"Failed to list redactions: {str(e)}")

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/marc-hanheide/redact_mcp'

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