qbo_get_invoice
Retrieve full invoice details, including line items, by providing the invoice ID. Returns the invoice record or null if not found.
Instructions
Fetch full invoice detail including line items.
Args: invoice_id: QBO Invoice.Id.
Returns:
JSON envelope. data is the invoice record, or null on 404.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| invoice_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- qbo_mcp/server.py:220-236 (handler)The MCP tool handler function. Registered with @mcp.tool(), it receives an invoice_id, validates it, delegates to _get_client().get_invoice(), and returns a JSON envelope.
@mcp.tool() def qbo_get_invoice(invoice_id: str) -> str: """Fetch full invoice detail including line items. Args: invoice_id: QBO Invoice.Id. Returns: JSON envelope. `data` is the invoice record, or null on 404. """ if not invoice_id or not str(invoice_id).strip(): return _err("invoice_id is required and must be non-empty") try: invoice = _get_client().get_invoice(str(invoice_id).strip()) return _ok(invoice) except (ValueError, QBOError, RuntimeError) as exc: return _err(str(exc)) - qbo_mcp/client.py:401-411 (helper)The QBOClient.get_invoice() method that performs the actual HTTP GET request to QBO's invoice/{invoice_id} endpoint. Handles 404 by returning None.
def get_invoice(self, invoice_id: str) -> dict | None: """Fetch one invoice by Id, or None on 404.""" if not invoice_id or not str(invoice_id).strip(): raise ValueError("invoice_id must be non-empty") try: data = self._request("GET", f"invoice/{invoice_id}") except QBOError as exc: if exc.status_code == 404: return None raise return data.get("Invoice") - qbo_mcp/server.py:220-220 (registration)The @mcp.tool() decorator on line 220 registers qbo_get_invoice as an MCP tool.
@mcp.tool()