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
    """
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves XML data but doesn't describe what happens if the invoice_id is invalid (e.g., errors, null returns), authentication needs, rate limits, or data format specifics. For a read operation with zero annotation coverage, this leaves significant gaps in understanding tool behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose in the first sentence, followed by structured 'Args' and 'Returns' sections. Every sentence earns its place: the first defines the tool, the second explains the parameter, and the third specifies the return value. It's appropriately sized with zero waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (1 parameter, no output schema, no annotations), the description is minimally complete. It covers the basic purpose and parameter but lacks behavioral details (e.g., error handling) and usage context. Without annotations or output schema, the agent has incomplete information for reliable invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaningful context for the single parameter: 'invoice_id: ID of the invoice to get XML for.' Since schema description coverage is 0% (the schema only provides a title 'Invoice Id' and type), this compensates well by explaining the parameter's role. With only one parameter, the baseline is high, and the description clarifies its purpose adequately.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get the e-invoice XML for a specific invoice.' It specifies the verb ('Get') and resource ('e-invoice XML'), distinguishing it from sibling tools like 'get_invoice' which likely retrieves invoice details rather than XML data. However, it doesn't explicitly differentiate from potential XML-related tools (none are present in siblings), so it's not a perfect 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., invoice must exist), exclusions (e.g., only for e-invoices), or compare it to siblings like 'get_invoice' or 'send_invoice'. The agent must infer usage from the name and description alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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