send_invoice
Send invoices via email with customizable subject, body, and recipient options. Supports additional email addresses, company copy, and custom client email fields for streamlined invoice distribution.
Instructions
Send an invoice via email.
Args:
invoice_id: ID of the invoice to send
subject: Email subject line
body: Email body content
additional_emails: List of additional email addresses to send to
is_send_to_company: Whether to send the copy to the company email (Owner)
custom_client_email: Custom email address for the client (By default the email address of the client is used if it is set)
Returns:
Response from the send invoice request
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| additional_emails | No | ||
| body | Yes | ||
| custom_client_email | No | ||
| invoice_id | Yes | ||
| is_send_to_company | No | ||
| subject | Yes |
Implementation Reference
- norman_mcp/tools/invoices.py:337-384 (handler)The core handler function for the 'send_invoice' MCP tool. It constructs and sends a POST request to the backend API to email the invoice with customizable subject, body, recipients, and options.@mcp.tool() async def send_invoice( ctx: Context, invoice_id: str, subject: str, body: str, additional_emails: Optional[List[str]] = None, is_send_to_company: bool = False, custom_client_email: Optional[str] = None ) -> Dict[str, Any]: """ Send an invoice via email. Args: invoice_id: ID of the invoice to send subject: Email subject line body: Email body content additional_emails: List of additional email addresses to send to is_send_to_company: Whether to send the copy to the company email (Owner) custom_client_email: Custom email address for the client (By default the email address of the client is used if it is set) Returns: Response from the send invoice request """ api = ctx.request_context.lifespan_context["api"] company_id = api.company_id if not company_id: return {"error": "No company available. Please authenticate first."} send_url = urljoin( config.api_base_url, f"api/v1/companies/{company_id}/invoices/{invoice_id}/send/" ) send_data = { "subject": subject, "body": body, "isSendToCompany": is_send_to_company } if additional_emails: send_data["additionalEmails"] = additional_emails if additional_emails else [] if custom_client_email: send_data["customClientEmail"] = custom_client_email return api._make_request("POST", send_url, json_data=send_data)
- norman_mcp/server.py:328-336 (registration)Registration block in the main server creation function, where register_invoice_tools(server) is called to register the send_invoice tool (imported from norman_mcp.tools.invoices).register_client_tools(server) register_invoice_tools(server) register_tax_tools(server) register_transaction_tools(server) register_document_tools(server) register_company_tools(server) register_prompts(server) register_resources(server)
- A @mcp.prompt() helper that provides a conversational template to guide users through the process of invoking the send_invoice tool, prompting for subject, body, and recipient options.def send_invoice_prompt(invoice_id: str) -> List[base.Message]: """ Create a prompt for sending an invoice via email. Args: invoice_id: ID of the invoice to send Returns: A list of messages forming a conversation about sending an invoice """ return [ base.UserMessage(f"I want to send invoice {invoice_id} to the client."), base.AssistantMessage("I'll help you send this invoice. What should the email subject line be?"), base.UserMessage("Invoice for your recent order"), base.AssistantMessage("Great! And what message would you like to include in the email body?"), base.UserMessage("Dear Client,\n\nPlease find attached the invoice for your recent order. Payment is due within 14 days.\n\nThank you for your business!\n\nBest regards,"), base.AssistantMessage("Would you like to send a copy to yourself or any additional recipients?"), base.UserMessage("Yes, please send a copy to myself."), base.AssistantMessage("I'll prepare the email with the invoice attachment and send it to the client with a copy to you. Would you like to review the email before sending?") ]