Skip to main content
Glama
andr3medeiros

PDF Manipulation MCP Server

pdf_delete_page

Remove specific pages from PDF files to eliminate unwanted content or streamline documents for sharing and archiving.

Instructions

Delete a page from a PDF.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pdf_pathYes
page_numberYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The primary handler function for the 'pdf_delete_page' tool, including its @mcp.tool() decorator which handles registration in the FastMCP framework. It validates the PDF file and page number, deletes the specified page using PyMuPDF (fitz.Document.delete_page()), generates a timestamped output filename, saves the modified PDF, and returns the success message with the output path.
    @mcp.tool()
    async def pdf_delete_page(
        pdf_path: str,
        page_number: int
    ) -> str:
        """Delete a page from a PDF."""
        if not os.path.exists(pdf_path):
            return f"Error: PDF file not found: {pdf_path}"
        
        if not validate_pdf_file(pdf_path):
            return f"Error: Invalid PDF file: {pdf_path}"
        
        try:
            # Open PDF document
            doc = fitz.open(pdf_path)
            
            # Validate page number
            if not validate_page_number(doc, page_number):
                doc.close()
                return f"Error: Invalid page number {page_number}. Document has {len(doc)} pages."
            
            # Delete the page
            doc.delete_page(page_number)
            
            # Generate output filename
            output_path = generate_output_filename(pdf_path)
            
            # Save the modified PDF
            doc.save(output_path)
            doc.close()
            
            return f"Successfully deleted page {page_number + 1}. Output saved to: {output_path}"
            
        except Exception as e:
            return f"Error deleting page: {str(e)}"
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. While 'Delete' implies a destructive operation, it doesn't specify whether this permanently removes the page, creates a modified copy, or allows undo operations. There's no mention of file permissions, error conditions, or what happens to page numbering after deletion. For a mutation tool with zero annotation coverage, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly concise at just 6 words. Every word earns its place: 'Delete' specifies the action, 'a page' identifies the target, 'from a PDF' provides context. There's no redundancy or unnecessary elaboration. The structure is front-loaded with the core action immediately apparent.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive operation with 2 parameters and no annotations, the description is incomplete. While an output schema exists (which reduces the need to describe return values), the description doesn't address critical behavioral aspects like whether the original file is modified, what permissions are required, or how errors are handled. Given the complexity of file manipulation and the presence of many sibling tools, more context is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description mentions 'a page' which aligns with the page_number parameter, and 'from a PDF' which aligns with pdf_path. However, with 0% schema description coverage, the description doesn't add meaningful context beyond what's obvious from parameter names. It doesn't explain what format pdf_path expects (file path, URL, etc.) or whether page_number is 0-indexed or 1-indexed. The baseline is 3 since the description minimally acknowledges the parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Delete') and resource ('a page from a PDF'), making the purpose immediately understandable. It distinguishes itself from siblings like pdf_merge_files or pdf_split by focusing on page removal rather than file manipulation. However, it doesn't specify whether this modifies the original file or creates a new one, which would have made it a perfect 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With siblings like pdf_crop_page, pdf_rotate_page, and pdf_auto_crop_page that also modify individual pages, there's no indication of when deletion is preferable to other page-level operations. The description offers no context about prerequisites or typical use cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/andr3medeiros/pdf-manipulation-mcp-server'

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