Skip to main content
Glama

Polish KSeF FA(2)/FA(3) E-Invoice Parser API

ksef_invoice_parser
Read-onlyIdempotent

Parse Polish KSeF FA(2) and FA(3) XML e-invoices into structured JSON with seller and buyer NIP details, invoice numbers, issue and sale dates, VAT rate breakdowns, net/VAT/gross totals, line items and arithmetic sanity checks. XXE-safe deterministic XML parsing, zero AI, nothing stored. Free: 5 calls/day per IP. Paid: Radar API key (from €15/mo at https://radarbg.com/pricing#starter via X-API-Key) or $0.005/call via x402 at https://radarbg.com/x402/ksef-invoice-parser.

Example tool call

This call uses example arguments supplied in the tool’s input schema.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "limit": 50,
      "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Faktura xmlns=\"http://crd.gov.pl/wzor/2025/06/25/13775/\"><Naglowek><KodFormularza kodSystemowy=\"FA (3)\" wersjaSchemy=\"1-0E\">FA</KodFormularza><WariantFormularza>3</WariantFormularza><DataWytworzeniaFa>2026-11-04T09:00:00Z</DataWytworzeniaFa></Naglowek><Podmiot1><DaneIdentyfikacyjne><NIP>5260001246</NIP><Nazwa>Demo Sp. z o.o.</Nazwa></DaneIdentyfikacyjne><Adres><KodKraju>PL</KodKraju><AdresL1>ul. Prosta 10, Warszawa</AdresL1></Adres></Podmiot1><Podmiot2><DaneIdentyfikacyjne><NIP>6340123456</NIP><Nazwa>Klient SA</Nazwa></DaneIdentyfikacyjne><Adres><KodKraju>PL</KodKraju><AdresL1>ul. Rynek 1, Krakow</AdresL1></Adres></Podmiot2><Fa><KodWaluty>PLN</KodWaluty><P_1>2026-11-04</P_1><P_2>FV/2026/11/0042</P_2><P_6>2026-11-03</P_6><P_13_1>1000.00</P_13_1><P_14_1>230.00</P_14_1><P_15>1230.00</P_15><RodzajFaktury>VAT</RodzajFaktury><FaWiersz><NrWierszaFa>1</NrWierszaFa><P_7>Consulting Services</P_7><P_8A>hrs</P_8A><P_8B>10</P_8B><P_9A>100.00</P_9A><P_11>1000.00</P_11><P_12>23</P_12></FaWiersz></Fa></Faktura>"
    },
    "name": "ksef_invoice_parser"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNoMaximum number of invoice line items to return (1-2000).
contentNoRaw KSeF FA(2) or FA(3) XML invoice string. Provide either content or fileBase64.
fileNameNoOptional original XML filename (used to detect KSeF reference number if present).
fileBase64NoBase64-encoded KSeF XML file (alternative to content, max 15 MB).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.3/5.0
Behavior5/5

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

Annotations only cover read-only/idempotent/open-world safety; the description goes well beyond them by disclosing XXE-safe deterministic parsing, no AI involvement, nothing stored, and concrete rate limits (5 calls/day per IP). It also names the auth mechanism (X-API-Key header) and the per-call x402 payment path, which is exactly the operational context an agent needs before invoking.

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?

Front-loads the capability and return fields, then security posture, then access/pricing in a compact three-sentence block with no filler. The pricing and x402 URLs are long but functional; they serve authentication rather than marketing repetition.

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?

With no output schema, the description responsibly enumerates the returned structure (seller/buyer NIP, invoice number, dates, VAT rate breakdowns, net/VAT/gross totals, line items, arithmetic checks), which compensates for the missing return contract. Input handling is left to the fully-covered schema; the only gap is that no error or validation-failure behavior is described for malformed XML.

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 content/fileBase64/fileName/limit are already documented with defaults and the 15 MB cap, and the schema even carries a full worked XML example. The description adds no parameter-level guidance (e.g. that content and fileBase64 are mutually exclusive alternatives is left entirely to the schema), so baseline 3 is appropriate.

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 (parse) and a precisely scoped resource (Polish KSeF FA(2)/FA(3) XML e-invoices) and enumerates the resulting JSON fields including NIP details, dates, VAT breakdowns and totals. The KSeF format naming cleanly separates it from sibling parsers such as fatturapa_parser, isdoc_invoice_parser and ebinterface_parser.

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

Usage Guidelines4/5

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

The format specifier (KSeF FA(2)/FA(3)) implicitly tells the agent when this tool applies versus other national e-invoice parsers, and the access terms (5 free calls/day, API key, x402) tell it how to proceed. There is no explicit exclusion sentence such as 'use fatturapa_parser for Italian invoices', so routing is inferred from the format name rather than stated.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources