Skip to main content
Glama

magic_convert_pdf

Read-onlyIdempotent

Convert flat, unstructured legacy PDF invoices into compliant ZUGFeRD 2.5 PDF/A-3b files via guarded AI extraction with deterministic math and IBAN checks.

Instructions

Convert a flat, unstructured legacy PDF invoice (max 5 pages) into a compliant ZUGFeRD 2.5 PDF/A-3b using guarded AI extraction verified by deterministic BigDecimal math and ISO 13616 MOD-97 IBAN checks. Use ONLY when you have a flat PDF and no structured JSON; prefer embed_zugferd_pdf when structured JSON is available, or generate_erechnung when creating an invoice from scratch. Returns JSON with format ('ZUGFERD'), profile, filename, mimeType ('application/pdf'), sizeBytes, and pdfBase64 (or an actionable validation error if math/IBAN guardrails fail).

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "pdfBase64": "<pdfBase64>"
    },
    "name": "magic_convert_pdf"
  }
}

Input Schema

NameRequiredDescriptionDefault
profileNoCompliance profile: 'EN16931' for standard German B2B invoices (DATEV ZUGFeRD 2.5 Comfort), or 'XRECHNUNG' for strict KoSIT XRechnung 3.0.2 public-sector rules (requires buyerReference, seller email/phone, buyer email).EN16931
pdfBase64YesBase64-encoded flat legacy PDF invoice (1 to 5 pages) to extract and convert into ZUGFeRD 2.5 PDF/A-3b.
stampGiroCodeNoWhen true, stamps a scannable EPC SEPA GiroCode QR code onto the visual ZUGFeRD PDF using seller.bankDetails[0].iban.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv1.0.1
    • changedInput schema / properties / pdfBase64 / description
      Previous value: -"Base64-encoded legacy PDF invoice"New value: +"Base64-encoded flat legacy PDF invoice (1 to 5 pages) to extract and convert into ZUGFeRD 2.5 PDF/A-3b."
    • addedInput schema / properties / profile / description
      Added value: +"Compliance profile: 'EN16931' for standard German B2B invoices (DATEV ZUGFeRD 2.5 Comfort), or 'XRECHNUNG' for strict KoSIT XRechnung 3.0.2 public-sector rules (requires buyerReference, seller email/phone, buyer email)."
    • addedInput schema / properties / stampGiroCode / description
      Added value: +"When true, stamps a scannable EPC SEPA GiroCode QR code onto the visual ZUGFeRD PDF using seller.bankDetails[0].iban."
  2. First observedv1.0.0

TDQS

A4.4/5.0
Behavior4/5

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

Goes well beyond the annotations by disclosing the internal guardrails (AI extraction verified by deterministic BigDecimal math and ISO 13616 MOD-97 IBAN checks), the 5-page input limit, and the failure mode (actionable validation error if guardrails fail). With readOnlyHint and idempotentHint already covering safety, the remaining gap is only the absence of any note on processing time or partial-extraction behavior, which is minor.

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?

Two dense sentences, front-loaded with the action and scope, then routing guidance, then the return contract. Every clause carries decision-relevant information and nothing is repeated from the schema.

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

Completeness4/5

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

No output schema exists, yet the description enumerates the returned JSON fields (format, profile, filename, mimeType, sizeBytes, pdfBase64) and the error path, so an agent knows what to expect. It is nearly complete; only edge-case behavior on extraction failures versus validation failures is left implicit.

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?

Schema description coverage is 100% and each parameter already carries its own explanation, including the XRECHNUNG prerequisites and the GiroCode stamping source, so the description adds little per-parameter meaning. Its only additions are the 5-page input ceiling and the profile-independent output shape, which are marginal over the schema.

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?

States a precise verb and named resource transformation: a flat legacy PDF invoice is converted into a compliant ZUGFeRD 2.5 PDF/A-3b. It immediately distinguishes itself from embed_zugferd_pdf (structured JSON input) and generate_erechnung (create from scratch), so an agent can route without opening any schema.

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

Usage Guidelines5/5

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

Gives explicit inclusion criteria ("Use ONLY when you have a flat PDF and no structured JSON") and names two alternatives with the exact conditions that select them. This is a complete when/when-not/alternative decision rule.

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