Skip to main content
Glama
pdfdotco

PDF.co MCP Server

Official
by pdfdotco

ai_invoice_parser

Extract structured data from invoices using AI. Provide a PDF URL to get parsed invoice fields.

Instructions

AI Invoice Parser: Extracts data from invoices using AI.
Ref: https://developer.pdf.co/api-reference/ai-invoice-parser.md

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL to the source PDF file. Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files.
api_keyNoPDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)

Implementation Reference

  • Helper function parse_invoice() that makes the actual API request to the 'ai-invoice-parser' endpoint.
    async def parse_invoice(params: ConversionParams, api_key: str | None = None) -> BaseResponse:
        return await request("ai-invoice-parser", params, api_key=api_key)
  • The lower-level request() helper that builds the payload, calls the API via PDFCoClient, and returns a BaseResponse.
    async def request(
        endpoint: str,
        params: ConversionParams,
        custom_payload: dict | None = None,
        api_key: str | None = None,
    ) -> BaseResponse:
        payload = params.parse_payload(async_mode=True)
        if custom_payload:
            payload.update(custom_payload)
    
        try:
            async with PDFCoClient(api_key=api_key) as client:
                url = f"/v1/{endpoint}"
                print(f"Requesting {url} with payload {payload}", file=sys.stderr)
                response = await client.post(url, json=payload)
                print(f"response: {response}", file=sys.stderr)
                json_data = response.json()
                return BaseResponse(
                    status="working",
                    content=json_data,
                    credits_used=json_data.get("credits"),
                    credits_remaining=json_data.get("remainingCredits"),
                    tips=f"You **should** use the 'wait_job_completion' tool to wait for the job [{json_data.get('jobId')}] to complete if a jobId is present.",
                )
        except Exception as e:
            return BaseResponse(
                status="error",
                content=f"{type(e)}: {[arg for arg in e.args if arg]}",
            )
Behavior2/5

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

No annotations are present, so the description bears full responsibility. It only states 'Extracts data' without disclosing behavior like auth requirements, rate limits, or whether the operation is destructive. The agent cannot infer safety or side effects.

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 extremely concise with a single sentence and a reference link. While efficient, it sacrifices informativeness; still, every word earns its place.

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?

The tool has no output schema and no annotations, yet the description omits return value format or behavior. For a data extraction tool, this is a significant gap. The reference link partially compensates but is not inline.

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 input schema has 100% description coverage (both url and api_key are documented). However, the tool description adds no additional meaning beyond the schema; it merely restates the purpose. Baseline score of 3 is appropriate.

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 verb and resource: 'Extracts data from invoices using AI.' It distinguishes itself from sibling tools like pdf_to_text by specifying invoice-specific AI extraction, though it could be more precise about what kind of data is extracted.

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 is provided on when to use this tool versus alternatives (e.g., pdf_to_text for generic text, find_table for tables, fill_forms for forms). The agent has no context for selection.

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/pdfdotco/pdfco-mcp'

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