Skip to main content
Glama

convert_to_pdfa

Convert any PDF to PDF/A archival format for long-term preservation, ensuring compliance with ISO standards.

Instructions

Convert a PDF to PDF/A archival format.

Args: pdf_base64: Base64-encoded PDF file.

Returns: Base64-encoded PDF/A file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pdf_base64Yes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler that accepts a base64-encoded PDF, decodes it, calls the DocGen PdfToolsClient.to_pdfa() method, and returns the base64-encoded PDF/A result.
    @mcp.tool()
    def convert_to_pdfa(pdf_base64: str) -> str:
        """Convert a PDF to PDF/A archival format.
    
        Args:
            pdf_base64: Base64-encoded PDF file.
    
        Returns:
            Base64-encoded PDF/A file.
        """
        dg = _get_client()
        result = dg.pdf_tools.to_pdfa(base64.b64decode(pdf_base64))
        return base64.b64encode(result).decode()
  • The @mcp.tool() decorator registers convert_to_pdfa as an MCP tool on the FastMCP server instance.
    @mcp.tool()
  • PdfToolsClient.to_pdfa() sends a POST /api/pdf-tools/pdfa/base64 request with the base64-encoded PDF and returns the PDF/A bytes.
    def to_pdfa(self, pdf: FileInput) -> bytes:
        """Convert a PDF to PDF/A format for archival.
    
        Args:
            pdf: PDF to convert.
    
        Returns:
            PDF/A bytes.
        """
        return self._transport.request_bytes(
            "POST", "/api/pdf-tools/pdfa/base64",
            json={"pdfBase64": to_base64(pdf)},
        )
  • Schema/type definition: the tool accepts a single string parameter 'pdf_base64' and returns a string (both base64-encoded). Defined inline via Python type hints.
    def convert_to_pdfa(pdf_base64: str) -> str:
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. It only states conversion to PDF/A and returns base64, but does not mention whether the conversion is lossy, if metadata is preserved, or any specific PDF/A version compliance.

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

Conciseness4/5

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

The description is brief and to the point, using a docstring format that separates Args and Returns. It contains no extraneous information, though the formatting could be slightly more streamlined.

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

Completeness3/5

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

For a simple tool with one parameter and an output schema (indicated but not provided), the description is adequate but lacks details about the PDF/A version, error handling, or comparison to sibling archival tools like validate_zugferd.

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

Parameters4/5

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

The description adds meaning to the single parameter 'pdf_base64' by clarifying it is a 'Base64-encoded PDF file.' The input schema only provides the title 'Pdf Base64', so the description fills a gap, though it could specify expected encoding format.

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

Purpose5/5

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

The description clearly states the tool converts a PDF to PDF/A archival format. The verb 'Convert' and the resource 'PDF to PDF/A' are specific, distinguishing it from sibling tools like merge_pdfs or rotate_pdf.

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?

No guidance on when to use this tool vs alternatives such as validate_zugferd or extract_text_from_pdf. There is no mention of prerequisites (e.g., input must be a valid PDF) or situations where conversion is not appropriate.

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/dokmatiq/docgen-sdks'

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