Dev.to AI 🤖 Ai 👁 0 📖 2 min read

Your AI agent rounds Japanese consumption tax per line. Japan says round once per rate.

If you let an AI agent draft invoices for Japanese customers, check one thing: how it rounds consumption tax. Since October 2023, a "qualified invoice" in Japan must round the tax once per invoice for each tax rate, not

If you let an AI agent draft invoices for Japanese customers, check one thing: how it rounds consumption tax.

Since October 2023, a "qualified invoice" in Japan must round the tax once per invoice for each tax rate, not line by line (National Tax Agency pamphlet, Japanese). Language models tend to compute the tax on every line and add it up. On a small invoice that is already off by two yen:

Item (10%, tax excluded) Amount Tax rounded per line
Copy paper 1,999 199
Toner 2,999 299
Pens 999 99
Total 5,997 597 (should be 599)

Two yen sounds small. For the accounting team it means the invoice does not match their books, and someone has to find out why.

A checker that computes instead of guessing

JP Invoice Check is a small MCP server, CLI and Agent Skill (Python standard library only, no network, MIT). It checks the six items a qualified invoice must carry, the 8% reduced-rate marks, the totals per rate, and the rounding rule. It names the per-line mistake (E_TAX_LINE_ROUNDING) separately from other wrong numbers, and every message comes in English and Japanese.

Keep the checker out of the agent's reach

A reader pointed out that a check is worth little if the agent being checked can rewrite it. Version 0.2.0 follows that advice:

  • The company rule (rounding method, tax included or excluded) is loaded once, when a person starts the server. No tool call can change it.
  • A rounding field inside the invoice is ignored while a rule is loaded.
  • Every result carries a sha256 fingerprint of the checking code.
pip install "git+https://github.com/ayatrader/jp-invoice-check"
{"mcpServers": {"jp-invoice-check": {"command": "jp-invoice-check",
  "args": ["--policy", "/etc/company/invoice_policy.json"]}}}

For an invoice a supplier sent you (role: receive), a different rounding method is legal, so it is a warning that says which method they used and the difference in yen.

Try it

https://github.com/ayatrader/jp-invoice-check

Limits: it does not check whether a registration number is currently registered (that needs the NTA site), and it does not cover simplified invoices. It is a checking tool, not tax advice.

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.