link_transaction
Associate a specific transaction with an invoice using invoice and transaction IDs. Streamlines accounting workflows by connecting financial records for accurate tracking and reporting.
Instructions
Link a transaction to an invoice.
Args:
invoice_id: ID of the invoice
transaction_id: ID of the transaction to link
Returns:
Response from the link transaction request
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| invoice_id | Yes | ||
| transaction_id | Yes |
Implementation Reference
- norman_mcp/tools/invoices.py:433-465 (handler)The core handler function for the 'link_transaction' tool. It is decorated with @mcp.tool() for registration and implements the logic to link a transaction ID to an invoice ID via a POST request to the Norman API.@mcp.tool() async def link_transaction( ctx: Context, invoice_id: str, transaction_id: str ) -> Dict[str, Any]: """ Link a transaction to an invoice. Args: invoice_id: ID of the invoice transaction_id: ID of the transaction to link Returns: Response from the link transaction 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."} link_url = urljoin( config.api_base_url, f"api/v1/companies/{company_id}/invoices/{invoice_id}/link-transaction/" ) link_data = { "transaction": transaction_id } return api._make_request("POST", link_url, json_data=link_data)
- norman_mcp/server.py:329-329 (registration)Top-level registration call to register_invoice_tools(server), which includes the registration of the link_transaction tool via its @mcp.tool() decorator.register_invoice_tools(server)
- norman_mcp/server.py:17-17 (registration)Import of register_invoice_tools from invoices.py in the main server.py file.from norman_mcp.tools.invoices import register_invoice_tools
- norman_mcp/tools/invoices.py:439-448 (schema)Docstring providing the input schema (arguments) and output description for the link_transaction tool.""" Link a transaction to an invoice. Args: invoice_id: ID of the invoice transaction_id: ID of the transaction to link Returns: Response from the link transaction request """