get_einvoice_xml
Retrieve e-invoice XML data for a specific invoice using the invoice ID. Simplify financial workflows by accessing structured invoice information directly from the Norman Finance MCP Server.
Instructions
Get the e-invoice XML for a specific invoice.
Args:
invoice_id: ID of the invoice to get XML for
Returns:
E-invoice XML data
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| invoice_id | Yes |
Implementation Reference
- norman_mcp/tools/invoices.py:467-506 (handler)The handler function that implements the get_einvoice_xml tool. It retrieves the e-invoice XML by making a direct HTTP GET request to the Norman API endpoint.async def get_einvoice_xml( ctx: Context, invoice_id: str ) -> Dict[str, Any]: """ Get the e-invoice XML for a specific invoice. Args: invoice_id: ID of the invoice to get XML for Returns: E-invoice XML data """ api = ctx.request_context.lifespan_context["api"] company_id = api.company_id if not company_id: return {"error": "No company available. Please authenticate first."} xml_url = urljoin( config.api_base_url, f"api/v1/companies/{company_id}/invoices/{invoice_id}/xml/" ) try: response = requests.get( xml_url, headers={"Authorization": f"Bearer {api.access_token}"}, timeout=config.NORMAN_API_TIMEOUT ) response.raise_for_status() # Return the XML content as a string return {"xml_content": response.text} except requests.exceptions.RequestException as e: logger.error(f"Failed to get e-invoice XML: {str(e)}") if hasattr(e, 'response') and e.response is not None: logger.error(f"Response: {e.response.text}") return {"error": f"Failed to get e-invoice XML: {str(e)}"}
- norman_mcp/server.py:329-329 (registration)Invocation of register_invoice_tools which defines and registers the get_einvoice_xml tool (along with other invoice tools) with the MCP server.register_invoice_tools(server)
- norman_mcp/tools/invoices.py:12-13 (registration)The registration function that contains the @mcp.tool() decorators for all invoice tools, including get_einvoice_xml.def register_invoice_tools(mcp): """Register all invoice-related tools with the MCP server."""
- norman_mcp/tools/invoices.py:472-479 (schema)Docstring providing the tool schema description, parameters, and return type for MCP tool schema generation.Get the e-invoice XML for a specific invoice. Args: invoice_id: ID of the invoice to get XML for Returns: E-invoice XML data """