check_peppol_participant_be
Check if a Belgian company is registered as a Peppol participant by querying the Peppol SMP/SML network. Returns registration status, supported document types, and SMP endpoint.
Instructions
Check whether a Belgian company is registered as a Peppol participant.
Queries the Peppol SMP/SML network. If a plain VAT number is provided it is converted to the Belgian Peppol scheme (ICD 0208 for KBO/BCE numbers).
Returns registration status, supported document type identifiers, and the SMP access point endpoint URL.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| identifier | Yes | Peppol participant ID (e.g. '0208:0123456789') or plain Belgian VAT number |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The main handler function that checks whether a Belgian company is registered as a Peppol participant. Queries the Peppol SMP/SML network. Accepts a participant ID (e.g. '0208:0123456789') or a plain Belgian VAT number.
async def check_peppol_participant_be( identifier: Annotated[ str, "Peppol participant ID (e.g. '0208:0123456789') or plain Belgian VAT number", ], ) -> dict[str, object]: """Check whether a Belgian company is registered as a Peppol participant. Queries the Peppol SMP/SML network. If a plain VAT number is provided it is converted to the Belgian Peppol scheme (ICD 0208 for KBO/BCE numbers). Returns registration status, supported document type identifiers, and the SMP access point endpoint URL. """ if ":" not in identifier: digits = normalize_vat_be(identifier)[2:] # strip 'BE' participant_id = f"0208:{digits}" else: participant_id = identifier scheme, value = participant_id.split(":", 1) path = f"/iso6523-actorid-upis::{scheme}:{value}" client = _peppol_client() try: response = await client._request("GET", path) except PlatformError as exc: if exc.status_code == 404: return { "registered": False, "participant_id": participant_id, "error": "Participant not found on Peppol network", } raise return { "registered": True, "participant_id": participant_id, "raw": response.text, } - src/mcp_einvoicing_be/server.py:20-28 (registration)The tool is registered on the MCP server via mcp.tool()(check_peppol_participant_be) inside _register_be_tools.
def _register_be_tools(mcp: Any) -> None: """Register all Belgian e-invoicing tools onto the shared FastMCP instance.""" mcp.tool()(_validator.validate_invoice_be) mcp.tool()(_validator.validate_pint_be) mcp.tool()(_generator.generate_invoice_be) mcp.tool()(transform_to_ubl) mcp.tool()(lookup_vat_be) mcp.tool()(check_peppol_participant_be) mcp.tool()(get_invoice_types_be) - Module docstring lists the tool; imports provide typed annotations (Annotated type hints) used in the handler's parameter signature.
"""Lookup tools: lookup_vat_be, check_peppol_participant_be, get_invoice_types_be.""" import os from typing import Annotated from mcp_einvoicing_core import AuthMode, BaseEInvoicingClient, PlatformError from mcp_einvoicing_be.standards.peppol_bis_3 import INVOICE_TYPES from mcp_einvoicing_be.utils.helpers import normalize_vat_be - The normalize_vat_be helper normalizes Belgian VAT numbers to 'BE' + 10 digits, used by the handler to convert plain VAT numbers to the Peppol participant ID format.
def normalize_vat_be(vat_number: str) -> str: """Normalize a Belgian VAT/enterprise number to 'BE' + 10-digit format. Accepts: - ``BE0123456789`` - ``0123456789`` - ``BE 0123.456.789`` - ``0123.456.789`` Raises ``ValueError`` if the result is not exactly 10 digits. """ cleaned = re.sub(r"[\s.\-]", "", vat_number.upper()) digits = cleaned[2:] if cleaned.startswith("BE") else cleaned if not re.fullmatch(r"\d{10}", digits): raise ValueError( f"Invalid Belgian VAT/enterprise number: {vat_number!r}. " "Expected 10 digits (with optional 'BE' prefix)." ) return f"BE{digits}"