Skip to main content
Glama

parse_erechnung

Read-onlyIdempotent

Extracts structured invoice header, seller, buyer, bank IBAN, tax breakdown, and line items from ZUGFeRD PDFs, XRechnung XML, or legacy flat PDFs and returns verified JSON.

Instructions

Extract structured invoice header, seller, buyer, bank IBAN, tax breakdown, and line items from a ZUGFeRD PDF, XRechnung XML, or legacy flat PDF. Extracts embedded XML deterministically in ~20ms (source='NATIVE_XML') or falls back to guarded extraction on flat PDFs (source='AI_EXTRACTED'). Use for data extraction (Empfangspflicht); use validate_erechnung instead for strict KoSIT/veraPDF compliance checks. Returns JSON with source, math_verified, iban_valid, invoiceNumber, issueDate, currency, seller, buyer, items[], netTotal, vatTotal, and grossTotal.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "parse_erechnung"
  }
}

Input Schema

NameRequiredDescriptionDefault
filenameNoOptional original filename ending in .pdf or .xml.
fileBase64NoBase64-encoded ZUGFeRD PDF, flat legacy PDF, or XRechnung XML file to parse (provide either fileBase64 or xmlContent).
xmlContentNoRaw UTF-8 XRechnung or Factur-X XML string to parse (alternative to fileBase64).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv1.0.1
    • changedInput schema / properties / fileBase64 / description
      Previous value: -"Base64-encoded ZUGFeRD PDF, legacy PDF, or XML"New value: +"Base64-encoded ZUGFeRD PDF, flat legacy PDF, or XRechnung XML file to parse (provide either fileBase64 or xmlContent)."
    • changedInput schema / properties / filename / description
      Previous value: -"Original filename ending in .pdf or .xml"New value: +"Optional original filename ending in .pdf or .xml."
    • changedInput schema / properties / xmlContent / description
      Previous value: -"Raw UTF-8 XRechnung / Factur-X XML string"New value: +"Raw UTF-8 XRechnung or Factur-X XML string to parse (alternative to fileBase64)."
  2. First observedv1.0.0

TDQS

A4.6/5.0
Behavior5/5

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

Goes well beyond the readOnly/idempotent/non-destructive annotations by disclosing the two internal execution paths: deterministic embedded-XML extraction in ~20ms (source='NATIVE_XML') versus guarded AI extraction on flat PDFs (source='AI_EXTRACTED'). It also exposes the validation flags returned (math_verified, iban_valid), which tells the agent how to judge result trustworthiness.

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?

Three sentences, front-loaded with the extraction scope before routing guidance and return shape; no filler. The trailing enumeration of return keys is long but earns its place because no output schema exists. Slightly dense, but structurally sound.

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

Completeness5/5

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

With no output schema, the description compensates by naming the return contract (source, math_verified, iban_valid, invoiceNumber, issueDate, currency, seller, buyer, items[], netTotal, vatTotal, grossTotal). Combined with the format coverage, fallback behavior, and sibling routing, an agent has everything needed to invoke it and interpret results.

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%, so all three parameters (filename, fileBase64, xmlContent) are already documented as mutually alternative inputs. The description adds no further parameter-level detail such as precedence between fileBase64 and xmlContent when both are supplied. Baseline 3 applies when the schema carries the semantics.

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 specific verb ("Extract") plus the exact resources returned (invoice header, seller, buyer, IBAN, tax breakdown, line items) across three named input formats (ZUGFeRD PDF, XRechnung XML, legacy flat PDF). It explicitly differentiates itself from the sibling validate_erechnung, so an agent can pick the right tool without opening either 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 an explicit use case ("Use for data extraction (Empfangspflicht)") and an explicit alternative with the condition that selects it ("use validate_erechnung instead for strict KoSIT/veraPDF compliance checks"). Both the when and the when-not are stated.

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