Skip to main content
Glama
norman-finance

Norman Finance MCP Server

Official

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
NameRequiredDescriptionDefault
invoice_idYes

Implementation Reference

  • 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)}"}
  • 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)
  • 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."""
  • 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
    """

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/norman-finance/norman-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server