convert_bo4e_to_edifact
Convert BO4E transaction data to EDIFACT format for German energy market communication using transformer.bee service.
Instructions
Convert a BO4E transaktion to its EDIFACT equivalent
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| transaktion | Yes | ||
| edifact_format_version | No |
Implementation Reference
- src/transformerbeemcp/server.py:105-122 (handler)Handler function for the 'convert_bo4e_to_edifact' tool. It retrieves the TransformerBeeClient from context, converts the provided BO4E transaction (BOneyComb) to EDIFACT format, handles errors, logs success, and returns the EDIFACT string. Registered via @mcp.tool decorator.@mcp.tool(description="Convert a BO4E transaktion to its EDIFACT equivalent") async def convert_bo4e_to_edifact( ctx: Context, # type:ignore[type-arg] # no idea what the second type arg is transaktion: BOneyComb, edifact_format_version: EdifactFormatVersion | None = None, ) -> str: """Tool that uses initialized resources""" if not edifact_format_version: edifact_format_version = get_current_edifact_format_version() client: TransformerBeeClient = ctx.request_context.lifespan_context.transformerbeeclient try: edifact = await client.convert_to_edifact(boney_comb=transaktion, edifact_format_version=edifact_format_version) except Exception: _logger.exception("Error while converting BO4E to edifact") raise await ctx.info(f"Successfully converted BO4E to EDIFACT with format version {edifact_format_version}") return edifact