From 6942774d5104e39626c14ba7796d5b6104d769f5 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Thu, 27 Aug 2026 20:05:35 -0700 Subject: [PATCH 1/6] feat(integrations): add validated QuickBooks integration --- apps/docs/components/icons.tsx | 19 + apps/docs/components/ui/icon-mapping.ts | 2 + .../content/docs/en/integrations/meta.json | 1 + .../docs/en/integrations/quickbooks.mdx | 2919 ++++++++++++++++ apps/sim/.env.example | 5 + apps/sim/app/api/auth/[...all]/route.test.ts | 63 + apps/sim/app/api/auth/[...all]/route.ts | 25 + .../api/auth/oauth/disconnect/route.test.ts | 4 +- .../app/api/auth/oauth/token/route.test.ts | 89 + apps/sim/app/api/auth/oauth/token/route.ts | 11 +- apps/sim/blocks/blocks/quickbooks.ts | 3033 +++++++++++++++++ apps/sim/blocks/registry-maps.ts | 3 + apps/sim/components/icons.tsx | 19 + .../lib/api/contracts/oauth-connections.ts | 1 + apps/sim/lib/api/contracts/selectors/oauth.ts | 1 + .../sim/lib/api/contracts/tools/quickbooks.ts | 196 ++ apps/sim/lib/auth/connectors/providers.ts | 43 + apps/sim/lib/core/config/env.ts | 3 + apps/sim/lib/core/security/redaction.test.ts | 41 + apps/sim/lib/core/security/redaction.ts | 2 +- .../credentials/api/route-policies.test.ts | 13 + .../sim/lib/credentials/api/route-policies.ts | 8 + .../application/oauth-accounts.test.ts | 126 +- apps/sim/lib/credentials/oauth-accounts.ts | 50 +- apps/sim/lib/integrations/icon-mapping.ts | 2 + .../internal/quickbooks/execute-tool.test.ts | 118 + .../lib/internal/quickbooks/execute-tool.ts | 133 + .../internal/quickbooks/operations.test.ts | 177 + .../sim/lib/internal/quickbooks/operations.ts | 330 ++ .../tool-operations/registry.server.ts | 9 + apps/sim/lib/oauth/oauth.ts | 31 + apps/sim/lib/oauth/quickbooks.test.ts | 90 + apps/sim/lib/oauth/quickbooks.ts | 195 ++ apps/sim/lib/oauth/token-resolution.ts | 51 +- apps/sim/lib/oauth/types.ts | 2 + apps/sim/lib/oauth/utils.test.ts | 20 + apps/sim/lib/oauth/utils.ts | 2 + apps/sim/tools/error-extractors.test.ts | 30 + apps/sim/tools/error-extractors.ts | 26 + apps/sim/tools/index.ts | 3 + apps/sim/tools/quickbooks/accounting_utils.ts | 307 ++ apps/sim/tools/quickbooks/add_attachment.ts | 123 + .../sim/tools/quickbooks/api_accuracy.test.ts | 89 + apps/sim/tools/quickbooks/client.ts | 184 + apps/sim/tools/quickbooks/create_bill.ts | 136 + .../tools/quickbooks/create_bill_payment.ts | 188 + .../tools/quickbooks/create_credit_memo.ts | 111 + apps/sim/tools/quickbooks/create_customer.ts | 152 + .../quickbooks/create_customer_payment.ts | 123 + apps/sim/tools/quickbooks/create_deposit.ts | 99 + apps/sim/tools/quickbooks/create_employee.ts | 151 + apps/sim/tools/quickbooks/create_estimate.ts | 117 + apps/sim/tools/quickbooks/create_invoice.ts | 117 + apps/sim/tools/quickbooks/create_item.ts | 158 + .../tools/quickbooks/create_journal_entry.ts | 105 + apps/sim/tools/quickbooks/create_purchase.ts | 118 + .../tools/quickbooks/create_purchase_order.ts | 111 + .../tools/quickbooks/create_refund_receipt.ts | 130 + .../tools/quickbooks/create_sales_receipt.ts | 129 + apps/sim/tools/quickbooks/create_vendor.ts | 156 + .../tools/quickbooks/create_vendor_credit.ts | 111 + apps/sim/tools/quickbooks/documents_utils.ts | 352 ++ .../tools/quickbooks/download_attachment.ts | 66 + .../quickbooks/download_transaction_pdf.ts | 74 + .../sim/tools/quickbooks/email_transaction.ts | 138 + apps/sim/tools/quickbooks/fault.test.ts | 65 + apps/sim/tools/quickbooks/fault.ts | 119 + .../tools/quickbooks/file_operations.test.ts | 70 + apps/sim/tools/quickbooks/full_update.test.ts | 89 + apps/sim/tools/quickbooks/get_company_info.ts | 91 + apps/sim/tools/quickbooks/index.ts | 48 + .../tools/quickbooks/purchasing_utils.test.ts | 175 + apps/sim/tools/quickbooks/purchasing_utils.ts | 607 ++++ .../read_accounting_transactions.ts | 188 + apps/sim/tools/quickbooks/read_attachments.ts | 183 + apps/sim/tools/quickbooks/read_master_data.ts | 211 ++ .../read_purchasing_transactions.ts | 194 ++ .../quickbooks/read_sales_transactions.ts | 196 ++ apps/sim/tools/quickbooks/reports.test.ts | 141 + apps/sim/tools/quickbooks/reports.ts | 533 +++ .../tools/quickbooks/run_financial_report.ts | 205 ++ apps/sim/tools/quickbooks/sales_utils.test.ts | 140 + apps/sim/tools/quickbooks/sales_utils.ts | 475 +++ apps/sim/tools/quickbooks/types.ts | 2017 +++++++++++ apps/sim/tools/quickbooks/update_bill.ts | 123 + .../tools/quickbooks/update_bill_payment.ts | 105 + .../tools/quickbooks/update_credit_memo.ts | 124 + apps/sim/tools/quickbooks/update_customer.ts | 169 + .../quickbooks/update_customer_payment.ts | 188 + apps/sim/tools/quickbooks/update_deposit.ts | 95 + apps/sim/tools/quickbooks/update_employee.ts | 178 + apps/sim/tools/quickbooks/update_estimate.ts | 119 + apps/sim/tools/quickbooks/update_invoice.ts | 119 + apps/sim/tools/quickbooks/update_item.ts | 172 + .../tools/quickbooks/update_journal_entry.ts | 100 + apps/sim/tools/quickbooks/update_purchase.ts | 112 + .../tools/quickbooks/update_purchase_order.ts | 117 + .../tools/quickbooks/update_refund_receipt.ts | 131 + .../tools/quickbooks/update_sales_receipt.ts | 131 + apps/sim/tools/quickbooks/update_vendor.ts | 189 + .../tools/quickbooks/update_vendor_credit.ts | 117 + apps/sim/tools/quickbooks/utils.ts | 706 ++++ apps/sim/tools/quickbooks/values.ts | 185 + .../tools/quickbooks/void_customer_payment.ts | 101 + apps/sim/tools/quickbooks/void_invoice.ts | 97 + apps/sim/tools/registry.ts | 96 + .../deployment-config/src/env-capabilities.ts | 1 + .../deployment-config/src/integrations.json | 208 ++ .../sim-setup/src/capability-config.test.ts | 13 + packages/sim-setup/src/capability-config.ts | 5 + 110 files changed, 20881 insertions(+), 8 deletions(-) create mode 100644 apps/docs/content/docs/en/integrations/quickbooks.mdx create mode 100644 apps/sim/blocks/blocks/quickbooks.ts create mode 100644 apps/sim/lib/api/contracts/tools/quickbooks.ts create mode 100644 apps/sim/lib/internal/quickbooks/execute-tool.test.ts create mode 100644 apps/sim/lib/internal/quickbooks/execute-tool.ts create mode 100644 apps/sim/lib/internal/quickbooks/operations.test.ts create mode 100644 apps/sim/lib/internal/quickbooks/operations.ts create mode 100644 apps/sim/lib/oauth/quickbooks.test.ts create mode 100644 apps/sim/lib/oauth/quickbooks.ts create mode 100644 apps/sim/tools/quickbooks/accounting_utils.ts create mode 100644 apps/sim/tools/quickbooks/add_attachment.ts create mode 100644 apps/sim/tools/quickbooks/api_accuracy.test.ts create mode 100644 apps/sim/tools/quickbooks/client.ts create mode 100644 apps/sim/tools/quickbooks/create_bill.ts create mode 100644 apps/sim/tools/quickbooks/create_bill_payment.ts create mode 100644 apps/sim/tools/quickbooks/create_credit_memo.ts create mode 100644 apps/sim/tools/quickbooks/create_customer.ts create mode 100644 apps/sim/tools/quickbooks/create_customer_payment.ts create mode 100644 apps/sim/tools/quickbooks/create_deposit.ts create mode 100644 apps/sim/tools/quickbooks/create_employee.ts create mode 100644 apps/sim/tools/quickbooks/create_estimate.ts create mode 100644 apps/sim/tools/quickbooks/create_invoice.ts create mode 100644 apps/sim/tools/quickbooks/create_item.ts create mode 100644 apps/sim/tools/quickbooks/create_journal_entry.ts create mode 100644 apps/sim/tools/quickbooks/create_purchase.ts create mode 100644 apps/sim/tools/quickbooks/create_purchase_order.ts create mode 100644 apps/sim/tools/quickbooks/create_refund_receipt.ts create mode 100644 apps/sim/tools/quickbooks/create_sales_receipt.ts create mode 100644 apps/sim/tools/quickbooks/create_vendor.ts create mode 100644 apps/sim/tools/quickbooks/create_vendor_credit.ts create mode 100644 apps/sim/tools/quickbooks/documents_utils.ts create mode 100644 apps/sim/tools/quickbooks/download_attachment.ts create mode 100644 apps/sim/tools/quickbooks/download_transaction_pdf.ts create mode 100644 apps/sim/tools/quickbooks/email_transaction.ts create mode 100644 apps/sim/tools/quickbooks/fault.test.ts create mode 100644 apps/sim/tools/quickbooks/fault.ts create mode 100644 apps/sim/tools/quickbooks/file_operations.test.ts create mode 100644 apps/sim/tools/quickbooks/full_update.test.ts create mode 100644 apps/sim/tools/quickbooks/get_company_info.ts create mode 100644 apps/sim/tools/quickbooks/index.ts create mode 100644 apps/sim/tools/quickbooks/purchasing_utils.test.ts create mode 100644 apps/sim/tools/quickbooks/purchasing_utils.ts create mode 100644 apps/sim/tools/quickbooks/read_accounting_transactions.ts create mode 100644 apps/sim/tools/quickbooks/read_attachments.ts create mode 100644 apps/sim/tools/quickbooks/read_master_data.ts create mode 100644 apps/sim/tools/quickbooks/read_purchasing_transactions.ts create mode 100644 apps/sim/tools/quickbooks/read_sales_transactions.ts create mode 100644 apps/sim/tools/quickbooks/reports.test.ts create mode 100644 apps/sim/tools/quickbooks/reports.ts create mode 100644 apps/sim/tools/quickbooks/run_financial_report.ts create mode 100644 apps/sim/tools/quickbooks/sales_utils.test.ts create mode 100644 apps/sim/tools/quickbooks/sales_utils.ts create mode 100644 apps/sim/tools/quickbooks/types.ts create mode 100644 apps/sim/tools/quickbooks/update_bill.ts create mode 100644 apps/sim/tools/quickbooks/update_bill_payment.ts create mode 100644 apps/sim/tools/quickbooks/update_credit_memo.ts create mode 100644 apps/sim/tools/quickbooks/update_customer.ts create mode 100644 apps/sim/tools/quickbooks/update_customer_payment.ts create mode 100644 apps/sim/tools/quickbooks/update_deposit.ts create mode 100644 apps/sim/tools/quickbooks/update_employee.ts create mode 100644 apps/sim/tools/quickbooks/update_estimate.ts create mode 100644 apps/sim/tools/quickbooks/update_invoice.ts create mode 100644 apps/sim/tools/quickbooks/update_item.ts create mode 100644 apps/sim/tools/quickbooks/update_journal_entry.ts create mode 100644 apps/sim/tools/quickbooks/update_purchase.ts create mode 100644 apps/sim/tools/quickbooks/update_purchase_order.ts create mode 100644 apps/sim/tools/quickbooks/update_refund_receipt.ts create mode 100644 apps/sim/tools/quickbooks/update_sales_receipt.ts create mode 100644 apps/sim/tools/quickbooks/update_vendor.ts create mode 100644 apps/sim/tools/quickbooks/update_vendor_credit.ts create mode 100644 apps/sim/tools/quickbooks/utils.ts create mode 100644 apps/sim/tools/quickbooks/values.ts create mode 100644 apps/sim/tools/quickbooks/void_customer_payment.ts create mode 100644 apps/sim/tools/quickbooks/void_invoice.ts diff --git a/apps/docs/components/icons.tsx b/apps/docs/components/icons.tsx index 5c80c285664..e0eab833b3a 100644 --- a/apps/docs/components/icons.tsx +++ b/apps/docs/components/icons.tsx @@ -2710,6 +2710,25 @@ export function BrexIcon(props: SVGProps) { ) } +/** + * Official QuickBooks circular mark, cropped from the user-supplied + * Intuit_QuickBooks_logo.svg wordmark. + */ +export function QuickBooksIcon(props: SVGProps) { + return ( + + + + + ) +} + export function BrightDataIcon(props: SVGProps) { return ( = { pulse_v2: PulseIcon, qdrant: QdrantIcon, quartr: QuartrIcon, + quickbooks: QuickBooksIcon, quiver: QuiverIcon, rabbitmq: RabbitmqIcon, railway: RailwayIcon, diff --git a/apps/docs/content/docs/en/integrations/meta.json b/apps/docs/content/docs/en/integrations/meta.json index d6b51540b8f..509def97389 100644 --- a/apps/docs/content/docs/en/integrations/meta.json +++ b/apps/docs/content/docs/en/integrations/meta.json @@ -204,6 +204,7 @@ "pulse", "qdrant", "quartr", + "quickbooks", "quiver", "rabbitmq", "railway", diff --git a/apps/docs/content/docs/en/integrations/quickbooks.mdx b/apps/docs/content/docs/en/integrations/quickbooks.mdx new file mode 100644 index 00000000000..0c29cb1e55a --- /dev/null +++ b/apps/docs/content/docs/en/integrations/quickbooks.mdx @@ -0,0 +1,2919 @@ +--- +title: QuickBooks +description: Manage QuickBooks Online company, transactions, reports, emails, PDFs, and attachments +--- + +import { BlockInfoCard } from "@/components/ui/block-info-card" + + + +{/* MANUAL-CONTENT-START:intro */} +Connect one QuickBooks Online company per credential. During OAuth, choose the company that the workflow should access; Sim binds that company to the credential automatically, so you do not enter a realm ID or API host. + +Master Data, Sales, and Purchasing transaction reads support **List** and **By ID** modes. List actions return at most one page. Use `nextStartPosition` in another workflow step when `hasMore` is true. Sim does not paginate, retry, or fetch related records automatically. + +QuickBooks update actions require the record ID and its current `SyncToken`; provide only the fields you want to change. Sim uses Intuit's documented sparse-update mode where the entity supports it, and otherwise reads the current entity, merges the requested fields, and submits a full update. Use the latest `SyncToken` returned by a read or mutation. Voiding keeps the transaction in QuickBooks with a zeroed financial effect; it is not deletion and requires explicit confirmation. Create actions accept an optional `requestId` that QuickBooks uses for idempotency when the same request may be submitted again. + +Sandbox credentials call only Intuit's sandbox API and are suitable for disposable test data. Production credentials call the production API and affect the selected live company. + +Run Financial Report exposes verified financial statements, aging, balance, sales, and expense reports while preserving QuickBooks' native columns and nested rows. Advanced controls appear only where QuickBooks supports them. Use Read Master Data to discover customer, vendor, account, item, class, and department IDs for report filters. Intuit recommends report periods of six months or less for performance, though Sim does not forbid longer accounting periods. + +Document actions can read attachment metadata, add one File or Note attachment, download an attachment file, and download supported transactions as PDFs. Downloaded files are stored as Sim files for downstream blocks. Attachment deletion, bulk upload/download, and bulk email remain outside this version of the block. +{/* MANUAL-CONTENT-END */} + + +## Usage Instructions + +Connect one QuickBooks Online company to manage bounded master-data, sales, purchasing, receivables, payables, accounting, reports, transaction delivery, and document workflows. + + + +## Actions + +### QuickBooks Get Company Info + +Get information about the connected QuickBooks Online company + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `company` | json | Verified QuickBooks CompanyInfo object with tax identifiers removed | +| ↳ `Id` | string | QuickBooks CompanyInfo entity ID \(commonly "1"\); this is not the OAuth realmId | +| ↳ `SyncToken` | string | CompanyInfo sync token | +| ↳ `CompanyName` | string | Company display name | +| ↳ `LegalName` | string | Company legal name | +| ↳ `CompanyAddr` | json | Company address | +| ↳ `CustomerCommunicationAddr` | json | Customer communication address | +| ↳ `LegalAddr` | json | Company legal address | +| ↳ `PrimaryPhone` | json | Primary phone details | +| ↳ `Email` | json | Company email details | +| ↳ `WebAddr` | json | Company website details | +| ↳ `CompanyStartDate` | string | Company start date | +| ↳ `Country` | string | Company country code | +| ↳ `FiscalYearStartMonth` | string | Fiscal year starting month | +| ↳ `SupportedLanguages` | string | Comma-separated list of languages supported by the company | +| ↳ `domain` | string | Originating Intuit domain | +| ↳ `sparse` | boolean | Whether QuickBooks returned a partial representation | +| ↳ `NameValue` | array | QuickBooks company settings represented as name/value entries | +| ↳ `MetaData` | json | CompanyInfo creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | +| `time` | string | QuickBooks response timestamp | + +### QuickBooks Read Master Data + +List or read one account, class, customer, department, employee, item, or vendor + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `recordType` | string | Yes | Master-data entity to read: account, class, customer, department, employee, item, or vendor | +| `readMode` | string | Yes | Whether to list records or read one record by ID | +| `recordId` | string | No | QuickBooks record ID, required for by-ID reads | +| `startPosition` | number | No | One-based position of the first list record to return | +| `maxResults` | number | No | Number of list records to request \(1–100\) | +| `activeStatus` | string | No | List records using the QuickBooks default, active, or inactive status | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordType` | string | Master-data record type returned by this action | +| `item` | json | Single QuickBooks master-data record returned by a by-ID read | +| ↳ `Id` | string | QuickBooks entity ID | +| ↳ `SyncToken` | string | Entity sync token | +| ↳ `Active` | boolean | Whether the entity is active | +| ↳ `MetaData` | json | Entity creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | +| ↳ `Name` | string | Account, item, class, or department name | +| ↳ `SubAccount` | boolean | Whether this is a subaccount | +| ↳ `ParentRef` | json | Parent account, item, class, or department reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `FullyQualifiedName` | string | Hierarchical qualified account, item, class, or department name | +| ↳ `Classification` | string | Account classification | +| ↳ `AccountType` | string | Account type | +| ↳ `AccountSubType` | string | Account subtype | +| ↳ `CurrentBalance` | number | Account current balance | +| ↳ `CurrencyRef` | json | Account, customer, or vendor currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `DisplayName` | string | Customer, vendor, or employee display name | +| ↳ `CompanyName` | string | Customer or vendor company name | +| ↳ `GivenName` | string | Given name | +| ↳ `FamilyName` | string | Family name | +| ↳ `Taxable` | boolean | Taxable status for the customer or item | +| ↳ `PrimaryEmailAddr` | json | Customer, vendor, or employee primary email address | +| ↳ `PrimaryPhone` | json | Customer, vendor, or employee primary phone number | +| ↳ `BillAddr` | json | Customer or vendor billing address | +| ↳ `ShipAddr` | json | Customer shipping address | +| ↳ `Balance` | number | Customer or vendor balance | +| ↳ `PrintOnCheckName` | string | Vendor or employee name printed on checks | +| ↳ `Vendor1099` | boolean | Whether the vendor is tracked for 1099 reporting | +| ↳ `AcctNum` | string | Vendor account number | +| ↳ `Description` | string | Item sales description | +| ↳ `UnitPrice` | number | Item sale price | +| ↳ `Type` | string | Item type | +| ↳ `IncomeAccountRef` | json | Item income account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `ExpenseAccountRef` | json | Item expense account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PurchaseDesc` | string | Item purchase description | +| ↳ `PurchaseCost` | number | Item purchase cost | +| ↳ `AssetAccountRef` | json | Inventory asset account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `TrackQtyOnHand` | boolean | Whether QuickBooks tracks quantity on hand | +| ↳ `QtyOnHand` | number | Current quantity on hand | +| ↳ `InvStartDate` | string | Inventory tracking start date | +| ↳ `PrimaryAddr` | json | Employee primary address | +| ↳ `BillableTime` | boolean | Whether employee time is billable | +| ↳ `domain` | string | QuickBooks domain | +| ↳ `sparse` | boolean | Whether this is a sparse entity | +| ↳ `SubClass` | boolean | Whether the Class is nested under another Class | +| ↳ `SubDepartment` | boolean | Whether the Department is nested under another Department | +| `items` | array | QuickBooks master-data records returned by a list read | +| ↳ `Id` | string | QuickBooks entity ID | +| ↳ `SyncToken` | string | Entity sync token | +| ↳ `Active` | boolean | Whether the entity is active | +| ↳ `MetaData` | json | Entity creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | +| ↳ `Name` | string | Account, item, class, or department name | +| ↳ `SubAccount` | boolean | Whether this is a subaccount | +| ↳ `ParentRef` | json | Parent account, item, class, or department reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `FullyQualifiedName` | string | Hierarchical qualified account, item, class, or department name | +| ↳ `Classification` | string | Account classification | +| ↳ `AccountType` | string | Account type | +| ↳ `AccountSubType` | string | Account subtype | +| ↳ `CurrentBalance` | number | Account current balance | +| ↳ `CurrencyRef` | json | Account, customer, or vendor currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `DisplayName` | string | Customer, vendor, or employee display name | +| ↳ `CompanyName` | string | Customer or vendor company name | +| ↳ `GivenName` | string | Given name | +| ↳ `FamilyName` | string | Family name | +| ↳ `Taxable` | boolean | Taxable status for the customer or item | +| ↳ `PrimaryEmailAddr` | json | Customer, vendor, or employee primary email address | +| ↳ `PrimaryPhone` | json | Customer, vendor, or employee primary phone number | +| ↳ `BillAddr` | json | Customer or vendor billing address | +| ↳ `ShipAddr` | json | Customer shipping address | +| ↳ `Balance` | number | Customer or vendor balance | +| ↳ `PrintOnCheckName` | string | Vendor or employee name printed on checks | +| ↳ `Vendor1099` | boolean | Whether the vendor is tracked for 1099 reporting | +| ↳ `AcctNum` | string | Vendor account number | +| ↳ `Description` | string | Item sales description | +| ↳ `UnitPrice` | number | Item sale price | +| ↳ `Type` | string | Item type | +| ↳ `IncomeAccountRef` | json | Item income account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `ExpenseAccountRef` | json | Item expense account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PurchaseDesc` | string | Item purchase description | +| ↳ `PurchaseCost` | number | Item purchase cost | +| ↳ `AssetAccountRef` | json | Inventory asset account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `TrackQtyOnHand` | boolean | Whether QuickBooks tracks quantity on hand | +| ↳ `QtyOnHand` | number | Current quantity on hand | +| ↳ `InvStartDate` | string | Inventory tracking start date | +| ↳ `PrimaryAddr` | json | Employee primary address | +| ↳ `BillableTime` | boolean | Whether employee time is billable | +| ↳ `domain` | string | QuickBooks domain | +| ↳ `sparse` | boolean | Whether this is a sparse entity | +| ↳ `SubClass` | boolean | Whether the Class is nested under another Class | +| ↳ `SubDepartment` | boolean | Whether the Department is nested under another Department | +| `startPosition` | number | One-based position of the first record in this page | +| `maxResults` | number | Actual number of records returned in this page | +| `nextStartPosition` | number | Position to use when explicitly requesting the next page | +| `hasMore` | boolean | Conservative indication that another page may exist | +| `time` | string | QuickBooks response timestamp | + +### QuickBooks Create Customer + +Create a customer in the connected QuickBooks Online company + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `displayName` | string | Yes | Unique customer display name | +| `companyName` | string | No | Customer company name | +| `givenName` | string | No | Customer given name | +| `familyName` | string | No | Customer family name | +| `primaryEmail` | string | No | Customer primary email address | +| `primaryPhone` | string | No | Customer primary phone number | +| `billingAddress` | json | No | Customer billing address | +| `shippingAddress` | json | No | Customer shipping address | +| `taxable` | boolean | No | Whether sales to this customer are taxable | +| `requestId` | string | No | Optional Intuit idempotency request ID, up to 50 characters | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Created QuickBooks Customer record | +| ↳ `Id` | string | QuickBooks entity ID | +| ↳ `SyncToken` | string | Entity sync token | +| ↳ `Active` | boolean | Whether the entity is active | +| ↳ `MetaData` | json | Entity creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | +| ↳ `DisplayName` | string | Customer display name | +| ↳ `CompanyName` | string | Customer company name | +| ↳ `GivenName` | string | Given name | +| ↳ `FamilyName` | string | Family name | +| ↳ `Taxable` | boolean | Whether the customer is taxable | +| ↳ `PrimaryEmailAddr` | json | Customer primary email address | +| ↳ `PrimaryPhone` | json | Customer primary phone number | +| ↳ `BillAddr` | json | Customer billing address | +| ↳ `ShipAddr` | json | Customer shipping address | +| ↳ `Balance` | number | Customer balance | +| ↳ `CurrencyRef` | json | Customer currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | + +### QuickBooks Update Customer + +Sparse-update a customer in the connected QuickBooks Online company + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `customerId` | string | Yes | ID of the customer to update | +| `syncToken` | string | Yes | Current customer sync token | +| `displayName` | string | No | Replacement customer display name | +| `companyName` | string | No | Replacement customer company name | +| `givenName` | string | No | Replacement customer given name | +| `familyName` | string | No | Replacement customer family name | +| `primaryEmail` | string | No | Replacement primary email address | +| `primaryPhone` | string | No | Replacement primary phone number | +| `billingAddress` | json | No | Replacement billing address | +| `shippingAddress` | json | No | Replacement shipping address | +| `taxable` | boolean | No | Whether sales to this customer are taxable | +| `activeStatus` | string | No | Customer status change: unchanged, active, or inactive | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Updated QuickBooks Customer record | +| ↳ `Id` | string | QuickBooks entity ID | +| ↳ `SyncToken` | string | Entity sync token | +| ↳ `Active` | boolean | Whether the entity is active | +| ↳ `MetaData` | json | Entity creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | +| ↳ `DisplayName` | string | Customer display name | +| ↳ `CompanyName` | string | Customer company name | +| ↳ `GivenName` | string | Given name | +| ↳ `FamilyName` | string | Family name | +| ↳ `Taxable` | boolean | Whether the customer is taxable | +| ↳ `PrimaryEmailAddr` | json | Customer primary email address | +| ↳ `PrimaryPhone` | json | Customer primary phone number | +| ↳ `BillAddr` | json | Customer billing address | +| ↳ `ShipAddr` | json | Customer shipping address | +| ↳ `Balance` | number | Customer balance | +| ↳ `CurrencyRef` | json | Customer currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | + +### QuickBooks Create Employee + +Create a non-payroll employee profile in the connected QuickBooks Online company + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `displayName` | string | No | Unique employee display name. When omitted QuickBooks derives it from the supplied name components, and it is read-only when QuickBooks Payroll is enabled | +| `givenName` | string | No | Employee given name. At least one of givenName or familyName is required | +| `familyName` | string | No | Employee family name. At least one of givenName or familyName is required | +| `primaryEmail` | string | No | Employee primary email address | +| `primaryPhone` | string | No | Employee primary phone number | +| `primaryAddress` | json | No | Employee primary address | +| `printOnCheckName` | string | No | Employee name printed on checks | +| `billableTime` | boolean | No | Whether employee time is billable | +| `requestId` | string | No | Optional Intuit idempotency request ID, up to 50 characters | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Created QuickBooks Employee record | +| ↳ `Id` | string | QuickBooks entity ID | +| ↳ `SyncToken` | string | Entity sync token | +| ↳ `Active` | boolean | Whether the entity is active | +| ↳ `MetaData` | json | Entity creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | +| ↳ `DisplayName` | string | Employee display name | +| ↳ `GivenName` | string | Given name | +| ↳ `FamilyName` | string | Family name | +| ↳ `PrintOnCheckName` | string | Employee name printed on checks | +| ↳ `PrimaryEmailAddr` | json | Employee primary email address | +| ↳ `PrimaryPhone` | json | Employee primary phone number | +| ↳ `PrimaryAddr` | json | Employee primary address | +| ↳ `BillableTime` | boolean | Whether employee time is billable | +| ↳ `domain` | string | QuickBooks domain | +| ↳ `sparse` | boolean | Whether this is a sparse entity | + +### QuickBooks Update Employee + +Read, merge, and full-update a non-payroll employee profile + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `employeeId` | string | Yes | ID of the employee to update | +| `syncToken` | string | Yes | Current employee sync token | +| `displayName` | string | No | Replacement employee display name | +| `givenName` | string | No | Replacement employee given name | +| `familyName` | string | No | Replacement employee family name | +| `primaryEmail` | string | No | Replacement employee primary email address | +| `primaryPhone` | string | No | Replacement employee primary phone number | +| `primaryAddress` | json | No | Replacement employee primary address | +| `printOnCheckName` | string | No | Replacement employee name printed on checks | +| `billableTime` | boolean | No | Whether employee time is billable | +| `activeStatus` | string | No | Employee status change: unchanged, active, or inactive | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Updated QuickBooks Employee record | +| ↳ `Id` | string | QuickBooks entity ID | +| ↳ `SyncToken` | string | Entity sync token | +| ↳ `Active` | boolean | Whether the entity is active | +| ↳ `MetaData` | json | Entity creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | +| ↳ `DisplayName` | string | Employee display name | +| ↳ `GivenName` | string | Given name | +| ↳ `FamilyName` | string | Family name | +| ↳ `PrintOnCheckName` | string | Employee name printed on checks | +| ↳ `PrimaryEmailAddr` | json | Employee primary email address | +| ↳ `PrimaryPhone` | json | Employee primary phone number | +| ↳ `PrimaryAddr` | json | Employee primary address | +| ↳ `BillableTime` | boolean | Whether employee time is billable | +| ↳ `domain` | string | QuickBooks domain | +| ↳ `sparse` | boolean | Whether this is a sparse entity | + +### QuickBooks Create Vendor + +Create a vendor in the connected QuickBooks Online company + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `displayName` | string | Yes | Unique vendor display name | +| `companyName` | string | No | Vendor company name | +| `givenName` | string | No | Vendor given name | +| `familyName` | string | No | Vendor family name | +| `primaryEmail` | string | No | Vendor primary email address | +| `primaryPhone` | string | No | Vendor primary phone number | +| `billingAddress` | json | No | Vendor billing address | +| `printOnCheckName` | string | No | Name to print on checks | +| `accountNumber` | string | No | Vendor account number | +| `vendor1099` | boolean | No | Whether the vendor is tracked for 1099 reporting | +| `requestId` | string | No | Optional Intuit idempotency request ID, up to 50 characters | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Created QuickBooks Vendor record | +| ↳ `Id` | string | QuickBooks entity ID | +| ↳ `SyncToken` | string | Entity sync token | +| ↳ `Active` | boolean | Whether the entity is active | +| ↳ `MetaData` | json | Entity creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | +| ↳ `DisplayName` | string | Vendor display name | +| ↳ `CompanyName` | string | Vendor company name | +| ↳ `GivenName` | string | Given name | +| ↳ `FamilyName` | string | Family name | +| ↳ `PrintOnCheckName` | string | Name printed on checks | +| ↳ `Vendor1099` | boolean | Whether the vendor is tracked for 1099 reporting | +| ↳ `PrimaryEmailAddr` | json | Vendor primary email address | +| ↳ `PrimaryPhone` | json | Vendor primary phone number | +| ↳ `BillAddr` | json | Vendor billing address | +| ↳ `AcctNum` | string | Vendor account number | +| ↳ `Balance` | number | Vendor balance | +| ↳ `CurrencyRef` | json | Vendor currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | + +### QuickBooks Update Vendor + +Read, merge, and full-update a vendor in QuickBooks Online + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `vendorId` | string | Yes | ID of the vendor to update | +| `syncToken` | string | Yes | Current vendor sync token | +| `displayName` | string | No | Replacement vendor display name | +| `companyName` | string | No | Replacement vendor company name | +| `givenName` | string | No | Replacement vendor given name | +| `familyName` | string | No | Replacement vendor family name | +| `primaryEmail` | string | No | Replacement primary email address | +| `primaryPhone` | string | No | Replacement primary phone number | +| `billingAddress` | json | No | Replacement billing address | +| `printOnCheckName` | string | No | Replacement name to print on checks | +| `accountNumber` | string | No | Replacement vendor account number | +| `vendor1099` | boolean | No | Whether the vendor is tracked for 1099 reporting | +| `activeStatus` | string | No | Vendor status change: unchanged, active, or inactive | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Updated QuickBooks Vendor record | +| ↳ `Id` | string | QuickBooks entity ID | +| ↳ `SyncToken` | string | Entity sync token | +| ↳ `Active` | boolean | Whether the entity is active | +| ↳ `MetaData` | json | Entity creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | +| ↳ `DisplayName` | string | Vendor display name | +| ↳ `CompanyName` | string | Vendor company name | +| ↳ `GivenName` | string | Given name | +| ↳ `FamilyName` | string | Family name | +| ↳ `PrintOnCheckName` | string | Name printed on checks | +| ↳ `Vendor1099` | boolean | Whether the vendor is tracked for 1099 reporting | +| ↳ `PrimaryEmailAddr` | json | Vendor primary email address | +| ↳ `PrimaryPhone` | json | Vendor primary phone number | +| ↳ `BillAddr` | json | Vendor billing address | +| ↳ `AcctNum` | string | Vendor account number | +| ↳ `Balance` | number | Vendor balance | +| ↳ `CurrencyRef` | json | Vendor currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | + +### QuickBooks Create Item + +Create a Service or Non-inventory item in QuickBooks Online + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `name` | string | Yes | Unique item name | +| `itemType` | string | Yes | Writable item type: service or non_inventory | +| `incomeAccountId` | string | No | Sales of Product Income account ID recording proceeds from the sale. Required for Service items, optional for Non-inventory items and for France locales | +| `description` | string | No | Sales description | +| `unitPrice` | number | No | Sales price per unit | +| `purchaseDescription` | string | No | Purchase description | +| `purchaseCost` | number | No | Purchase cost per unit | +| `expenseAccountId` | string | Yes | Cost of Goods Sold account ID used to pay the vendor for this item. Required for both Service and Non-inventory items, except in France locales where it is optional | +| `taxable` | boolean | No | Whether the item is taxable | +| `requestId` | string | No | Optional Intuit idempotency request ID, up to 50 characters | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Created QuickBooks Item record | +| ↳ `Id` | string | QuickBooks entity ID | +| ↳ `SyncToken` | string | Entity sync token | +| ↳ `Active` | boolean | Whether the entity is active | +| ↳ `MetaData` | json | Entity creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | +| ↳ `Name` | string | Item name | +| ↳ `Description` | string | Item sales description | +| ↳ `FullyQualifiedName` | string | Hierarchical qualified item name | +| ↳ `Taxable` | boolean | Whether the item is taxable | +| ↳ `UnitPrice` | number | Item sale price | +| ↳ `Type` | string | Item type | +| ↳ `IncomeAccountRef` | json | Item income account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `ExpenseAccountRef` | json | Item expense account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PurchaseDesc` | string | Item purchase description | +| ↳ `PurchaseCost` | number | Item purchase cost | +| ↳ `AssetAccountRef` | json | Inventory asset account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `TrackQtyOnHand` | boolean | Whether QuickBooks tracks quantity on hand | +| ↳ `QtyOnHand` | number | Current quantity on hand | +| ↳ `InvStartDate` | string | Inventory tracking start date | +| ↳ `ParentRef` | json | Parent item or category reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | + +### QuickBooks Update Item + +Read, merge, and full-update an item without changing its type + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `itemId` | string | Yes | ID of the item to update | +| `syncToken` | string | Yes | Current item sync token | +| `name` | string | No | Replacement item name | +| `incomeAccountId` | string | No | Replacement income account ID | +| `description` | string | No | Replacement sales description | +| `unitPrice` | number | No | Replacement sales price per unit | +| `purchaseDescription` | string | No | Replacement purchase description | +| `purchaseCost` | number | No | Replacement purchase cost per unit | +| `expenseAccountId` | string | No | Replacement expense account ID | +| `taxable` | boolean | No | Whether the item is taxable | +| `activeStatus` | string | No | Item status change: unchanged, active, or inactive | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Updated QuickBooks Item record | +| ↳ `Id` | string | QuickBooks entity ID | +| ↳ `SyncToken` | string | Entity sync token | +| ↳ `Active` | boolean | Whether the entity is active | +| ↳ `MetaData` | json | Entity creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | +| ↳ `Name` | string | Item name | +| ↳ `Description` | string | Item sales description | +| ↳ `FullyQualifiedName` | string | Hierarchical qualified item name | +| ↳ `Taxable` | boolean | Whether the item is taxable | +| ↳ `UnitPrice` | number | Item sale price | +| ↳ `Type` | string | Item type | +| ↳ `IncomeAccountRef` | json | Item income account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `ExpenseAccountRef` | json | Item expense account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PurchaseDesc` | string | Item purchase description | +| ↳ `PurchaseCost` | number | Item purchase cost | +| ↳ `AssetAccountRef` | json | Inventory asset account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `TrackQtyOnHand` | boolean | Whether QuickBooks tracks quantity on hand | +| ↳ `QtyOnHand` | number | Current quantity on hand | +| ↳ `InvStartDate` | string | Inventory tracking start date | +| ↳ `ParentRef` | json | Parent item or category reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | + +### QuickBooks Read Sales Transactions + +List or read one estimate, invoice, sales receipt, payment, credit memo, or refund receipt + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `transactionType` | string | Yes | Sales transaction type to read | +| `readMode` | string | Yes | Whether to list transactions or read one transaction by ID | +| `transactionId` | string | No | QuickBooks transaction ID, required for by-ID reads | +| `startPosition` | number | No | One-based position of the first list record to return | +| `maxResults` | number | No | Number of list records to request \(1–100\) | +| `startDate` | string | No | List transactions on or after this date in YYYY-MM-DD format | +| `endDate` | string | No | List transactions on or before this date in YYYY-MM-DD format | +| `customerId` | string | No | List transactions for one QuickBooks customer ID | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `transactionType` | string | Sales transaction type returned | +| `item` | json | Single native QuickBooks sales transaction | +| ↳ `Id` | string | QuickBooks sales transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Invoice due date | +| ↳ `ExpirationDate` | string | Estimate expiration date | +| ↳ `CustomerRef` | json | Customer reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `CustomerMemo` | json | Customer-facing memo | +| ↳ `DepositToAccountRef` | json | Deposit account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentMethodRef` | json | Payment method reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentRefNum` | string | Customer payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks transaction lines | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `UnappliedAmt` | number | Unapplied payment amount | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `TxnStatus` | string | Transaction status | +| ↳ `TxnTaxDetail` | json | Calculated tax details | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | +| `items` | array | Native QuickBooks sales transactions | +| ↳ `Id` | string | QuickBooks sales transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Invoice due date | +| ↳ `ExpirationDate` | string | Estimate expiration date | +| ↳ `CustomerRef` | json | Customer reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `CustomerMemo` | json | Customer-facing memo | +| ↳ `DepositToAccountRef` | json | Deposit account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentMethodRef` | json | Payment method reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentRefNum` | string | Customer payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks transaction lines | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `UnappliedAmt` | number | Unapplied payment amount | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `TxnStatus` | string | Transaction status | +| ↳ `TxnTaxDetail` | json | Calculated tax details | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | +| `startPosition` | number | One-based position of the first item in this response | +| `maxResults` | number | Actual number of items reported for this response | +| `nextStartPosition` | number | Position to use when explicitly requesting the next page | +| `hasMore` | boolean | Conservative indication that another page may exist | +| `time` | string | QuickBooks response timestamp | + +### QuickBooks Create Estimate + +Create an estimate with bounded item and description lines + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `customerId` | string | Yes | Customer receiving the estimate | +| `lines` | json | Yes | Bounded item and description lines | +| `transactionDate` | string | No | Estimate date in YYYY-MM-DD format | +| `expirationDate` | string | No | Estimate expiration date in YYYY-MM-DD format | +| `documentNumber` | string | No | Optional estimate number | +| `privateNote` | string | No | Internal estimate note | +| `customerMemo` | string | No | Customer-facing estimate memo | +| `requestId` | string | No | Optional Intuit idempotency request ID, up to 50 characters | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Created native QuickBooks Estimate | +| ↳ `Id` | string | QuickBooks sales transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Invoice due date | +| ↳ `ExpirationDate` | string | Estimate expiration date | +| ↳ `CustomerRef` | json | Customer reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `CustomerMemo` | json | Customer-facing memo | +| ↳ `DepositToAccountRef` | json | Deposit account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentMethodRef` | json | Payment method reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentRefNum` | string | Customer payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks transaction lines | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `UnappliedAmt` | number | Unapplied payment amount | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `TxnStatus` | string | Transaction status | +| ↳ `TxnTaxDetail` | json | Calculated tax details | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | + +### QuickBooks Update Estimate + +Sparse-update an estimate using its current sync token + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `transactionId` | string | Yes | Estimate ID to update | +| `syncToken` | string | Yes | Current estimate sync token | +| `customerId` | string | No | Replacement customer ID | +| `lines` | json | No | Complete replacement set of estimate lines: any existing line omitted here is deleted from the estimate | +| `transactionDate` | string | No | Replacement estimate date in YYYY-MM-DD format | +| `expirationDate` | string | No | Replacement expiration date in YYYY-MM-DD format | +| `documentNumber` | string | No | Replacement estimate number | +| `privateNote` | string | No | Replacement internal note | +| `customerMemo` | string | No | Replacement customer-facing memo | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Updated native QuickBooks Estimate | +| ↳ `Id` | string | QuickBooks sales transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Invoice due date | +| ↳ `ExpirationDate` | string | Estimate expiration date | +| ↳ `CustomerRef` | json | Customer reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `CustomerMemo` | json | Customer-facing memo | +| ↳ `DepositToAccountRef` | json | Deposit account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentMethodRef` | json | Payment method reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentRefNum` | string | Customer payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks transaction lines | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `UnappliedAmt` | number | Unapplied payment amount | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `TxnStatus` | string | Transaction status | +| ↳ `TxnTaxDetail` | json | Calculated tax details | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | + +### QuickBooks Create Invoice + +Create an invoice without emailing or collecting payment + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `customerId` | string | Yes | Customer receiving the invoice | +| `lines` | json | Yes | Bounded item and description lines | +| `transactionDate` | string | No | Invoice date in YYYY-MM-DD format | +| `dueDate` | string | No | Invoice due date in YYYY-MM-DD format | +| `documentNumber` | string | No | Optional invoice number | +| `privateNote` | string | No | Internal invoice note | +| `customerMemo` | string | No | Customer-facing invoice memo | +| `requestId` | string | No | Optional Intuit idempotency request ID, up to 50 characters | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Created native QuickBooks Invoice | +| ↳ `Id` | string | QuickBooks sales transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Invoice due date | +| ↳ `ExpirationDate` | string | Estimate expiration date | +| ↳ `CustomerRef` | json | Customer reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `CustomerMemo` | json | Customer-facing memo | +| ↳ `DepositToAccountRef` | json | Deposit account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentMethodRef` | json | Payment method reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentRefNum` | string | Customer payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks transaction lines | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `UnappliedAmt` | number | Unapplied payment amount | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `TxnStatus` | string | Transaction status | +| ↳ `TxnTaxDetail` | json | Calculated tax details | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | + +### QuickBooks Update Invoice + +Sparse-update an invoice using its current sync token + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `transactionId` | string | Yes | Invoice ID to update | +| `syncToken` | string | Yes | Current invoice sync token | +| `customerId` | string | No | Replacement customer ID | +| `lines` | json | No | Complete replacement set of invoice lines: any existing line omitted here is deleted from the invoice | +| `transactionDate` | string | No | Replacement invoice date in YYYY-MM-DD format | +| `dueDate` | string | No | Replacement due date in YYYY-MM-DD format | +| `documentNumber` | string | No | Replacement invoice number | +| `privateNote` | string | No | Replacement internal note | +| `customerMemo` | string | No | Replacement customer-facing memo | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Updated native QuickBooks Invoice | +| ↳ `Id` | string | QuickBooks sales transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Invoice due date | +| ↳ `ExpirationDate` | string | Estimate expiration date | +| ↳ `CustomerRef` | json | Customer reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `CustomerMemo` | json | Customer-facing memo | +| ↳ `DepositToAccountRef` | json | Deposit account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentMethodRef` | json | Payment method reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentRefNum` | string | Customer payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks transaction lines | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `UnappliedAmt` | number | Unapplied payment amount | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `TxnStatus` | string | Transaction status | +| ↳ `TxnTaxDetail` | json | Calculated tax details | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | + +### QuickBooks Void Invoice + +Void an invoice after explicit confirmation + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `transactionId` | string | Yes | Invoice ID to void | +| `syncToken` | string | Yes | Current invoice sync token | +| `confirmVoid` | boolean | Yes | Explicit confirmation that the invoice should be voided | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `voided` | boolean | Whether QuickBooks voided the transaction | +| `record` | json | Voided native QuickBooks Invoice | +| ↳ `Id` | string | QuickBooks sales transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Invoice due date | +| ↳ `ExpirationDate` | string | Estimate expiration date | +| ↳ `CustomerRef` | json | Customer reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `CustomerMemo` | json | Customer-facing memo | +| ↳ `DepositToAccountRef` | json | Deposit account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentMethodRef` | json | Payment method reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentRefNum` | string | Customer payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks transaction lines | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `UnappliedAmt` | number | Unapplied payment amount | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `TxnStatus` | string | Transaction status | +| ↳ `TxnTaxDetail` | json | Calculated tax details | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | + +### QuickBooks Create Sales Receipt + +Create a sales receipt for a completed customer sale + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `customerId` | string | Yes | Customer for the sales receipt | +| `lines` | json | Yes | Bounded item and description lines | +| `transactionDate` | string | No | Sales receipt date in YYYY-MM-DD format | +| `documentNumber` | string | No | Optional sales receipt number | +| `privateNote` | string | No | Internal sales receipt note | +| `customerMemo` | string | No | Customer-facing sales receipt memo | +| `paymentMethodId` | string | No | QuickBooks payment method ID | +| `paymentReferenceNumber` | string | No | Payment reference number | +| `depositAccountId` | string | No | QuickBooks deposit account ID | +| `requestId` | string | No | Optional Intuit idempotency request ID, up to 50 characters | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Created native QuickBooks SalesReceipt | +| ↳ `Id` | string | QuickBooks sales transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Invoice due date | +| ↳ `ExpirationDate` | string | Estimate expiration date | +| ↳ `CustomerRef` | json | Customer reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `CustomerMemo` | json | Customer-facing memo | +| ↳ `DepositToAccountRef` | json | Deposit account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentMethodRef` | json | Payment method reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentRefNum` | string | Customer payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks transaction lines | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `UnappliedAmt` | number | Unapplied payment amount | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `TxnStatus` | string | Transaction status | +| ↳ `TxnTaxDetail` | json | Calculated tax details | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | + +### QuickBooks Update Sales Receipt + +Sparse-update a sales receipt using its current sync token + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `transactionId` | string | Yes | Sales receipt ID to update | +| `syncToken` | string | Yes | Current sales receipt sync token | +| `customerId` | string | No | Replacement customer ID | +| `lines` | json | No | Complete replacement set of sales receipt lines: any existing line omitted here is deleted from the sales receipt | +| `transactionDate` | string | No | Replacement receipt date in YYYY-MM-DD format | +| `documentNumber` | string | No | Replacement sales receipt number | +| `privateNote` | string | No | Replacement internal note | +| `customerMemo` | string | No | Replacement customer-facing memo | +| `paymentMethodId` | string | No | Replacement payment method ID | +| `paymentReferenceNumber` | string | No | Replacement payment reference number | +| `depositAccountId` | string | No | Replacement deposit account ID | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Updated native QuickBooks SalesReceipt | +| ↳ `Id` | string | QuickBooks sales transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Invoice due date | +| ↳ `ExpirationDate` | string | Estimate expiration date | +| ↳ `CustomerRef` | json | Customer reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `CustomerMemo` | json | Customer-facing memo | +| ↳ `DepositToAccountRef` | json | Deposit account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentMethodRef` | json | Payment method reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentRefNum` | string | Customer payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks transaction lines | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `UnappliedAmt` | number | Unapplied payment amount | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `TxnStatus` | string | Transaction status | +| ↳ `TxnTaxDetail` | json | Calculated tax details | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | + +### QuickBooks Create Customer Payment + +Record a customer payment with optional bounded invoice allocations + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `customerId` | string | Yes | Customer making the payment | +| `totalAmount` | number | Yes | Positive total payment amount | +| `transactionDate` | string | No | Payment date in YYYY-MM-DD format | +| `privateNote` | string | No | Internal payment note | +| `paymentReferenceNumber` | string | No | Payment reference number such as a check number | +| `paymentMethodId` | string | No | QuickBooks payment method ID | +| `depositAccountId` | string | No | QuickBooks deposit account ID | +| `invoiceAllocations` | json | No | Up to 100 invoice allocations with invoiceId and positive amount | +| `requestId` | string | No | Optional Intuit idempotency request ID, up to 50 characters | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Created native QuickBooks Payment | +| ↳ `Id` | string | QuickBooks sales transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Invoice due date | +| ↳ `ExpirationDate` | string | Estimate expiration date | +| ↳ `CustomerRef` | json | Customer reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `CustomerMemo` | json | Customer-facing memo | +| ↳ `DepositToAccountRef` | json | Deposit account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentMethodRef` | json | Payment method reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentRefNum` | string | Customer payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks transaction lines | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `UnappliedAmt` | number | Unapplied payment amount | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `TxnStatus` | string | Transaction status | +| ↳ `TxnTaxDetail` | json | Calculated tax details | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | + +### QuickBooks Update Customer Payment + +Sparse-update a customer payment using its current sync token + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `paymentId` | string | Yes | Payment ID to update | +| `syncToken` | string | Yes | Current payment sync token | +| `customerId` | string | No | Replacement customer ID | +| `totalAmount` | number | No | Replacement positive payment total | +| `transactionDate` | string | No | Replacement payment date in YYYY-MM-DD format | +| `privateNote` | string | No | Replacement internal note | +| `paymentReferenceNumber` | string | No | Replacement payment reference number | +| `paymentMethodId` | string | No | Replacement payment method ID | +| `depositAccountId` | string | No | Replacement deposit account ID | +| `invoiceAllocations` | json | No | Bounded invoice allocations to apply. Each entry sets the amount applied to that invoice; invoices already applied on the payment and not listed here keep their current amounts | +| `unapplyOmittedInvoices` | boolean | No | Replace the payment allocations outright. Every invoice not listed in invoiceAllocations is UNAPPLIED and returns to open | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Updated native QuickBooks Payment | +| ↳ `Id` | string | QuickBooks sales transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Invoice due date | +| ↳ `ExpirationDate` | string | Estimate expiration date | +| ↳ `CustomerRef` | json | Customer reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `CustomerMemo` | json | Customer-facing memo | +| ↳ `DepositToAccountRef` | json | Deposit account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentMethodRef` | json | Payment method reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentRefNum` | string | Customer payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks transaction lines | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `UnappliedAmt` | number | Unapplied payment amount | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `TxnStatus` | string | Transaction status | +| ↳ `TxnTaxDetail` | json | Calculated tax details | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | + +### QuickBooks Void Customer Payment + +Void a customer payment after explicit confirmation + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `transactionId` | string | Yes | Payment ID to void | +| `syncToken` | string | Yes | Current payment sync token | +| `confirmVoid` | boolean | Yes | Explicit confirmation that the payment should be voided | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `voided` | boolean | Whether QuickBooks voided the transaction | +| `record` | json | Voided native QuickBooks Payment | +| ↳ `Id` | string | QuickBooks sales transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Invoice due date | +| ↳ `ExpirationDate` | string | Estimate expiration date | +| ↳ `CustomerRef` | json | Customer reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `CustomerMemo` | json | Customer-facing memo | +| ↳ `DepositToAccountRef` | json | Deposit account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentMethodRef` | json | Payment method reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentRefNum` | string | Customer payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks transaction lines | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `UnappliedAmt` | number | Unapplied payment amount | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `TxnStatus` | string | Transaction status | +| ↳ `TxnTaxDetail` | json | Calculated tax details | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | + +### QuickBooks Create Credit Memo + +Create a customer credit memo with bounded sales lines + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `customerId` | string | Yes | Customer receiving the credit memo | +| `lines` | json | Yes | Bounded item and description lines | +| `transactionDate` | string | No | Credit memo date in YYYY-MM-DD format | +| `documentNumber` | string | No | Optional credit memo number | +| `privateNote` | string | No | Internal credit memo note | +| `customerMemo` | string | No | Customer-facing credit memo memo | +| `requestId` | string | No | Optional Intuit idempotency request ID, up to 50 characters | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Created native QuickBooks CreditMemo | +| ↳ `Id` | string | QuickBooks sales transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Invoice due date | +| ↳ `ExpirationDate` | string | Estimate expiration date | +| ↳ `CustomerRef` | json | Customer reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `CustomerMemo` | json | Customer-facing memo | +| ↳ `DepositToAccountRef` | json | Deposit account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentMethodRef` | json | Payment method reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentRefNum` | string | Customer payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks transaction lines | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `UnappliedAmt` | number | Unapplied payment amount | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `TxnStatus` | string | Transaction status | +| ↳ `TxnTaxDetail` | json | Calculated tax details | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | + +### QuickBooks Update Credit Memo + +Read, merge, and full-update a credit memo using its current sync token + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `transactionId` | string | Yes | Credit memo ID to update | +| `syncToken` | string | Yes | Current credit memo sync token | +| `customerId` | string | No | Replacement customer ID | +| `lines` | json | No | Complete replacement set of credit memo lines: any existing line omitted here is deleted from the credit memo | +| `transactionDate` | string | No | Replacement credit memo date in YYYY-MM-DD format | +| `documentNumber` | string | No | Replacement credit memo number | +| `privateNote` | string | No | Replacement internal note | +| `customerMemo` | string | No | Replacement customer-facing memo | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Updated native QuickBooks CreditMemo | +| ↳ `Id` | string | QuickBooks sales transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Invoice due date | +| ↳ `ExpirationDate` | string | Estimate expiration date | +| ↳ `CustomerRef` | json | Customer reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `CustomerMemo` | json | Customer-facing memo | +| ↳ `DepositToAccountRef` | json | Deposit account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentMethodRef` | json | Payment method reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentRefNum` | string | Customer payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks transaction lines | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `UnappliedAmt` | number | Unapplied payment amount | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `TxnStatus` | string | Transaction status | +| ↳ `TxnTaxDetail` | json | Calculated tax details | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | + +### QuickBooks Create Refund Receipt + +Create a customer refund receipt against a required deposit account + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `customerId` | string | Yes | Customer receiving the refund | +| `lines` | json | Yes | Bounded item and description lines | +| `depositAccountId` | string | Yes | QuickBooks bank account funding the refund | +| `transactionDate` | string | No | Refund receipt date in YYYY-MM-DD format | +| `documentNumber` | string | No | Optional refund receipt number | +| `privateNote` | string | No | Internal refund receipt note | +| `customerMemo` | string | No | Customer-facing refund memo | +| `paymentMethodId` | string | No | QuickBooks payment method ID | +| `paymentReferenceNumber` | string | No | Refund payment reference number | +| `requestId` | string | No | Optional Intuit idempotency request ID, up to 50 characters | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Created native QuickBooks RefundReceipt | +| ↳ `Id` | string | QuickBooks sales transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Invoice due date | +| ↳ `ExpirationDate` | string | Estimate expiration date | +| ↳ `CustomerRef` | json | Customer reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `CustomerMemo` | json | Customer-facing memo | +| ↳ `DepositToAccountRef` | json | Deposit account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentMethodRef` | json | Payment method reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentRefNum` | string | Customer payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks transaction lines | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `UnappliedAmt` | number | Unapplied payment amount | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `TxnStatus` | string | Transaction status | +| ↳ `TxnTaxDetail` | json | Calculated tax details | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | + +### QuickBooks Update Refund Receipt + +Sparse-update a refund receipt using its current sync token + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `transactionId` | string | Yes | Refund receipt ID to update | +| `syncToken` | string | Yes | Current refund receipt sync token | +| `customerId` | string | No | Replacement customer ID | +| `lines` | json | No | Complete replacement set of refund receipt lines: any existing line omitted here is deleted from the refund receipt | +| `transactionDate` | string | No | Replacement refund date in YYYY-MM-DD format | +| `documentNumber` | string | No | Replacement refund receipt number | +| `privateNote` | string | No | Replacement internal note | +| `customerMemo` | string | No | Replacement customer-facing memo | +| `paymentMethodId` | string | No | Replacement payment method ID | +| `paymentReferenceNumber` | string | No | Replacement payment reference number | +| `depositAccountId` | string | No | Replacement deposit account ID | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Updated native QuickBooks RefundReceipt | +| ↳ `Id` | string | QuickBooks sales transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Invoice due date | +| ↳ `ExpirationDate` | string | Estimate expiration date | +| ↳ `CustomerRef` | json | Customer reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `CustomerMemo` | json | Customer-facing memo | +| ↳ `DepositToAccountRef` | json | Deposit account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentMethodRef` | json | Payment method reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentRefNum` | string | Customer payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks transaction lines | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `UnappliedAmt` | number | Unapplied payment amount | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `TxnStatus` | string | Transaction status | +| ↳ `TxnTaxDetail` | json | Calculated tax details | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | + +### QuickBooks Read Purchasing Transactions + +List or read one purchase order, bill, bill payment, vendor credit, or purchase + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `transactionType` | string | Yes | Purchasing transaction type to read | +| `readMode` | string | Yes | Whether to list transactions or read one transaction by ID | +| `transactionId` | string | No | QuickBooks transaction ID, required for by-ID reads | +| `startPosition` | number | No | One-based position of the first list record to return | +| `maxResults` | number | No | Number of list records to request \(1–100\) | +| `startDate` | string | No | List transactions on or after this date in YYYY-MM-DD format | +| `endDate` | string | No | List transactions on or before this date in YYYY-MM-DD format | +| `vendorId` | string | No | List transactions for one supported QuickBooks vendor ID | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `transactionType` | string | Purchasing transaction type returned | +| `item` | json | Single native QuickBooks purchasing transaction | +| ↳ `Id` | string | QuickBooks purchasing transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Bill due date | +| ↳ `VendorRef` | json | Vendor reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `APAccountRef` | json | Accounts-payable account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `AccountRef` | json | Payment account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `EntityRef` | json | Purchase payee reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `type` | string | Referenced entity type | +| ↳ `PaymentType` | string | Purchase payment type | +| ↳ `PayType` | string | Bill-payment type | +| ↳ `CheckPayment` | json | Check payment account details | +| ↳ `CreditCardPayment` | json | Credit-card payment account details | +| ↳ `PaymentRefNum` | string | Payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks expense or allocation lines | +| ↳ `Id` | string | QuickBooks transaction line ID | +| ↳ `LineNum` | number | QuickBooks transaction line number | +| ↳ `Description` | string | Transaction line description | +| ↳ `Amount` | number | Transaction line amount | +| ↳ `DetailType` | string | QuickBooks line detail type | +| ↳ `LinkedTxn` | array | Transactions linked to this QuickBooks line | +| ↳ `TxnId` | string | Linked QuickBooks transaction ID | +| ↳ `TxnType` | string | Linked QuickBooks transaction type | +| ↳ `TxnLineId` | string | Linked QuickBooks transaction line ID | +| ↳ `AccountBasedExpenseLineDetail` | json | Native QuickBooks account-based expense details | +| ↳ `ItemBasedExpenseLineDetail` | json | Native QuickBooks item-based expense details | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TxnId` | string | Linked QuickBooks transaction ID | +| ↳ `TxnType` | string | Linked QuickBooks transaction type | +| ↳ `TxnLineId` | string | Linked QuickBooks transaction line ID | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | +| `items` | array | Native QuickBooks purchasing transactions | +| ↳ `Id` | string | QuickBooks purchasing transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Bill due date | +| ↳ `VendorRef` | json | Vendor reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `APAccountRef` | json | Accounts-payable account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `AccountRef` | json | Payment account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `EntityRef` | json | Purchase payee reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `type` | string | Referenced entity type | +| ↳ `PaymentType` | string | Purchase payment type | +| ↳ `PayType` | string | Bill-payment type | +| ↳ `CheckPayment` | json | Check payment account details | +| ↳ `CreditCardPayment` | json | Credit-card payment account details | +| ↳ `PaymentRefNum` | string | Payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks expense or allocation lines | +| ↳ `Id` | string | QuickBooks transaction line ID | +| ↳ `LineNum` | number | QuickBooks transaction line number | +| ↳ `Description` | string | Transaction line description | +| ↳ `Amount` | number | Transaction line amount | +| ↳ `DetailType` | string | QuickBooks line detail type | +| ↳ `LinkedTxn` | array | Transactions linked to this QuickBooks line | +| ↳ `TxnId` | string | Linked QuickBooks transaction ID | +| ↳ `TxnType` | string | Linked QuickBooks transaction type | +| ↳ `TxnLineId` | string | Linked QuickBooks transaction line ID | +| ↳ `AccountBasedExpenseLineDetail` | json | Native QuickBooks account-based expense details | +| ↳ `ItemBasedExpenseLineDetail` | json | Native QuickBooks item-based expense details | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TxnId` | string | Linked QuickBooks transaction ID | +| ↳ `TxnType` | string | Linked QuickBooks transaction type | +| ↳ `TxnLineId` | string | Linked QuickBooks transaction line ID | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | +| `startPosition` | number | One-based position of the first item in this response | +| `maxResults` | number | Actual number of items reported for this response | +| `nextStartPosition` | number | Position to use when explicitly requesting the next page | +| `hasMore` | boolean | Conservative indication that another page may exist | +| `time` | string | QuickBooks response timestamp | + +### QuickBooks Create Purchase Order + +Create a purchase order with bounded expense lines + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `vendorId` | string | Yes | Purchase-order vendor ID | +| `apAccountId` | string | Yes | Accounts-payable account ID | +| `lines` | json | Yes | Bounded account-based or item-based expense lines | +| `transactionDate` | string | No | Purchase-order date in YYYY-MM-DD format | +| `documentNumber` | string | No | Optional purchase-order number | +| `privateNote` | string | No | Internal purchase-order note | +| `requestId` | string | No | Optional Intuit idempotency request ID, up to 50 characters | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Created native QuickBooks PurchaseOrder | +| ↳ `Id` | string | QuickBooks purchasing transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Bill due date | +| ↳ `VendorRef` | json | Vendor reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `APAccountRef` | json | Accounts-payable account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `AccountRef` | json | Payment account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `EntityRef` | json | Purchase payee reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `type` | string | Referenced entity type | +| ↳ `PaymentType` | string | Purchase payment type | +| ↳ `PayType` | string | Bill-payment type | +| ↳ `CheckPayment` | json | Check payment account details | +| ↳ `CreditCardPayment` | json | Credit-card payment account details | +| ↳ `PaymentRefNum` | string | Payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks expense or allocation lines | +| ↳ `Id` | string | QuickBooks transaction line ID | +| ↳ `LineNum` | number | QuickBooks transaction line number | +| ↳ `Description` | string | Transaction line description | +| ↳ `Amount` | number | Transaction line amount | +| ↳ `DetailType` | string | QuickBooks line detail type | +| ↳ `LinkedTxn` | array | Transactions linked to this QuickBooks line | +| ↳ `TxnId` | string | Linked QuickBooks transaction ID | +| ↳ `TxnType` | string | Linked QuickBooks transaction type | +| ↳ `TxnLineId` | string | Linked QuickBooks transaction line ID | +| ↳ `AccountBasedExpenseLineDetail` | json | Native QuickBooks account-based expense details | +| ↳ `ItemBasedExpenseLineDetail` | json | Native QuickBooks item-based expense details | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TxnId` | string | Linked QuickBooks transaction ID | +| ↳ `TxnType` | string | Linked QuickBooks transaction type | +| ↳ `TxnLineId` | string | Linked QuickBooks transaction line ID | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | + +### QuickBooks Update Purchase Order + +Read, merge, and full-update purchase-order header fields + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `purchaseOrderId` | string | Yes | Purchase Order ID to update | +| `syncToken` | string | Yes | Current purchase-order sync token | +| `vendorId` | string | No | Replacement vendor ID | +| `apAccountId` | string | No | Replacement accounts-payable account ID | +| `transactionDate` | string | No | Replacement date in YYYY-MM-DD format | +| `documentNumber` | string | No | Replacement purchase-order number | +| `privateNote` | string | No | Replacement internal note | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Updated native QuickBooks PurchaseOrder | +| ↳ `Id` | string | QuickBooks purchasing transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Bill due date | +| ↳ `VendorRef` | json | Vendor reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `APAccountRef` | json | Accounts-payable account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `AccountRef` | json | Payment account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `EntityRef` | json | Purchase payee reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `type` | string | Referenced entity type | +| ↳ `PaymentType` | string | Purchase payment type | +| ↳ `PayType` | string | Bill-payment type | +| ↳ `CheckPayment` | json | Check payment account details | +| ↳ `CreditCardPayment` | json | Credit-card payment account details | +| ↳ `PaymentRefNum` | string | Payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks expense or allocation lines | +| ↳ `Id` | string | QuickBooks transaction line ID | +| ↳ `LineNum` | number | QuickBooks transaction line number | +| ↳ `Description` | string | Transaction line description | +| ↳ `Amount` | number | Transaction line amount | +| ↳ `DetailType` | string | QuickBooks line detail type | +| ↳ `LinkedTxn` | array | Transactions linked to this QuickBooks line | +| ↳ `TxnId` | string | Linked QuickBooks transaction ID | +| ↳ `TxnType` | string | Linked QuickBooks transaction type | +| ↳ `TxnLineId` | string | Linked QuickBooks transaction line ID | +| ↳ `AccountBasedExpenseLineDetail` | json | Native QuickBooks account-based expense details | +| ↳ `ItemBasedExpenseLineDetail` | json | Native QuickBooks item-based expense details | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TxnId` | string | Linked QuickBooks transaction ID | +| ↳ `TxnType` | string | Linked QuickBooks transaction type | +| ↳ `TxnLineId` | string | Linked QuickBooks transaction line ID | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | + +### QuickBooks Create Bill + +Create a vendor bill with optional Purchase Order line links without paying it + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `vendorId` | string | Yes | Bill vendor ID | +| `lines` | json | Yes | Bounded account-based or item-based expense lines with optional paired Purchase Order and line IDs | +| `apAccountId` | string | No | Optional accounts-payable account ID | +| `transactionDate` | string | No | Bill date in YYYY-MM-DD format | +| `dueDate` | string | No | Bill due date in YYYY-MM-DD format | +| `documentNumber` | string | No | Optional bill number | +| `privateNote` | string | No | Internal bill note | +| `requestId` | string | No | Optional Intuit idempotency request ID, up to 50 characters | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `linkingRequested` | boolean | Whether any Purchase Order line links were requested | +| `linkingSucceeded` | boolean | Whether QuickBooks returned every requested Purchase Order line link | +| `linkedLines` | array | Requested Purchase Order line links confirmed by QuickBooks | +| ↳ `purchaseOrderId` | string | Requested Purchase Order ID | +| ↳ `purchaseOrderLineId` | string | Requested Purchase Order line ID | +| ↳ `billLineId` | string | Created Bill line ID carrying the confirmed link | +| `missingLinks` | array | Requested Purchase Order line links omitted by QuickBooks | +| ↳ `purchaseOrderId` | string | Requested Purchase Order ID | +| ↳ `purchaseOrderLineId` | string | Requested Purchase Order line ID | +| `linkingWarning` | string | Warning that the Bill was created without every requested Purchase Order link | +| `record` | json | Created native QuickBooks Bill | +| ↳ `Id` | string | QuickBooks purchasing transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Bill due date | +| ↳ `VendorRef` | json | Vendor reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `APAccountRef` | json | Accounts-payable account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `AccountRef` | json | Payment account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `EntityRef` | json | Purchase payee reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `type` | string | Referenced entity type | +| ↳ `PaymentType` | string | Purchase payment type | +| ↳ `PayType` | string | Bill-payment type | +| ↳ `CheckPayment` | json | Check payment account details | +| ↳ `CreditCardPayment` | json | Credit-card payment account details | +| ↳ `PaymentRefNum` | string | Payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks expense or allocation lines | +| ↳ `Id` | string | QuickBooks transaction line ID | +| ↳ `LineNum` | number | QuickBooks transaction line number | +| ↳ `Description` | string | Transaction line description | +| ↳ `Amount` | number | Transaction line amount | +| ↳ `DetailType` | string | QuickBooks line detail type | +| ↳ `LinkedTxn` | array | Transactions linked to this QuickBooks line | +| ↳ `TxnId` | string | Linked QuickBooks transaction ID | +| ↳ `TxnType` | string | Linked QuickBooks transaction type | +| ↳ `TxnLineId` | string | Linked QuickBooks transaction line ID | +| ↳ `AccountBasedExpenseLineDetail` | json | Native QuickBooks account-based expense details | +| ↳ `ItemBasedExpenseLineDetail` | json | Native QuickBooks item-based expense details | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TxnId` | string | Linked QuickBooks transaction ID | +| ↳ `TxnType` | string | Linked QuickBooks transaction type | +| ↳ `TxnLineId` | string | Linked QuickBooks transaction line ID | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | + +### QuickBooks Update Bill + +Read, merge, and full-update bill header fields using its current sync token + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `billId` | string | Yes | Bill ID to update | +| `syncToken` | string | Yes | Current bill sync token | +| `vendorId` | string | Yes | Current or replacement vendor ID required by QuickBooks | +| `apAccountId` | string | No | Replacement accounts-payable account ID | +| `transactionDate` | string | No | Replacement bill date in YYYY-MM-DD format | +| `dueDate` | string | No | Replacement due date in YYYY-MM-DD format | +| `documentNumber` | string | No | Replacement bill number | +| `privateNote` | string | No | Replacement internal note | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Updated native QuickBooks Bill | +| ↳ `Id` | string | QuickBooks purchasing transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Bill due date | +| ↳ `VendorRef` | json | Vendor reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `APAccountRef` | json | Accounts-payable account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `AccountRef` | json | Payment account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `EntityRef` | json | Purchase payee reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `type` | string | Referenced entity type | +| ↳ `PaymentType` | string | Purchase payment type | +| ↳ `PayType` | string | Bill-payment type | +| ↳ `CheckPayment` | json | Check payment account details | +| ↳ `CreditCardPayment` | json | Credit-card payment account details | +| ↳ `PaymentRefNum` | string | Payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks expense or allocation lines | +| ↳ `Id` | string | QuickBooks transaction line ID | +| ↳ `LineNum` | number | QuickBooks transaction line number | +| ↳ `Description` | string | Transaction line description | +| ↳ `Amount` | number | Transaction line amount | +| ↳ `DetailType` | string | QuickBooks line detail type | +| ↳ `LinkedTxn` | array | Transactions linked to this QuickBooks line | +| ↳ `TxnId` | string | Linked QuickBooks transaction ID | +| ↳ `TxnType` | string | Linked QuickBooks transaction type | +| ↳ `TxnLineId` | string | Linked QuickBooks transaction line ID | +| ↳ `AccountBasedExpenseLineDetail` | json | Native QuickBooks account-based expense details | +| ↳ `ItemBasedExpenseLineDetail` | json | Native QuickBooks item-based expense details | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TxnId` | string | Linked QuickBooks transaction ID | +| ↳ `TxnType` | string | Linked QuickBooks transaction type | +| ↳ `TxnLineId` | string | Linked QuickBooks transaction line ID | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | + +### QuickBooks Create Bill Payment + +Record a check or credit-card payment allocated to one or more bills + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `vendorId` | string | Yes | Vendor whose bills are being paid | +| `totalAmount` | number | Yes | Positive total payment amount | +| `paymentType` | string | Yes | Check or credit-card payment type | +| `paymentAccountId` | string | Yes | Bank or credit-card account ID matching the payment type | +| `billAllocations` | json | No | Optional bounded Bill-only allocations; any unallocated amount becomes vendor credit | +| `transactionDate` | string | No | Payment date in YYYY-MM-DD format | +| `privateNote` | string | No | Internal payment note | +| `requestId` | string | No | Optional Intuit idempotency request ID, up to 50 characters | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Created native QuickBooks BillPayment | +| ↳ `Id` | string | QuickBooks purchasing transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Bill due date | +| ↳ `VendorRef` | json | Vendor reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `APAccountRef` | json | Accounts-payable account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `AccountRef` | json | Payment account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `EntityRef` | json | Purchase payee reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `type` | string | Referenced entity type | +| ↳ `PaymentType` | string | Purchase payment type | +| ↳ `PayType` | string | Bill-payment type | +| ↳ `CheckPayment` | json | Check payment account details | +| ↳ `CreditCardPayment` | json | Credit-card payment account details | +| ↳ `PaymentRefNum` | string | Payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks expense or allocation lines | +| ↳ `Id` | string | QuickBooks transaction line ID | +| ↳ `LineNum` | number | QuickBooks transaction line number | +| ↳ `Description` | string | Transaction line description | +| ↳ `Amount` | number | Transaction line amount | +| ↳ `DetailType` | string | QuickBooks line detail type | +| ↳ `LinkedTxn` | array | Transactions linked to this QuickBooks line | +| ↳ `TxnId` | string | Linked QuickBooks transaction ID | +| ↳ `TxnType` | string | Linked QuickBooks transaction type | +| ↳ `TxnLineId` | string | Linked QuickBooks transaction line ID | +| ↳ `AccountBasedExpenseLineDetail` | json | Native QuickBooks account-based expense details | +| ↳ `ItemBasedExpenseLineDetail` | json | Native QuickBooks item-based expense details | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TxnId` | string | Linked QuickBooks transaction ID | +| ↳ `TxnType` | string | Linked QuickBooks transaction type | +| ↳ `TxnLineId` | string | Linked QuickBooks transaction line ID | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | + +### QuickBooks Update Bill Payment + +Read, merge, and full-update a BillPayment without changing allocations + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `billPaymentId` | string | Yes | BillPayment ID to update | +| `syncToken` | string | Yes | Current BillPayment sync token | +| `vendorId` | string | Yes | Current vendor ID required by QuickBooks | +| `transactionDate` | string | No | Replacement payment date in YYYY-MM-DD format | +| `privateNote` | string | No | Replacement internal note | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Updated native QuickBooks BillPayment | +| ↳ `Id` | string | QuickBooks purchasing transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Bill due date | +| ↳ `VendorRef` | json | Vendor reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `APAccountRef` | json | Accounts-payable account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `AccountRef` | json | Payment account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `EntityRef` | json | Purchase payee reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `type` | string | Referenced entity type | +| ↳ `PaymentType` | string | Purchase payment type | +| ↳ `PayType` | string | Bill-payment type | +| ↳ `CheckPayment` | json | Check payment account details | +| ↳ `CreditCardPayment` | json | Credit-card payment account details | +| ↳ `PaymentRefNum` | string | Payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks expense or allocation lines | +| ↳ `Id` | string | QuickBooks transaction line ID | +| ↳ `LineNum` | number | QuickBooks transaction line number | +| ↳ `Description` | string | Transaction line description | +| ↳ `Amount` | number | Transaction line amount | +| ↳ `DetailType` | string | QuickBooks line detail type | +| ↳ `LinkedTxn` | array | Transactions linked to this QuickBooks line | +| ↳ `TxnId` | string | Linked QuickBooks transaction ID | +| ↳ `TxnType` | string | Linked QuickBooks transaction type | +| ↳ `TxnLineId` | string | Linked QuickBooks transaction line ID | +| ↳ `AccountBasedExpenseLineDetail` | json | Native QuickBooks account-based expense details | +| ↳ `ItemBasedExpenseLineDetail` | json | Native QuickBooks item-based expense details | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TxnId` | string | Linked QuickBooks transaction ID | +| ↳ `TxnType` | string | Linked QuickBooks transaction type | +| ↳ `TxnLineId` | string | Linked QuickBooks transaction line ID | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | + +### QuickBooks Create Vendor Credit + +Create a vendor credit without applying it to a bill + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `vendorId` | string | Yes | Vendor issuing the credit | +| `lines` | json | Yes | Bounded account-based or item-based expense lines | +| `apAccountId` | string | No | Optional accounts-payable account ID | +| `transactionDate` | string | No | Credit date in YYYY-MM-DD format | +| `documentNumber` | string | No | Optional vendor-credit number | +| `privateNote` | string | No | Internal vendor-credit note | +| `requestId` | string | No | Optional Intuit idempotency request ID, up to 50 characters | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Created native QuickBooks VendorCredit | +| ↳ `Id` | string | QuickBooks purchasing transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Bill due date | +| ↳ `VendorRef` | json | Vendor reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `APAccountRef` | json | Accounts-payable account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `AccountRef` | json | Payment account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `EntityRef` | json | Purchase payee reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `type` | string | Referenced entity type | +| ↳ `PaymentType` | string | Purchase payment type | +| ↳ `PayType` | string | Bill-payment type | +| ↳ `CheckPayment` | json | Check payment account details | +| ↳ `CreditCardPayment` | json | Credit-card payment account details | +| ↳ `PaymentRefNum` | string | Payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks expense or allocation lines | +| ↳ `Id` | string | QuickBooks transaction line ID | +| ↳ `LineNum` | number | QuickBooks transaction line number | +| ↳ `Description` | string | Transaction line description | +| ↳ `Amount` | number | Transaction line amount | +| ↳ `DetailType` | string | QuickBooks line detail type | +| ↳ `LinkedTxn` | array | Transactions linked to this QuickBooks line | +| ↳ `TxnId` | string | Linked QuickBooks transaction ID | +| ↳ `TxnType` | string | Linked QuickBooks transaction type | +| ↳ `TxnLineId` | string | Linked QuickBooks transaction line ID | +| ↳ `AccountBasedExpenseLineDetail` | json | Native QuickBooks account-based expense details | +| ↳ `ItemBasedExpenseLineDetail` | json | Native QuickBooks item-based expense details | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TxnId` | string | Linked QuickBooks transaction ID | +| ↳ `TxnType` | string | Linked QuickBooks transaction type | +| ↳ `TxnLineId` | string | Linked QuickBooks transaction line ID | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | + +### QuickBooks Update Vendor Credit + +Read, merge, and full-update vendor-credit header fields + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `vendorCreditId` | string | Yes | VendorCredit ID to update | +| `syncToken` | string | Yes | Current vendor-credit sync token | +| `vendorId` | string | Yes | Current or replacement vendor ID required by QuickBooks | +| `apAccountId` | string | No | Replacement accounts-payable account ID | +| `transactionDate` | string | No | Replacement date in YYYY-MM-DD format | +| `documentNumber` | string | No | Replacement vendor-credit number | +| `privateNote` | string | No | Replacement internal note | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Updated native QuickBooks VendorCredit | +| ↳ `Id` | string | QuickBooks purchasing transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Bill due date | +| ↳ `VendorRef` | json | Vendor reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `APAccountRef` | json | Accounts-payable account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `AccountRef` | json | Payment account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `EntityRef` | json | Purchase payee reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `type` | string | Referenced entity type | +| ↳ `PaymentType` | string | Purchase payment type | +| ↳ `PayType` | string | Bill-payment type | +| ↳ `CheckPayment` | json | Check payment account details | +| ↳ `CreditCardPayment` | json | Credit-card payment account details | +| ↳ `PaymentRefNum` | string | Payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks expense or allocation lines | +| ↳ `Id` | string | QuickBooks transaction line ID | +| ↳ `LineNum` | number | QuickBooks transaction line number | +| ↳ `Description` | string | Transaction line description | +| ↳ `Amount` | number | Transaction line amount | +| ↳ `DetailType` | string | QuickBooks line detail type | +| ↳ `LinkedTxn` | array | Transactions linked to this QuickBooks line | +| ↳ `TxnId` | string | Linked QuickBooks transaction ID | +| ↳ `TxnType` | string | Linked QuickBooks transaction type | +| ↳ `TxnLineId` | string | Linked QuickBooks transaction line ID | +| ↳ `AccountBasedExpenseLineDetail` | json | Native QuickBooks account-based expense details | +| ↳ `ItemBasedExpenseLineDetail` | json | Native QuickBooks item-based expense details | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TxnId` | string | Linked QuickBooks transaction ID | +| ↳ `TxnType` | string | Linked QuickBooks transaction type | +| ↳ `TxnLineId` | string | Linked QuickBooks transaction line ID | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | + +### QuickBooks Create Purchase + +Record a cash, check, or credit-card purchase with bounded expense lines + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `paymentType` | string | Yes | Cash, check, or credit-card purchase type | +| `paymentAccountId` | string | Yes | Bank or credit-card account ID matching the purchase type | +| `lines` | json | Yes | Bounded account-based or item-based expense lines | +| `vendorId` | string | No | Optional vendor payee ID | +| `transactionDate` | string | No | Purchase date in YYYY-MM-DD format | +| `paymentReference` | string | No | Optional transaction reference number, such as a check number, sent as the purchase DocNumber | +| `privateNote` | string | No | Internal purchase note | +| `requestId` | string | No | Optional Intuit idempotency request ID, up to 50 characters | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Created native QuickBooks Purchase | +| ↳ `Id` | string | QuickBooks purchasing transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Bill due date | +| ↳ `VendorRef` | json | Vendor reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `APAccountRef` | json | Accounts-payable account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `AccountRef` | json | Payment account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `EntityRef` | json | Purchase payee reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `type` | string | Referenced entity type | +| ↳ `PaymentType` | string | Purchase payment type | +| ↳ `PayType` | string | Bill-payment type | +| ↳ `CheckPayment` | json | Check payment account details | +| ↳ `CreditCardPayment` | json | Credit-card payment account details | +| ↳ `PaymentRefNum` | string | Payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks expense or allocation lines | +| ↳ `Id` | string | QuickBooks transaction line ID | +| ↳ `LineNum` | number | QuickBooks transaction line number | +| ↳ `Description` | string | Transaction line description | +| ↳ `Amount` | number | Transaction line amount | +| ↳ `DetailType` | string | QuickBooks line detail type | +| ↳ `LinkedTxn` | array | Transactions linked to this QuickBooks line | +| ↳ `TxnId` | string | Linked QuickBooks transaction ID | +| ↳ `TxnType` | string | Linked QuickBooks transaction type | +| ↳ `TxnLineId` | string | Linked QuickBooks transaction line ID | +| ↳ `AccountBasedExpenseLineDetail` | json | Native QuickBooks account-based expense details | +| ↳ `ItemBasedExpenseLineDetail` | json | Native QuickBooks item-based expense details | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TxnId` | string | Linked QuickBooks transaction ID | +| ↳ `TxnType` | string | Linked QuickBooks transaction type | +| ↳ `TxnLineId` | string | Linked QuickBooks transaction line ID | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | + +### QuickBooks Update Purchase + +Read, merge, and full-update purchase header fields without changing lines + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `purchaseId` | string | Yes | Purchase ID to update | +| `syncToken` | string | Yes | Current purchase sync token | +| `vendorId` | string | No | Replacement vendor payee ID | +| `transactionDate` | string | No | Replacement purchase date in YYYY-MM-DD format | +| `paymentReference` | string | No | Replacement transaction reference number, such as a check number, sent as the purchase DocNumber | +| `privateNote` | string | No | Replacement internal note | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Updated native QuickBooks Purchase | +| ↳ `Id` | string | QuickBooks purchasing transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Bill due date | +| ↳ `VendorRef` | json | Vendor reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `APAccountRef` | json | Accounts-payable account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `AccountRef` | json | Payment account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `EntityRef` | json | Purchase payee reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `type` | string | Referenced entity type | +| ↳ `PaymentType` | string | Purchase payment type | +| ↳ `PayType` | string | Bill-payment type | +| ↳ `CheckPayment` | json | Check payment account details | +| ↳ `CreditCardPayment` | json | Credit-card payment account details | +| ↳ `PaymentRefNum` | string | Payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks expense or allocation lines | +| ↳ `Id` | string | QuickBooks transaction line ID | +| ↳ `LineNum` | number | QuickBooks transaction line number | +| ↳ `Description` | string | Transaction line description | +| ↳ `Amount` | number | Transaction line amount | +| ↳ `DetailType` | string | QuickBooks line detail type | +| ↳ `LinkedTxn` | array | Transactions linked to this QuickBooks line | +| ↳ `TxnId` | string | Linked QuickBooks transaction ID | +| ↳ `TxnType` | string | Linked QuickBooks transaction type | +| ↳ `TxnLineId` | string | Linked QuickBooks transaction line ID | +| ↳ `AccountBasedExpenseLineDetail` | json | Native QuickBooks account-based expense details | +| ↳ `ItemBasedExpenseLineDetail` | json | Native QuickBooks item-based expense details | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TxnId` | string | Linked QuickBooks transaction ID | +| ↳ `TxnType` | string | Linked QuickBooks transaction type | +| ↳ `TxnLineId` | string | Linked QuickBooks transaction line ID | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | + +### QuickBooks Read Accounting Transactions + +List or read one journal entry, deposit, or transfer + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `transactionType` | string | Yes | Accounting transaction type to read | +| `readMode` | string | Yes | Whether to list transactions or read one transaction by ID | +| `transactionId` | string | No | QuickBooks transaction ID, required for by-ID reads | +| `startPosition` | number | No | One-based position of the first list record to return | +| `maxResults` | number | No | Number of list records to request \(1–100\) | +| `startDate` | string | No | List transactions on or after this date in YYYY-MM-DD format | +| `endDate` | string | No | List transactions on or before this date in YYYY-MM-DD format | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `transactionType` | string | Accounting transaction type returned | +| `item` | json | Single native QuickBooks accounting transaction | +| ↳ `Id` | string | QuickBooks accounting transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `Adjustment` | boolean | Whether the journal entry is an adjusting entry | +| ↳ `DepositToAccountRef` | json | Account receiving a deposit | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `FromAccountRef` | json | Transfer source account | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `ToAccountRef` | json | Transfer destination account | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks journal or deposit lines | +| ↳ `Amount` | number | Transfer amount | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | +| `items` | array | Native QuickBooks accounting transactions | +| ↳ `Id` | string | QuickBooks accounting transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `Adjustment` | boolean | Whether the journal entry is an adjusting entry | +| ↳ `DepositToAccountRef` | json | Account receiving a deposit | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `FromAccountRef` | json | Transfer source account | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `ToAccountRef` | json | Transfer destination account | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks journal or deposit lines | +| ↳ `Amount` | number | Transfer amount | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | +| `startPosition` | number | One-based position of the first item in this response | +| `maxResults` | number | Actual number of items reported for this response | +| `nextStartPosition` | number | Position to use when explicitly requesting the next page | +| `hasMore` | boolean | Conservative indication that another page may exist | +| `time` | string | QuickBooks response timestamp | + +### QuickBooks Create Journal Entry + +Post a balanced journal entry after explicit confirmation + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `lines` | json | Yes | Two to 100 balanced debit and credit lines | +| `confirmPosting` | boolean | Yes | Explicit confirmation that this journal entry should be posted | +| `transactionDate` | string | No | Journal-entry date in YYYY-MM-DD format | +| `documentNumber` | string | No | Optional journal-entry number | +| `privateNote` | string | No | Internal journal-entry note | +| `requestId` | string | No | Optional Intuit idempotency request ID, up to 50 characters | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Created native QuickBooks JournalEntry | +| ↳ `Id` | string | QuickBooks accounting transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `Adjustment` | boolean | Whether the journal entry is an adjusting entry | +| ↳ `DepositToAccountRef` | json | Account receiving a deposit | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `FromAccountRef` | json | Transfer source account | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `ToAccountRef` | json | Transfer destination account | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks journal or deposit lines | +| ↳ `Amount` | number | Transfer amount | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | + +### QuickBooks Update Journal Entry + +Sparse-update journal-entry header fields after explicit confirmation + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `journalEntryId` | string | Yes | Journal Entry ID to update | +| `syncToken` | string | Yes | Current journal-entry sync token | +| `confirmPosting` | boolean | Yes | Explicit confirmation that this journal-entry update should be posted | +| `transactionDate` | string | No | Replacement date in YYYY-MM-DD format | +| `documentNumber` | string | No | Replacement journal-entry number | +| `privateNote` | string | No | Replacement internal note | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Updated native QuickBooks JournalEntry | +| ↳ `Id` | string | QuickBooks accounting transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `Adjustment` | boolean | Whether the journal entry is an adjusting entry | +| ↳ `DepositToAccountRef` | json | Account receiving a deposit | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `FromAccountRef` | json | Transfer source account | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `ToAccountRef` | json | Transfer destination account | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks journal or deposit lines | +| ↳ `Amount` | number | Transfer amount | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | + +### QuickBooks Create Deposit + +Create a deposit with bounded account lines + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `depositAccountId` | string | Yes | Bank or asset account receiving the deposit | +| `lines` | json | Yes | One to 100 account-based deposit lines | +| `transactionDate` | string | No | Deposit date in YYYY-MM-DD format | +| `privateNote` | string | No | Internal deposit note | +| `requestId` | string | No | Optional Intuit idempotency request ID, up to 50 characters | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Created native QuickBooks Deposit | +| ↳ `Id` | string | QuickBooks accounting transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `Adjustment` | boolean | Whether the journal entry is an adjusting entry | +| ↳ `DepositToAccountRef` | json | Account receiving a deposit | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `FromAccountRef` | json | Transfer source account | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `ToAccountRef` | json | Transfer destination account | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks journal or deposit lines | +| ↳ `Amount` | number | Transfer amount | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | + +### QuickBooks Update Deposit + +Sparse-update deposit header fields using the current sync token and destination account + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `depositId` | string | Yes | Deposit ID to update | +| `syncToken` | string | Yes | Current deposit sync token | +| `depositAccountId` | string | Yes | Current QuickBooks account receiving the deposit | +| `transactionDate` | string | No | Replacement date in YYYY-MM-DD format | +| `privateNote` | string | No | Replacement internal note | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `recordId` | string | ID of the created or updated QuickBooks entity | +| `syncToken` | string | Latest sync token required for a subsequent update | +| `time` | string | QuickBooks response timestamp | +| `record` | json | Updated native QuickBooks Deposit | +| ↳ `Id` | string | QuickBooks accounting transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `Adjustment` | boolean | Whether the journal entry is an adjusting entry | +| ↳ `DepositToAccountRef` | json | Account receiving a deposit | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `FromAccountRef` | json | Transfer source account | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `ToAccountRef` | json | Transfer destination account | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks journal or deposit lines | +| ↳ `Amount` | number | Transfer amount | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | + +### QuickBooks Run Financial Report + +Run a fixed QuickBooks financial report with verified accountant-focused filters + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `reportType` | string | Yes | Fixed QuickBooks financial report to run | +| `startDate` | string | No | Report start date in YYYY-MM-DD format; Intuit recommends periods of six months or less for performance | +| `endDate` | string | No | Report end or as-of date in YYYY-MM-DD format | +| `accountingMethod` | string | No | Use the QuickBooks default, cash basis, or accrual basis | +| `summarizeBy` | string | No | Time period or business dimension used to summarize report columns | +| `customerId` | string | No | Single QuickBooks customer ID filter | +| `vendorId` | string | No | Single QuickBooks vendor ID filter | +| `accountId` | string | No | Single QuickBooks account ID filter | +| `itemId` | string | No | Single QuickBooks item ID filter | +| `classId` | string | No | Single QuickBooks class ID filter | +| `departmentId` | string | No | Single QuickBooks department ID filter | +| `agingMethod` | string | No | Age open balances from the report date or current date | +| `agingDays` | number | No | Positive number of days in each aging period | +| `transactionType` | string | No | Transaction type filter for Transaction List | +| `groupBy` | string | No | Grouping dimension for Transaction List | +| `accountsPayablePaid` | string | No | Accounts-payable paid status for Transaction List | +| `accountsReceivablePaid` | string | No | Accounts-receivable paid status for Transaction List | +| `clearedStatus` | string | No | Cleared status filter for Transaction List | +| `documentNumber` | string | No | Document number filter for Transaction List | +| `sourceAccountType` | string | No | Source account type filter for Transaction List | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `reportType` | string | Financial report type that was run | +| `header` | json | Native QuickBooks report header with name, periods, basis, currency, summarization, filters, and options | +| ↳ `Time` | string | QuickBooks report generation timestamp | +| ↳ `ReportName` | string | Native QuickBooks report name | +| ↳ `DateMacro` | string | QuickBooks date macro, when returned | +| ↳ `ReportBasis` | string | Cash or accrual basis | +| ↳ `StartPeriod` | string | Report start date | +| ↳ `EndPeriod` | string | Report end or as-of date | +| ↳ `SummarizeColumnsBy` | string | Dimension or time period used for report columns | +| ↳ `Currency` | string | Report currency | +| ↳ `Customer` | string | Applied customer filter | +| ↳ `Vendor` | string | Applied vendor filter | +| ↳ `Account` | string | Applied account filter | +| ↳ `Item` | string | Applied item filter | +| ↳ `Class` | string | Applied class filter | +| ↳ `Department` | string | Applied department filter | +| ↳ `Option` | array | Native QuickBooks report options, including no-data indicators when present | +| `columns` | json | Native QuickBooks report column definitions | +| ↳ `Column` | array | Native report column definitions with titles, types, and metadata | +| ↳ `ColTitle` | string | Column title | +| ↳ `ColType` | string | QuickBooks column data type | +| ↳ `MetaData` | array | Native column metadata name/value entries | +| `rows` | json | Native hierarchical QuickBooks report rows and section summaries | +| ↳ `Row` | array | Native hierarchical report rows; section rows may contain Header, nested Rows, and Summary, while data rows contain ColData values, IDs, and links | +| ↳ `type` | string | QuickBooks row type | +| ↳ `group` | string | QuickBooks section group | +| ↳ `Header` | json | Section header column data | +| ↳ `ColData` | array | Row values with optional operational IDs and links | +| ↳ `Rows` | json | Nested native QuickBooks report rows | +| ↳ `Summary` | json | Section summary column data | +| `time` | string | QuickBooks response timestamp | + +### QuickBooks Email Transaction + +Send a supported QuickBooks transaction by email. This causes an external email and Intuit limits sandbox email delivery. + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `transactionType` | string | Yes | Supported transaction type to email | +| `transactionId` | string | Yes | QuickBooks transaction ID | +| `recipient` | string | No | Required for Customer Payments; otherwise an optional single recipient override | +| `confirmSend` | boolean | Yes | Explicit confirmation that an external email should be sent | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `transactionType` | string | Emailed QuickBooks transaction type | +| `transactionId` | string | Emailed QuickBooks transaction ID | +| `sent` | boolean | Whether QuickBooks accepted the email send request | +| `record` | json | Native QuickBooks transaction returned after sending | +| ↳ `Id` | string | QuickBooks transaction ID | +| ↳ `SyncToken` | string | Current transaction sync token | +| ↳ `DocNumber` | string | Transaction document number | +| ↳ `TxnDate` | string | Transaction date | +| ↳ `DueDate` | string | Transaction due date | +| ↳ `ExpirationDate` | string | Estimate expiration date | +| ↳ `CustomerRef` | json | Customer reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `CustomerMemo` | json | Customer-facing memo | +| ↳ `DepositToAccountRef` | json | Deposit account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentMethodRef` | json | Payment method reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `PaymentRefNum` | string | Payment reference number | +| ↳ `CurrencyRef` | json | Transaction currency reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `Line` | array | Native QuickBooks sales or purchasing transaction lines | +| ↳ `Id` | string | QuickBooks transaction line ID | +| ↳ `LineNum` | number | QuickBooks transaction line number | +| ↳ `Description` | string | Transaction line description | +| ↳ `Amount` | number | Transaction line amount | +| ↳ `DetailType` | string | QuickBooks line detail type | +| ↳ `LinkedTxn` | array | Transactions linked to this QuickBooks line | +| ↳ `TxnId` | string | Linked QuickBooks transaction ID | +| ↳ `TxnType` | string | Linked QuickBooks transaction type | +| ↳ `TxnLineId` | string | Linked QuickBooks transaction line ID | +| ↳ `AccountBasedExpenseLineDetail` | json | Native QuickBooks account-based expense details | +| ↳ `ItemBasedExpenseLineDetail` | json | Native QuickBooks item-based expense details | +| ↳ `SalesItemLineDetail` | json | Native QuickBooks sales item line details | +| ↳ `DescriptionLineDetail` | json | Native QuickBooks description line details | +| ↳ `LinkedTxn` | array | Transactions linked by QuickBooks | +| ↳ `TxnId` | string | Linked QuickBooks transaction ID | +| ↳ `TxnType` | string | Linked QuickBooks transaction type | +| ↳ `TxnLineId` | string | Linked QuickBooks transaction line ID | +| ↳ `TotalAmt` | number | Transaction total amount | +| ↳ `Balance` | number | Remaining transaction balance | +| ↳ `UnappliedAmt` | number | Unapplied payment amount | +| ↳ `PrivateNote` | string | Internal transaction note | +| ↳ `TxnStatus` | string | Transaction status | +| ↳ `TxnTaxDetail` | json | Calculated tax details | +| ↳ `MetaData` | json | Transaction creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | +| ↳ `VendorRef` | json | Vendor reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `APAccountRef` | json | Accounts-payable account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `AccountRef` | json | Payment account reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `EntityRef` | json | Purchase payee reference | +| ↳ `value` | string | QuickBooks entity ID | +| ↳ `name` | string | QuickBooks entity display name | +| ↳ `type` | string | Referenced entity type | +| ↳ `PaymentType` | string | Purchase payment type | +| ↳ `PayType` | string | Bill-payment type | +| ↳ `CheckPayment` | json | Check payment account details | +| ↳ `CreditCardPayment` | json | Credit-card payment account details | +| ↳ `POStatus` | string | Purchase order status | +| `time` | string | QuickBooks response timestamp | + +### QuickBooks Download Transaction PDF + +Download a supported QuickBooks transaction as a bounded PDF file + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `transactionType` | string | Yes | Supported transaction type to download | +| `transactionId` | string | Yes | QuickBooks transaction ID | +| `fileName` | string | No | Optional safe PDF filename override | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `file` | file | Downloaded file stored in execution files | +| `fileName` | string | Safe downloaded filename | +| `mimeType` | string | Downloaded file MIME type | +| `size` | number | Downloaded file size in bytes | +| `transactionType` | string | Downloaded QuickBooks transaction type | +| `transactionId` | string | Downloaded QuickBooks transaction ID | + +### QuickBooks Read Attachments + +List attachment metadata for a fixed QuickBooks entity or read one attachment by ID + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `readMode` | string | Yes | Read mode: list or by_id | +| `targetType` | string | No | Fixed QuickBooks entity type for List mode | +| `targetId` | string | No | QuickBooks entity ID for List mode | +| `attachmentId` | string | No | QuickBooks attachment ID for By ID mode | +| `startPosition` | number | No | One-based list start position; defaults to 1 | +| `maxResults` | number | No | List page size from 1 through 100; defaults to 25 | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `startPosition` | number | One-based position of the first item in this response | +| `maxResults` | number | Actual number of items reported for this response | +| `nextStartPosition` | number | Position to use when explicitly requesting the next page | +| `hasMore` | boolean | Conservative indication that another page may exist | +| `time` | string | QuickBooks response timestamp | +| `item` | json | Native QuickBooks attachment metadata | +| ↳ `Id` | string | QuickBooks attachment ID | +| ↳ `SyncToken` | string | Attachment sync token | +| ↳ `FileName` | string | Attached file name | +| ↳ `ContentType` | string | Attached file MIME type | +| ↳ `Size` | number | Attached file size in bytes | +| ↳ `Note` | string | Attachment note or description | +| ↳ `Category` | string | Native QuickBooks attachment category | +| ↳ `AttachableRef` | array | QuickBooks entities referenced by this attachment | +| ↳ `EntityRef` | json | Attached entity type and operational ID | +| ↳ `IncludeOnSend` | boolean | Whether QuickBooks includes the attachment when sending | +| ↳ `MetaData` | json | Attachment creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | +| ↳ `domain` | string | QuickBooks domain | +| ↳ `sparse` | boolean | Whether this is a sparse entity | +| `items` | array | Native QuickBooks attachment metadata page | +| ↳ `Id` | string | QuickBooks attachment ID | +| ↳ `SyncToken` | string | Attachment sync token | +| ↳ `FileName` | string | Attached file name | +| ↳ `ContentType` | string | Attached file MIME type | +| ↳ `Size` | number | Attached file size in bytes | +| ↳ `Note` | string | Attachment note or description | +| ↳ `Category` | string | Native QuickBooks attachment category | +| ↳ `AttachableRef` | array | QuickBooks entities referenced by this attachment | +| ↳ `EntityRef` | json | Attached entity type and operational ID | +| ↳ `IncludeOnSend` | boolean | Whether QuickBooks includes the attachment when sending | +| ↳ `MetaData` | json | Attachment creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | +| ↳ `domain` | string | QuickBooks domain | +| ↳ `sparse` | boolean | Whether this is a sparse entity | + +### QuickBooks Add Attachment + +Attach one supported file or one note to a fixed QuickBooks entity + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `attachmentKind` | string | Yes | Attachment kind: file or note | +| `targetType` | string | Yes | Fixed QuickBooks entity type to attach to | +| `targetId` | string | Yes | QuickBooks target entity ID | +| `file` | file | No | Single Sim file to upload | +| `fileName` | string | No | Optional safe filename override | +| `contentType` | string | No | Optional compatible QuickBooks MIME type override | +| `description` | string | No | Optional file attachment description | +| `note` | string | No | Required nonempty note text in Note mode | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `attachment` | json | Created native QuickBooks attachment metadata | +| ↳ `Id` | string | QuickBooks attachment ID | +| ↳ `SyncToken` | string | Attachment sync token | +| ↳ `FileName` | string | Attached file name | +| ↳ `ContentType` | string | Attached file MIME type | +| ↳ `Size` | number | Attached file size in bytes | +| ↳ `Note` | string | Attachment note or description | +| ↳ `Category` | string | Native QuickBooks attachment category | +| ↳ `AttachableRef` | array | QuickBooks entities referenced by this attachment | +| ↳ `EntityRef` | json | Attached entity type and operational ID | +| ↳ `IncludeOnSend` | boolean | Whether QuickBooks includes the attachment when sending | +| ↳ `MetaData` | json | Attachment creation and update timestamps | +| ↳ `CreateTime` | string | Entity creation timestamp | +| ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | +| ↳ `domain` | string | QuickBooks domain | +| ↳ `sparse` | boolean | Whether this is a sparse entity | +| `attachmentId` | string | Created QuickBooks attachment ID | +| `attachmentKind` | string | Created attachment kind | +| `targetType` | string | QuickBooks target entity type | +| `targetId` | string | QuickBooks target entity ID | +| `time` | string | QuickBooks response timestamp | + +### QuickBooks Download Attachment + +Download a QuickBooks file attachment as a stored Sim file + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `attachmentId` | string | Yes | QuickBooks attachment ID | +| `fileName` | string | No | Optional safe filename override | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `file` | file | Downloaded file stored in execution files | +| `fileName` | string | Safe downloaded filename | +| `mimeType` | string | Downloaded file MIME type | +| `size` | number | Downloaded file size in bytes | +| `attachmentId` | string | Downloaded QuickBooks attachment ID | + + diff --git a/apps/sim/.env.example b/apps/sim/.env.example index 443ff1d2da9..7dba3ed1f42 100644 --- a/apps/sim/.env.example +++ b/apps/sim/.env.example @@ -152,6 +152,11 @@ CRON_SECRET=your_cron_secret # Use `openssl rand -hex 32` to generate. Authentic # TIKTOK_CLIENT_ID= # TIKTOK_CLIENT_SECRET= +# QuickBooks Online OAuth (Optional - credentials from the Intuit Developer Portal) +# QUICKBOOKS_CLIENT_ID= +# QUICKBOOKS_CLIENT_SECRET= +# QUICKBOOKS_ENV=sandbox # Required when QuickBooks is configured: sandbox or production + # Azure Blob Storage # AZURE_ACCOUNT_NAME= # Azure storage account name # AZURE_ACCOUNT_KEY= # Azure storage account key diff --git a/apps/sim/app/api/auth/[...all]/route.test.ts b/apps/sim/app/api/auth/[...all]/route.test.ts index e173e2ffee0..026da92de6f 100644 --- a/apps/sim/app/api/auth/[...all]/route.test.ts +++ b/apps/sim/app/api/auth/[...all]/route.test.ts @@ -60,6 +60,7 @@ vi.mock('@/app/api/credential-groups/oauth-callback', () => ({ handleCredentialGroupOAuthCallback: handlerMocks.credentialGroupCallback, })) +import { getQuickBooksCallbackRealm } from '@/lib/oauth/quickbooks' import { GET, POST } from '@/app/api/auth/[...all]/route' afterAll(resetEnvFlagsMock) @@ -132,6 +133,68 @@ describe('auth catch-all route managed OAuth callbacks', () => { }) }) +describe('auth catch-all route QuickBooks callback', () => { + beforeEach(() => { + vi.clearAllMocks() + setEnvFlags({ isAuthDisabled: false }) + }) + + it('binds the callback realm only while Better Auth processes the OAuth response', async () => { + const { NextResponse } = await import('next/server') + handlerMocks.betterAuthGET.mockImplementationOnce(async () => { + await Promise.resolve() + expect(getQuickBooksCallbackRealm()).toBe('123456789') + return new NextResponse(null, { status: 302 }) + }) + const request = createMockRequest( + 'GET', + undefined, + {}, + 'http://localhost:3000/api/auth/oauth2/callback/quickbooks?code=test&state=test&realmId=123456789' + ) + + const response = await GET(request) + + expect(response.status).toBe(302) + expect(handlerMocks.betterAuthGET).toHaveBeenCalledOnce() + expect(() => getQuickBooksCallbackRealm()).toThrow(/did not include a company identity/) + }) + + it('delegates a denied callback without requiring a realm', async () => { + const { NextResponse } = await import('next/server') + handlerMocks.betterAuthGET.mockImplementationOnce(async () => { + expect(() => getQuickBooksCallbackRealm()).toThrow(/did not include a company identity/) + return new NextResponse(null, { status: 302 }) + }) + const request = createMockRequest( + 'GET', + undefined, + {}, + 'http://localhost:3000/api/auth/oauth2/callback/quickbooks?error=access_denied&state=test' + ) + + const response = await GET(request) + + expect(response.status).toBe(302) + expect(handlerMocks.betterAuthGET).toHaveBeenCalledOnce() + }) + + it.each([ + ['missing', 'http://localhost:3000/api/auth/oauth2/callback/quickbooks?code=test&state=test'], + [ + 'invalid', + 'http://localhost:3000/api/auth/oauth2/callback/quickbooks?code=test&state=test&realmId=not-a-company', + ], + ])('rejects a %s callback realm before Better Auth exchanges the code', async (_, url) => { + const request = createMockRequest('GET', undefined, {}, url) + + const response = await GET(request) + + expect(response.status).toBe(400) + expect(handlerMocks.betterAuthGET).not.toHaveBeenCalled() + }) +}) + describe('auth catch-all route (DISABLE_AUTH get-session)', () => { beforeEach(() => { vi.clearAllMocks() diff --git a/apps/sim/app/api/auth/[...all]/route.ts b/apps/sim/app/api/auth/[...all]/route.ts index 03c3a1514ad..b7a4a5018b9 100644 --- a/apps/sim/app/api/auth/[...all]/route.ts +++ b/apps/sim/app/api/auth/[...all]/route.ts @@ -9,6 +9,7 @@ import { withRouteHandler } from '@/lib/core/utils/with-route-handler' import { isCredentialGroupOAuthState } from '@/lib/credential-groups/oauth-state' import { getCredentialGroupStandardOAuthProviderFromProviderId } from '@/lib/credential-groups/providers' import { enforcePublicCredentialGroupIpRateLimit } from '@/lib/credential-groups/rate-limit' +import { normalizeQuickBooksRealmId, withQuickBooksCallbackRealm } from '@/lib/oauth/quickbooks' import { handleCredentialGroupOAuthCallback } from '@/app/api/credential-groups/oauth-callback' export const dynamic = 'force-dynamic' @@ -106,6 +107,30 @@ export const GET = withRouteHandler(async (request: NextRequest) => { return NextResponse.json(createAnonymousSession()) } + if (path === 'oauth2/callback/quickbooks') { + const authorizationCode = request.nextUrl.searchParams.get('code') + if (!authorizationCode) return betterAuthGET(request) + + const realmId = request.nextUrl.searchParams.get('realmId') + if (!realmId) { + return NextResponse.json( + { error: 'QuickBooks callback did not include a company identity.' }, + { status: 400 } + ) + } + + try { + normalizeQuickBooksRealmId(realmId) + } catch { + return NextResponse.json( + { error: 'QuickBooks callback included an invalid company identity.' }, + { status: 400 } + ) + } + + return withQuickBooksCallbackRealm(realmId, () => betterAuthGET(request)) + } + return betterAuthGET(request) }) diff --git a/apps/sim/app/api/auth/oauth/disconnect/route.test.ts b/apps/sim/app/api/auth/oauth/disconnect/route.test.ts index e1dd3aa2eec..6f53dcccf0a 100644 --- a/apps/sim/app/api/auth/oauth/disconnect/route.test.ts +++ b/apps/sim/app/api/auth/oauth/disconnect/route.test.ts @@ -20,7 +20,7 @@ describe('OAuth Disconnect API Route', () => { beforeEach(() => { vi.clearAllMocks() resetDbChainMock() - dbChainMockFns.where.mockResolvedValue([]) + dbChainMockFns.limit.mockResolvedValue([]) }) it('should disconnect provider successfully', async () => { @@ -93,7 +93,7 @@ describe('OAuth Disconnect API Route', () => { session: { id: 'session-1' }, }) - dbChainMockFns.where.mockRejectedValueOnce(new Error('Database error')) + dbChainMockFns.limit.mockRejectedValueOnce(new Error('Database error')) const req = createMockRequest('POST', { provider: 'google', diff --git a/apps/sim/app/api/auth/oauth/token/route.test.ts b/apps/sim/app/api/auth/oauth/token/route.test.ts index a0fb99cdee4..c7a43ef8c43 100644 --- a/apps/sim/app/api/auth/oauth/token/route.test.ts +++ b/apps/sim/app/api/auth/oauth/token/route.test.ts @@ -88,12 +88,74 @@ describe('OAuth Token API Routes', () => { expect(response.status).toBe(200) expect(data).toHaveProperty('accessToken', 'fresh-token') + expect(data).not.toHaveProperty('realmId') expect(mockAuthorizeCredentialUse).toHaveBeenCalled() expect(authOAuthUtilsMockFns.mockGetCredential).toHaveBeenCalled() expect(authOAuthUtilsMockFns.mockRefreshTokenIfNeeded).toHaveBeenCalled() }) + it('returns realmId only for QuickBooks credentials', async () => { + mockAuthorizeCredentialUse.mockResolvedValueOnce({ + ok: true, + authType: 'session', + requesterUserId: 'test-user-id', + credentialOwnerUserId: 'owner-user-id', + }) + authOAuthUtilsMockFns.mockGetCredential.mockResolvedValueOnce({ + id: 'credential-id', + accountId: 'quickbooks:123456789:intuit-subject-01234567-89ab-4def-8abc-0123456789ab', + accessToken: 'test-token', + refreshToken: 'refresh-token', + accessTokenExpiresAt: new Date(Date.now() + 3600 * 1000), + providerId: 'quickbooks', + }) + authOAuthUtilsMockFns.mockRefreshTokenIfNeeded.mockResolvedValueOnce({ + accessToken: 'fresh-token', + refreshed: false, + }) + + const response = await POST( + createMockRequest('POST', { + credentialId: 'credential-id', + }) + ) + + expect(response.status).toBe(200) + expect(await response.json()).toEqual({ + accessToken: 'fresh-token', + realmId: '123456789', + }) + }) + + it('rejects a malformed QuickBooks company identity with reconnect guidance', async () => { + mockAuthorizeCredentialUse.mockResolvedValueOnce({ + ok: true, + authType: 'session', + requesterUserId: 'test-user-id', + credentialOwnerUserId: 'owner-user-id', + }) + authOAuthUtilsMockFns.mockGetCredential.mockResolvedValueOnce({ + id: 'credential-id', + accountId: 'malformed', + accessToken: 'test-token', + refreshToken: 'refresh-token', + accessTokenExpiresAt: new Date(Date.now() + 3600 * 1000), + providerId: 'quickbooks', + }) + + const response = await POST( + createMockRequest('POST', { + credentialId: 'credential-id', + }) + ) + const data = await response.json() + + expect(response.status).toBe(401) + expect(data.error).toMatch(/Reconnect the QuickBooks credential/) + expect(authOAuthUtilsMockFns.mockRefreshTokenIfNeeded).not.toHaveBeenCalled() + }) + it('should handle workflowId for server-side authentication', async () => { mockAuthorizeCredentialUse.mockResolvedValueOnce({ ok: true, @@ -734,6 +796,33 @@ describe('OAuth Token API Routes', () => { expect(data).toHaveProperty('error') }) + it('rejects a malformed QuickBooks identity before reporting a missing token', async () => { + mockAuthorizeCredentialUse.mockResolvedValueOnce({ + ok: true, + authType: 'session', + requesterUserId: 'test-user-id', + credentialOwnerUserId: 'test-user-id', + }) + authOAuthUtilsMockFns.mockGetCredential.mockResolvedValueOnce({ + id: 'credential-id', + accountId: 'malformed', + accessToken: null, + refreshToken: 'refresh-token', + providerId: 'quickbooks', + }) + + const response = await GET( + new NextRequest( + 'http://localhost:3000/api/auth/oauth/token?credentialId=credential-id' + ) as any + ) + const data = await response.json() + + expect(response.status).toBe(401) + expect(data.error).toMatch(/Reconnect the QuickBooks credential/) + expect(authOAuthUtilsMockFns.mockRefreshTokenIfNeeded).not.toHaveBeenCalled() + }) + it('should handle token refresh failure', async () => { mockAuthorizeCredentialUse.mockResolvedValueOnce({ ok: true, diff --git a/apps/sim/app/api/auth/oauth/token/route.ts b/apps/sim/app/api/auth/oauth/token/route.ts index d695df99fa0..edaf2d085e1 100644 --- a/apps/sim/app/api/auth/oauth/token/route.ts +++ b/apps/sim/app/api/auth/oauth/token/route.ts @@ -24,7 +24,11 @@ import { import { resolveManagedOAuthCredentialToken } from '@/lib/credentials/application/resolve-managed-oauth-token' import { ManagedOAuthCredentialError } from '@/lib/credentials/managed-oauth' import { getCredential, getOAuthToken, resolveOAuthAccountId } from '@/lib/oauth/credential-service' -import { completeOAuthCredentialToken, resolveCredentialToken } from '@/lib/oauth/token-resolution' +import { + completeOAuthCredentialToken, + resolveCredentialToken, + validateOAuthCredentialContext, +} from '@/lib/oauth/token-resolution' import { getCanonicalScopesForProvider } from '@/lib/oauth/utils' import { captureServerEvent } from '@/lib/posthog/server' import { getToolMetadata } from '@/tools/metadata' @@ -326,6 +330,11 @@ export const GET = withRouteHandler(async (request: NextRequest) => { return NextResponse.json({ error: 'Credential not found' }, { status: 404 }) } + const contextValidation = validateOAuthCredentialContext(credential) + if (!contextValidation.ok) { + return NextResponse.json({ error: contextValidation.error }, { status: 401 }) + } + if (!credential.accessToken) { logger.warn(`[${requestId}] No access token available for credential`) return NextResponse.json({ error: 'No access token available' }, { status: 400 }) diff --git a/apps/sim/blocks/blocks/quickbooks.ts b/apps/sim/blocks/blocks/quickbooks.ts new file mode 100644 index 00000000000..ab04505f654 --- /dev/null +++ b/apps/sim/blocks/blocks/quickbooks.ts @@ -0,0 +1,3033 @@ +import { QuickBooksIcon } from '@/components/icons' +import { getScopesForService } from '@/lib/oauth/utils' +import type { BlockConfig, BlockMeta, OutputCondition } from '@/blocks/types' +import { AuthMode, IntegrationType } from '@/blocks/types' +import { normalizeFileInput } from '@/blocks/utils' +import { + parseQuickBooksDepositLines, + parseQuickBooksJournalLines, +} from '@/tools/quickbooks/accounting_utils' +import { + parseQuickBooksBillAllocations, + parseQuickBooksBillLines, + parseQuickBooksPurchasingLines, +} from '@/tools/quickbooks/purchasing_utils' +import { + getQuickBooksReportTypesSupporting, + QUICKBOOKS_REPORT_TYPES_WITH_ALL_SUMMARIES, + QUICKBOOKS_REPORT_TYPES_WITH_CUSTOMER_SALES_SUMMARIES, + QUICKBOOKS_REPORT_TYPES_WITH_TIME_SUMMARIES, + QUICKBOOKS_REPORT_TYPES_WITH_VENDOR_EXPENSE_SUMMARIES, + type QuickBooksReportControl, +} from '@/tools/quickbooks/reports' +import { + parseQuickBooksInvoiceAllocations, + parseQuickBooksSalesLines, +} from '@/tools/quickbooks/sales_utils' +import type { QuickBooksReportType, QuickBooksResponse } from '@/tools/quickbooks/types' +import { parseQuickBooksAddress } from '@/tools/quickbooks/values' + +const MASTER_DATA_OPERATION = 'quickbooks_read_master_data' +const SALES_READ_OPERATION = 'quickbooks_read_sales_transactions' +const PURCHASING_READ_OPERATION = 'quickbooks_read_purchasing_transactions' +const ACCOUNTING_READ_OPERATION = 'quickbooks_read_accounting_transactions' +const REPORT_OPERATION = 'quickbooks_run_financial_report' +const EMAIL_TRANSACTION_OPERATION = 'quickbooks_email_transaction' +const DOWNLOAD_TRANSACTION_PDF_OPERATION = 'quickbooks_download_transaction_pdf' +const READ_ATTACHMENTS_OPERATION = 'quickbooks_read_attachments' +const ADD_ATTACHMENT_OPERATION = 'quickbooks_add_attachment' +const DOWNLOAD_ATTACHMENT_OPERATION = 'quickbooks_download_attachment' +const CUSTOMER_OPERATIONS = ['quickbooks_create_customer', 'quickbooks_update_customer'] as const +const EMPLOYEE_OPERATIONS = ['quickbooks_create_employee', 'quickbooks_update_employee'] as const +const VENDOR_OPERATIONS = ['quickbooks_create_vendor', 'quickbooks_update_vendor'] as const +const ITEM_OPERATIONS = ['quickbooks_create_item', 'quickbooks_update_item'] as const +const MASTER_DATA_CREATE_OPERATIONS = [ + 'quickbooks_create_customer', + 'quickbooks_create_employee', + 'quickbooks_create_item', + 'quickbooks_create_vendor', +] as const +const SALES_DOCUMENT_CREATE_OPERATIONS = [ + 'quickbooks_create_estimate', + 'quickbooks_create_invoice', + 'quickbooks_create_sales_receipt', + 'quickbooks_create_credit_memo', + 'quickbooks_create_refund_receipt', +] as const +const SALES_DOCUMENT_UPDATE_OPERATIONS = [ + 'quickbooks_update_estimate', + 'quickbooks_update_invoice', + 'quickbooks_update_sales_receipt', + 'quickbooks_update_credit_memo', + 'quickbooks_update_refund_receipt', +] as const +const SALES_DOCUMENT_OPERATIONS = [ + ...SALES_DOCUMENT_CREATE_OPERATIONS, + ...SALES_DOCUMENT_UPDATE_OPERATIONS, +] as const +const PAYMENT_OPERATIONS = [ + 'quickbooks_create_customer_payment', + 'quickbooks_update_customer_payment', +] as const +const SALES_CREATE_OPERATIONS = [ + ...SALES_DOCUMENT_CREATE_OPERATIONS, + 'quickbooks_create_customer_payment', +] as const +const PURCHASING_CREATE_OPERATIONS = [ + 'quickbooks_create_purchase_order', + 'quickbooks_create_bill', + 'quickbooks_create_bill_payment', + 'quickbooks_create_vendor_credit', + 'quickbooks_create_purchase', +] as const +const ACCOUNTING_CREATE_OPERATIONS = [ + 'quickbooks_create_journal_entry', + 'quickbooks_create_deposit', +] as const +const CREATE_OPERATIONS = [ + ...MASTER_DATA_CREATE_OPERATIONS, + ...SALES_CREATE_OPERATIONS, + ...PURCHASING_CREATE_OPERATIONS, + ...ACCOUNTING_CREATE_OPERATIONS, +] as const +const SALES_UPDATE_OPERATIONS = [ + ...SALES_DOCUMENT_UPDATE_OPERATIONS, + 'quickbooks_update_customer_payment', +] as const +const SALES_VOID_OPERATIONS = [ + 'quickbooks_void_invoice', + 'quickbooks_void_customer_payment', +] as const +const MASTER_DATA_UPDATE_OPERATIONS = [ + 'quickbooks_update_customer', + 'quickbooks_update_employee', + 'quickbooks_update_item', + 'quickbooks_update_vendor', +] as const +const PURCHASING_UPDATE_OPERATIONS = [ + 'quickbooks_update_purchase_order', + 'quickbooks_update_bill', + 'quickbooks_update_bill_payment', + 'quickbooks_update_vendor_credit', + 'quickbooks_update_purchase', +] as const +const ACCOUNTING_UPDATE_OPERATIONS = [ + 'quickbooks_update_journal_entry', + 'quickbooks_update_deposit', +] as const +const SALES_MUTATION_OPERATIONS = [ + ...SALES_CREATE_OPERATIONS, + ...SALES_UPDATE_OPERATIONS, + ...SALES_VOID_OPERATIONS, +] as const +const PURCHASING_MUTATION_OPERATIONS = [ + ...PURCHASING_CREATE_OPERATIONS, + ...PURCHASING_UPDATE_OPERATIONS, +] as const +const ACCOUNTING_MUTATION_OPERATIONS = [ + ...ACCOUNTING_CREATE_OPERATIONS, + ...ACCOUNTING_UPDATE_OPERATIONS, +] as const +const UPDATE_OPERATIONS = [ + ...MASTER_DATA_UPDATE_OPERATIONS, + ...SALES_UPDATE_OPERATIONS, + ...SALES_VOID_OPERATIONS, + ...PURCHASING_UPDATE_OPERATIONS, + ...ACCOUNTING_UPDATE_OPERATIONS, +] as const +const MUTATION_OPERATIONS = [ + ...CUSTOMER_OPERATIONS, + ...EMPLOYEE_OPERATIONS, + ...ITEM_OPERATIONS, + ...VENDOR_OPERATIONS, + ...SALES_MUTATION_OPERATIONS, + ...PURCHASING_MUTATION_OPERATIONS, + ...ACCOUNTING_MUTATION_OPERATIONS, +] as const +const PAGINATED_OPERATIONS = [ + MASTER_DATA_OPERATION, + SALES_READ_OPERATION, + PURCHASING_READ_OPERATION, + ACCOUNTING_READ_OPERATION, + READ_ATTACHMENTS_OPERATION, +] as const +const LIST_OUTPUT_CONDITION: OutputCondition = { + field: 'operation', + value: [ + MASTER_DATA_OPERATION, + SALES_READ_OPERATION, + PURCHASING_READ_OPERATION, + ACCOUNTING_READ_OPERATION, + READ_ATTACHMENTS_OPERATION, + ], + and: { field: 'readMode', value: 'list' }, +} +const QUICKBOOKS_OPERATIONS = [ + 'quickbooks_get_company_info', + MASTER_DATA_OPERATION, + SALES_READ_OPERATION, + PURCHASING_READ_OPERATION, + ACCOUNTING_READ_OPERATION, + REPORT_OPERATION, + EMAIL_TRANSACTION_OPERATION, + DOWNLOAD_TRANSACTION_PDF_OPERATION, + READ_ATTACHMENTS_OPERATION, + ADD_ATTACHMENT_OPERATION, + DOWNLOAD_ATTACHMENT_OPERATION, + ...MUTATION_OPERATIONS, +] as const + +const REPORT_TIME_SUMMARY_OPTIONS = [ + { label: 'QuickBooks Default', id: 'default' }, + { label: 'Total', id: 'total' }, + { label: 'Day', id: 'day' }, + { label: 'Week', id: 'week' }, + { label: 'Month', id: 'month' }, + { label: 'Quarter', id: 'quarter' }, + { label: 'Year', id: 'year' }, +] as const + +/** + * Wand config for a QuickBooks `YYYY-MM-DD` date field. `subject` names the + * specific date so the generated value lands in the right field. + */ +function dateWandConfig(subject: string) { + return { + enabled: true, + prompt: `Generate the ${subject} in YYYY-MM-DD format from the user description. Return ONLY the date - no explanations, no extra text.`, + generationType: 'timestamp' as const, + placeholder: 'Describe the date (e.g., "the last day of last month")...', + } +} + +function reportControlCondition(control: QuickBooksReportControl) { + return { + field: 'operation', + value: REPORT_OPERATION, + and: { field: 'reportType', value: getQuickBooksReportTypesSupporting(control) }, + } +} + +function reportSupports(reportType: unknown, control: QuickBooksReportControl): boolean { + return getQuickBooksReportTypesSupporting(control).includes(reportType as QuickBooksReportType) +} + +function reportSummarizeValue(params: Record, reportType: unknown): unknown { + if ( + QUICKBOOKS_REPORT_TYPES_WITH_ALL_SUMMARIES.includes( + reportType as (typeof QUICKBOOKS_REPORT_TYPES_WITH_ALL_SUMMARIES)[number] + ) + ) { + return params.reportSummarizeBy ?? 'default' + } + if ( + QUICKBOOKS_REPORT_TYPES_WITH_CUSTOMER_SALES_SUMMARIES.includes( + reportType as (typeof QUICKBOOKS_REPORT_TYPES_WITH_CUSTOMER_SALES_SUMMARIES)[number] + ) + ) { + return params.reportCustomerSalesSummarizeBy ?? 'default' + } + if ( + QUICKBOOKS_REPORT_TYPES_WITH_VENDOR_EXPENSE_SUMMARIES.includes( + reportType as (typeof QUICKBOOKS_REPORT_TYPES_WITH_VENDOR_EXPENSE_SUMMARIES)[number] + ) + ) { + return params.reportVendorExpenseSummarizeBy ?? 'default' + } + if ( + QUICKBOOKS_REPORT_TYPES_WITH_TIME_SUMMARIES.includes( + reportType as (typeof QUICKBOOKS_REPORT_TYPES_WITH_TIME_SUMMARIES)[number] + ) + ) { + return params.reportTimeSummarizeBy ?? 'default' + } + return undefined +} + +function parseOptionalPositiveInteger(value: unknown, fieldName: string): number | undefined { + if (value == null || (typeof value === 'string' && value.trim() === '')) return undefined + const parsed = typeof value === 'number' ? value : Number(value) + if (!Number.isInteger(parsed) || parsed < 1) { + throw new Error(`${fieldName} must be a positive integer`) + } + return parsed +} + +function parsePaginationInteger( + value: unknown, + fieldName: 'startPosition' | 'maxResults', + fallback: number +): number { + if (value == null || (typeof value === 'string' && value.trim() === '')) return fallback + const parsed = typeof value === 'number' ? value : Number(value) + if (!Number.isInteger(parsed)) throw new Error(`${fieldName} must be an integer`) + if (fieldName === 'startPosition' && parsed < 1) { + throw new Error('startPosition must be a positive integer') + } + if (fieldName === 'maxResults' && (parsed < 1 || parsed > 100)) { + throw new Error('maxResults must be an integer from 1 through 100') + } + return parsed +} + +function parseOptionalNumber(value: unknown, fieldName: string): number | undefined { + if (value == null || (typeof value === 'string' && value.trim() === '')) return undefined + const parsed = typeof value === 'number' ? value : Number(value) + if (!Number.isFinite(parsed)) throw new Error(`${fieldName} must be a finite number`) + return parsed +} + +function parseTriStateBoolean(value: unknown, fieldName: string): boolean | undefined { + if (value == null || value === '' || value === 'not_specified') return undefined + if (value === true || value === 'yes') return true + if (value === false || value === 'no') return false + throw new Error(`${fieldName} must be not specified, yes, or no`) +} + +function optionalValue(value: unknown): unknown { + if (value == null) return undefined + return typeof value === 'string' && value.trim() === '' ? undefined : value +} + +function paginationCondition(values?: Record) { + if (!values) { + return { field: 'operation', value: [...PAGINATED_OPERATIONS] } + } + if (values?.operation === MASTER_DATA_OPERATION) { + return { field: 'readMode', value: 'list' } + } + if (values?.operation === SALES_READ_OPERATION) { + return { field: 'readMode', value: 'list' } + } + if (values?.operation === PURCHASING_READ_OPERATION) { + return { field: 'readMode', value: 'list' } + } + if (values?.operation === ACCOUNTING_READ_OPERATION) { + return { field: 'readMode', value: 'list' } + } + if (values?.operation === READ_ATTACHMENTS_OPERATION) { + return { field: 'readMode', value: 'list' } + } + return { field: 'operation', value: [] } +} + +function salesTransactionIdCondition(values?: Record) { + if (!values) { + return { + field: 'operation', + value: [ + SALES_READ_OPERATION, + PURCHASING_READ_OPERATION, + ACCOUNTING_READ_OPERATION, + ...SALES_UPDATE_OPERATIONS, + ...SALES_VOID_OPERATIONS, + ...PURCHASING_UPDATE_OPERATIONS, + ...ACCOUNTING_UPDATE_OPERATIONS, + ], + } + } + if ( + values?.operation === SALES_READ_OPERATION || + values?.operation === PURCHASING_READ_OPERATION || + values?.operation === ACCOUNTING_READ_OPERATION + ) { + return { field: 'readMode', value: 'by_id' } + } + return { + field: 'operation', + value: [ + ...SALES_UPDATE_OPERATIONS, + ...SALES_VOID_OPERATIONS, + ...PURCHASING_UPDATE_OPERATIONS, + ...ACCOUNTING_UPDATE_OPERATIONS, + ], + } +} + +function parseConfirmation(value: unknown, fieldName: string): boolean { + if (value === true || value === 'yes') return true + if (value === false || value === 'no' || value == null || value === '') return false + throw new Error(`${fieldName} must be yes or no`) +} + +function attachmentTargetCondition(values?: Record) { + if (!values) { + return { field: 'operation', value: [READ_ATTACHMENTS_OPERATION, ADD_ATTACHMENT_OPERATION] } + } + if (values.operation === READ_ATTACHMENTS_OPERATION) { + return { field: 'readMode', value: 'list' } + } + return { field: 'operation', value: ADD_ATTACHMENT_OPERATION } +} + +function attachmentIdCondition(values?: Record) { + if (!values) { + return { + field: 'operation', + value: [READ_ATTACHMENTS_OPERATION, DOWNLOAD_ATTACHMENT_OPERATION], + } + } + if (values.operation === READ_ATTACHMENTS_OPERATION) { + return { field: 'readMode', value: 'by_id' } + } + return { field: 'operation', value: DOWNLOAD_ATTACHMENT_OPERATION } +} + +export const QuickBooksBlock: BlockConfig = { + type: 'quickbooks', + name: 'QuickBooks', + description: + 'Manage QuickBooks Online company, transactions, reports, emails, PDFs, and attachments', + authMode: AuthMode.OAuth, + longDescription: + 'Connect one QuickBooks Online company to manage bounded master-data, sales, purchasing, receivables, payables, accounting, reports, transaction delivery, and document workflows.', + docsLink: 'https://docs.sim.ai/integrations/quickbooks', + category: 'tools', + integrationType: IntegrationType.Commerce, + bgColor: '#2CA01C', + icon: QuickBooksIcon, + subBlocks: [ + { + id: 'operation', + title: 'Operation', + type: 'dropdown', + options: [ + { label: 'Get Company Info', id: 'quickbooks_get_company_info' }, + { label: 'Read Master Data', id: 'quickbooks_read_master_data' }, + { label: 'Create Customer', id: 'quickbooks_create_customer' }, + { label: 'Update Customer', id: 'quickbooks_update_customer' }, + { label: 'Create Employee', id: 'quickbooks_create_employee' }, + { label: 'Update Employee', id: 'quickbooks_update_employee' }, + { label: 'Create Vendor', id: 'quickbooks_create_vendor' }, + { label: 'Update Vendor', id: 'quickbooks_update_vendor' }, + { label: 'Create Item', id: 'quickbooks_create_item' }, + { label: 'Update Item', id: 'quickbooks_update_item' }, + { label: 'Read Sales Transactions', id: 'quickbooks_read_sales_transactions' }, + { label: 'Create Estimate', id: 'quickbooks_create_estimate' }, + { label: 'Update Estimate', id: 'quickbooks_update_estimate' }, + { label: 'Create Invoice', id: 'quickbooks_create_invoice' }, + { label: 'Update Invoice', id: 'quickbooks_update_invoice' }, + { label: 'Void Invoice', id: 'quickbooks_void_invoice' }, + { label: 'Create Sales Receipt', id: 'quickbooks_create_sales_receipt' }, + { label: 'Update Sales Receipt', id: 'quickbooks_update_sales_receipt' }, + { label: 'Create Customer Payment', id: 'quickbooks_create_customer_payment' }, + { label: 'Update Customer Payment', id: 'quickbooks_update_customer_payment' }, + { label: 'Void Customer Payment', id: 'quickbooks_void_customer_payment' }, + { label: 'Create Credit Memo', id: 'quickbooks_create_credit_memo' }, + { label: 'Update Credit Memo', id: 'quickbooks_update_credit_memo' }, + { label: 'Create Refund Receipt', id: 'quickbooks_create_refund_receipt' }, + { label: 'Update Refund Receipt', id: 'quickbooks_update_refund_receipt' }, + { + label: 'Read Purchasing Transactions', + id: 'quickbooks_read_purchasing_transactions', + }, + { label: 'Create Purchase Order', id: 'quickbooks_create_purchase_order' }, + { label: 'Update Purchase Order', id: 'quickbooks_update_purchase_order' }, + { label: 'Create Bill', id: 'quickbooks_create_bill' }, + { label: 'Update Bill', id: 'quickbooks_update_bill' }, + { label: 'Create Bill Payment', id: 'quickbooks_create_bill_payment' }, + { label: 'Update Bill Payment', id: 'quickbooks_update_bill_payment' }, + { label: 'Create Vendor Credit', id: 'quickbooks_create_vendor_credit' }, + { label: 'Update Vendor Credit', id: 'quickbooks_update_vendor_credit' }, + { label: 'Create Purchase or Expense', id: 'quickbooks_create_purchase' }, + { label: 'Update Purchase or Expense', id: 'quickbooks_update_purchase' }, + { + label: 'Read Accounting Transactions', + id: 'quickbooks_read_accounting_transactions', + }, + { label: 'Create Journal Entry', id: 'quickbooks_create_journal_entry' }, + { label: 'Update Journal Entry', id: 'quickbooks_update_journal_entry' }, + { label: 'Create Deposit', id: 'quickbooks_create_deposit' }, + { label: 'Update Deposit', id: 'quickbooks_update_deposit' }, + { label: 'Run Financial Report', id: 'quickbooks_run_financial_report' }, + { label: 'Email Transaction', id: 'quickbooks_email_transaction' }, + { label: 'Download Transaction PDF', id: 'quickbooks_download_transaction_pdf' }, + { label: 'Read Attachments', id: 'quickbooks_read_attachments' }, + { label: 'Add Attachment', id: 'quickbooks_add_attachment' }, + { label: 'Download Attachment', id: 'quickbooks_download_attachment' }, + ], + value: () => 'quickbooks_get_company_info', + }, + { + id: 'credential', + title: 'QuickBooks Account', + type: 'oauth-input', + canonicalParamId: 'oauthCredential', + mode: 'basic', + serviceId: 'quickbooks', + requiredScopes: getScopesForService('quickbooks'), + placeholder: 'Select QuickBooks company', + required: true, + }, + { + id: 'manualCredential', + title: 'QuickBooks Account', + type: 'short-input', + canonicalParamId: 'oauthCredential', + mode: 'advanced', + placeholder: 'Enter credential ID', + required: true, + }, + { + id: 'documentTransactionType', + title: 'Transaction Type', + type: 'dropdown', + options: [ + { label: 'Invoice', id: 'invoice' }, + { label: 'Customer Payment', id: 'payment' }, + { label: 'Estimate', id: 'estimate' }, + { label: 'Sales Receipt', id: 'sales_receipt' }, + { label: 'Credit Memo', id: 'credit_memo' }, + { label: 'Refund Receipt', id: 'refund_receipt' }, + { label: 'Purchase Order', id: 'purchase_order' }, + ], + condition: { + field: 'operation', + value: [EMAIL_TRANSACTION_OPERATION, DOWNLOAD_TRANSACTION_PDF_OPERATION], + }, + required: { + field: 'operation', + value: [EMAIL_TRANSACTION_OPERATION, DOWNLOAD_TRANSACTION_PDF_OPERATION], + }, + value: () => 'invoice', + }, + { + id: 'documentTransactionId', + title: 'Transaction ID', + type: 'short-input', + placeholder: 'QuickBooks transaction ID', + condition: { + field: 'operation', + value: [EMAIL_TRANSACTION_OPERATION, DOWNLOAD_TRANSACTION_PDF_OPERATION], + }, + required: { + field: 'operation', + value: [EMAIL_TRANSACTION_OPERATION, DOWNLOAD_TRANSACTION_PDF_OPERATION], + }, + }, + { + id: 'confirmSend', + title: 'Confirm Send', + type: 'dropdown', + options: [ + { label: 'No', id: 'no' }, + { label: 'Yes', id: 'yes' }, + ], + condition: { field: 'operation', value: EMAIL_TRANSACTION_OPERATION }, + required: { field: 'operation', value: EMAIL_TRANSACTION_OPERATION }, + value: () => 'no', + }, + { + id: 'recipientOverride', + title: 'Recipient', + type: 'short-input', + placeholder: 'Required for Customer Payments; otherwise optional', + condition: { field: 'operation', value: EMAIL_TRANSACTION_OPERATION }, + required: { + field: 'operation', + value: EMAIL_TRANSACTION_OPERATION, + and: { field: 'documentTransactionType', value: 'payment' }, + }, + description: + 'Required for Customer Payments. For other transactions, leave blank to use the email stored in QuickBooks or provide one override address.', + }, + { + id: 'documentFileName', + title: 'File Name', + type: 'short-input', + placeholder: 'Optional PDF filename', + condition: { field: 'operation', value: DOWNLOAD_TRANSACTION_PDF_OPERATION }, + mode: 'advanced', + }, + { + id: 'attachmentTargetType', + title: 'Target Type', + type: 'dropdown', + options: [ + { label: 'Bill', id: 'bill' }, + { label: 'Credit Memo', id: 'credit_memo' }, + { label: 'Customer', id: 'customer' }, + { label: 'Estimate', id: 'estimate' }, + { label: 'Invoice', id: 'invoice' }, + { label: 'Customer Payment', id: 'payment' }, + { label: 'Purchase or Expense', id: 'purchase' }, + { label: 'Refund Receipt', id: 'refund_receipt' }, + { label: 'Sales Receipt', id: 'sales_receipt' }, + { label: 'Vendor', id: 'vendor' }, + { label: 'Vendor Credit', id: 'vendor_credit' }, + ], + condition: attachmentTargetCondition, + required: attachmentTargetCondition, + value: () => 'invoice', + }, + { + id: 'attachmentTargetId', + title: 'Target ID', + type: 'short-input', + placeholder: 'QuickBooks target entity ID', + condition: attachmentTargetCondition, + required: attachmentTargetCondition, + }, + { + id: 'attachmentId', + title: 'Attachment ID', + type: 'short-input', + placeholder: 'QuickBooks attachment ID', + condition: attachmentIdCondition, + required: attachmentIdCondition, + }, + { + id: 'attachmentKind', + title: 'Attachment Kind', + type: 'dropdown', + options: [ + { label: 'File', id: 'file' }, + { label: 'Note', id: 'note' }, + ], + condition: { field: 'operation', value: ADD_ATTACHMENT_OPERATION }, + required: { field: 'operation', value: ADD_ATTACHMENT_OPERATION }, + value: () => 'file', + }, + { + id: 'attachmentFileUpload', + title: 'File', + type: 'file-upload', + canonicalParamId: 'attachmentFile', + placeholder: 'Upload one supported file', + condition: { + field: 'operation', + value: ADD_ATTACHMENT_OPERATION, + and: { field: 'attachmentKind', value: 'file' }, + }, + required: { + field: 'operation', + value: ADD_ATTACHMENT_OPERATION, + and: { field: 'attachmentKind', value: 'file' }, + }, + mode: 'basic', + multiple: false, + }, + { + id: 'attachmentFileReference', + title: 'File', + type: 'short-input', + canonicalParamId: 'attachmentFile', + placeholder: 'Reference one file from a previous block', + condition: { + field: 'operation', + value: ADD_ATTACHMENT_OPERATION, + and: { field: 'attachmentKind', value: 'file' }, + }, + required: { + field: 'operation', + value: ADD_ATTACHMENT_OPERATION, + and: { field: 'attachmentKind', value: 'file' }, + }, + mode: 'advanced', + }, + { + id: 'attachmentNote', + title: 'Note', + type: 'long-input', + placeholder: 'Note to attach in QuickBooks', + condition: { + field: 'operation', + value: ADD_ATTACHMENT_OPERATION, + and: { field: 'attachmentKind', value: 'note' }, + }, + required: { + field: 'operation', + value: ADD_ATTACHMENT_OPERATION, + and: { field: 'attachmentKind', value: 'note' }, + }, + }, + { + id: 'attachmentFileName', + title: 'File Name', + type: 'short-input', + placeholder: 'Optional safe filename override', + condition: { + field: 'operation', + value: [ADD_ATTACHMENT_OPERATION, DOWNLOAD_ATTACHMENT_OPERATION], + }, + mode: 'advanced', + }, + { + id: 'attachmentContentType', + title: 'Content Type', + type: 'short-input', + placeholder: 'Optional compatible MIME type', + condition: { + field: 'operation', + value: ADD_ATTACHMENT_OPERATION, + and: { field: 'attachmentKind', value: 'file' }, + }, + mode: 'advanced', + }, + { + id: 'attachmentDescription', + title: 'Description', + type: 'long-input', + placeholder: 'Optional file attachment description', + condition: { + field: 'operation', + value: ADD_ATTACHMENT_OPERATION, + and: { field: 'attachmentKind', value: 'file' }, + }, + mode: 'advanced', + }, + { + id: 'recordType', + title: 'Record Type', + type: 'dropdown', + options: [ + { label: 'Account', id: 'account' }, + { label: 'Class', id: 'class' }, + { label: 'Customer', id: 'customer' }, + { label: 'Department', id: 'department' }, + { label: 'Vendor', id: 'vendor' }, + { label: 'Item', id: 'item' }, + { label: 'Employee', id: 'employee' }, + ], + condition: { field: 'operation', value: MASTER_DATA_OPERATION }, + required: { field: 'operation', value: MASTER_DATA_OPERATION }, + value: () => 'account', + }, + { + id: 'readMode', + title: 'Read Mode', + type: 'dropdown', + options: [ + { label: 'List', id: 'list' }, + { label: 'By ID', id: 'by_id' }, + ], + condition: { + field: 'operation', + value: [ + MASTER_DATA_OPERATION, + SALES_READ_OPERATION, + PURCHASING_READ_OPERATION, + ACCOUNTING_READ_OPERATION, + READ_ATTACHMENTS_OPERATION, + ], + }, + required: { + field: 'operation', + value: [ + MASTER_DATA_OPERATION, + SALES_READ_OPERATION, + PURCHASING_READ_OPERATION, + ACCOUNTING_READ_OPERATION, + READ_ATTACHMENTS_OPERATION, + ], + }, + value: () => 'list', + }, + { + id: 'recordId', + title: 'Record ID', + type: 'short-input', + placeholder: 'QuickBooks record ID', + condition: { + field: 'operation', + value: MASTER_DATA_OPERATION, + and: { field: 'readMode', value: 'by_id' }, + }, + required: { + field: 'operation', + value: MASTER_DATA_OPERATION, + and: { field: 'readMode', value: 'by_id' }, + }, + }, + { + id: 'readActiveStatus', + title: 'Active Status', + type: 'dropdown', + options: [ + { label: 'QuickBooks Default', id: 'default' }, + { label: 'Active', id: 'active' }, + { label: 'Inactive', id: 'inactive' }, + ], + mode: 'advanced', + condition: { + field: 'operation', + value: MASTER_DATA_OPERATION, + and: { field: 'readMode', value: 'list' }, + }, + value: () => 'default', + }, + { + id: 'readStartDate', + title: 'Start Date', + type: 'short-input', + placeholder: 'YYYY-MM-DD', + mode: 'advanced', + wandConfig: dateWandConfig('transaction list start date'), + condition: { + field: 'operation', + value: [SALES_READ_OPERATION, PURCHASING_READ_OPERATION, ACCOUNTING_READ_OPERATION], + and: { field: 'readMode', value: 'list' }, + }, + }, + { + id: 'readEndDate', + title: 'End Date', + type: 'short-input', + placeholder: 'YYYY-MM-DD', + mode: 'advanced', + wandConfig: dateWandConfig('transaction list end date'), + condition: { + field: 'operation', + value: [SALES_READ_OPERATION, PURCHASING_READ_OPERATION, ACCOUNTING_READ_OPERATION], + and: { field: 'readMode', value: 'list' }, + }, + }, + { + id: 'readCustomerId', + title: 'Customer ID', + type: 'short-input', + placeholder: 'Use Read Master Data to find a customer ID', + mode: 'advanced', + condition: { + field: 'operation', + value: SALES_READ_OPERATION, + and: { field: 'readMode', value: 'list' }, + }, + }, + { + id: 'readVendorId', + title: 'Vendor ID', + type: 'short-input', + placeholder: 'Use Read Master Data to find a vendor ID', + description: + 'Supported for purchase orders, bills, bill payments, and vendor credits. Purchase/Expense filtering is not exposed because its reference contract differs.', + mode: 'advanced', + condition: (values) => ({ + field: 'operation', + value: PURCHASING_READ_OPERATION, + and: + values?.purchasingTransactionType === 'purchase' + ? { field: 'purchasingTransactionType', value: 'purchase', not: true } + : { field: 'readMode', value: 'list' }, + }), + }, + { + id: 'transactionType', + title: 'Transaction Type', + type: 'dropdown', + options: [ + { label: 'Estimate', id: 'estimate' }, + { label: 'Invoice', id: 'invoice' }, + { label: 'Sales Receipt', id: 'sales_receipt' }, + { label: 'Customer Payment', id: 'payment' }, + { label: 'Credit Memo', id: 'credit_memo' }, + { label: 'Refund Receipt', id: 'refund_receipt' }, + ], + condition: { field: 'operation', value: SALES_READ_OPERATION }, + required: { field: 'operation', value: SALES_READ_OPERATION }, + value: () => 'invoice', + }, + { + id: 'purchasingTransactionType', + title: 'Transaction Type', + type: 'dropdown', + options: [ + { label: 'Purchase Order', id: 'purchase_order' }, + { label: 'Bill', id: 'bill' }, + { label: 'Bill Payment', id: 'bill_payment' }, + { label: 'Vendor Credit', id: 'vendor_credit' }, + { label: 'Purchase/Expense', id: 'purchase' }, + ], + condition: { field: 'operation', value: PURCHASING_READ_OPERATION }, + required: { field: 'operation', value: PURCHASING_READ_OPERATION }, + value: () => 'bill', + }, + { + id: 'accountingTransactionType', + title: 'Transaction Type', + type: 'dropdown', + options: [ + { label: 'Journal Entry', id: 'journal_entry' }, + { label: 'Deposit', id: 'deposit' }, + { label: 'Transfer', id: 'transfer' }, + ], + condition: { field: 'operation', value: ACCOUNTING_READ_OPERATION }, + required: { field: 'operation', value: ACCOUNTING_READ_OPERATION }, + value: () => 'journal_entry', + }, + { + id: 'transactionId', + title: 'Transaction ID', + type: 'short-input', + placeholder: 'QuickBooks transaction ID', + condition: salesTransactionIdCondition, + required: salesTransactionIdCondition, + }, + { + id: 'reportType', + title: 'Report Type', + type: 'dropdown', + options: [ + { label: 'Balance Sheet', id: 'balance_sheet' }, + { label: 'Profit and Loss', id: 'profit_and_loss' }, + { label: 'Profit and Loss Detail', id: 'profit_and_loss_detail' }, + { label: 'Trial Balance', id: 'trial_balance' }, + { label: 'Statement of Cash Flows', id: 'cash_flow' }, + { label: 'A/P Aging Summary', id: 'ap_aging_summary' }, + { label: 'A/P Aging Detail', id: 'ap_aging_detail' }, + { label: 'A/R Aging Summary', id: 'ar_aging_summary' }, + { label: 'A/R Aging Detail', id: 'ar_aging_detail' }, + { label: 'Vendor Balance Summary', id: 'vendor_balance' }, + { label: 'Customer Balance Summary', id: 'customer_balance' }, + { label: 'Sales by Customer Summary', id: 'sales_by_customer' }, + { label: 'Sales by Product/Service Summary', id: 'sales_by_item' }, + { label: 'Expenses by Vendor', id: 'expenses_by_vendor' }, + { label: 'Transaction List', id: 'transaction_list' }, + ], + condition: { field: 'operation', value: REPORT_OPERATION }, + required: { field: 'operation', value: REPORT_OPERATION }, + value: () => 'profit_and_loss', + }, + { + id: 'reportStartDate', + title: 'Start Date', + type: 'short-input', + placeholder: 'YYYY-MM-DD', + description: + 'Intuit recommends report periods of six months or less for performance, but longer periods remain supported.', + mode: 'advanced', + wandConfig: dateWandConfig('report start date'), + condition: reportControlCondition('startDate'), + }, + { + id: 'reportEndDate', + title: 'End or Report Date', + type: 'short-input', + placeholder: 'YYYY-MM-DD', + description: 'End date for range reports or as-of date for balance and aging reports.', + mode: 'advanced', + wandConfig: dateWandConfig('report end or as-of date'), + condition: reportControlCondition('endDate'), + }, + { + id: 'reportAccountingMethod', + title: 'Accounting Method', + type: 'dropdown', + options: [ + { label: 'QuickBooks Default', id: 'default' }, + { label: 'Cash', id: 'cash' }, + { label: 'Accrual', id: 'accrual' }, + ], + mode: 'advanced', + condition: reportControlCondition('accountingMethod'), + value: () => 'default', + }, + { + id: 'reportSummarizeBy', + title: 'Summarize Columns By', + type: 'dropdown', + options: [ + ...REPORT_TIME_SUMMARY_OPTIONS, + { label: 'Customer', id: 'customer' }, + { label: 'Vendor', id: 'vendor' }, + { label: 'Product/Service', id: 'item' }, + { label: 'Class', id: 'class' }, + { label: 'Department', id: 'department' }, + ], + mode: 'advanced', + condition: { + field: 'operation', + value: REPORT_OPERATION, + and: { field: 'reportType', value: [...QUICKBOOKS_REPORT_TYPES_WITH_ALL_SUMMARIES] }, + }, + value: () => 'default', + }, + { + id: 'reportCustomerSalesSummarizeBy', + title: 'Summarize Columns By', + type: 'dropdown', + options: [ + ...REPORT_TIME_SUMMARY_OPTIONS, + { label: 'Customer', id: 'customer' }, + { label: 'Product/Service', id: 'item' }, + { label: 'Class', id: 'class' }, + { label: 'Department', id: 'department' }, + ], + mode: 'advanced', + condition: { + field: 'operation', + value: REPORT_OPERATION, + and: { + field: 'reportType', + value: [...QUICKBOOKS_REPORT_TYPES_WITH_CUSTOMER_SALES_SUMMARIES], + }, + }, + value: () => 'default', + }, + { + id: 'reportVendorExpenseSummarizeBy', + title: 'Summarize Columns By', + type: 'dropdown', + options: [ + ...REPORT_TIME_SUMMARY_OPTIONS, + { label: 'Customer', id: 'customer' }, + { label: 'Vendor', id: 'vendor' }, + { label: 'Class', id: 'class' }, + { label: 'Department', id: 'department' }, + ], + mode: 'advanced', + condition: { + field: 'operation', + value: REPORT_OPERATION, + and: { + field: 'reportType', + value: [...QUICKBOOKS_REPORT_TYPES_WITH_VENDOR_EXPENSE_SUMMARIES], + }, + }, + value: () => 'default', + }, + { + id: 'reportTimeSummarizeBy', + title: 'Summarize Columns By', + type: 'dropdown', + options: [...REPORT_TIME_SUMMARY_OPTIONS], + mode: 'advanced', + condition: { + field: 'operation', + value: REPORT_OPERATION, + and: { field: 'reportType', value: [...QUICKBOOKS_REPORT_TYPES_WITH_TIME_SUMMARIES] }, + }, + value: () => 'default', + }, + { + id: 'reportCustomerId', + title: 'Customer ID', + type: 'short-input', + placeholder: 'Use Read Master Data to find a customer ID', + mode: 'advanced', + condition: reportControlCondition('customerId'), + }, + { + id: 'reportVendorId', + title: 'Vendor ID', + type: 'short-input', + placeholder: 'Use Read Master Data to find a vendor ID', + mode: 'advanced', + condition: reportControlCondition('vendorId'), + }, + { + id: 'reportAccountId', + title: 'Account ID', + type: 'short-input', + placeholder: 'Use Read Master Data to find an account ID', + mode: 'advanced', + condition: reportControlCondition('accountId'), + }, + { + id: 'reportItemId', + title: 'Product/Service ID', + type: 'short-input', + placeholder: 'Use Read Master Data to find an item ID', + mode: 'advanced', + condition: reportControlCondition('itemId'), + }, + { + id: 'reportClassId', + title: 'Class ID', + type: 'short-input', + placeholder: 'Use Read Master Data to find a class ID', + mode: 'advanced', + condition: reportControlCondition('classId'), + }, + { + id: 'reportDepartmentId', + title: 'Department ID', + type: 'short-input', + placeholder: 'Use Read Master Data to find a department ID', + mode: 'advanced', + condition: reportControlCondition('departmentId'), + }, + { + id: 'reportAgingMethod', + title: 'Aging Method', + type: 'dropdown', + options: [ + { label: 'QuickBooks Default', id: 'default' }, + { label: 'Report Date', id: 'report_date' }, + { label: 'Current Date', id: 'current' }, + ], + mode: 'advanced', + condition: reportControlCondition('agingMethod'), + value: () => 'default', + }, + { + id: 'reportAgingDays', + title: 'Days per Aging Period', + type: 'short-input', + placeholder: '30', + mode: 'advanced', + condition: reportControlCondition('agingPeriod'), + }, + { + id: 'reportTransactionType', + title: 'Transaction Type', + type: 'dropdown', + options: [ + { label: 'All', id: 'default' }, + { label: 'Bill', id: 'bill' }, + { label: 'Bill Payment (Check)', id: 'bill_payment_check' }, + { label: 'Bill Payment (Credit Card)', id: 'bill_payment_credit_card' }, + { label: 'Cash Purchase', id: 'cash_purchase' }, + { label: 'Check', id: 'check' }, + { label: 'Credit Card Charge', id: 'credit_card_charge' }, + { label: 'Credit Card Credit', id: 'credit_card_credit' }, + { label: 'Credit Memo', id: 'credit_memo' }, + { label: 'Deposit', id: 'deposit' }, + { label: 'Estimate', id: 'estimate' }, + { label: 'Invoice', id: 'invoice' }, + { label: 'Journal Entry', id: 'journal_entry' }, + { label: 'Customer Payment', id: 'payment' }, + { label: 'Purchase Order', id: 'purchase_order' }, + { label: 'Sales Receipt', id: 'sales_receipt' }, + { label: 'Transfer', id: 'transfer' }, + { label: 'Vendor Credit', id: 'vendor_credit' }, + ], + mode: 'advanced', + condition: { + field: 'operation', + value: REPORT_OPERATION, + and: { field: 'reportType', value: 'transaction_list' }, + }, + value: () => 'default', + }, + { + id: 'reportGroupBy', + title: 'Group By', + type: 'dropdown', + options: [ + { label: 'QuickBooks Default', id: 'default' }, + { label: 'Account', id: 'account' }, + { label: 'Customer', id: 'customer' }, + { label: 'Day', id: 'day' }, + { label: 'Department', id: 'department' }, + { label: 'Employee', id: 'employee' }, + { label: 'Month', id: 'month' }, + { label: 'Name', id: 'name' }, + { label: 'None', id: 'none' }, + { label: 'Payment Method', id: 'payment_method' }, + { label: 'Quarter', id: 'quarter' }, + { label: 'Transaction Type', id: 'transaction_type' }, + { label: 'Vendor', id: 'vendor' }, + { label: 'Week', id: 'week' }, + { label: 'Year', id: 'year' }, + ], + mode: 'advanced', + condition: { + field: 'operation', + value: REPORT_OPERATION, + and: { field: 'reportType', value: 'transaction_list' }, + }, + value: () => 'default', + }, + { + id: 'reportAccountsPayablePaid', + title: 'A/P Paid Status', + type: 'dropdown', + options: [ + { label: 'QuickBooks Default', id: 'default' }, + { label: 'All', id: 'all' }, + { label: 'Paid', id: 'paid' }, + { label: 'Unpaid', id: 'unpaid' }, + ], + mode: 'advanced', + condition: { + field: 'operation', + value: REPORT_OPERATION, + and: { field: 'reportType', value: 'transaction_list' }, + }, + value: () => 'default', + }, + { + id: 'reportAccountsReceivablePaid', + title: 'A/R Paid Status', + type: 'dropdown', + options: [ + { label: 'QuickBooks Default', id: 'default' }, + { label: 'All', id: 'all' }, + { label: 'Paid', id: 'paid' }, + { label: 'Unpaid', id: 'unpaid' }, + ], + mode: 'advanced', + condition: { + field: 'operation', + value: REPORT_OPERATION, + and: { field: 'reportType', value: 'transaction_list' }, + }, + value: () => 'default', + }, + { + id: 'reportClearedStatus', + title: 'Cleared Status', + type: 'dropdown', + options: [ + { label: 'QuickBooks Default', id: 'default' }, + { label: 'Cleared', id: 'cleared' }, + { label: 'Uncleared', id: 'uncleared' }, + { label: 'Reconciled', id: 'reconciled' }, + { label: 'Deposited', id: 'deposited' }, + ], + mode: 'advanced', + condition: { + field: 'operation', + value: REPORT_OPERATION, + and: { field: 'reportType', value: 'transaction_list' }, + }, + value: () => 'default', + }, + { + id: 'reportDocumentNumber', + title: 'Document Number', + type: 'short-input', + placeholder: 'Exact QuickBooks document number', + mode: 'advanced', + condition: { + field: 'operation', + value: REPORT_OPERATION, + and: { field: 'reportType', value: 'transaction_list' }, + }, + }, + { + id: 'reportSourceAccountType', + title: 'Source Account Type', + type: 'dropdown', + options: [ + { label: 'QuickBooks Default', id: 'default' }, + { label: 'Accounts Payable', id: 'accounts_payable' }, + { label: 'Accounts Receivable', id: 'accounts_receivable' }, + { label: 'Bank', id: 'bank' }, + { label: 'Cost of Goods Sold', id: 'cost_of_goods_sold' }, + { label: 'Credit Card', id: 'credit_card' }, + { label: 'Equity', id: 'equity' }, + { label: 'Expense', id: 'expense' }, + { label: 'Fixed Asset', id: 'fixed_asset' }, + { label: 'Income', id: 'income' }, + { label: 'Long-term Liability', id: 'long_term_liability' }, + { label: 'Non-posting', id: 'non_posting' }, + { label: 'Other Asset', id: 'other_asset' }, + { label: 'Other Current Asset', id: 'other_current_asset' }, + { label: 'Other Current Liability', id: 'other_current_liability' }, + { label: 'Other Expense', id: 'other_expense' }, + { label: 'Other Income', id: 'other_income' }, + ], + mode: 'advanced', + condition: { + field: 'operation', + value: REPORT_OPERATION, + and: { field: 'reportType', value: 'transaction_list' }, + }, + value: () => 'default', + }, + { + id: 'startPosition', + title: 'Start Position', + type: 'short-input', + placeholder: '1', + mode: 'advanced', + condition: paginationCondition, + value: () => '1', + }, + { + id: 'maxResults', + title: 'Max Results', + type: 'short-input', + placeholder: '25', + mode: 'advanced', + condition: paginationCondition, + value: () => '25', + }, + { + id: 'customerId', + title: 'Customer ID', + type: 'short-input', + placeholder: 'QuickBooks customer ID', + condition: { + field: 'operation', + value: ['quickbooks_update_customer', ...SALES_DOCUMENT_OPERATIONS, ...PAYMENT_OPERATIONS], + }, + required: { + field: 'operation', + value: ['quickbooks_update_customer', ...SALES_CREATE_OPERATIONS], + }, + }, + { + id: 'vendorId', + title: 'Vendor ID', + type: 'short-input', + placeholder: 'QuickBooks vendor ID', + condition: { + field: 'operation', + value: ['quickbooks_update_vendor', ...PURCHASING_MUTATION_OPERATIONS], + }, + required: { + field: 'operation', + value: [ + 'quickbooks_update_vendor', + 'quickbooks_create_purchase_order', + 'quickbooks_create_bill', + 'quickbooks_update_bill', + 'quickbooks_create_bill_payment', + 'quickbooks_update_bill_payment', + 'quickbooks_create_vendor_credit', + 'quickbooks_update_vendor_credit', + ], + }, + }, + { + id: 'itemId', + title: 'Item ID', + type: 'short-input', + placeholder: 'QuickBooks item ID', + condition: { field: 'operation', value: 'quickbooks_update_item' }, + required: { field: 'operation', value: 'quickbooks_update_item' }, + }, + { + id: 'employeeId', + title: 'Employee ID', + type: 'short-input', + placeholder: 'QuickBooks employee ID', + condition: { field: 'operation', value: 'quickbooks_update_employee' }, + required: { field: 'operation', value: 'quickbooks_update_employee' }, + }, + { + id: 'syncToken', + title: 'Sync Token', + type: 'short-input', + placeholder: 'Current QuickBooks sync token', + condition: { field: 'operation', value: [...UPDATE_OPERATIONS] }, + required: { field: 'operation', value: [...UPDATE_OPERATIONS] }, + }, + { + id: 'displayName', + title: 'Display Name', + type: 'short-input', + placeholder: 'Unique display name', + condition: { + field: 'operation', + value: [...CUSTOMER_OPERATIONS, ...EMPLOYEE_OPERATIONS, ...VENDOR_OPERATIONS], + }, + required: { + field: 'operation', + value: ['quickbooks_create_customer', 'quickbooks_create_vendor'], + }, + }, + { + id: 'companyName', + title: 'Company Name', + type: 'short-input', + placeholder: 'Company name', + condition: { + field: 'operation', + value: [...CUSTOMER_OPERATIONS, ...VENDOR_OPERATIONS], + }, + }, + { + id: 'givenName', + title: 'Given Name', + type: 'short-input', + placeholder: 'Given name', + condition: { + field: 'operation', + value: [...CUSTOMER_OPERATIONS, ...EMPLOYEE_OPERATIONS, ...VENDOR_OPERATIONS], + }, + }, + { + id: 'familyName', + title: 'Family Name', + type: 'short-input', + placeholder: 'Family name', + condition: { + field: 'operation', + value: [...CUSTOMER_OPERATIONS, ...EMPLOYEE_OPERATIONS, ...VENDOR_OPERATIONS], + }, + }, + { + id: 'primaryEmail', + title: 'Primary Email', + type: 'short-input', + placeholder: 'name@example.com', + condition: { + field: 'operation', + value: [...CUSTOMER_OPERATIONS, ...EMPLOYEE_OPERATIONS, ...VENDOR_OPERATIONS], + }, + }, + { + id: 'primaryPhone', + title: 'Primary Phone', + type: 'short-input', + placeholder: 'Phone number', + condition: { + field: 'operation', + value: [...CUSTOMER_OPERATIONS, ...EMPLOYEE_OPERATIONS, ...VENDOR_OPERATIONS], + }, + }, + { + id: 'billingAddress', + title: 'Billing Address (JSON)', + type: 'code', + language: 'json', + placeholder: + '{"line1":"123 Main St","city":"San Francisco","countrySubDivisionCode":"CA","postalCode":"94105"}', + condition: { + field: 'operation', + value: [...CUSTOMER_OPERATIONS, ...VENDOR_OPERATIONS], + }, + mode: 'advanced', + wandConfig: { + enabled: true, + placeholder: 'Describe the customer or vendor billing address', + prompt: + 'Generate a QuickBooks address JSON object using only line1, line2, city, countrySubDivisionCode, postalCode, and country. Return ONLY the JSON object - no explanations, no extra text.', + generationType: 'json-object', + }, + }, + { + id: 'shippingAddress', + title: 'Shipping Address (JSON)', + type: 'code', + language: 'json', + placeholder: + '{"line1":"123 Main St","city":"San Francisco","countrySubDivisionCode":"CA","postalCode":"94105"}', + condition: { field: 'operation', value: [...CUSTOMER_OPERATIONS] }, + mode: 'advanced', + wandConfig: { + enabled: true, + placeholder: 'Describe the customer shipping address', + prompt: + 'Generate a QuickBooks address JSON object using only line1, line2, city, countrySubDivisionCode, postalCode, and country. Return ONLY the JSON object - no explanations, no extra text.', + generationType: 'json-object', + }, + }, + { + id: 'primaryAddress', + title: 'Primary Address (JSON)', + type: 'code', + language: 'json', + placeholder: + '{"line1":"123 Main St","city":"San Francisco","countrySubDivisionCode":"CA","postalCode":"94105"}', + condition: { field: 'operation', value: [...EMPLOYEE_OPERATIONS] }, + mode: 'advanced', + wandConfig: { + enabled: true, + placeholder: 'Describe the employee address', + prompt: + 'Generate a QuickBooks address JSON object using only line1, line2, city, countrySubDivisionCode, postalCode, and country. Return ONLY the JSON object - no explanations, no extra text.', + generationType: 'json-object', + }, + }, + { + id: 'printOnCheckName', + title: 'Print on Check Name', + type: 'short-input', + placeholder: 'Name printed on checks', + condition: { + field: 'operation', + value: [...EMPLOYEE_OPERATIONS, ...VENDOR_OPERATIONS], + }, + mode: 'advanced', + }, + { + id: 'billableTime', + title: 'Billable Time', + type: 'dropdown', + options: [ + { label: 'Not specified', id: 'not_specified' }, + { label: 'Yes', id: 'yes' }, + { label: 'No', id: 'no' }, + ], + condition: { field: 'operation', value: [...EMPLOYEE_OPERATIONS] }, + mode: 'advanced', + value: () => 'not_specified', + }, + { + id: 'accountNumber', + title: 'Vendor Account Number', + type: 'short-input', + placeholder: 'Account number', + condition: { field: 'operation', value: [...VENDOR_OPERATIONS] }, + mode: 'advanced', + }, + { + id: 'vendor1099', + title: '1099 Vendor', + type: 'dropdown', + options: [ + { label: 'Not specified', id: 'not_specified' }, + { label: 'Yes', id: 'yes' }, + { label: 'No', id: 'no' }, + ], + condition: { field: 'operation', value: [...VENDOR_OPERATIONS] }, + mode: 'advanced', + value: () => 'not_specified', + }, + { + id: 'name', + title: 'Item Name', + type: 'short-input', + placeholder: 'Unique item name', + condition: { field: 'operation', value: [...ITEM_OPERATIONS] }, + required: { field: 'operation', value: 'quickbooks_create_item' }, + }, + { + id: 'itemType', + title: 'Item Type', + type: 'dropdown', + options: [ + { label: 'Service', id: 'service' }, + { label: 'Non-inventory', id: 'non_inventory' }, + ], + condition: { field: 'operation', value: 'quickbooks_create_item' }, + required: { field: 'operation', value: 'quickbooks_create_item' }, + value: () => 'service', + }, + { + id: 'incomeAccountId', + title: 'Income Account ID', + type: 'short-input', + placeholder: 'QuickBooks income account ID', + condition: { field: 'operation', value: [...ITEM_OPERATIONS] }, + required: { + field: 'operation', + value: 'quickbooks_create_item', + and: { field: 'itemType', value: 'service' }, + }, + }, + { + id: 'description', + title: 'Sales Description', + type: 'long-input', + placeholder: 'Item sales description', + condition: { field: 'operation', value: [...ITEM_OPERATIONS] }, + }, + { + id: 'unitPrice', + title: 'Unit Price', + type: 'short-input', + placeholder: '0.00', + condition: { field: 'operation', value: [...ITEM_OPERATIONS] }, + }, + { + id: 'purchaseDescription', + title: 'Purchase Description', + type: 'long-input', + placeholder: 'Item purchase description', + condition: { field: 'operation', value: [...ITEM_OPERATIONS] }, + mode: 'advanced', + }, + { + id: 'purchaseCost', + title: 'Purchase Cost', + type: 'short-input', + placeholder: '0.00', + condition: { field: 'operation', value: [...ITEM_OPERATIONS] }, + mode: 'advanced', + }, + { + id: 'expenseAccountId', + title: 'Expense Account ID', + type: 'short-input', + placeholder: 'QuickBooks expense account ID', + condition: { field: 'operation', value: [...ITEM_OPERATIONS] }, + required: { field: 'operation', value: 'quickbooks_create_item' }, + }, + { + id: 'taxable', + title: 'Taxable', + type: 'dropdown', + options: [ + { label: 'Not specified', id: 'not_specified' }, + { label: 'Yes', id: 'yes' }, + { label: 'No', id: 'no' }, + ], + condition: { + field: 'operation', + value: [...CUSTOMER_OPERATIONS, ...ITEM_OPERATIONS], + }, + mode: 'advanced', + value: () => 'not_specified', + }, + { + id: 'activeStatus', + title: 'Active Status', + type: 'dropdown', + options: [ + { label: 'Unchanged', id: 'unchanged' }, + { label: 'Active', id: 'active' }, + { label: 'Inactive', id: 'inactive' }, + ], + condition: { field: 'operation', value: [...MASTER_DATA_UPDATE_OPERATIONS] }, + value: () => 'unchanged', + }, + { + id: 'lines', + title: 'Lines (JSON)', + type: 'code', + language: 'json', + placeholder: '[{"lineType":"item","amount":100,"itemId":"7","description":"Consulting"}]', + condition: { field: 'operation', value: [...SALES_DOCUMENT_OPERATIONS] }, + required: { field: 'operation', value: [...SALES_DOCUMENT_CREATE_OPERATIONS] }, + wandConfig: { + enabled: true, + placeholder: 'Describe the products, services, amounts, and quantities', + prompt: + 'Generate a JSON array of QuickBooks sales lines. Use item lines with lineType, positive amount, itemId, and optional description, positive quantity, positive unitPrice, and serviceDate. When quantity and unitPrice are both present, amount must equal quantity multiplied by unitPrice. Use description lines with lineType and description. Return ONLY the JSON array - no explanations, no extra text.', + }, + }, + { + id: 'purchasingLines', + title: 'Expense Lines (JSON)', + type: 'code', + language: 'json', + placeholder: '[{"lineType":"account","amount":100,"accountId":"7","description":"Supplies"}]', + condition: { + field: 'operation', + value: [ + 'quickbooks_create_purchase_order', + 'quickbooks_create_bill', + 'quickbooks_create_vendor_credit', + 'quickbooks_create_purchase', + ], + }, + required: { + field: 'operation', + value: [ + 'quickbooks_create_purchase_order', + 'quickbooks_create_bill', + 'quickbooks_create_vendor_credit', + 'quickbooks_create_purchase', + ], + }, + wandConfig: { + enabled: true, + placeholder: 'Describe the expense accounts or items and amounts', + prompt: + 'Generate a JSON array of QuickBooks purchasing lines. Use account lines with lineType account, positive amount, accountId, and optional description; or item lines with lineType item, positive amount, itemId, and optional description, positive quantity, and positive unitPrice. When quantity and unitPrice are both present, amount must equal their product. For Create Bill only, a line may include both purchaseOrderId and purchaseOrderLineId to request an explicit Purchase Order line link; always supply both or neither. Return ONLY the JSON array - no explanations, no extra text.', + }, + }, + { + id: 'journalLines', + title: 'Journal Lines (JSON)', + type: 'code', + language: 'json', + placeholder: + '[{"postingType":"debit","amount":100,"accountId":"7"},{"postingType":"credit","amount":100,"accountId":"35"}]', + condition: { field: 'operation', value: 'quickbooks_create_journal_entry' }, + required: { field: 'operation', value: 'quickbooks_create_journal_entry' }, + wandConfig: { + enabled: true, + placeholder: 'Describe the debit and credit entries', + prompt: + 'Generate a balanced JSON array of QuickBooks journal lines. Each line needs postingType debit or credit, a positive amount, and accountId. Optional fields are description and an entityType/entityId pair. Debits and credits must total the same amount. Return ONLY the JSON array - no explanations, no extra text.', + }, + }, + { + id: 'depositLines', + title: 'Deposit Lines (JSON)', + type: 'code', + language: 'json', + placeholder: '[{"amount":100,"accountId":"7","description":"Deposit source"}]', + condition: { field: 'operation', value: 'quickbooks_create_deposit' }, + required: { field: 'operation', value: 'quickbooks_create_deposit' }, + wandConfig: { + enabled: true, + placeholder: 'Describe the deposit sources and amounts', + prompt: + 'Generate a JSON array of QuickBooks deposit lines. Each line needs a positive amount and accountId, with optional description. Return ONLY the JSON array - no explanations, no extra text.', + }, + }, + { + id: 'totalAmount', + title: 'Total Amount', + type: 'short-input', + placeholder: '100.00', + condition: { + field: 'operation', + value: [...PAYMENT_OPERATIONS, 'quickbooks_create_bill_payment'], + }, + required: { + field: 'operation', + value: ['quickbooks_create_customer_payment', 'quickbooks_create_bill_payment'], + }, + }, + { + id: 'apAccountId', + title: 'Accounts Payable Account ID', + type: 'short-input', + placeholder: 'QuickBooks A/P account ID', + condition: { + field: 'operation', + value: [ + 'quickbooks_create_purchase_order', + 'quickbooks_update_purchase_order', + 'quickbooks_create_bill', + 'quickbooks_update_bill', + 'quickbooks_create_vendor_credit', + 'quickbooks_update_vendor_credit', + ], + }, + required: { field: 'operation', value: 'quickbooks_create_purchase_order' }, + }, + { + id: 'billPaymentType', + title: 'Payment Type', + type: 'dropdown', + options: [ + { label: 'Check', id: 'check' }, + { label: 'Credit Card', id: 'credit_card' }, + ], + condition: { field: 'operation', value: 'quickbooks_create_bill_payment' }, + required: { field: 'operation', value: 'quickbooks_create_bill_payment' }, + value: () => 'check', + }, + { + id: 'purchasePaymentType', + title: 'Payment Type', + type: 'dropdown', + options: [ + { label: 'Cash', id: 'cash' }, + { label: 'Check', id: 'check' }, + { label: 'Credit Card', id: 'credit_card' }, + ], + condition: { field: 'operation', value: 'quickbooks_create_purchase' }, + required: { field: 'operation', value: 'quickbooks_create_purchase' }, + value: () => 'cash', + }, + { + id: 'paymentAccountId', + title: 'Payment Account ID', + type: 'short-input', + placeholder: 'QuickBooks bank or credit-card account ID', + condition: { + field: 'operation', + value: ['quickbooks_create_bill_payment', 'quickbooks_create_purchase'], + }, + required: { + field: 'operation', + value: ['quickbooks_create_bill_payment', 'quickbooks_create_purchase'], + }, + }, + { + id: 'billAllocations', + title: 'Bill Allocations (JSON)', + type: 'code', + language: 'json', + placeholder: '[{"billId":"123","amount":75}]', + condition: { field: 'operation', value: 'quickbooks_create_bill_payment' }, + wandConfig: { + enabled: true, + placeholder: 'Describe how the payment should be allocated across bills', + prompt: + 'Generate a JSON array of QuickBooks Bill allocations using only billId and a positive amount. Allocation amounts must total the payment amount. Return ONLY the JSON array - no explanations, no extra text.', + }, + }, + { + id: 'transactionDate', + title: 'Transaction Date', + type: 'short-input', + placeholder: 'YYYY-MM-DD', + condition: { + field: 'operation', + value: [ + ...SALES_CREATE_OPERATIONS, + ...SALES_UPDATE_OPERATIONS, + ...PURCHASING_MUTATION_OPERATIONS, + ...ACCOUNTING_MUTATION_OPERATIONS, + ], + }, + mode: 'advanced', + wandConfig: dateWandConfig('transaction date'), + }, + { + id: 'dueDate', + title: 'Due Date', + type: 'short-input', + placeholder: 'YYYY-MM-DD', + condition: { + field: 'operation', + value: [ + 'quickbooks_create_invoice', + 'quickbooks_update_invoice', + 'quickbooks_create_bill', + 'quickbooks_update_bill', + ], + }, + mode: 'advanced', + wandConfig: dateWandConfig('due date'), + }, + { + id: 'expirationDate', + title: 'Expiration Date', + type: 'short-input', + placeholder: 'YYYY-MM-DD', + condition: { + field: 'operation', + value: ['quickbooks_create_estimate', 'quickbooks_update_estimate'], + }, + mode: 'advanced', + wandConfig: dateWandConfig('estimate expiration date'), + }, + { + id: 'documentNumber', + title: 'Document Number', + type: 'short-input', + placeholder: 'Optional QuickBooks document number', + condition: { + field: 'operation', + value: [ + ...SALES_DOCUMENT_OPERATIONS, + 'quickbooks_create_purchase_order', + 'quickbooks_update_purchase_order', + 'quickbooks_create_bill', + 'quickbooks_update_bill', + 'quickbooks_create_vendor_credit', + 'quickbooks_update_vendor_credit', + 'quickbooks_create_journal_entry', + 'quickbooks_update_journal_entry', + ], + }, + mode: 'advanced', + }, + { + id: 'privateNote', + title: 'Private Note', + type: 'long-input', + placeholder: 'Internal note', + condition: { + field: 'operation', + value: [ + ...SALES_CREATE_OPERATIONS, + ...SALES_UPDATE_OPERATIONS, + ...PURCHASING_MUTATION_OPERATIONS, + ...ACCOUNTING_MUTATION_OPERATIONS, + ], + }, + mode: 'advanced', + }, + { + id: 'customerMemo', + title: 'Customer Memo', + type: 'long-input', + placeholder: 'Customer-facing memo', + condition: { field: 'operation', value: [...SALES_DOCUMENT_OPERATIONS] }, + mode: 'advanced', + }, + { + id: 'paymentMethodId', + title: 'Payment Method ID', + type: 'short-input', + placeholder: 'QuickBooks payment method ID', + condition: { + field: 'operation', + value: [ + 'quickbooks_create_sales_receipt', + 'quickbooks_update_sales_receipt', + 'quickbooks_create_refund_receipt', + 'quickbooks_update_refund_receipt', + ...PAYMENT_OPERATIONS, + ], + }, + mode: 'advanced', + }, + { + id: 'paymentReferenceNumber', + title: 'Payment Reference Number', + type: 'short-input', + placeholder: 'Check or payment reference', + condition: { + field: 'operation', + value: [ + 'quickbooks_create_sales_receipt', + 'quickbooks_update_sales_receipt', + 'quickbooks_create_refund_receipt', + 'quickbooks_update_refund_receipt', + ...PAYMENT_OPERATIONS, + ], + }, + mode: 'advanced', + }, + { + id: 'depositAccountId', + title: 'Deposit Account ID', + type: 'short-input', + placeholder: 'QuickBooks deposit account ID', + condition: { + field: 'operation', + value: [ + 'quickbooks_create_sales_receipt', + 'quickbooks_update_sales_receipt', + 'quickbooks_create_refund_receipt', + 'quickbooks_update_refund_receipt', + ...PAYMENT_OPERATIONS, + 'quickbooks_create_deposit', + 'quickbooks_update_deposit', + ], + }, + required: { + field: 'operation', + value: [ + 'quickbooks_create_refund_receipt', + 'quickbooks_create_deposit', + 'quickbooks_update_deposit', + ], + }, + }, + { + id: 'invoiceAllocations', + title: 'Invoice Allocations (JSON)', + type: 'code', + language: 'json', + placeholder: '[{"invoiceId":"42","amount":75}]', + condition: { field: 'operation', value: [...PAYMENT_OPERATIONS] }, + mode: 'advanced', + wandConfig: { + enabled: true, + placeholder: 'Describe how the payment should be allocated across invoices', + prompt: + 'Generate a JSON array of QuickBooks invoice allocations using only invoiceId and a positive amount. On an update these are merged into the allocations the payment already has, so list only the invoices whose applied amount should change; any invoice already applied and not listed keeps its current amount. Return ONLY the JSON array - no explanations, no extra text.', + }, + }, + { + id: 'unapplyOmittedInvoices', + title: 'Replace Invoice Allocations', + type: 'dropdown', + options: [ + { label: 'No', id: 'no' }, + { label: 'Yes', id: 'yes' }, + ], + description: + 'Yes removes every invoice not listed in the allocations from this payment, returning it to open.', + condition: { field: 'operation', value: 'quickbooks_update_customer_payment' }, + mode: 'advanced', + value: () => 'no', + }, + { + id: 'paymentReference', + title: 'Payment Reference', + type: 'short-input', + placeholder: 'Optional check or payment reference', + condition: { + field: 'operation', + value: ['quickbooks_create_purchase', 'quickbooks_update_purchase'], + }, + mode: 'advanced', + }, + { + id: 'requestId', + title: 'Request ID', + type: 'short-input', + placeholder: 'Optional idempotency key (max 50 characters)', + condition: { field: 'operation', value: [...CREATE_OPERATIONS] }, + mode: 'advanced', + }, + { + id: 'confirmVoid', + title: 'Confirm Void', + type: 'dropdown', + options: [ + { label: 'No', id: 'no' }, + { label: 'Yes', id: 'yes' }, + ], + condition: { field: 'operation', value: [...SALES_VOID_OPERATIONS] }, + required: { field: 'operation', value: [...SALES_VOID_OPERATIONS] }, + value: () => 'no', + }, + { + id: 'confirmPosting', + title: 'Confirm Posting', + type: 'dropdown', + options: [ + { label: 'No', id: 'no' }, + { label: 'Yes', id: 'yes' }, + ], + condition: { + field: 'operation', + value: ['quickbooks_create_journal_entry', 'quickbooks_update_journal_entry'], + }, + required: { + field: 'operation', + value: ['quickbooks_create_journal_entry', 'quickbooks_update_journal_entry'], + }, + value: () => 'no', + }, + ], + tools: { + access: [ + 'quickbooks_get_company_info', + 'quickbooks_read_master_data', + 'quickbooks_create_customer', + 'quickbooks_update_customer', + 'quickbooks_create_employee', + 'quickbooks_update_employee', + 'quickbooks_create_vendor', + 'quickbooks_update_vendor', + 'quickbooks_create_item', + 'quickbooks_update_item', + 'quickbooks_read_sales_transactions', + 'quickbooks_create_estimate', + 'quickbooks_update_estimate', + 'quickbooks_create_invoice', + 'quickbooks_update_invoice', + 'quickbooks_void_invoice', + 'quickbooks_create_sales_receipt', + 'quickbooks_update_sales_receipt', + 'quickbooks_create_customer_payment', + 'quickbooks_update_customer_payment', + 'quickbooks_void_customer_payment', + 'quickbooks_create_credit_memo', + 'quickbooks_update_credit_memo', + 'quickbooks_create_refund_receipt', + 'quickbooks_update_refund_receipt', + 'quickbooks_read_purchasing_transactions', + 'quickbooks_create_purchase_order', + 'quickbooks_update_purchase_order', + 'quickbooks_create_bill', + 'quickbooks_update_bill', + 'quickbooks_create_bill_payment', + 'quickbooks_update_bill_payment', + 'quickbooks_create_vendor_credit', + 'quickbooks_update_vendor_credit', + 'quickbooks_create_purchase', + 'quickbooks_update_purchase', + 'quickbooks_read_accounting_transactions', + 'quickbooks_create_journal_entry', + 'quickbooks_update_journal_entry', + 'quickbooks_create_deposit', + 'quickbooks_update_deposit', + 'quickbooks_run_financial_report', + 'quickbooks_email_transaction', + 'quickbooks_download_transaction_pdf', + 'quickbooks_read_attachments', + 'quickbooks_add_attachment', + 'quickbooks_download_attachment', + ], + config: { + tool: (params) => { + const operation = String(params.operation) + if (!QUICKBOOKS_OPERATIONS.includes(operation as (typeof QUICKBOOKS_OPERATIONS)[number])) { + throw new Error(`Unknown QuickBooks operation: ${operation}`) + } + return operation + }, + params: (params) => { + const operation = String(params.operation) + const oauthCredentialValue = params.oauthCredential + + if (operation === EMAIL_TRANSACTION_OPERATION) { + return { + credential: oauthCredentialValue, + transactionType: params.documentTransactionType, + transactionId: optionalValue(params.documentTransactionId), + recipient: optionalValue(params.recipientOverride), + confirmSend: parseConfirmation(params.confirmSend, 'confirmSend'), + } + } + if (operation === DOWNLOAD_TRANSACTION_PDF_OPERATION) { + return { + credential: oauthCredentialValue, + transactionType: params.documentTransactionType, + transactionId: optionalValue(params.documentTransactionId), + fileName: optionalValue(params.documentFileName), + } + } + if (operation === READ_ATTACHMENTS_OPERATION) { + if (params.readMode === 'by_id') { + return { + credential: oauthCredentialValue, + readMode: 'by_id', + attachmentId: optionalValue(params.attachmentId), + } + } + return { + credential: oauthCredentialValue, + readMode: 'list', + targetType: params.attachmentTargetType, + targetId: optionalValue(params.attachmentTargetId), + startPosition: parsePaginationInteger(params.startPosition, 'startPosition', 1), + maxResults: parsePaginationInteger(params.maxResults, 'maxResults', 25), + } + } + if (operation === ADD_ATTACHMENT_OPERATION) { + const attachmentKind = params.attachmentKind + return { + credential: oauthCredentialValue, + attachmentKind, + targetType: params.attachmentTargetType, + targetId: optionalValue(params.attachmentTargetId), + file: + attachmentKind === 'file' + ? normalizeFileInput(params.attachmentFile, { single: true }) + : undefined, + fileName: + attachmentKind === 'file' ? optionalValue(params.attachmentFileName) : undefined, + contentType: + attachmentKind === 'file' ? optionalValue(params.attachmentContentType) : undefined, + description: + attachmentKind === 'file' ? optionalValue(params.attachmentDescription) : undefined, + note: attachmentKind === 'note' ? optionalValue(params.attachmentNote) : undefined, + } + } + if (operation === DOWNLOAD_ATTACHMENT_OPERATION) { + return { + credential: oauthCredentialValue, + attachmentId: optionalValue(params.attachmentId), + fileName: optionalValue(params.attachmentFileName), + } + } + + if (operation === MASTER_DATA_OPERATION) { + if (params.readMode === 'by_id') { + return { + credential: oauthCredentialValue, + recordType: params.recordType, + readMode: params.readMode, + recordId: optionalValue(params.recordId), + } + } + return { + credential: oauthCredentialValue, + recordType: params.recordType, + readMode: params.readMode, + activeStatus: params.readActiveStatus ?? 'default', + startPosition: parsePaginationInteger(params.startPosition, 'startPosition', 1), + maxResults: parsePaginationInteger(params.maxResults, 'maxResults', 25), + } + } + if (operation === SALES_READ_OPERATION) { + if (params.readMode === 'by_id') { + return { + credential: oauthCredentialValue, + transactionType: params.transactionType, + readMode: params.readMode, + transactionId: optionalValue(params.transactionId), + } + } + return { + credential: oauthCredentialValue, + transactionType: params.transactionType, + readMode: params.readMode, + startDate: optionalValue(params.readStartDate), + endDate: optionalValue(params.readEndDate), + customerId: optionalValue(params.readCustomerId), + startPosition: parsePaginationInteger(params.startPosition, 'startPosition', 1), + maxResults: parsePaginationInteger(params.maxResults, 'maxResults', 25), + } + } + if (operation === PURCHASING_READ_OPERATION) { + if (params.readMode === 'by_id') { + return { + credential: oauthCredentialValue, + transactionType: params.purchasingTransactionType, + readMode: params.readMode, + transactionId: optionalValue(params.transactionId), + } + } + return { + credential: oauthCredentialValue, + transactionType: params.purchasingTransactionType, + readMode: params.readMode, + startDate: optionalValue(params.readStartDate), + endDate: optionalValue(params.readEndDate), + vendorId: + params.purchasingTransactionType === 'purchase' + ? undefined + : optionalValue(params.readVendorId), + startPosition: parsePaginationInteger(params.startPosition, 'startPosition', 1), + maxResults: parsePaginationInteger(params.maxResults, 'maxResults', 25), + } + } + if (operation === ACCOUNTING_READ_OPERATION) { + if (params.readMode === 'by_id') { + return { + credential: oauthCredentialValue, + transactionType: params.accountingTransactionType, + readMode: params.readMode, + transactionId: optionalValue(params.transactionId), + } + } + return { + credential: oauthCredentialValue, + transactionType: params.accountingTransactionType, + readMode: params.readMode, + startDate: optionalValue(params.readStartDate), + endDate: optionalValue(params.readEndDate), + startPosition: parsePaginationInteger(params.startPosition, 'startPosition', 1), + maxResults: parsePaginationInteger(params.maxResults, 'maxResults', 25), + } + } + if (operation === REPORT_OPERATION) { + const reportType = params.reportType + return { + credential: oauthCredentialValue, + reportType, + startDate: reportSupports(reportType, 'startDate') + ? optionalValue(params.reportStartDate) + : undefined, + endDate: optionalValue(params.reportEndDate), + accountingMethod: reportSupports(reportType, 'accountingMethod') + ? (params.reportAccountingMethod ?? 'default') + : undefined, + summarizeBy: reportSupports(reportType, 'summarizeBy') + ? reportSummarizeValue(params, reportType) + : undefined, + customerId: reportSupports(reportType, 'customerId') + ? optionalValue(params.reportCustomerId) + : undefined, + vendorId: reportSupports(reportType, 'vendorId') + ? optionalValue(params.reportVendorId) + : undefined, + accountId: reportSupports(reportType, 'accountId') + ? optionalValue(params.reportAccountId) + : undefined, + itemId: reportSupports(reportType, 'itemId') + ? optionalValue(params.reportItemId) + : undefined, + classId: reportSupports(reportType, 'classId') + ? optionalValue(params.reportClassId) + : undefined, + departmentId: reportSupports(reportType, 'departmentId') + ? optionalValue(params.reportDepartmentId) + : undefined, + agingMethod: reportSupports(reportType, 'agingMethod') + ? (params.reportAgingMethod ?? 'default') + : undefined, + agingDays: reportSupports(reportType, 'agingPeriod') + ? parseOptionalPositiveInteger(params.reportAgingDays, 'agingDays') + : undefined, + transactionType: + reportType === 'transaction_list' && params.reportTransactionType !== 'default' + ? params.reportTransactionType + : undefined, + groupBy: + reportType === 'transaction_list' && params.reportGroupBy !== 'default' + ? params.reportGroupBy + : undefined, + accountsPayablePaid: + reportType === 'transaction_list' && params.reportAccountsPayablePaid !== 'default' + ? params.reportAccountsPayablePaid + : undefined, + accountsReceivablePaid: + reportType === 'transaction_list' && params.reportAccountsReceivablePaid !== 'default' + ? params.reportAccountsReceivablePaid + : undefined, + clearedStatus: + reportType === 'transaction_list' && params.reportClearedStatus !== 'default' + ? params.reportClearedStatus + : undefined, + documentNumber: + reportType === 'transaction_list' + ? optionalValue(params.reportDocumentNumber) + : undefined, + sourceAccountType: + reportType === 'transaction_list' && params.reportSourceAccountType !== 'default' + ? params.reportSourceAccountType + : undefined, + } + } + if (SALES_VOID_OPERATIONS.includes(operation as (typeof SALES_VOID_OPERATIONS)[number])) { + return { + credential: oauthCredentialValue, + transactionId: optionalValue(params.transactionId), + syncToken: optionalValue(params.syncToken), + confirmVoid: parseConfirmation(params.confirmVoid, 'confirmVoid'), + } + } + if ( + SALES_DOCUMENT_OPERATIONS.includes( + operation as (typeof SALES_DOCUMENT_OPERATIONS)[number] + ) + ) { + const isCreate = SALES_DOCUMENT_CREATE_OPERATIONS.includes( + operation as (typeof SALES_DOCUMENT_CREATE_OPERATIONS)[number] + ) + const isInvoice = + operation === 'quickbooks_create_invoice' || operation === 'quickbooks_update_invoice' + const isEstimate = + operation === 'quickbooks_create_estimate' || operation === 'quickbooks_update_estimate' + const isReceipt = + operation === 'quickbooks_create_sales_receipt' || + operation === 'quickbooks_update_sales_receipt' || + operation === 'quickbooks_create_refund_receipt' || + operation === 'quickbooks_update_refund_receipt' + return { + credential: oauthCredentialValue, + transactionId: isCreate ? undefined : optionalValue(params.transactionId), + syncToken: isCreate ? undefined : optionalValue(params.syncToken), + customerId: optionalValue(params.customerId), + lines: parseQuickBooksSalesLines(params.lines), + transactionDate: optionalValue(params.transactionDate), + dueDate: isInvoice ? optionalValue(params.dueDate) : undefined, + expirationDate: isEstimate ? optionalValue(params.expirationDate) : undefined, + documentNumber: optionalValue(params.documentNumber), + privateNote: optionalValue(params.privateNote), + customerMemo: optionalValue(params.customerMemo), + paymentMethodId: isReceipt ? optionalValue(params.paymentMethodId) : undefined, + paymentReferenceNumber: isReceipt + ? optionalValue(params.paymentReferenceNumber) + : undefined, + depositAccountId: isReceipt ? optionalValue(params.depositAccountId) : undefined, + requestId: isCreate ? optionalValue(params.requestId) : undefined, + } + } + if (PAYMENT_OPERATIONS.includes(operation as (typeof PAYMENT_OPERATIONS)[number])) { + const isCreate = operation === 'quickbooks_create_customer_payment' + return { + credential: oauthCredentialValue, + paymentId: isCreate ? undefined : optionalValue(params.transactionId), + syncToken: isCreate ? undefined : optionalValue(params.syncToken), + customerId: optionalValue(params.customerId), + totalAmount: parseOptionalNumber(params.totalAmount, 'totalAmount'), + transactionDate: optionalValue(params.transactionDate), + privateNote: optionalValue(params.privateNote), + paymentReferenceNumber: optionalValue(params.paymentReferenceNumber), + paymentMethodId: optionalValue(params.paymentMethodId), + depositAccountId: optionalValue(params.depositAccountId), + invoiceAllocations: parseQuickBooksInvoiceAllocations(params.invoiceAllocations), + unapplyOmittedInvoices: isCreate + ? undefined + : parseConfirmation(params.unapplyOmittedInvoices, 'unapplyOmittedInvoices'), + requestId: isCreate ? optionalValue(params.requestId) : undefined, + } + } + if ( + PURCHASING_MUTATION_OPERATIONS.includes( + operation as (typeof PURCHASING_MUTATION_OPERATIONS)[number] + ) + ) { + const isCreate = PURCHASING_CREATE_OPERATIONS.includes( + operation as (typeof PURCHASING_CREATE_OPERATIONS)[number] + ) + const isPurchaseOrder = + operation === 'quickbooks_create_purchase_order' || + operation === 'quickbooks_update_purchase_order' + const isBill = + operation === 'quickbooks_create_bill' || operation === 'quickbooks_update_bill' + const isBillPayment = + operation === 'quickbooks_create_bill_payment' || + operation === 'quickbooks_update_bill_payment' + const isVendorCredit = + operation === 'quickbooks_create_vendor_credit' || + operation === 'quickbooks_update_vendor_credit' + const isPurchase = + operation === 'quickbooks_create_purchase' || operation === 'quickbooks_update_purchase' + return { + credential: oauthCredentialValue, + purchaseOrderId: + !isCreate && isPurchaseOrder ? optionalValue(params.transactionId) : undefined, + billId: !isCreate && isBill ? optionalValue(params.transactionId) : undefined, + billPaymentId: + !isCreate && isBillPayment ? optionalValue(params.transactionId) : undefined, + vendorCreditId: + !isCreate && isVendorCredit ? optionalValue(params.transactionId) : undefined, + purchaseId: !isCreate && isPurchase ? optionalValue(params.transactionId) : undefined, + syncToken: isCreate ? undefined : optionalValue(params.syncToken), + vendorId: optionalValue(params.vendorId), + apAccountId: + isPurchaseOrder || isBill || isVendorCredit + ? optionalValue(params.apAccountId) + : undefined, + lines: + isCreate && (isPurchaseOrder || isBill || isVendorCredit || isPurchase) + ? isBill + ? parseQuickBooksBillLines(params.purchasingLines) + : parseQuickBooksPurchasingLines(params.purchasingLines) + : undefined, + totalAmount: + isCreate && isBillPayment + ? parseOptionalNumber(params.totalAmount, 'totalAmount') + : undefined, + paymentType: + isCreate && isBillPayment + ? optionalValue(params.billPaymentType) + : isCreate && isPurchase + ? optionalValue(params.purchasePaymentType) + : undefined, + paymentAccountId: + isCreate && (isBillPayment || isPurchase) + ? optionalValue(params.paymentAccountId) + : undefined, + billAllocations: + isCreate && isBillPayment + ? parseQuickBooksBillAllocations(params.billAllocations) + : undefined, + transactionDate: optionalValue(params.transactionDate), + dueDate: isBill ? optionalValue(params.dueDate) : undefined, + documentNumber: + isPurchaseOrder || isBill || isVendorCredit + ? optionalValue(params.documentNumber) + : undefined, + paymentReference: isPurchase ? optionalValue(params.paymentReference) : undefined, + privateNote: optionalValue(params.privateNote), + requestId: isCreate ? optionalValue(params.requestId) : undefined, + } + } + if ( + ACCOUNTING_MUTATION_OPERATIONS.includes( + operation as (typeof ACCOUNTING_MUTATION_OPERATIONS)[number] + ) + ) { + const isJournalEntry = + operation === 'quickbooks_create_journal_entry' || + operation === 'quickbooks_update_journal_entry' + const isCreate = ACCOUNTING_CREATE_OPERATIONS.includes( + operation as (typeof ACCOUNTING_CREATE_OPERATIONS)[number] + ) + return { + credential: oauthCredentialValue, + journalEntryId: + !isCreate && isJournalEntry ? optionalValue(params.transactionId) : undefined, + depositId: + !isCreate && !isJournalEntry ? optionalValue(params.transactionId) : undefined, + syncToken: isCreate ? undefined : optionalValue(params.syncToken), + lines: + isCreate && isJournalEntry + ? parseQuickBooksJournalLines(params.journalLines) + : isCreate + ? parseQuickBooksDepositLines(params.depositLines) + : undefined, + confirmPosting: isJournalEntry + ? parseConfirmation(params.confirmPosting, 'confirmPosting') + : undefined, + depositAccountId: !isJournalEntry ? optionalValue(params.depositAccountId) : undefined, + transactionDate: optionalValue(params.transactionDate), + documentNumber: isJournalEntry ? optionalValue(params.documentNumber) : undefined, + privateNote: optionalValue(params.privateNote), + requestId: isCreate ? optionalValue(params.requestId) : undefined, + } + } + if ( + operation === 'quickbooks_create_customer' || + operation === 'quickbooks_update_customer' + ) { + const isCreate = operation === 'quickbooks_create_customer' + return { + credential: oauthCredentialValue, + customerId: isCreate ? undefined : optionalValue(params.customerId), + syncToken: isCreate ? undefined : optionalValue(params.syncToken), + displayName: optionalValue(params.displayName), + companyName: optionalValue(params.companyName), + givenName: optionalValue(params.givenName), + familyName: optionalValue(params.familyName), + primaryEmail: optionalValue(params.primaryEmail), + primaryPhone: optionalValue(params.primaryPhone), + billingAddress: parseQuickBooksAddress(params.billingAddress, 'billingAddress'), + shippingAddress: parseQuickBooksAddress(params.shippingAddress, 'shippingAddress'), + taxable: parseTriStateBoolean(params.taxable, 'taxable'), + activeStatus: isCreate ? undefined : (params.activeStatus ?? 'unchanged'), + requestId: isCreate ? optionalValue(params.requestId) : undefined, + } + } + if ( + operation === 'quickbooks_create_employee' || + operation === 'quickbooks_update_employee' + ) { + const isCreate = operation === 'quickbooks_create_employee' + return { + credential: oauthCredentialValue, + employeeId: isCreate ? undefined : optionalValue(params.employeeId), + syncToken: isCreate ? undefined : optionalValue(params.syncToken), + displayName: optionalValue(params.displayName), + givenName: optionalValue(params.givenName), + familyName: optionalValue(params.familyName), + primaryEmail: optionalValue(params.primaryEmail), + primaryPhone: optionalValue(params.primaryPhone), + primaryAddress: parseQuickBooksAddress(params.primaryAddress, 'primaryAddress'), + printOnCheckName: optionalValue(params.printOnCheckName), + billableTime: parseTriStateBoolean(params.billableTime, 'billableTime'), + activeStatus: isCreate ? undefined : (params.activeStatus ?? 'unchanged'), + requestId: isCreate ? optionalValue(params.requestId) : undefined, + } + } + if (operation === 'quickbooks_create_vendor' || operation === 'quickbooks_update_vendor') { + const isCreate = operation === 'quickbooks_create_vendor' + return { + credential: oauthCredentialValue, + vendorId: isCreate ? undefined : optionalValue(params.vendorId), + syncToken: isCreate ? undefined : optionalValue(params.syncToken), + displayName: optionalValue(params.displayName), + companyName: optionalValue(params.companyName), + givenName: optionalValue(params.givenName), + familyName: optionalValue(params.familyName), + primaryEmail: optionalValue(params.primaryEmail), + primaryPhone: optionalValue(params.primaryPhone), + billingAddress: parseQuickBooksAddress(params.billingAddress, 'billingAddress'), + printOnCheckName: optionalValue(params.printOnCheckName), + accountNumber: optionalValue(params.accountNumber), + vendor1099: parseTriStateBoolean(params.vendor1099, 'vendor1099'), + activeStatus: isCreate ? undefined : (params.activeStatus ?? 'unchanged'), + requestId: isCreate ? optionalValue(params.requestId) : undefined, + } + } + if (operation === 'quickbooks_create_item' || operation === 'quickbooks_update_item') { + const isCreate = operation === 'quickbooks_create_item' + return { + credential: oauthCredentialValue, + itemId: isCreate ? undefined : optionalValue(params.itemId), + syncToken: isCreate ? undefined : optionalValue(params.syncToken), + name: optionalValue(params.name), + itemType: isCreate ? optionalValue(params.itemType) : undefined, + incomeAccountId: optionalValue(params.incomeAccountId), + description: optionalValue(params.description), + unitPrice: parseOptionalNumber(params.unitPrice, 'unitPrice'), + purchaseDescription: optionalValue(params.purchaseDescription), + purchaseCost: parseOptionalNumber(params.purchaseCost, 'purchaseCost'), + expenseAccountId: optionalValue(params.expenseAccountId), + taxable: parseTriStateBoolean(params.taxable, 'taxable'), + activeStatus: isCreate ? undefined : (params.activeStatus ?? 'unchanged'), + requestId: isCreate ? optionalValue(params.requestId) : undefined, + } + } + return { credential: oauthCredentialValue } + }, + }, + }, + inputs: { + operation: { type: 'string', description: 'QuickBooks operation to perform' }, + oauthCredential: { + type: 'string', + description: 'OAuth credential bound to one QuickBooks company', + }, + recordType: { type: 'string', description: 'Master-data entity type' }, + readMode: { type: 'string', description: 'List or by-ID read mode' }, + recordId: { type: 'string', description: 'Master-data record ID' }, + transactionType: { type: 'string', description: 'Sales transaction entity type' }, + purchasingTransactionType: { + type: 'string', + description: 'Purchasing transaction entity type', + }, + accountingTransactionType: { + type: 'string', + description: 'Accounting transaction entity type', + }, + reportType: { type: 'string', description: 'Financial report type' }, + reportStartDate: { type: 'string', description: 'Report start date' }, + reportEndDate: { type: 'string', description: 'Report end or as-of date' }, + reportAccountingMethod: { type: 'string', description: 'Cash or accrual report basis' }, + reportSummarizeBy: { type: 'string', description: 'Report column summarization' }, + reportCustomerSalesSummarizeBy: { + type: 'string', + description: 'Sales report column summarization', + }, + reportVendorExpenseSummarizeBy: { + type: 'string', + description: 'Vendor expense report column summarization', + }, + reportTimeSummarizeBy: { + type: 'string', + description: 'Time-based report column summarization', + }, + reportCustomerId: { type: 'string', description: 'Customer report filter ID' }, + reportVendorId: { type: 'string', description: 'Vendor report filter ID' }, + reportAccountId: { type: 'string', description: 'Account report filter ID' }, + reportItemId: { type: 'string', description: 'Product or service report filter ID' }, + reportClassId: { type: 'string', description: 'Class report filter ID' }, + reportDepartmentId: { type: 'string', description: 'Department report filter ID' }, + reportAgingMethod: { type: 'string', description: 'Aging report calculation date' }, + reportAgingDays: { type: 'number', description: 'Days in each aging period' }, + reportTransactionType: { type: 'string', description: 'Transaction List type filter' }, + reportGroupBy: { type: 'string', description: 'Transaction List grouping' }, + reportAccountsPayablePaid: { type: 'string', description: 'Transaction List A/P status' }, + reportAccountsReceivablePaid: { type: 'string', description: 'Transaction List A/R status' }, + reportClearedStatus: { type: 'string', description: 'Transaction List cleared status' }, + reportDocumentNumber: { type: 'string', description: 'Transaction List document number' }, + reportSourceAccountType: { + type: 'string', + description: 'Transaction List source account type', + }, + readActiveStatus: { type: 'string', description: 'Master-data active-status filter' }, + readStartDate: { type: 'string', description: 'Transaction list start date' }, + readEndDate: { type: 'string', description: 'Transaction list end date' }, + readCustomerId: { type: 'string', description: 'Sales list customer filter' }, + readVendorId: { type: 'string', description: 'Purchasing list vendor filter' }, + transactionId: { type: 'string', description: 'QuickBooks transaction ID' }, + startPosition: { + type: 'number', + description: 'One-based position of the first list item to request', + }, + maxResults: { + type: 'number', + description: 'Number of list items to request, from 1 through 100', + }, + customerId: { type: 'string', description: 'QuickBooks customer ID' }, + vendorId: { type: 'string', description: 'QuickBooks vendor ID' }, + itemId: { type: 'string', description: 'Item ID for an update' }, + employeeId: { type: 'string', description: 'Employee ID for an update' }, + syncToken: { type: 'string', description: 'Current entity sync token' }, + displayName: { type: 'string', description: 'Customer, employee, or vendor display name' }, + companyName: { type: 'string', description: 'Customer or vendor company name' }, + givenName: { type: 'string', description: 'Customer, employee, or vendor given name' }, + familyName: { type: 'string', description: 'Customer, employee, or vendor family name' }, + primaryEmail: { type: 'string', description: 'Primary email address' }, + primaryPhone: { type: 'string', description: 'Primary phone number' }, + billingAddress: { type: 'json', description: 'Allowlisted billing address object' }, + shippingAddress: { type: 'json', description: 'Allowlisted shipping address object' }, + primaryAddress: { type: 'json', description: 'Allowlisted employee address object' }, + taxable: { type: 'boolean', description: 'Optional taxable value' }, + printOnCheckName: { type: 'string', description: 'Employee or vendor name printed on checks' }, + billableTime: { type: 'boolean', description: 'Optional employee billable-time value' }, + accountNumber: { type: 'string', description: 'Vendor account number' }, + vendor1099: { type: 'boolean', description: 'Optional vendor 1099 value' }, + name: { type: 'string', description: 'Item name' }, + itemType: { type: 'string', description: 'Service or Non-inventory item type' }, + incomeAccountId: { type: 'string', description: 'Item income account ID' }, + description: { type: 'string', description: 'Item sales description' }, + unitPrice: { type: 'number', description: 'Item sales price' }, + purchaseDescription: { type: 'string', description: 'Item purchase description' }, + purchaseCost: { type: 'number', description: 'Item purchase cost' }, + expenseAccountId: { type: 'string', description: 'Item expense account ID' }, + activeStatus: { type: 'string', description: 'Entity active-status change' }, + lines: { type: 'json', description: 'Bounded item and description sales lines' }, + purchasingLines: { + type: 'json', + description: + 'Bounded purchasing expense lines; Create Bill lines may include paired Purchase Order and line IDs', + }, + journalLines: { type: 'json', description: 'Bounded balanced journal-entry lines' }, + depositLines: { type: 'json', description: 'Bounded account-based deposit lines' }, + totalAmount: { type: 'number', description: 'Customer or Bill payment total' }, + apAccountId: { type: 'string', description: 'QuickBooks accounts-payable account ID' }, + billPaymentType: { type: 'string', description: 'Check or credit-card BillPayment type' }, + purchasePaymentType: { + type: 'string', + description: 'Cash, check, or credit-card Purchase type', + }, + paymentAccountId: { type: 'string', description: 'QuickBooks payment account ID' }, + billAllocations: { type: 'json', description: 'Bounded BillPayment allocations to Bills' }, + transactionDate: { type: 'string', description: 'Transaction date in YYYY-MM-DD format' }, + dueDate: { type: 'string', description: 'Invoice due date in YYYY-MM-DD format' }, + expirationDate: { + type: 'string', + description: 'Estimate expiration date in YYYY-MM-DD format', + }, + documentNumber: { type: 'string', description: 'QuickBooks document number' }, + privateNote: { type: 'string', description: 'Internal transaction note' }, + customerMemo: { type: 'string', description: 'Customer-facing transaction memo' }, + paymentMethodId: { type: 'string', description: 'QuickBooks payment method ID' }, + paymentReferenceNumber: { type: 'string', description: 'Payment reference number' }, + paymentReference: { type: 'string', description: 'Purchase payment reference number' }, + depositAccountId: { type: 'string', description: 'QuickBooks deposit account ID' }, + invoiceAllocations: { + type: 'json', + description: 'Bounded customer-payment allocations to invoices', + }, + unapplyOmittedInvoices: { + type: 'boolean', + description: 'Replace payment allocations outright, unapplying every invoice not listed', + }, + requestId: { type: 'string', description: 'Optional Intuit idempotency request ID' }, + confirmVoid: { type: 'boolean', description: 'Explicit confirmation for a void operation' }, + confirmPosting: { + type: 'boolean', + description: 'Explicit confirmation before posting a journal entry', + }, + documentTransactionType: { + type: 'string', + description: 'Supported transaction type for email or PDF download', + }, + documentTransactionId: { + type: 'string', + description: 'QuickBooks transaction ID for email or PDF download', + }, + confirmSend: { type: 'boolean', description: 'Explicit confirmation before sending email' }, + recipientOverride: { type: 'string', description: 'Optional single email recipient override' }, + documentFileName: { type: 'string', description: 'Optional PDF filename override' }, + attachmentTargetType: { type: 'string', description: 'QuickBooks attachment target type' }, + attachmentTargetId: { type: 'string', description: 'QuickBooks attachment target ID' }, + attachmentId: { type: 'string', description: 'QuickBooks attachment ID' }, + attachmentKind: { type: 'string', description: 'File or Note attachment kind' }, + attachmentFile: { type: 'file', description: 'Single file to attach to QuickBooks' }, + attachmentNote: { type: 'string', description: 'Note text to attach to QuickBooks' }, + attachmentFileName: { type: 'string', description: 'Optional attachment filename override' }, + attachmentContentType: { type: 'string', description: 'Optional compatible MIME type' }, + attachmentDescription: { type: 'string', description: 'Optional file attachment description' }, + }, + outputs: { + company: { + type: 'json', + description: + 'CompanyInfo with Id, CompanyName, LegalName, addresses, contact details, company settings, and MetaData', + condition: { field: 'operation', value: 'quickbooks_get_company_info' }, + }, + recordType: { + type: 'string', + description: 'Master-data record type returned by the read', + condition: { field: 'operation', value: MASTER_DATA_OPERATION }, + }, + transactionType: { + type: 'string', + description: 'Sales, purchasing, or accounting transaction type returned by the read', + condition: { + field: 'operation', + value: [ + SALES_READ_OPERATION, + PURCHASING_READ_OPERATION, + ACCOUNTING_READ_OPERATION, + EMAIL_TRANSACTION_OPERATION, + DOWNLOAD_TRANSACTION_PDF_OPERATION, + ], + }, + }, + transactionId: { + type: 'string', + description: 'QuickBooks transaction ID used by the document operation', + condition: { + field: 'operation', + value: [EMAIL_TRANSACTION_OPERATION, DOWNLOAD_TRANSACTION_PDF_OPERATION], + }, + }, + reportType: { + type: 'string', + description: 'Financial report type that was run', + condition: { field: 'operation', value: REPORT_OPERATION }, + }, + header: { + type: 'json', + description: 'Native QuickBooks report header, periods, basis, filters, and options', + condition: { field: 'operation', value: REPORT_OPERATION }, + }, + columns: { + type: 'json', + description: 'Native QuickBooks report column definitions', + condition: { field: 'operation', value: REPORT_OPERATION }, + }, + rows: { + type: 'json', + description: 'Native hierarchical QuickBooks report rows and summaries', + condition: { field: 'operation', value: REPORT_OPERATION }, + }, + item: { + type: 'json', + description: + 'Single master-data, transaction, or attachment record with native QuickBooks fields', + condition: { + field: 'operation', + value: [ + MASTER_DATA_OPERATION, + SALES_READ_OPERATION, + PURCHASING_READ_OPERATION, + ACCOUNTING_READ_OPERATION, + READ_ATTACHMENTS_OPERATION, + ], + and: { field: 'readMode', value: 'by_id' }, + }, + }, + items: { + type: 'array', + description: 'Master-data, transaction, or attachment objects with native QuickBooks fields', + condition: LIST_OUTPUT_CONDITION, + }, + startPosition: { + type: 'number', + description: 'One-based position of the first returned list item', + condition: LIST_OUTPUT_CONDITION, + }, + maxResults: { + type: 'number', + description: 'Actual number of items reported for the list response', + condition: LIST_OUTPUT_CONDITION, + }, + nextStartPosition: { + type: 'number', + description: 'Position to pass into an explicit next-page request', + condition: LIST_OUTPUT_CONDITION, + }, + hasMore: { + type: 'boolean', + description: 'Conservative indication that another list page may exist', + condition: LIST_OUTPUT_CONDITION, + }, + record: { + type: 'json', + description: + 'Created, updated, voided, or emailed record with native QuickBooks fields when QuickBooks returns one', + condition: { + field: 'operation', + value: [...MUTATION_OPERATIONS, EMAIL_TRANSACTION_OPERATION], + }, + }, + recordId: { + type: 'string', + description: 'ID of the created, updated, or voided QuickBooks record', + condition: { field: 'operation', value: [...MUTATION_OPERATIONS] }, + }, + syncToken: { + type: 'string', + description: 'Latest QuickBooks sync token for a subsequent update', + condition: { field: 'operation', value: [...MUTATION_OPERATIONS] }, + }, + voided: { + type: 'boolean', + description: 'True when QuickBooks successfully voided the transaction', + condition: { field: 'operation', value: [...SALES_VOID_OPERATIONS] }, + }, + linkingRequested: { + type: 'boolean', + description: 'Whether Create Bill requested any Purchase Order line links', + condition: { field: 'operation', value: 'quickbooks_create_bill' }, + }, + linkingSucceeded: { + type: 'boolean', + description: + 'Whether QuickBooks returned every requested Purchase Order line link; null when no links were requested', + condition: { field: 'operation', value: 'quickbooks_create_bill' }, + }, + linkedLines: { + type: 'array', + description: + 'Confirmed Purchase Order links as [{purchaseOrderId, purchaseOrderLineId, billLineId}]', + condition: { field: 'operation', value: 'quickbooks_create_bill' }, + }, + missingLinks: { + type: 'array', + description: + 'Requested links omitted by QuickBooks as [{purchaseOrderId, purchaseOrderLineId}]', + condition: { field: 'operation', value: 'quickbooks_create_bill' }, + }, + linkingWarning: { + type: 'string', + description: 'Warning that QuickBooks created the Bill without every requested link', + condition: { field: 'operation', value: 'quickbooks_create_bill' }, + }, + sent: { + type: 'boolean', + description: 'Whether QuickBooks accepted the transaction email request', + condition: { field: 'operation', value: EMAIL_TRANSACTION_OPERATION }, + }, + attachment: { + type: 'json', + description: 'Created native QuickBooks attachment metadata', + condition: { field: 'operation', value: ADD_ATTACHMENT_OPERATION }, + }, + attachmentId: { + type: 'string', + description: 'QuickBooks attachment ID', + condition: { + field: 'operation', + value: [ADD_ATTACHMENT_OPERATION, DOWNLOAD_ATTACHMENT_OPERATION], + }, + }, + attachmentKind: { + type: 'string', + description: 'Created QuickBooks attachment kind', + condition: { field: 'operation', value: ADD_ATTACHMENT_OPERATION }, + }, + targetType: { + type: 'string', + description: 'QuickBooks attachment target type', + condition: { field: 'operation', value: ADD_ATTACHMENT_OPERATION }, + }, + targetId: { + type: 'string', + description: 'QuickBooks attachment target ID', + condition: { field: 'operation', value: ADD_ATTACHMENT_OPERATION }, + }, + file: { + type: 'file', + description: 'Downloaded QuickBooks file stored in execution files', + condition: { + field: 'operation', + value: [DOWNLOAD_TRANSACTION_PDF_OPERATION, DOWNLOAD_ATTACHMENT_OPERATION], + }, + }, + fileName: { + type: 'string', + description: 'Downloaded file name', + condition: { + field: 'operation', + value: [DOWNLOAD_TRANSACTION_PDF_OPERATION, DOWNLOAD_ATTACHMENT_OPERATION], + }, + }, + mimeType: { + type: 'string', + description: 'Downloaded file MIME type', + condition: { + field: 'operation', + value: [DOWNLOAD_TRANSACTION_PDF_OPERATION, DOWNLOAD_ATTACHMENT_OPERATION], + }, + }, + size: { + type: 'number', + description: 'Downloaded file size in bytes', + condition: { + field: 'operation', + value: [DOWNLOAD_TRANSACTION_PDF_OPERATION, DOWNLOAD_ATTACHMENT_OPERATION], + }, + }, + time: { + type: 'string', + description: 'QuickBooks response timestamp', + condition: { + field: 'operation', + value: [DOWNLOAD_TRANSACTION_PDF_OPERATION, DOWNLOAD_ATTACHMENT_OPERATION], + not: true, + }, + }, + }, +} + +export const QuickBooksBlockMeta = { + tags: ['payments', 'automation', 'data-analytics'], + url: 'https://quickbooks.intuit.com', + templates: [ + { + icon: QuickBooksIcon, + title: 'QuickBooks customer onboarding', + prompt: + 'Build a workflow that receives an approved customer profile, creates the QuickBooks customer, and stores its ID and sync token in a Sim table.', + modules: ['tables', 'agent', 'workflows'], + category: 'operations', + tags: ['finance', 'customers', 'onboarding'], + }, + { + icon: QuickBooksIcon, + title: 'QuickBooks vendor onboarding', + prompt: + 'Create a workflow that receives approved vendor identity, contact, address, and 1099 details, creates the QuickBooks vendor, and stores the returned ID and sync token.', + modules: ['tables', 'agent', 'workflows'], + category: 'operations', + tags: ['finance', 'vendors', 'procurement'], + }, + { + icon: QuickBooksIcon, + title: 'QuickBooks catalogue maintenance', + prompt: + 'Build a workflow that reads filtered QuickBooks master data, creates approved non-payroll employees or Service and Non-inventory items, and safely updates exposed fields while retaining returned IDs and sync tokens.', + modules: ['tables', 'agent', 'workflows'], + category: 'operations', + tags: ['finance', 'catalogue', 'operations'], + }, + { + icon: QuickBooksIcon, + title: 'QuickBooks monthly and year-end reporting', + prompt: + 'Build a scheduled workflow that runs monthly and year-end Balance Sheet, Profit and Loss, Trial Balance, and Cash Flow reports, preserves their native rows and summaries, and stores review results in a Sim table.', + modules: ['scheduled', 'tables', 'agent', 'workflows'], + category: 'operations', + tags: ['finance', 'reporting', 'financial-close'], + }, + { + icon: QuickBooksIcon, + title: 'QuickBooks estimate preparation', + prompt: + 'Build a workflow that receives an approved customer quote and line items, creates a QuickBooks estimate, and stores its ID and sync token for controlled revisions.', + modules: ['tables', 'agent', 'workflows'], + category: 'operations', + tags: ['finance', 'estimates', 'sales'], + }, + { + icon: QuickBooksIcon, + title: 'QuickBooks invoice creation and delivery', + prompt: + 'Create a workflow that validates approved customer and item IDs, creates a QuickBooks invoice, stores its ID and sync token, then—after explicit approval—emails it or downloads its PDF for controlled delivery and archiving.', + modules: ['tables', 'agent', 'workflows'], + category: 'operations', + tags: ['finance', 'invoices', 'receivables'], + }, + { + icon: QuickBooksIcon, + title: 'QuickBooks partial-payment application', + prompt: + 'Build a workflow that records a customer payment, applies bounded amounts to approved QuickBooks invoice IDs, and reports any unapplied remainder.', + modules: ['tables', 'agent', 'workflows'], + category: 'operations', + tags: ['finance', 'payments', 'receivables'], + }, + { + icon: QuickBooksIcon, + title: 'QuickBooks journal adjustments and deposits', + prompt: + 'Build a controlled workflow that posts an explicitly approved, balanced QuickBooks journal entry or records a bounded deposit, then runs cash- and accrual-basis reports to support the accounting review.', + modules: ['tables', 'agent', 'workflows'], + category: 'operations', + tags: ['finance', 'accounting', 'journal-entries'], + }, + { + icon: QuickBooksIcon, + title: 'QuickBooks receivables and payables aging', + prompt: + 'Create a scheduled workflow that runs A/R and A/P aging summaries and details with approved aging controls, optionally filters by customer or vendor, and flags balances requiring accountant review without changing records.', + modules: ['scheduled', 'agent', 'workflows'], + category: 'operations', + tags: ['finance', 'reporting', 'aging'], + }, + { + icon: QuickBooksIcon, + title: 'QuickBooks bill entry and payment', + prompt: + 'Build a controlled workflow that reads an approved Purchase Order by ID, captures its Line IDs, creates a QuickBooks Bill with explicit PO-line mappings, checks linkingSucceeded and missingLinks, attaches one approved receipt or audit note, and records a separately approved payment only after reviewing the created Bill.', + modules: ['tables', 'agent', 'workflows'], + category: 'operations', + tags: ['finance', 'payments', 'payables'], + }, + { + icon: QuickBooksIcon, + title: 'QuickBooks customer, vendor, and expense analysis', + prompt: + 'Create a workflow that runs customer and vendor balance reports, expenses by vendor, or the Transaction List with bounded date, entity, paid-status, cleared-status, document-number, grouping, and source-account filters for accountant review.', + modules: ['tables', 'agent', 'workflows'], + category: 'operations', + tags: ['finance', 'reporting', 'analysis'], + }, + ], + skills: [ + { + name: 'onboard-quickbooks-customers', + description: 'Create approved QuickBooks customers and retain their IDs and sync tokens.', + content: + '# Onboard QuickBooks Customers\n\n## Steps\n1. Validate the approved customer identity and contact details.\n2. Use Create Customer with a unique display name.\n3. Store the returned `recordId` and `syncToken` for later updates.\n\n## Output\nReturn the created customer, ID, and sync token. Report duplicate-name faults for human review.', + }, + { + name: 'onboard-quickbooks-vendors', + description: 'Create approved QuickBooks vendors with bounded contact and 1099 fields.', + content: + '# Onboard QuickBooks Vendors\n\n## Steps\n1. Validate the approved vendor identity, contact, address, and optional 1099 status.\n2. Use Create Vendor.\n3. Store the returned `recordId` and `syncToken`.\n\n## Output\nReturn the created vendor and identifiers. Do not claim to merge vendors or administer tax identifiers.', + }, + { + name: 'maintain-products-and-services', + description: 'Create supported items or update exposed item fields without changing types.', + content: + '# Maintain QuickBooks Products and Services\n\n## Steps\n1. Read Account master data to obtain approved account IDs.\n2. Create a Service or Non-inventory Item, or update exposed basic fields without changing the existing item Type.\n3. Store the latest item ID and sync token.\n\n## Output\nReturn the native Item record. Do not claim to create Inventory, Category, or Group items or manage their specialized fields.', + }, + { + name: 'record-quickbooks-accounting-adjustments', + description: 'Post approved balanced journal entries, record deposits, and review transfers.', + content: + '# Record QuickBooks Accounting Adjustments\n\n## Steps\n1. Read the approved account IDs from Master Data.\n2. For a journal entry, verify that positive debit and credit lines balance and require explicit posting confirmation; for a deposit, verify the destination and source account IDs.\n3. Store the returned `recordId` and `syncToken`; use Read Accounting Transactions to review journal entries, deposits, or read-only transfers.\n4. Run an approved Trial Balance or financial statement on cash or accrual basis when an accountant requests post-adjustment review.\n\n## Output\nReturn the native accounting transaction and identifiers plus the native report hierarchy when requested. Do not claim to create transfers, replace transaction lines, or administer currencies.', + }, + { + name: 'prepare-quickbooks-estimates', + description: 'Create and revise bounded QuickBooks estimates from approved quote details.', + content: + '# Prepare QuickBooks Estimates\n\n## Steps\n1. Validate the customer, item IDs, amounts, and dates.\n2. Use Create Estimate with bounded item or description lines.\n3. For a revision, use the estimate ID and latest `syncToken` with Update Estimate.\n\n## Output\nReturn the native Estimate, ID, and latest sync token. Do not claim to email or accept the estimate.', + }, + { + name: 'create-quickbooks-invoices', + description: + 'Create approved QuickBooks invoices and explicitly deliver or archive their documents.', + content: + '# Create and Deliver QuickBooks Invoices\n\n## Steps\n1. Validate the approved customer, item IDs, positive amounts, and optional dates.\n2. Use Create Invoice with at least one bounded line.\n3. Store the returned `recordId` and `syncToken`.\n4. Only after explicit approval, use Email Transaction for one recipient or Download Transaction PDF for controlled archiving.\n5. Use Add Attachment for one approved receipt or audit note when needed, and Read Attachments to verify the metadata.\n\n## Output\nReturn the native Invoice and identifiers plus any sent status, downloaded file, or attachment ID. Do not claim bulk email, automatic resend, attachment deletion, or automatic payment collection.', + }, + { + name: 'record-quickbooks-payables', + description: + 'Create standalone or PO-linked bills and record bounded payments to approved Bill IDs.', + content: + '# Record QuickBooks Payables\n\n## Steps\n1. Validate the vendor, expense lines, and optional A/P account.\n2. For PO-linked billing, use Read Purchasing Transactions by ID and copy each approved Purchase Order `Line[].Id` into the matching Create Bill line with its PO ID.\n3. Use Create Bill, store its ID and sync token, and inspect `linkingSucceeded` and `missingLinks`; QuickBooks may create the Bill while omitting an invalid or unavailable link.\n4. When payment is separately approved, use Create Bill Payment with bounded Bill allocations whose amounts equal the payment total.\n5. Run A/P Aging Summary or Detail with supported vendor, department, date, and aging controls for accountant review.\n\n## Output\nAlways return the created Bill ID and linkage result. Preserve the native aging report when requested. Never imply that a missing link prevented Bill creation, and never create a payment implicitly.', + }, + { + name: 'analyze-quickbooks-financial-reports', + description: + 'Run verified financial, balance, aging, sales, and expense reports with supported filters.', + content: + '# Analyze QuickBooks Financial Reports\n\n## Steps\n1. Choose a verified report and an accountant-approved date or as-of period.\n2. Use Read Master Data to discover customer, vendor, account, item, class, or department IDs required by supported filters.\n3. Run Financial Report with only the controls shown for that report; compare cash and accrual basis or time summaries when requested.\n4. Preserve the native Header, Columns, nested Rows, and summaries for review.\n\n## Output\nReturn the report hierarchy and applied report context. Do not claim to export spreadsheets, email reports, customize columns, schedule delivery in QuickBooks, or mutate accounting records from a report.', + }, + ], +} as const satisfies BlockMeta diff --git a/apps/sim/blocks/registry-maps.ts b/apps/sim/blocks/registry-maps.ts index 758dda94cd2..a3cb747d3f4 100644 --- a/apps/sim/blocks/registry-maps.ts +++ b/apps/sim/blocks/registry-maps.ts @@ -265,6 +265,7 @@ import { ProspeoBlock, ProspeoBlockMeta } from '@/blocks/blocks/prospeo' import { PulseBlock, PulseBlockMeta, PulseV2Block } from '@/blocks/blocks/pulse' import { QdrantBlock, QdrantBlockMeta } from '@/blocks/blocks/qdrant' import { QuartrBlock, QuartrBlockMeta } from '@/blocks/blocks/quartr' +import { QuickBooksBlock, QuickBooksBlockMeta } from '@/blocks/blocks/quickbooks' import { QuiverBlock, QuiverBlockMeta } from '@/blocks/blocks/quiver' import { RabbitmqBlock, RabbitmqBlockMeta } from '@/blocks/blocks/rabbitmq' import { RailwayBlock, RailwayBlockMeta } from '@/blocks/blocks/railway' @@ -605,6 +606,7 @@ export const BLOCK_REGISTRY: Record = { pulse_v2: PulseV2Block, qdrant: QdrantBlock, quartr: QuartrBlock, + quickbooks: QuickBooksBlock, quiver: QuiverBlock, rabbitmq: RabbitmqBlock, railway: RailwayBlock, @@ -922,6 +924,7 @@ export const BLOCK_META_REGISTRY: Record = { pulse: PulseBlockMeta, qdrant: QdrantBlockMeta, quartr: QuartrBlockMeta, + quickbooks: QuickBooksBlockMeta, quiver: QuiverBlockMeta, rabbitmq: RabbitmqBlockMeta, railway: RailwayBlockMeta, diff --git a/apps/sim/components/icons.tsx b/apps/sim/components/icons.tsx index 5c80c285664..e0eab833b3a 100644 --- a/apps/sim/components/icons.tsx +++ b/apps/sim/components/icons.tsx @@ -2710,6 +2710,25 @@ export function BrexIcon(props: SVGProps) { ) } +/** + * Official QuickBooks circular mark, cropped from the user-supplied + * Intuit_QuickBooks_logo.svg wordmark. + */ +export function QuickBooksIcon(props: SVGProps) { + return ( + + + + + ) +} + export function BrightDataIcon(props: SVGProps) { return ( !/[\r\n]/.test(value), 'Access token is invalid'), + realmId: z + .string() + .trim() + .max(64, 'QuickBooks company ID is too long') + .regex(/^[1-9]\d*$/, 'QuickBooks company ID is invalid'), +}) + +const documentTransactionTypeSchema = z.enum([ + 'credit_memo', + 'estimate', + 'invoice', + 'payment', + 'purchase_order', + 'refund_receipt', + 'sales_receipt', +]) + +const attachmentTargetTypeSchema = z.enum([ + 'bill', + 'credit_memo', + 'customer', + 'estimate', + 'invoice', + 'payment', + 'purchase', + 'refund_receipt', + 'sales_receipt', + 'vendor', + 'vendor_credit', +]) + +const optionalFileName = z.string().trim().max(180, 'Filename is too long').optional().nullable() +const optionalContentType = z + .string() + .trim() + .max(255, 'Content type is too long') + .optional() + .nullable() +const optionalDescription = z + .string() + .trim() + .max(1000, 'Description is too long') + .optional() + .nullable() +const optionalNote = z.string().trim().max(4000, 'Note is too long').optional().nullable() +const boundedId = z.string().trim().min(1, 'ID is required').max(256, 'ID is too long') +const routeErrorSchema = z.object({ success: z.literal(false), error: z.string().min(1) }) +const attachableSchema = z + .object({ + Id: z.string().min(1), + FileName: z.string().optional(), + ContentType: z.string().optional(), + Size: z.number().optional(), + Note: z.string().optional(), + }) + .passthrough() + +/** + * Both QuickBooks document downloads share one internal operation schema. + * `documentKind` selects whether Intuit returns attachment bytes or a rendered PDF. + */ +export const quickBooksDownloadDocumentBodySchema = z.discriminatedUnion('documentKind', [ + quickBooksAuthSchema.extend({ + documentKind: z.literal('attachment'), + attachmentId: boundedId, + fileName: optionalFileName, + }), + quickBooksAuthSchema.extend({ + documentKind: z.literal('transaction_pdf'), + transactionType: documentTransactionTypeSchema, + transactionId: boundedId, + fileName: optionalFileName, + }), +]) + +export type QuickBooksDownloadDocumentBody = z.output + +export const quickBooksAddAttachmentBodySchema = quickBooksAuthSchema + .extend({ + attachmentKind: z.enum(['file', 'note']), + targetType: attachmentTargetTypeSchema, + targetId: boundedId, + file: RawFileInputSchema.optional().nullable(), + fileName: optionalFileName, + contentType: optionalContentType, + description: optionalDescription, + note: optionalNote, + }) + .superRefine((value, context) => { + if (value.attachmentKind === 'file') { + if (!value.file) + context.addIssue({ + code: 'custom', + path: ['file'], + message: 'File is required in File mode', + }) + if (value.note) + context.addIssue({ + code: 'custom', + path: ['note'], + message: 'Note-only content is not allowed in File mode', + }) + } else { + if (!value.note) + context.addIssue({ + code: 'custom', + path: ['note'], + message: 'Note is required in Note mode', + }) + if (value.file) + context.addIssue({ + code: 'custom', + path: ['file'], + message: 'A file is not allowed in Note mode', + }) + if (value.fileName || value.contentType || value.description) { + context.addIssue({ + code: 'custom', + path: ['attachmentKind'], + message: 'File-only fields are not allowed in Note mode', + }) + } + } + }) + +export type QuickBooksAddAttachmentBody = z.output + +const quickBooksStoredFileShape = { + file: userFileSchema, + fileName: z.string().min(1).max(180), + size: z.number().int().positive(), +} + +export const quickBooksDownloadDocumentContract = defineRouteContract({ + method: 'POST', + path: '/api/tools/quickbooks/download-document', + body: quickBooksDownloadDocumentBodySchema, + response: { + mode: 'json', + schema: z.union([ + z.object({ + success: z.literal(true), + output: z.object({ + ...quickBooksStoredFileShape, + attachmentId: boundedId, + mimeType: z.string().min(1).max(255), + }), + }), + z.object({ + success: z.literal(true), + output: z.object({ + ...quickBooksStoredFileShape, + transactionType: documentTransactionTypeSchema, + transactionId: boundedId, + mimeType: z.literal('application/pdf'), + }), + }), + routeErrorSchema, + ]), + }, +}) + +export const quickBooksAddAttachmentContract = defineRouteContract({ + method: 'POST', + path: '/api/tools/quickbooks/add-attachment', + body: quickBooksAddAttachmentBodySchema, + response: { + mode: 'json', + schema: z.union([ + z.object({ + success: z.literal(true), + output: z.object({ + attachment: attachableSchema, + attachmentId: boundedId, + attachmentKind: z.enum(['file', 'note']), + targetType: attachmentTargetTypeSchema, + targetId: boundedId, + time: z.string().nullable(), + }), + }), + routeErrorSchema, + ]), + }, +}) diff --git a/apps/sim/lib/auth/connectors/providers.ts b/apps/sim/lib/auth/connectors/providers.ts index 89e47f6e59b..124175e68de 100644 --- a/apps/sim/lib/auth/connectors/providers.ts +++ b/apps/sim/lib/auth/connectors/providers.ts @@ -15,6 +15,13 @@ import { import { getBaseUrl } from '@/lib/core/utils/urls' import { getDocusignOAuthUrl } from '@/lib/oauth/docusign' import { getMicrosoftUserInfoFromIdToken } from '@/lib/oauth/microsoft' +import { + fetchQuickBooksConnectionProfile, + getQuickBooksCallbackRealm, + QUICKBOOKS_AUTHORIZATION_URL, + QUICKBOOKS_OIDC_CLAIMS, + QUICKBOOKS_TOKEN_URL, +} from '@/lib/oauth/quickbooks' import { SALESFORCE_LOGIN_HOSTS } from '@/lib/oauth/salesforce' import { getCanonicalScopesForProvider } from '@/lib/oauth/utils' import { MONDAY_API_URL, MONDAY_API_VERSION } from '@/tools/monday/utils' @@ -2553,6 +2560,42 @@ export function buildConnectorProviders(): GenericOAuthConfig[] { }, }, + { + providerId: 'quickbooks', + clientId: env.QUICKBOOKS_CLIENT_ID as string, + clientSecret: env.QUICKBOOKS_CLIENT_SECRET as string, + authorizationUrl: QUICKBOOKS_AUTHORIZATION_URL, + tokenUrl: QUICKBOOKS_TOKEN_URL, + scopes: getCanonicalScopesForProvider('quickbooks'), + responseType: 'code', + accessType: 'offline', + prompt: 'consent', + authentication: 'basic', + redirectURI: `${getBaseUrl()}/api/auth/oauth2/callback/quickbooks`, + authorizationUrlParams: { + claims: JSON.stringify(QUICKBOOKS_OIDC_CLAIMS), + }, + getUserInfo: async (tokens) => { + if (!tokens.accessToken) { + throw new Error('QuickBooks OAuth did not issue an access token') + } + + const profile = await fetchQuickBooksConnectionProfile( + tokens.accessToken, + getQuickBooksCallbackRealm() + ) + const now = new Date() + return { + id: profile.accountId, + name: profile.name, + email: profile.email, + emailVerified: profile.emailVerified, + createdAt: now, + updatedAt: now, + } + }, + }, + // Cal.com provider { providerId: 'calcom', diff --git a/apps/sim/lib/core/config/env.ts b/apps/sim/lib/core/config/env.ts index 5bc20313e08..5bdf1b667e6 100644 --- a/apps/sim/lib/core/config/env.ts +++ b/apps/sim/lib/core/config/env.ts @@ -511,6 +511,9 @@ export const env = createEnv({ WEALTHBOX_CLIENT_SECRET: z.string().optional(), // WealthBox OAuth client secret PIPEDRIVE_CLIENT_ID: z.string().optional(), // Pipedrive OAuth client ID PIPEDRIVE_CLIENT_SECRET: z.string().optional(), // Pipedrive OAuth client secret + QUICKBOOKS_CLIENT_ID: z.string().optional(), // QuickBooks Online OAuth client ID + QUICKBOOKS_CLIENT_SECRET: z.string().optional(), // QuickBooks Online OAuth client secret + QUICKBOOKS_ENV: z.enum(['sandbox', 'production']).optional(), // QuickBooks Online API environment (must be configured explicitly) LINEAR_CLIENT_ID: z.string().optional(), // Linear OAuth client ID LINEAR_CLIENT_SECRET: z.string().optional(), // Linear OAuth client secret CLICKUP_CLIENT_ID: z.string().optional(), // ClickUp OAuth client ID diff --git a/apps/sim/lib/core/security/redaction.test.ts b/apps/sim/lib/core/security/redaction.test.ts index ac493b709ad..cb4ef360965 100644 --- a/apps/sim/lib/core/security/redaction.test.ts +++ b/apps/sim/lib/core/security/redaction.test.ts @@ -54,6 +54,10 @@ describe('isSensitiveKey', () => { expect(isSensitiveKey('refresh_token')).toBe(true) expect(isSensitiveKey('auth_token')).toBe(true) expect(isSensitiveKey('accessToken')).toBe(true) + expect(isSensitiveKey('sessionToken')).toBe(true) + expect(isSensitiveKey('webIdentityToken')).toBe(true) + expect(isSensitiveKey('verificationToken')).toBe(true) + expect(isSensitiveKey('githubToken')).toBe(true) }) it.concurrent('should match secret variations', () => { @@ -108,9 +112,28 @@ describe('isSensitiveKey', () => { it.concurrent('should match ssh passphrases', () => { expect(isSensitiveKey('passphrase')).toBe(true) }) + + it.concurrent('should not allow arbitrary keys ending in workflow token names', () => { + expect(isSensitiveKey('asyncToken')).toBe(true) + expect(isSensitiveKey('homepageToken')).toBe(true) + }) }) describe('non-sensitive keys (no false positives)', () => { + it.concurrent('should bypass the exact allowlisted non-secret token fields', () => { + expect(isSensitiveKey('nextPageToken')).toBe(false) + expect(isSensitiveKey('syncToken')).toBe(false) + expect(isSensitiveKey('SyncToken')).toBe(false) + expect(isSensitiveKey('subjectFromWebIdentityToken')).toBe(false) + }) + + it.concurrent('should keep the allowlist exact rather than suffix-based', () => { + expect(isSensitiveKey('nextSyncToken')).toBe(true) + expect(isSensitiveKey('pageToken')).toBe(true) + expect(isSensitiveKey('nextToken')).toBe(true) + expect(isSensitiveKey('webIdentityToken')).toBe(true) + }) + it.concurrent('should not match keys with sensitive words as prefix only', () => { expect(isSensitiveKey('tokenCount')).toBe(false) expect(isSensitiveKey('tokenizer')).toBe(false) @@ -523,6 +546,24 @@ describe('redactApiKeys', () => { expect(result.config.normalField).toBe('normal-value') }) + it.concurrent('should preserve allowlisted token fields while redacting credentials', () => { + const result = redactApiKeys({ + nextPageToken: 'page-2', + subjectFromWebIdentityToken: 'arn-subject', + record: { Id: '42', SyncToken: '3' }, + accessToken: 'access-secret', + sessionToken: 'session-secret', + }) + + expect(result).toEqual({ + nextPageToken: 'page-2', + subjectFromWebIdentityToken: 'arn-subject', + record: { Id: '42', SyncToken: '3' }, + accessToken: REDACTED_MARKER, + sessionToken: REDACTED_MARKER, + }) + }) + it.concurrent('should redact sensitive keys in arrays', () => { const arr = [{ apiKey: 'secret-key-1' }, { apiKey: 'secret-key-2' }] diff --git a/apps/sim/lib/core/security/redaction.ts b/apps/sim/lib/core/security/redaction.ts index af6ea2c5487..3b8260b5f50 100644 --- a/apps/sim/lib/core/security/redaction.ts +++ b/apps/sim/lib/core/security/redaction.ts @@ -7,7 +7,7 @@ import { filterUserFileForDisplay, isUserFile } from '@/lib/core/utils/user-file export const REDACTED_MARKER = '[REDACTED]' export const TRUNCATED_MARKER = '[TRUNCATED]' -const BYPASS_REDACTION_KEYS = new Set(['nextpagetoken']) +const BYPASS_REDACTION_KEYS = new Set(['nextpagetoken', 'synctoken', 'subjectfromwebidentitytoken']) /** Keys that contain large binary/encoded data that should be truncated in logs */ const LARGE_DATA_KEYS = new Set(['base64']) diff --git a/apps/sim/lib/credentials/api/route-policies.test.ts b/apps/sim/lib/credentials/api/route-policies.test.ts index 2a00ee16d52..b03b4fca7f8 100644 --- a/apps/sim/lib/credentials/api/route-policies.test.ts +++ b/apps/sim/lib/credentials/api/route-policies.test.ts @@ -4,6 +4,7 @@ import { describe, expect, it } from 'vitest' import { internalCredentialErrorPolicy } from '@/lib/credentials/api/route-policies' import { CredentialProviderOperationError } from '@/lib/credentials/application/credential-crud' +import { OAuthProviderRevocationError } from '@/lib/credentials/oauth-accounts' function project(error: unknown) { return internalCredentialErrorPolicy.project(error) @@ -34,6 +35,18 @@ describe('internalCredentialErrorPolicy', () => { expect(response?.headers).toBeUndefined() }) + it('renders an OAuth revocation outage as retryable without exposing the provider response', () => { + const response = project( + new OAuthProviderRevocationError('QuickBooks', new Error('upstream token detail')) + ) + + expect(response?.status).toBe(503) + expect(response?.headers).toEqual({ 'Retry-After': '5' }) + expect(response?.body).toEqual({ + error: 'Unable to revoke QuickBooks access. Please try again.', + }) + }) + it('defers anything that is not a provider failure to the base policy', () => { expect(project(new Error('unrelated'))).toBeNull() }) diff --git a/apps/sim/lib/credentials/api/route-policies.ts b/apps/sim/lib/credentials/api/route-policies.ts index a7cbfda62c7..7e816198ce7 100644 --- a/apps/sim/lib/credentials/api/route-policies.ts +++ b/apps/sim/lib/credentials/api/route-policies.ts @@ -10,6 +10,7 @@ import { ForbiddenOperationError } from '@/lib/core/application/forbidden' import { OrchestrationError } from '@/lib/core/orchestration/types' import { CredentialAccessRequiredError } from '@/lib/credentials/application/authorized-credential-use-case' import { CredentialProviderOperationError } from '@/lib/credentials/application/credential-crud' +import { OAuthProviderRevocationError } from '@/lib/credentials/oauth-accounts' export const credentialValidationParseOptions = { validationErrorResponse: (error: Parameters[0]) => @@ -26,6 +27,13 @@ export const credentialValidationParseOptions = { export const internalCredentialErrorPolicy = extendInternalErrorPolicy( internalOrchestrationErrorPolicy, (error) => { + if (error instanceof OAuthProviderRevocationError) { + return internalErrorResponse( + 503, + { error: error.message }, + { 'Retry-After': ADMISSION_RETRY_AFTER_SECONDS.toString() } + ) + } if (!(error instanceof CredentialProviderOperationError)) return null if (!error.providerUnavailable) { return internalErrorResponse(400, { error: error.message, code: error.providerErrorCode }) diff --git a/apps/sim/lib/credentials/application/oauth-accounts.test.ts b/apps/sim/lib/credentials/application/oauth-accounts.test.ts index bf77fae5662..c71a2bf2ced 100644 --- a/apps/sim/lib/credentials/application/oauth-accounts.test.ts +++ b/apps/sim/lib/credentials/application/oauth-accounts.test.ts @@ -2,18 +2,28 @@ * @vitest-environment node */ import { account, credential } from '@sim/db/schema' -import { auditMock, auditMockFns, queueTableRows, resetDbChainMock } from '@sim/testing' +import { + auditMock, + auditMockFns, + dbChainMockFns, + queueTableRows, + resetDbChainMock, +} from '@sim/testing' import { beforeEach, describe, expect, it, vi } from 'vitest' const mocks = vi.hoisted(() => ({ deleteCredential: vi.fn(), capture: vi.fn(), + revokeQuickBooksToken: vi.fn(), })) vi.mock('@sim/audit', () => auditMock) vi.mock('@/lib/credentials/orchestration', () => ({ deleteCredentialRecord: mocks.deleteCredential, })) +vi.mock('@/lib/oauth/quickbooks', () => ({ + revokeQuickBooksToken: mocks.revokeQuickBooksToken, +})) vi.mock('@/lib/posthog/server', () => ({ captureServerEvent: mocks.capture })) import { disconnectOAuthUseCase } from '@/lib/credentials/application/oauth-accounts' @@ -38,6 +48,7 @@ describe('OAuth account application operations', () => { beforeEach(() => { vi.clearAllMocks() resetDbChainMock() + mocks.revokeQuickBooksToken.mockResolvedValue(undefined) }) it('audits and captures committed deletions before rethrowing a later failure', async () => { @@ -81,4 +92,117 @@ describe('OAuth account application operations', () => { { groups: { workspace: 'workspace-1' } } ) }) + + it('revokes the QuickBooks refresh token before deleting the local account', async () => { + queueTableRows(account, [ + { + id: 'account-1', + providerId: 'quickbooks', + accessToken: 'access-token', + refreshToken: 'refresh-token', + }, + ]) + queueTableRows(credential, []) + + await disconnectOAuthUseCase.execute({ + principal: { kind: 'session', userId: 'user-1', sessionId: 'session-1' }, + input: { provider: 'quickbooks', accountId: 'account-1' }, + }) + + expect(mocks.revokeQuickBooksToken).toHaveBeenCalledWith( + 'refresh-token', + expect.any(AbortSignal) + ) + expect(dbChainMockFns.delete).toHaveBeenCalled() + expect(mocks.revokeQuickBooksToken.mock.invocationCallOrder[0]).toBeLessThan( + dbChainMockFns.delete.mock.invocationCallOrder[0] + ) + }) + + it('falls back to the QuickBooks access token when no refresh token is stored', async () => { + queueTableRows(account, [ + { + id: 'account-1', + providerId: 'quickbooks', + accessToken: 'access-token', + refreshToken: null, + }, + ]) + queueTableRows(credential, []) + + await disconnectOAuthUseCase.execute({ + principal: { kind: 'session', userId: 'user-1', sessionId: 'session-1' }, + input: { provider: 'quickbooks', accountId: 'account-1' }, + }) + + expect(mocks.revokeQuickBooksToken).toHaveBeenCalledWith( + 'access-token', + expect.any(AbortSignal) + ) + }) + + it('keeps QuickBooks credentials locally when Intuit revocation fails', async () => { + queueTableRows(account, [ + { + id: 'account-1', + providerId: 'quickbooks', + accessToken: 'access-token', + refreshToken: 'refresh-token', + }, + ]) + mocks.revokeQuickBooksToken.mockRejectedValueOnce(new Error('Intuit unavailable')) + + await expect( + disconnectOAuthUseCase.execute({ + principal: { kind: 'session', userId: 'user-1', sessionId: 'session-1' }, + input: { provider: 'quickbooks', accountId: 'account-1' }, + }) + ).rejects.toMatchObject({ + name: 'OAuthProviderRevocationError', + message: 'Unable to revoke QuickBooks access. Please try again.', + }) + + expect(mocks.deleteCredential).not.toHaveBeenCalled() + expect(dbChainMockFns.delete).not.toHaveBeenCalled() + }) + + it('removes a tokenless QuickBooks account without calling Intuit', async () => { + queueTableRows(account, [ + { + id: 'account-1', + providerId: 'quickbooks', + accessToken: null, + refreshToken: null, + }, + ]) + queueTableRows(credential, []) + + await disconnectOAuthUseCase.execute({ + principal: { kind: 'session', userId: 'user-1', sessionId: 'session-1' }, + input: { provider: 'quickbooks', accountId: 'account-1' }, + }) + + expect(mocks.revokeQuickBooksToken).not.toHaveBeenCalled() + expect(dbChainMockFns.delete).toHaveBeenCalled() + }) + + it('does not revoke tokens for non-QuickBooks providers', async () => { + queueTableRows(account, [ + { + id: 'account-1', + providerId: 'google-email', + accessToken: 'access-token', + refreshToken: 'refresh-token', + }, + ]) + queueTableRows(credential, []) + + await disconnectOAuthUseCase.execute({ + principal: { kind: 'session', userId: 'user-1', sessionId: 'session-1' }, + input: { provider: 'google', accountId: 'account-1' }, + }) + + expect(mocks.revokeQuickBooksToken).not.toHaveBeenCalled() + expect(dbChainMockFns.delete).toHaveBeenCalled() + }) }) diff --git a/apps/sim/lib/credentials/oauth-accounts.ts b/apps/sim/lib/credentials/oauth-accounts.ts index 705d926d5bc..a804c8bda07 100644 --- a/apps/sim/lib/credentials/oauth-accounts.ts +++ b/apps/sim/lib/credentials/oauth-accounts.ts @@ -8,9 +8,13 @@ import type { OAuthConnection } from '@/lib/api/contracts/oauth-connections' import { deleteCredentialRecord } from '@/lib/credentials/orchestration' import type { OAuthProvider } from '@/lib/oauth' import { parseProvider } from '@/lib/oauth' +import { revokeQuickBooksToken } from '@/lib/oauth/quickbooks' import { providerIdsForService } from '@/lib/oauth/utils' const logger = createLogger('CredentialOAuthAccounts') +const MAX_DISCONNECT_ACCOUNTS = 100 +const MAX_DISCONNECT_CREDENTIALS = 1000 +const QUICKBOOKS_DISCONNECT_TIMEOUT_MS = 30_000 interface GoogleIdToken { email?: string @@ -111,6 +115,16 @@ export class OAuthDisconnectPartialFailureError extends Error { } } +export class OAuthProviderRevocationError extends Error { + constructor( + readonly providerId: string, + cause: unknown + ) { + super(`Unable to revoke ${providerId} access. Please try again.`, { cause: toError(cause) }) + this.name = 'OAuthProviderRevocationError' + } +} + export async function disconnectOAuthAccounts(params: DisconnectOAuthAccountsParams) { const accountFilter = params.accountId ? and(eq(account.userId, params.userId), eq(account.id, params.accountId)) @@ -123,14 +137,48 @@ export async function disconnectOAuthAccounts(params: DisconnectOAuthAccountsPar like(account.providerId, `${params.provider}-%`) ) ) - const targetAccounts = await db.select({ id: account.id }).from(account).where(accountFilter) + const targetAccounts = await db + .select({ + id: account.id, + providerId: account.providerId, + accessToken: account.accessToken, + refreshToken: account.refreshToken, + }) + .from(account) + .where(accountFilter) + .limit(MAX_DISCONNECT_ACCOUNTS + 1) + if (targetAccounts.length > MAX_DISCONNECT_ACCOUNTS) { + throw new OAuthProviderRevocationError( + params.provider, + new Error('Too many linked accounts to disconnect in one request') + ) + } const targetAccountIds = targetAccounts.map((row) => row.id) if (targetAccountIds.length === 0) return { credentials: [] } + const quickBooksDisconnectSignal = AbortSignal.timeout(QUICKBOOKS_DISCONNECT_TIMEOUT_MS) + for (const targetAccount of targetAccounts) { + if (targetAccount.providerId !== 'quickbooks') continue + const token = targetAccount.refreshToken?.trim() || targetAccount.accessToken?.trim() + if (!token) continue + try { + await revokeQuickBooksToken(token, quickBooksDisconnectSignal) + } catch (error) { + throw new OAuthProviderRevocationError('QuickBooks', error) + } + } + const credentialRows = await db .select() .from(credential) .where(inArray(credential.accountId, targetAccountIds)) + .limit(MAX_DISCONNECT_CREDENTIALS + 1) + if (credentialRows.length > MAX_DISCONNECT_CREDENTIALS) { + throw new OAuthProviderRevocationError( + params.provider, + new Error('Too many linked credentials to disconnect in one request') + ) + } const deletedCredentials: typeof credentialRows = [] try { for (const credentialRow of credentialRows) { diff --git a/apps/sim/lib/integrations/icon-mapping.ts b/apps/sim/lib/integrations/icon-mapping.ts index fff4f30f3b9..d34b02b84e6 100644 --- a/apps/sim/lib/integrations/icon-mapping.ts +++ b/apps/sim/lib/integrations/icon-mapping.ts @@ -190,6 +190,7 @@ import { PulseIcon, QdrantIcon, QuartrIcon, + QuickBooksIcon, QuiverIcon, RabbitmqIcon, RailwayIcon, @@ -475,6 +476,7 @@ export const blockTypeToIconMap: Record = { pulse_v2: PulseIcon, qdrant: QdrantIcon, quartr: QuartrIcon, + quickbooks: QuickBooksIcon, quiver: QuiverIcon, rabbitmq: RabbitmqIcon, railway: RailwayIcon, diff --git a/apps/sim/lib/internal/quickbooks/execute-tool.test.ts b/apps/sim/lib/internal/quickbooks/execute-tool.test.ts new file mode 100644 index 00000000000..9bf82ca1d43 --- /dev/null +++ b/apps/sim/lib/internal/quickbooks/execute-tool.test.ts @@ -0,0 +1,118 @@ +/** + * @vitest-environment node + */ +import { createExecutionContext } from '@sim/testing' +import { beforeEach, describe, expect, it, vi } from 'vitest' + +const mocks = vi.hoisted(() => ({ + addAttachment: vi.fn(), + downloadDocument: vi.fn(), +})) + +vi.mock('@/lib/internal/quickbooks/operations', () => ({ + QuickBooksInternalOperationError: class QuickBooksInternalOperationError extends Error { + constructor( + readonly status: number, + message: string + ) { + super(message) + } + }, + executeQuickBooksAddAttachment: mocks.addAttachment, + executeQuickBooksDownloadDocument: mocks.downloadDocument, +})) + +import { executeQuickBooksTool } from '@/lib/internal/quickbooks/execute-tool' +import type { InternalToolOperationCall } from '@/lib/internal/tool-operations/types' + +function request(overrides: Partial = {}): InternalToolOperationCall { + return { + toolId: 'quickbooks_download_attachment', + input: { + accessToken: 'token', + realmId: '123', + attachmentId: 'attachment-1', + }, + headers: new Headers(), + context: { + ...createExecutionContext({ workflowId: 'workflow-1' }), + userId: 'user-1', + workspaceId: 'workspace-1', + executionId: 'execution-1', + }, + requestId: 'request-1', + ...overrides, + } +} + +describe('executeQuickBooksTool', () => { + beforeEach(() => { + vi.clearAllMocks() + mocks.addAttachment.mockResolvedValue({ attachmentId: 'attachment-1' }) + mocks.downloadDocument.mockResolvedValue({ attachmentId: 'attachment-1' }) + }) + + it('dispatches downloads with trusted execution context', async () => { + const controller = new AbortController() + + const response = await executeQuickBooksTool(request({ signal: controller.signal })) + + expect(response.status).toBe(200) + expect(mocks.downloadDocument).toHaveBeenCalledWith( + { + accessToken: 'token', + realmId: '123', + documentKind: 'attachment', + attachmentId: 'attachment-1', + }, + { + userId: 'user-1', + requestId: 'request-1', + workspaceId: 'workspace-1', + workflowId: 'workflow-1', + executionId: 'execution-1', + signal: controller.signal, + } + ) + }) + + it('rejects missing trusted user identity', async () => { + const response = await executeQuickBooksTool(request({ context: { workflowId: 'workflow-1' } })) + + expect(response.status).toBe(401) + expect(mocks.downloadDocument).not.toHaveBeenCalled() + }) + + it('rejects malformed provider input', async () => { + const response = await executeQuickBooksTool(request({ input: { accessToken: '' } })) + + expect(response.status).toBe(400) + expect(mocks.downloadDocument).not.toHaveBeenCalled() + }) + + it('rejects oversized operation input before dispatch', async () => { + const response = await executeQuickBooksTool( + request({ + input: { + accessToken: 'token', + realmId: '123', + attachmentId: 'attachment-1', + extra: 'x'.repeat(1024 * 1024 + 1), + }, + }) + ) + + expect(response.status).toBe(413) + expect(mocks.downloadDocument).not.toHaveBeenCalled() + }) + + it('propagates cancellation before validation or provider work', async () => { + const controller = new AbortController() + controller.abort(new DOMException('cancelled', 'AbortError')) + + await expect( + executeQuickBooksTool(request({ signal: controller.signal })) + ).rejects.toMatchObject({ name: 'AbortError' }) + expect(mocks.downloadDocument).not.toHaveBeenCalled() + }) +}) diff --git a/apps/sim/lib/internal/quickbooks/execute-tool.ts b/apps/sim/lib/internal/quickbooks/execute-tool.ts new file mode 100644 index 00000000000..58d4ed5c947 --- /dev/null +++ b/apps/sim/lib/internal/quickbooks/execute-tool.ts @@ -0,0 +1,133 @@ +import { createLogger } from '@sim/logger' +import { getErrorMessage } from '@sim/utils/errors' +import { + quickBooksAddAttachmentBodySchema, + quickBooksDownloadDocumentBodySchema, +} from '@/lib/api/contracts/tools/quickbooks' +import { getValidationErrorMessage } from '@/lib/api/server' +import { isPayloadSizeLimitError } from '@/lib/core/utils/stream-limits' +import { + executeQuickBooksAddAttachment, + executeQuickBooksDownloadDocument, + QuickBooksInternalOperationError, + type QuickBooksOperationContext, +} from '@/lib/internal/quickbooks/operations' +import type { + InternalToolOperationCall, + InternalToolOperationHandler, +} from '@/lib/internal/tool-operations/types' + +const logger = createLogger('QuickBooksToolExecution') +const QUICKBOOKS_MAX_OPERATION_INPUT_BYTES = 1024 * 1024 +const QUICKBOOKS_FILE_TOOL_IDS = [ + 'quickbooks_add_attachment', + 'quickbooks_download_attachment', + 'quickbooks_download_transaction_pdf', +] as const + +type QuickBooksFileToolId = (typeof QUICKBOOKS_FILE_TOOL_IDS)[number] + +function isQuickBooksFileToolId(value: string): value is QuickBooksFileToolId { + return QUICKBOOKS_FILE_TOOL_IDS.some((toolId) => toolId === value) +} + +function inputSizeError(input: unknown): Response | null { + let serialized: string + try { + serialized = JSON.stringify(input) ?? '' + } catch { + return Response.json({ success: false, error: 'Invalid request data' }, { status: 400 }) + } + if (Buffer.byteLength(serialized, 'utf8') <= QUICKBOOKS_MAX_OPERATION_INPUT_BYTES) return null + return Response.json( + { + success: false, + error: `Request body exceeds the maximum allowed size of ${QUICKBOOKS_MAX_OPERATION_INPUT_BYTES} bytes`, + }, + { status: 413 } + ) +} + +function operationContext(request: InternalToolOperationCall): QuickBooksOperationContext | null { + const userId = request.context.userId + if (!userId) return null + return { + userId, + requestId: request.requestId, + workspaceId: request.context.workspaceId, + workflowId: request.context.workflowId, + executionId: request.context.executionId, + signal: request.signal ?? new AbortController().signal, + } +} + +export const executeQuickBooksTool: InternalToolOperationHandler = async (request) => { + request.signal?.throwIfAborted() + if (!isQuickBooksFileToolId(request.toolId)) { + return Response.json( + { success: false, error: `Unsupported QuickBooks tool: ${request.toolId}` }, + { status: 500 } + ) + } + + const sizeError = inputSizeError(request.input) + if (sizeError) return sizeError + const context = operationContext(request) + if (!context) { + return Response.json({ success: false, error: 'Authentication required' }, { status: 401 }) + } + + try { + if (request.toolId === 'quickbooks_add_attachment') { + const parsed = quickBooksAddAttachmentBodySchema.safeParse(request.input) + if (!parsed.success) { + return Response.json( + { + success: false, + error: getValidationErrorMessage(parsed.error, 'Invalid request data'), + }, + { status: 400 } + ) + } + return Response.json({ + success: true, + output: await executeQuickBooksAddAttachment(parsed.data, context), + }) + } + + const documentInput = { + ...(request.input as Record), + documentKind: + request.toolId === 'quickbooks_download_attachment' ? 'attachment' : 'transaction_pdf', + } + const parsed = quickBooksDownloadDocumentBodySchema.safeParse(documentInput) + if (!parsed.success) { + return Response.json( + { + success: false, + error: getValidationErrorMessage(parsed.error, 'Invalid request data'), + }, + { status: 400 } + ) + } + return Response.json({ + success: true, + output: await executeQuickBooksDownloadDocument(parsed.data, context), + }) + } catch (error) { + request.signal?.throwIfAborted() + const status = + error instanceof QuickBooksInternalOperationError + ? error.status + : isPayloadSizeLimitError(error) + ? 413 + : 500 + const message = getErrorMessage(error, 'QuickBooks file operation failed') + logger.error('QuickBooks file operation failed', { + error: message, + requestId: request.requestId, + toolId: request.toolId, + }) + return Response.json({ success: false, error: message }, { status }) + } +} diff --git a/apps/sim/lib/internal/quickbooks/operations.test.ts b/apps/sim/lib/internal/quickbooks/operations.test.ts new file mode 100644 index 00000000000..ac2f703d589 --- /dev/null +++ b/apps/sim/lib/internal/quickbooks/operations.test.ts @@ -0,0 +1,177 @@ +/** + * @vitest-environment node + */ +import { beforeEach, describe, expect, it, vi } from 'vitest' + +const mocks = vi.hoisted(() => ({ + uploadCopilotFile: vi.fn(), + uploadExecutionFile: vi.fn(), +})) + +vi.mock('@/lib/uploads/contexts/copilot', () => ({ + uploadCopilotFile: mocks.uploadCopilotFile, +})) +vi.mock('@/lib/uploads/contexts/execution', () => ({ + uploadExecutionFile: mocks.uploadExecutionFile, +})) +vi.mock('@/tools/quickbooks/client', () => ({ + QUICKBOOKS_MAX_RESPONSE_BYTES: 8 * 1024 * 1024, + buildQuickBooksCompanyUrl: (realmId: string, resource: string) => { + const url = new URL(`https://quickbooks.api.intuit.com/v3/company/${realmId}/${resource}`) + url.searchParams.set('minorversion', '75') + return url + }, + buildQuickBooksHeaders: (accessToken: string) => ({ + Accept: 'application/json', + Authorization: `Bearer ${accessToken}`, + }), +})) + +import { executeQuickBooksDownloadDocument } from '@/lib/internal/quickbooks/operations' +import { QUICKBOOKS_MAX_ATTACHMENT_BYTES } from '@/tools/quickbooks/documents_utils' + +const COPILOT_FILE = { + id: 'file-1', + key: 'copilot/file-1', + context: 'copilot', + name: 'receipt.png', + url: '/api/files/serve/copilot/file-1', + size: 4, + type: 'image/png', +} + +function context(overrides: Record = {}) { + return { + userId: 'user-1', + requestId: 'request-1', + signal: new AbortController().signal, + ...overrides, + } +} + +describe('QuickBooks internal operations', () => { + beforeEach(() => { + vi.clearAllMocks() + vi.stubGlobal('fetch', vi.fn()) + mocks.uploadCopilotFile.mockResolvedValue(COPILOT_FILE) + mocks.uploadExecutionFile.mockResolvedValue({ ...COPILOT_FILE, context: 'execution' }) + }) + + it('downloads attachment bytes directly from the authenticated Intuit endpoint', async () => { + vi.mocked(fetch).mockResolvedValue( + new Response(new Uint8Array([1, 2, 3, 4]), { + headers: { + 'content-disposition': 'attachment; filename="receipt.png"', + 'content-length': '4', + 'content-type': 'image/png', + }, + }) + ) + + const result = await executeQuickBooksDownloadDocument( + { + documentKind: 'attachment', + accessToken: 'secret-token', + realmId: '123', + attachmentId: 'attachment-1', + }, + context() + ) + + const [url, init] = vi.mocked(fetch).mock.calls[0] + expect(String(url)).toMatch( + /^https:\/\/(sandbox-)?quickbooks\.api\.intuit\.com\/v3\/company\/123\/download\/attachment-1\?minorversion=75$/ + ) + expect(init).toEqual( + expect.objectContaining({ + method: 'GET', + headers: expect.objectContaining({ Authorization: 'Bearer secret-token' }), + }) + ) + expect(mocks.uploadCopilotFile).toHaveBeenCalledWith({ + buffer: Buffer.from([1, 2, 3, 4]), + fileName: 'receipt.png', + contentType: 'image/png', + userId: 'user-1', + }) + expect(result).toMatchObject({ file: COPILOT_FILE, attachmentId: 'attachment-1' }) + }) + + it('rejects an oversized attachment from Content-Length before buffering it', async () => { + vi.mocked(fetch).mockResolvedValue( + new Response(new Uint8Array([1]), { + headers: { 'content-length': String(QUICKBOOKS_MAX_ATTACHMENT_BYTES + 1) }, + }) + ) + + await expect( + executeQuickBooksDownloadDocument( + { + documentKind: 'attachment', + accessToken: 'secret-token', + realmId: '123', + attachmentId: 'attachment-1', + }, + context() + ) + ).rejects.toThrow('exceeds maximum size') + expect(mocks.uploadCopilotFile).not.toHaveBeenCalled() + }) + + it('rejects malformed PDF content before storing it', async () => { + vi.mocked(fetch).mockResolvedValue( + new Response(new TextEncoder().encode('not a PDF'), { + headers: { 'content-type': 'application/pdf' }, + }) + ) + + await expect( + executeQuickBooksDownloadDocument( + { + documentKind: 'transaction_pdf', + accessToken: 'secret-token', + realmId: '123', + transactionType: 'invoice', + transactionId: 'invoice-1', + }, + context() + ) + ).rejects.toThrow('malformed PDF') + expect(mocks.uploadCopilotFile).not.toHaveBeenCalled() + }) + + it('stores valid PDFs in trusted execution scope', async () => { + const pdf = new TextEncoder().encode('%PDF-1.7\n') + vi.mocked(fetch).mockResolvedValue( + new Response(pdf, { headers: { 'content-type': 'application/pdf' } }) + ) + + await executeQuickBooksDownloadDocument( + { + documentKind: 'transaction_pdf', + accessToken: 'secret-token', + realmId: '123', + transactionType: 'invoice', + transactionId: 'invoice-1', + }, + context({ + workspaceId: 'workspace-1', + workflowId: 'workflow-1', + executionId: 'execution-1', + }) + ) + + expect(mocks.uploadExecutionFile).toHaveBeenCalledWith( + { + workspaceId: 'workspace-1', + workflowId: 'workflow-1', + executionId: 'execution-1', + }, + Buffer.from(pdf), + 'quickbooks-invoice-invoice-1.pdf', + 'application/pdf', + 'user-1' + ) + expect(mocks.uploadCopilotFile).not.toHaveBeenCalled() + }) +}) diff --git a/apps/sim/lib/internal/quickbooks/operations.ts b/apps/sim/lib/internal/quickbooks/operations.ts new file mode 100644 index 00000000000..8ebd6c65803 --- /dev/null +++ b/apps/sim/lib/internal/quickbooks/operations.ts @@ -0,0 +1,330 @@ +import { createLogger } from '@sim/logger' +import { userFileSchema } from '@/lib/api/contracts/primitives' +import type { + QuickBooksAddAttachmentBody, + QuickBooksDownloadDocumentBody, +} from '@/lib/api/contracts/tools/quickbooks' +import { + assertContentLengthWithinLimit, + assertKnownSizeWithinLimit, + readResponseToBufferWithLimit, +} from '@/lib/core/utils/stream-limits' +import { uploadCopilotFile } from '@/lib/uploads/contexts/copilot' +import { uploadExecutionFile } from '@/lib/uploads/contexts/execution' +import { processFilesToUserFiles } from '@/lib/uploads/utils/file-utils' +import { downloadServableFileFromStorage } from '@/lib/uploads/utils/file-utils.server' +import { docNotReadyResponse } from '@/lib/uploads/utils/servable-file-response' +import { assertToolFileAccess } from '@/app/api/files/authorization' +import { buildQuickBooksCompanyUrl, buildQuickBooksHeaders } from '@/tools/quickbooks/client' +import { + assertQuickBooksAttachmentExtension, + assertSingleQuickBooksFile, + buildQuickBooksAttachableMetadata, + getQuickBooksDocumentError, + getQuickBooksDocumentTransaction, + parseQuickBooksAttachableResponse, + QUICKBOOKS_DOCUMENT_METADATA_TIMEOUT_MS, + QUICKBOOKS_DOCUMENT_TRANSFER_TIMEOUT_MS, + QUICKBOOKS_MAX_ATTACHMENT_BYTES, + quickBooksDocumentSignal, + sanitizeQuickBooksFileName, + validateQuickBooksAttachmentFileType, +} from '@/tools/quickbooks/documents_utils' + +const logger = createLogger('QuickBooksInternalOperations') + +export interface QuickBooksOperationContext { + userId: string + requestId: string + workspaceId?: string + workflowId?: string + executionId?: string + signal: AbortSignal +} + +export class QuickBooksInternalOperationError extends Error { + constructor( + readonly status: number, + message: string + ) { + super(message) + this.name = 'QuickBooksInternalOperationError' + } +} + +interface DownloadedDocument { + buffer: Buffer + mimeType: string + fileName: string +} + +async function errorFromResponse(response: Response, fallback: string): Promise { + let message = fallback + try { + const data = (await response.json()) as { error?: unknown } + if (typeof data.error === 'string' && data.error.trim()) message = data.error + } catch {} + throw new QuickBooksInternalOperationError(response.status, message) +} + +function contentDispositionFileName(value: string | null): string | undefined { + if (!value) return undefined + const utf8 = value.match(/filename\*=UTF-8''([^;]+)/i)?.[1] + if (utf8) { + try { + return decodeURIComponent(utf8) + } catch { + return utf8 + } + } + return value.match(/filename="?([^";]+)"?/i)?.[1] +} + +async function downloadQuickBooksAttachment( + body: Extract, + signal: AbortSignal +): Promise { + const downloadUrl = buildQuickBooksCompanyUrl( + body.realmId, + `download/${encodeURIComponent(body.attachmentId)}` + ) + const transferSignal = quickBooksDocumentSignal(signal, QUICKBOOKS_DOCUMENT_TRANSFER_TIMEOUT_MS) + const downloadResponse = await fetch(downloadUrl, { + method: 'GET', + headers: { ...buildQuickBooksHeaders(body.accessToken), Accept: '*/*' }, + signal: transferSignal, + }) + if (downloadResponse.status === 404) { + throw new Error('This QuickBooks attachment has no downloadable file') + } + if (!downloadResponse.ok) throw await getQuickBooksDocumentError(downloadResponse, signal) + assertContentLengthWithinLimit( + downloadResponse.headers, + QUICKBOOKS_MAX_ATTACHMENT_BYTES, + 'QuickBooks attachment file' + ) + const buffer = await readResponseToBufferWithLimit(downloadResponse, { + maxBytes: QUICKBOOKS_MAX_ATTACHMENT_BYTES, + label: 'QuickBooks attachment file', + signal: transferSignal, + }) + if (buffer.length === 0) throw new Error('QuickBooks attachment file is empty') + + const fallbackName = `quickbooks-attachment-${body.attachmentId}` + + return { + buffer, + mimeType: + downloadResponse.headers.get('content-type')?.split(';', 1)[0]?.trim().toLowerCase() || + 'application/octet-stream', + fileName: sanitizeQuickBooksFileName( + body.fileName ?? undefined, + contentDispositionFileName(downloadResponse.headers.get('content-disposition')) || + fallbackName + ), + } +} + +async function downloadQuickBooksTransactionPdf( + body: Extract, + signal: AbortSignal +): Promise { + const fileName = sanitizeQuickBooksFileName( + body.fileName ?? undefined, + `quickbooks-${body.transactionType.replaceAll('_', '-')}-${body.transactionId}.pdf` + ) + if (!fileName.toLowerCase().endsWith('.pdf')) throw new Error('PDF filename must end in .pdf') + + const { resource } = getQuickBooksDocumentTransaction(body.transactionType) + const url = buildQuickBooksCompanyUrl( + body.realmId, + `${resource}/${encodeURIComponent(body.transactionId)}/pdf` + ) + const transferSignal = quickBooksDocumentSignal(signal, QUICKBOOKS_DOCUMENT_TRANSFER_TIMEOUT_MS) + const response = await fetch(url, { + method: 'GET', + headers: { ...buildQuickBooksHeaders(body.accessToken), Accept: 'application/pdf' }, + signal: transferSignal, + }) + if (!response.ok) throw await getQuickBooksDocumentError(response, signal) + + const mimeType = + response.headers.get('content-type')?.split(';', 1)[0]?.trim().toLowerCase() ?? '' + if (mimeType !== 'application/pdf') throw new Error('QuickBooks returned a non-PDF response') + const buffer = await readResponseToBufferWithLimit(response, { + maxBytes: QUICKBOOKS_MAX_ATTACHMENT_BYTES, + label: 'QuickBooks transaction PDF', + signal: transferSignal, + }) + if (buffer.length === 0) throw new Error('QuickBooks returned an empty PDF') + if (buffer.subarray(0, 5).toString('ascii') !== '%PDF-') { + throw new Error('QuickBooks returned malformed PDF content') + } + return { buffer, mimeType, fileName } +} + +export async function executeQuickBooksAddAttachment( + data: QuickBooksAddAttachmentBody, + context: QuickBooksOperationContext +) { + context.signal.throwIfAborted() + const url = buildQuickBooksCompanyUrl( + data.realmId, + data.attachmentKind === 'file' ? 'upload' : 'attachable' + ) + let response: Response + + if (data.attachmentKind === 'note') { + const metadata = buildQuickBooksAttachableMetadata(data.targetType, data.targetId, { + note: data.note!, + }) + response = await fetch(url, { + method: 'POST', + headers: { + ...buildQuickBooksHeaders(data.accessToken), + 'Content-Type': 'application/json', + }, + body: JSON.stringify(metadata), + signal: quickBooksDocumentSignal(context.signal, QUICKBOOKS_DOCUMENT_METADATA_TIMEOUT_MS), + }) + } else { + const rawFile = assertSingleQuickBooksFile(data.file ?? undefined) + const files = processFilesToUserFiles([rawFile], context.requestId, logger) + if (files.length !== 1) throw new Error('Exactly one valid file is required') + const file = files[0] + assertKnownSizeWithinLimit( + file.size, + QUICKBOOKS_MAX_ATTACHMENT_BYTES, + 'QuickBooks attachment file' + ) + const resolvedName = sanitizeQuickBooksFileName(data.fileName ?? undefined, file.name) + assertQuickBooksAttachmentExtension(resolvedName) + const denied = await assertToolFileAccess(file.key, context.userId, context.requestId, logger) + if (denied) await errorFromResponse(denied, 'Unable to access QuickBooks attachment file') + + let downloaded: Awaited> + try { + downloaded = await downloadServableFileFromStorage(file, context.requestId, logger, { + maxBytes: QUICKBOOKS_MAX_ATTACHMENT_BYTES, + signal: context.signal, + }) + } catch (error) { + const notReady = docNotReadyResponse(error) + if (notReady) await errorFromResponse(notReady, 'QuickBooks attachment file is not ready') + throw error + } + context.signal.throwIfAborted() + assertKnownSizeWithinLimit( + downloaded.buffer.length, + QUICKBOOKS_MAX_ATTACHMENT_BYTES, + 'QuickBooks attachment file' + ) + if (downloaded.buffer.length === 0) { + throw new Error('QuickBooks attachment file cannot be empty') + } + + const storedMime = (downloaded.contentType || file.type || '') + .split(';', 1)[0] + .trim() + .toLowerCase() + const requestedMime = data.contentType?.trim().toLowerCase() || storedMime + const mimeType = validateQuickBooksAttachmentFileType(resolvedName, requestedMime) + if (data.contentType && storedMime && requestedMime !== storedMime) { + validateQuickBooksAttachmentFileType(resolvedName, storedMime) + } + + const metadata = buildQuickBooksAttachableMetadata(data.targetType, data.targetId, { + fileName: resolvedName, + contentType: mimeType, + description: data.description ?? undefined, + }) + const formData = new FormData() + formData.append( + 'file_metadata_01', + new Blob([JSON.stringify(metadata)], { type: 'application/json' }), + 'attachment.json' + ) + formData.append( + 'file_content_01', + new Blob( + [ + new Uint8Array( + downloaded.buffer.buffer as ArrayBuffer, + downloaded.buffer.byteOffset, + downloaded.buffer.byteLength + ), + ], + { type: mimeType } + ), + resolvedName + ) + response = await fetch(url, { + method: 'POST', + headers: buildQuickBooksHeaders(data.accessToken), + body: formData, + signal: quickBooksDocumentSignal(context.signal, QUICKBOOKS_DOCUMENT_TRANSFER_TIMEOUT_MS), + }) + } + + if (!response.ok) throw await getQuickBooksDocumentError(response, context.signal) + const transformed = await parseQuickBooksAttachableResponse(response, context.signal) + return { + attachment: transformed.attachment, + attachmentId: transformed.attachment.Id.trim(), + attachmentKind: data.attachmentKind, + targetType: data.targetType, + targetId: data.targetId, + time: transformed.time, + } +} + +export async function executeQuickBooksDownloadDocument( + body: QuickBooksDownloadDocumentBody, + context: QuickBooksOperationContext +) { + context.signal.throwIfAborted() + const downloaded = + body.documentKind === 'attachment' + ? await downloadQuickBooksAttachment(body, context.signal) + : await downloadQuickBooksTransactionPdf(body, context.signal) + + context.signal.throwIfAborted() + const executionContext = + context.workspaceId && context.workflowId && context.executionId + ? { + workspaceId: context.workspaceId, + workflowId: context.workflowId, + executionId: context.executionId, + } + : null + const storedFile = userFileSchema.parse( + executionContext + ? await uploadExecutionFile( + executionContext, + downloaded.buffer, + downloaded.fileName, + downloaded.mimeType, + context.userId + ) + : await uploadCopilotFile({ + buffer: downloaded.buffer, + fileName: downloaded.fileName, + contentType: downloaded.mimeType, + userId: context.userId, + }) + ) + + const shared = { + file: storedFile, + fileName: downloaded.fileName, + mimeType: downloaded.mimeType, + size: downloaded.buffer.length, + } + return body.documentKind === 'attachment' + ? { ...shared, attachmentId: body.attachmentId } + : { + ...shared, + transactionType: body.transactionType, + transactionId: body.transactionId, + } +} diff --git a/apps/sim/lib/internal/tool-operations/registry.server.ts b/apps/sim/lib/internal/tool-operations/registry.server.ts index c84c5735af6..b2f9e6d030a 100644 --- a/apps/sim/lib/internal/tool-operations/registry.server.ts +++ b/apps/sim/lib/internal/tool-operations/registry.server.ts @@ -694,6 +694,12 @@ const DOCUSIGN_TOOL_IDS = [ 'docusign_void_envelope', ] as const +const QUICKBOOKS_TOOL_IDS = [ + 'quickbooks_add_attachment', + 'quickbooks_download_attachment', + 'quickbooks_download_transaction_pdf', +] as const + const THINKING_TOOL_IDS = ['thinking_tool'] as const const BITBUCKET_TOOL_IDS = [ @@ -1344,6 +1350,9 @@ registerFamily(handlerLoaders, ASANA_TOOL_IDS, async () => { registerFamily(handlerLoaders, DOCUSIGN_TOOL_IDS, async () => { return (await import('@/lib/internal/docusign/execute-tool')).executeDocuSignTool }) +registerFamily(handlerLoaders, QUICKBOOKS_TOOL_IDS, async () => { + return (await import('@/lib/internal/quickbooks/execute-tool')).executeQuickBooksTool +}) registerFamily(handlerLoaders, THINKING_TOOL_IDS, async () => { return (await import('@/lib/internal/thinking/execute-tool')).executeThinkingTool }) diff --git a/apps/sim/lib/oauth/oauth.ts b/apps/sim/lib/oauth/oauth.ts index a8d07519aaa..9bbe66426ea 100644 --- a/apps/sim/lib/oauth/oauth.ts +++ b/apps/sim/lib/oauth/oauth.ts @@ -48,6 +48,7 @@ import { NotionIcon, OutlookIcon, PipedriveIcon, + QuickBooksIcon, RedditIcon, SalesforceIcon, ShopifyIcon, @@ -1154,6 +1155,22 @@ export const OAUTH_PROVIDERS: Record = { }, defaultService: 'pipedrive', }, + quickbooks: { + name: 'QuickBooks', + icon: QuickBooksIcon, + services: { + quickbooks: { + name: 'QuickBooks', + description: + 'Access company data and manage customers, vendors, and items in QuickBooks Online.', + providerId: 'quickbooks', + icon: QuickBooksIcon, + baseProviderIcon: QuickBooksIcon, + scopes: ['openid', 'profile', 'email', 'com.intuit.quickbooks.accounting'], + }, + }, + defaultService: 'quickbooks', + }, hubspot: { name: 'HubSpot', icon: HubspotIcon, @@ -1762,6 +1779,20 @@ function getProviderAuthConfig(provider: string): ProviderAuthConfig { supportsRefreshTokenRotation: true, } } + case 'quickbooks': { + const { clientId, clientSecret } = getConfiguredClientCredentials( + 'quickbooks', + 'QUICKBOOKS_CLIENT_ID', + 'QUICKBOOKS_CLIENT_SECRET' + ) + return { + tokenEndpoint: 'https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer', + clientId, + clientSecret, + useBasicAuth: true, + supportsRefreshTokenRotation: true, + } + } case 'hubspot': { const { clientId, clientSecret } = getConfiguredClientCredentials( 'hubspot', diff --git a/apps/sim/lib/oauth/quickbooks.test.ts b/apps/sim/lib/oauth/quickbooks.test.ts new file mode 100644 index 00000000000..aa58aa8bc9c --- /dev/null +++ b/apps/sim/lib/oauth/quickbooks.test.ts @@ -0,0 +1,90 @@ +/** + * @vitest-environment node + */ +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' + +const { mockEnv, mockFetch } = vi.hoisted(() => ({ + mockEnv: { + QUICKBOOKS_CLIENT_ID: 'quickbooks-client-id' as string | undefined, + QUICKBOOKS_CLIENT_SECRET: 'quickbooks-client-secret' as string | undefined, + }, + mockFetch: vi.fn(), +})) + +vi.mock('@/lib/core/config/env', () => ({ env: mockEnv })) + +import { revokeQuickBooksToken } from '@/lib/oauth/quickbooks' + +describe('revokeQuickBooksToken', () => { + beforeEach(() => { + vi.clearAllMocks() + mockEnv.QUICKBOOKS_CLIENT_ID = 'quickbooks-client-id' + mockEnv.QUICKBOOKS_CLIENT_SECRET = 'quickbooks-client-secret' + vi.stubGlobal('fetch', mockFetch) + }) + + afterEach(() => { + vi.unstubAllGlobals() + }) + + it('sends the token to the Intuit revocation endpoint with client authentication', async () => { + mockFetch.mockResolvedValueOnce(new Response(null, { status: 200 })) + + await expect(revokeQuickBooksToken(' refresh-token ')).resolves.toBeUndefined() + + expect(mockFetch).toHaveBeenCalledOnce() + const [url, init] = mockFetch.mock.calls[0] + expect(url).toBe('https://developer.api.intuit.com/v2/oauth2/tokens/revoke') + expect(init).toMatchObject({ + method: 'POST', + headers: { + Accept: 'application/json', + Authorization: `Basic ${Buffer.from( + 'quickbooks-client-id:quickbooks-client-secret' + ).toString('base64')}`, + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ token: 'refresh-token' }), + }) + expect(init.signal).toBeInstanceOf(AbortSignal) + }) + + it('rejects before sending when client credentials are missing', async () => { + mockEnv.QUICKBOOKS_CLIENT_SECRET = undefined + + await expect(revokeQuickBooksToken('refresh-token')).rejects.toThrow( + 'QuickBooks OAuth client credentials are not configured' + ) + expect(mockFetch).not.toHaveBeenCalled() + }) + + it('sanitizes network and timeout failures', async () => { + mockFetch.mockRejectedValueOnce(new DOMException('request timed out', 'AbortError')) + + const result = revokeQuickBooksToken('sensitive-refresh-token') + await expect(result).rejects.toThrow('QuickBooks token revocation request failed') + await expect(result).rejects.not.toThrow('sensitive-refresh-token') + }) + + it('fails closed when Intuit rejects the revocation request', async () => { + mockFetch.mockResolvedValueOnce( + new Response('sensitive-refresh-token quickbooks-client-secret', { status: 400 }) + ) + + const result = revokeQuickBooksToken('sensitive-refresh-token') + await expect(result).rejects.toThrow('QuickBooks token revocation failed with HTTP 400') + await expect(result).rejects.not.toThrow('sensitive-refresh-token') + await expect(result).rejects.not.toThrow('quickbooks-client-secret') + }) + + it('sanitizes non-terminal non-success responses', async () => { + mockFetch.mockResolvedValueOnce( + new Response('sensitive-refresh-token quickbooks-client-secret', { status: 503 }) + ) + + const result = revokeQuickBooksToken('sensitive-refresh-token') + await expect(result).rejects.toThrow('QuickBooks token revocation failed with HTTP 503') + await expect(result).rejects.not.toThrow('sensitive-refresh-token') + await expect(result).rejects.not.toThrow('quickbooks-client-secret') + }) +}) diff --git a/apps/sim/lib/oauth/quickbooks.ts b/apps/sim/lib/oauth/quickbooks.ts new file mode 100644 index 00000000000..763b1948440 --- /dev/null +++ b/apps/sim/lib/oauth/quickbooks.ts @@ -0,0 +1,195 @@ +import { AsyncLocalStorage } from 'node:async_hooks' +import { generateId } from '@sim/utils/id' +import { env } from '@/lib/core/config/env' +import { + readResponseJsonWithLimit, + readResponseTextWithLimit, +} from '@/lib/core/utils/stream-limits' +import { + fetchValidatedQuickBooksCompanyInfo, + getQuickBooksUserInfoUrl, + normalizeQuickBooksRealmId as normalizeRealmId, + QUICKBOOKS_MAX_USER_INFO_BYTES, + QUICKBOOKS_OAUTH_REQUEST_TIMEOUT_MS, +} from '@/tools/quickbooks/client' + +const QUICKBOOKS_ACCOUNT_PREFIX = 'quickbooks:' +const QUICKBOOKS_REVOCATION_URL = 'https://developer.api.intuit.com/v2/oauth2/tokens/revoke' +const QUICKBOOKS_MAX_REVOCATION_ERROR_BYTES = 64 * 1024 +const UUID_SUFFIX_PATTERN = + /-([0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$/i +const quickBooksCallbackRealmStorage = new AsyncLocalStorage() + +export const QUICKBOOKS_AUTHORIZATION_URL = 'https://appcenter.intuit.com/connect/oauth2' +export const QUICKBOOKS_TOKEN_URL = 'https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer' +export const QUICKBOOKS_OIDC_CLAIMS = { + id_token: { realmId: null }, + userinfo: { realmId: null }, +} as const + +export interface QuickBooksAccountIdentity { + realmId: string + subject: string +} + +export interface QuickBooksConnectionProfile extends QuickBooksAccountIdentity { + accountId: string + name: string + email: string + emailVerified: boolean +} + +export const normalizeQuickBooksRealmId = normalizeRealmId + +export function withQuickBooksCallbackRealm(realmId: string, callback: () => T): T { + return quickBooksCallbackRealmStorage.run(normalizeQuickBooksRealmId(realmId), callback) +} + +export function getQuickBooksCallbackRealm(): string { + const realmId = quickBooksCallbackRealmStorage.getStore() + if (!realmId) { + throw new Error( + 'QuickBooks callback did not include a company identity. Reconnect the QuickBooks credential.' + ) + } + return realmId +} + +function normalizeSubject(subject: string): string { + const normalized = subject.trim() + if (!normalized || normalized.includes(':')) { + throw new Error('QuickBooks user identity is invalid. Reconnect the QuickBooks credential.') + } + return normalized +} + +export function createQuickBooksAccountId( + realmId: string, + subject: string, + uniqueId = generateId() +): string { + return `${QUICKBOOKS_ACCOUNT_PREFIX}${normalizeQuickBooksRealmId(realmId)}:${normalizeSubject(subject)}-${uniqueId}` +} + +export function parseQuickBooksAccountId(accountId: string): QuickBooksAccountIdentity { + if (!accountId.startsWith(QUICKBOOKS_ACCOUNT_PREFIX)) { + throw new Error('QuickBooks company identity is missing. Reconnect the QuickBooks credential.') + } + + const value = accountId.slice(QUICKBOOKS_ACCOUNT_PREFIX.length) + const separatorIndex = value.indexOf(':') + if (separatorIndex <= 0) { + throw new Error('QuickBooks company identity is invalid. Reconnect the QuickBooks credential.') + } + + const realmId = normalizeQuickBooksRealmId(value.slice(0, separatorIndex)) + const subjectWithUuid = value.slice(separatorIndex + 1) + const uuidMatch = subjectWithUuid.match(UUID_SUFFIX_PATTERN) + if (!uuidMatch) { + throw new Error('QuickBooks company identity is invalid. Reconnect the QuickBooks credential.') + } + + const subject = normalizeSubject(subjectWithUuid.slice(0, -uuidMatch[0].length)) + return { realmId, subject } +} + +/** Revokes an Intuit OAuth grant using the latest available refresh or access token. */ +export async function revokeQuickBooksToken(token: string, signal?: AbortSignal): Promise { + const normalizedToken = token.trim() + if (!normalizedToken) { + throw new Error('QuickBooks token revocation requires a token') + } + + const clientId = env.QUICKBOOKS_CLIENT_ID?.trim() + const clientSecret = env.QUICKBOOKS_CLIENT_SECRET?.trim() + if (!clientId || !clientSecret) { + throw new Error('QuickBooks OAuth client credentials are not configured') + } + + let response: Response + try { + response = await fetch(QUICKBOOKS_REVOCATION_URL, { + method: 'POST', + headers: { + Accept: 'application/json', + Authorization: `Basic ${Buffer.from(`${clientId}:${clientSecret}`).toString('base64')}`, + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ token: normalizedToken }), + signal: signal + ? AbortSignal.any([signal, AbortSignal.timeout(QUICKBOOKS_OAUTH_REQUEST_TIMEOUT_MS)]) + : AbortSignal.timeout(QUICKBOOKS_OAUTH_REQUEST_TIMEOUT_MS), + }) + } catch { + throw new Error('QuickBooks token revocation request failed') + } + + if (!response.ok) { + await readResponseTextWithLimit(response, { + maxBytes: QUICKBOOKS_MAX_REVOCATION_ERROR_BYTES, + label: 'QuickBooks token revocation error response', + }).catch(() => {}) + throw new Error(`QuickBooks token revocation failed with HTTP ${response.status}`) + } +} + +export async function fetchQuickBooksConnectionProfile( + accessToken: string, + callbackRealmId: string +): Promise { + const realmId = normalizeQuickBooksRealmId(callbackRealmId) + const response = await fetch(getQuickBooksUserInfoUrl(), { + headers: { Authorization: `Bearer ${accessToken}` }, + signal: AbortSignal.timeout(QUICKBOOKS_OAUTH_REQUEST_TIMEOUT_MS), + }) + if (!response.ok) { + await readResponseTextWithLimit(response, { + maxBytes: QUICKBOOKS_MAX_USER_INFO_BYTES, + label: 'QuickBooks UserInfo error response', + }).catch(() => {}) + throw new Error(`QuickBooks UserInfo request failed with HTTP ${response.status}`) + } + + const profile = await readResponseJsonWithLimit<{ + sub?: string + realmId?: string + realmid?: string + name?: string + givenName?: string + familyName?: string + given_name?: string + family_name?: string + email?: string + emailVerified?: boolean + email_verified?: boolean + }>(response, { + maxBytes: QUICKBOOKS_MAX_USER_INFO_BYTES, + label: 'QuickBooks UserInfo response', + }) + + const subject = profile.sub?.trim() + const claimedRealmId = (profile.realmId ?? profile.realmid)?.trim() + const email = profile.email?.trim() + const givenName = (profile.givenName ?? profile.given_name)?.trim() + const familyName = (profile.familyName ?? profile.family_name)?.trim() + const name = profile.name?.trim() || [givenName, familyName].filter(Boolean).join(' ') + const emailVerified = profile.emailVerified ?? profile.email_verified ?? false + + if (!subject || !email || !name) { + throw new Error('QuickBooks UserInfo did not return the required user identity') + } + if (claimedRealmId && normalizeQuickBooksRealmId(claimedRealmId) !== realmId) { + throw new Error('QuickBooks callback and UserInfo returned different company identities') + } + + await fetchValidatedQuickBooksCompanyInfo(accessToken, realmId) + + return { + accountId: createQuickBooksAccountId(realmId, subject), + realmId, + subject: normalizeSubject(subject), + name, + email, + emailVerified, + } +} diff --git a/apps/sim/lib/oauth/token-resolution.ts b/apps/sim/lib/oauth/token-resolution.ts index 298ccd29592..e387d148573 100644 --- a/apps/sim/lib/oauth/token-resolution.ts +++ b/apps/sim/lib/oauth/token-resolution.ts @@ -1,5 +1,6 @@ import { AuditAction, AuditResourceType, recordAudit } from '@sim/audit' import { createLogger } from '@sim/logger' +import { getErrorMessage } from '@sim/utils/errors' import { impersonateEmailSchema, type OAuthTokenResponse, @@ -14,6 +15,7 @@ import { resolveOAuthAccountId, resolveServiceAccountToken, } from '@/lib/oauth/credential-service' +import { parseQuickBooksAccountId } from '@/lib/oauth/quickbooks' import { extractSalesforceInstanceUrl, isSalesforceOAuthProviderId } from '@/lib/oauth/salesforce' import { captureServerEvent } from '@/lib/posthog/server' import { extractZohoDeskBaseFromScope } from '@/tools/zoho_desk/host-allowlist' @@ -54,6 +56,30 @@ export type ResolveCredentialTokenResult = | { ok: true; token: CredentialTokenPayload } | { ok: false; status: number; error: string; code?: string } +interface OAuthCredentialContext { + providerId: string + accountId?: string | null +} + +export function validateOAuthCredentialContext( + credential: OAuthCredentialContext +): { ok: true } | { ok: false; error: string } { + if (credential.providerId !== 'quickbooks') return { ok: true } + + try { + parseQuickBooksAccountId(credential.accountId ?? '') + return { ok: true } + } catch (error) { + return { + ok: false, + error: getErrorMessage( + error, + 'QuickBooks company identity is invalid. Reconnect the QuickBooks credential.' + ), + } + } +} + /** * Emits the semantic "credential used" trail for one resolved credential. * Both the audit row and the analytics event are fire-and-forget. @@ -98,7 +124,12 @@ function recordCredentialAccess(params: { * local regex — these values are injected into tool calls that carry the token. */ function buildOAuthTokenPayload( - credential: { providerId: string; scope?: string | null; idToken?: string | null }, + credential: { + providerId: string + accountId?: string | null + scope?: string | null + idToken?: string | null + }, accessToken: string ): CredentialTokenPayload { const instanceUrl = isSalesforceOAuthProviderId(credential.providerId) @@ -110,11 +141,17 @@ function buildOAuthTokenPayload( apiDomain = extractZohoDeskBaseFromScope(credential.scope) } + const realmId = + credential.providerId === 'quickbooks' + ? parseQuickBooksAccountId(credential.accountId ?? '').realmId + : undefined + return { accessToken, idToken: credential.idToken || undefined, ...(instanceUrl && { instanceUrl }), ...(apiDomain && { apiDomain }), + ...(realmId && { realmId }), } } @@ -125,13 +162,23 @@ function buildOAuthTokenPayload( */ export async function completeOAuthCredentialToken(params: { requestId: string - credential: { providerId: string; scope?: string | null; idToken?: string | null } + credential: { + providerId: string + accountId?: string | null + scope?: string | null + idToken?: string | null + } resolvedCredentialId: string actorId?: string workspaceId: string | null auditRequest?: CredentialAuditRequest }): Promise { const { requestId, credential, resolvedCredentialId, actorId, workspaceId, auditRequest } = params + const contextValidation = validateOAuthCredentialContext(credential) + if (!contextValidation.ok) { + return { ok: false, status: 401, error: contextValidation.error } + } + try { const { accessToken } = await refreshTokenIfNeeded(requestId, credential, resolvedCredentialId) diff --git a/apps/sim/lib/oauth/types.ts b/apps/sim/lib/oauth/types.ts index bd38a3d2189..6c947fd9af5 100644 --- a/apps/sim/lib/oauth/types.ts +++ b/apps/sim/lib/oauth/types.ts @@ -78,6 +78,7 @@ export type OAuthProvider = | 'asana' | 'attio' | 'pipedrive' + | 'quickbooks' | 'hubspot' | 'harmonic' | 'salesforce' @@ -137,6 +138,7 @@ export type OAuthService = | 'asana' | 'attio' | 'pipedrive' + | 'quickbooks' | 'hubspot' | 'harmonic' | 'salesforce' diff --git a/apps/sim/lib/oauth/utils.test.ts b/apps/sim/lib/oauth/utils.test.ts index ab0e34a9273..cb888d8403e 100644 --- a/apps/sim/lib/oauth/utils.test.ts +++ b/apps/sim/lib/oauth/utils.test.ts @@ -80,6 +80,11 @@ describe('getAllOAuthServices', () => { expect(slackService).toBeDefined() expect(slackService?.name).toBe('Slack') expect(slackService?.baseProvider).toBe('slack') + + const quickbooksService = services.find((s) => s.providerId === 'quickbooks') + expect(quickbooksService).toBeDefined() + expect(quickbooksService?.name).toBe('QuickBooks') + expect(quickbooksService?.baseProvider).toBe('quickbooks') }) it.concurrent('should not include duplicate services', () => { @@ -276,6 +281,14 @@ describe('getServiceConfigByProviderId', () => { expect(service?.name).toBe('Slack') }) + it.concurrent('should work for QuickBooks', () => { + const service = getServiceConfigByProviderId('quickbooks') + + expect(service).toBeDefined() + expect(service?.providerId).toBe('quickbooks') + expect(service?.name).toBe('QuickBooks') + }) + it.concurrent('should return service with scopes', () => { const service = getServiceConfigByProviderId('google-drive') @@ -370,6 +383,13 @@ describe('getCanonicalScopesForProvider', () => { expect(excelScopes).toContain('Files.Read') }) + it.concurrent('should return the exact canonical QuickBooks scopes', () => { + const expected = ['openid', 'profile', 'email', 'com.intuit.quickbooks.accounting'] + + expect(getCanonicalScopesForProvider('quickbooks')).toEqual(expected) + expect(getScopesForService('quickbooks')).toEqual(expected) + }) + it.concurrent('should handle providers with empty scopes array', () => { const scopes = getCanonicalScopesForProvider('notion') diff --git a/apps/sim/lib/oauth/utils.ts b/apps/sim/lib/oauth/utils.ts index 9e6f6a3a494..b1344b195cf 100644 --- a/apps/sim/lib/oauth/utils.ts +++ b/apps/sim/lib/oauth/utils.ts @@ -103,6 +103,8 @@ export const SCOPE_DESCRIPTIONS: Record = { openid: 'Standard authentication', profile: 'Access profile information', email: 'Access email address', + 'com.intuit.quickbooks.accounting': + 'Access and manage accounting data in the connected QuickBooks Online company', // Notion scopes 'database.read': 'Read database', diff --git a/apps/sim/tools/error-extractors.test.ts b/apps/sim/tools/error-extractors.test.ts index 9959f8eb06d..37958594822 100644 --- a/apps/sim/tools/error-extractors.test.ts +++ b/apps/sim/tools/error-extractors.test.ts @@ -169,6 +169,36 @@ describe('Error Extractors', () => { }) describe('extractErrorMessage with explicit extractorId', () => { + it('formats QuickBooks faults with status guidance', () => { + const errorInfo: ErrorInfo = { + status: 401, + data: { + Fault: { + Error: [ + { + code: '3200', + Message: 'Authentication failed', + Detail: 'Token expired', + }, + ], + }, + }, + } + + expect(extractErrorMessage(errorInfo, ErrorExtractorId.QUICKBOOKS_FAULT)).toBe( + 'QuickBooks request failed with HTTP 401. Reconnect the QuickBooks credential. 3200: Authentication failed: Token expired' + ) + }) + + it('does not claim non-QuickBooks payloads', () => { + expect( + extractErrorMessage( + { status: 400, data: { message: 'Unrelated provider error' } }, + ErrorExtractorId.QUICKBOOKS_FAULT + ) + ).toBe('Request failed with status 400') + }) + it('should use specified extractor directly (deterministic)', () => { const errorInfo: ErrorInfo = { status: 403, diff --git a/apps/sim/tools/error-extractors.ts b/apps/sim/tools/error-extractors.ts index 449525e9f6b..9ae2f0ff51a 100644 --- a/apps/sim/tools/error-extractors.ts +++ b/apps/sim/tools/error-extractors.ts @@ -20,6 +20,7 @@ */ import { parseGraphErrorFromData } from '@/tools/microsoft_excel/utils' +import { formatQuickBooksFaultDetail, sanitizeQuickBooksFaultData } from '@/tools/quickbooks/fault' export interface ErrorInfo { status?: number @@ -415,6 +416,30 @@ const ERROR_EXTRACTORS: ErrorExtractorConfig[] = [ return typeof attr === 'string' && attr ? `${detail} (${attr})` : detail }, }, + { + id: 'quickbooks-fault', + description: 'QuickBooks Online Fault.Error[] responses with authentication and rate guidance', + examples: ['QuickBooks Online Accounting API'], + extract: (errorInfo) => { + const status = errorInfo?.status + const fault = sanitizeQuickBooksFaultData(errorInfo?.data) + if (!fault) return null + + const guidance = + status === 401 + ? 'Reconnect the QuickBooks credential.' + : status === 403 + ? 'Confirm the QuickBooks accounting scope and access to this company.' + : status === 429 + ? 'QuickBooks rate limit reached; retry after the indicated delay.' + : '' + const statusMessage = + typeof status === 'number' + ? `QuickBooks request failed with HTTP ${status}.` + : 'QuickBooks request failed.' + return [statusMessage, guidance, formatQuickBooksFaultDetail(fault)].filter(Boolean).join(' ') + }, + }, { id: 'prospeo-errors', description: 'Prospeo API error_code with optional filter_error and message details', @@ -592,6 +617,7 @@ export const ErrorExtractorId = { DYNATRACE_ERRORS: 'dynatrace-errors', SMARTLEAD_ERRORS: 'smartlead-errors', POSTHOG_ERRORS: 'posthog-errors', + QUICKBOOKS_FAULT: 'quickbooks-fault', PROSPEO_ERRORS: 'prospeo-errors', CRUNCHBASE_ERRORS: 'crunchbase-errors', PITCHBOOK_ERRORS: 'pitchbook-errors', diff --git a/apps/sim/tools/index.ts b/apps/sim/tools/index.ts index 61ffc52d772..8b09cfdb134 100644 --- a/apps/sim/tools/index.ts +++ b/apps/sim/tools/index.ts @@ -1829,6 +1829,9 @@ async function executeToolImplementation( if (data.domain && !contextParams.domain) { contextParams.domain = data.domain } + if (data.realmId) { + contextParams.realmId = data.realmId + } if (data.authStyle && !contextParams.authStyle) { contextParams.authStyle = data.authStyle } diff --git a/apps/sim/tools/quickbooks/accounting_utils.ts b/apps/sim/tools/quickbooks/accounting_utils.ts new file mode 100644 index 00000000000..616952e5537 --- /dev/null +++ b/apps/sim/tools/quickbooks/accounting_utils.ts @@ -0,0 +1,307 @@ +import { filterUndefined } from '@sim/utils/object' +import Decimal from 'decimal.js' +import type { + QuickBooksCreateDepositParams, + QuickBooksCreateJournalEntryParams, + QuickBooksDepositLineInput, + QuickBooksJournalEntityType, + QuickBooksJournalLineInput, + QuickBooksJournalPostingType, + QuickBooksUpdateDepositParams, + QuickBooksUpdateJournalEntryParams, +} from '@/tools/quickbooks/types' +import { + assertQuickBooksSparseUpdate, + optionalQuickBooksString, + quickBooksReference, + requiredQuickBooksString, + validateQuickBooksDate, +} from '@/tools/quickbooks/values' + +const MAX_ACCOUNTING_LINES = 100 +const JOURNAL_LINE_KEYS = new Set([ + 'postingType', + 'amount', + 'accountId', + 'description', + 'entityType', + 'entityId', +]) +const DEPOSIT_LINE_KEYS = new Set(['amount', 'accountId', 'description']) + +function parseJsonArray(value: unknown, fieldName: string): unknown[] | undefined { + if (value == null || value === '') return undefined + let parsed = value + if (typeof value === 'string') { + try { + parsed = JSON.parse(value) + } catch { + throw new Error(`${fieldName} must be valid JSON`) + } + } + if (!Array.isArray(parsed)) throw new Error(`${fieldName} must be a JSON array`) + return parsed +} + +function requireObject(value: unknown, fieldName: string): Record { + if (!value || typeof value !== 'object' || Array.isArray(value)) { + throw new Error(`${fieldName} must be a JSON object`) + } + return value as Record +} + +function rejectUnknownKeys( + value: Record, + allowed: Set, + fieldName: string +): void { + const unknownKey = Object.keys(value).find((key) => !allowed.has(key)) + if (unknownKey) throw new Error(`${fieldName} contains unsupported field "${unknownKey}"`) +} + +/** + * Line amounts may be negative — QuickBooks expresses discounts, returns, and credits that way — + * so only zero and non-numeric input are rejected. + */ +function quickBooksLineAmount( + value: unknown, + fieldName: string +): { cents: bigint; number: number } { + if (typeof value !== 'number' && typeof value !== 'string') { + throw new Error(`${fieldName} must be a non-zero finite number`) + } + const normalized = typeof value === 'string' ? value.trim() : value + if (normalized === '') throw new Error(`${fieldName} must be a non-zero finite number`) + + let decimal: Decimal + try { + decimal = new Decimal(normalized) + } catch { + throw new Error(`${fieldName} must be a non-zero finite number`) + } + if (!decimal.isFinite() || decimal.isZero()) { + throw new Error(`${fieldName} must be a non-zero finite number`) + } + if (decimal.decimalPlaces() > 2) { + throw new Error(`${fieldName} cannot have more than two decimal places`) + } + + const centsNumber = decimal.times(100).toNumber() + if (!Number.isSafeInteger(centsNumber)) { + throw new Error(`${fieldName} is outside the safely supported amount range`) + } + + const number = decimal.toNumber() + if (!Number.isFinite(number) || !new Decimal(number).equals(decimal)) { + throw new Error(`${fieldName} is outside the safely supported amount range`) + } + return { cents: BigInt(centsNumber), number } +} + +function stringValue(value: unknown, fieldName: string): string { + if (typeof value !== 'string') throw new Error(`${fieldName} must be a string`) + return requiredQuickBooksString(value, fieldName) +} + +function optionalStringValue(value: unknown, fieldName: string): string | undefined { + if (value === undefined) return undefined + if (typeof value !== 'string') throw new Error(`${fieldName} must be a string`) + return optionalQuickBooksString(value) +} + +function validateLineCount(lines: unknown[], fieldName: string, minimum: number): void { + if (lines.length < minimum) { + throw new Error( + `${fieldName} must contain at least ${minimum} ${minimum === 1 ? 'line' : 'lines'}` + ) + } + if (lines.length > MAX_ACCOUNTING_LINES) { + throw new Error(`${fieldName} cannot contain more than ${MAX_ACCOUNTING_LINES} lines`) + } +} + +export function parseQuickBooksJournalLines( + value: unknown, + fieldName = 'lines' +): QuickBooksJournalLineInput[] | undefined { + const parsed = parseJsonArray(value, fieldName) + if (!parsed) return undefined + validateLineCount(parsed, fieldName, 2) + + const centAmounts: bigint[] = [] + const lines = parsed.map((rawLine, index) => { + const itemName = `${fieldName}[${index}]` + const line = requireObject(rawLine, itemName) + rejectUnknownKeys(line, JOURNAL_LINE_KEYS, itemName) + if (line.postingType !== 'debit' && line.postingType !== 'credit') { + throw new Error(`${itemName}.postingType must be debit or credit`) + } + const postingType = line.postingType as QuickBooksJournalPostingType + const entityType = line.entityType as QuickBooksJournalEntityType | undefined + if ( + entityType !== undefined && + entityType !== 'customer' && + entityType !== 'vendor' && + entityType !== 'employee' + ) { + throw new Error(`${itemName}.entityType must be customer, vendor, or employee`) + } + if ((entityType === undefined) !== (line.entityId === undefined)) { + throw new Error(`${itemName}.entityType and entityId must be supplied together`) + } + const amount = quickBooksLineAmount(line.amount, `${itemName}.amount`) + centAmounts.push(amount.cents) + return { + postingType, + amount: amount.number, + accountId: stringValue(line.accountId, `${itemName}.accountId`), + description: optionalStringValue(line.description, `${itemName}.description`), + entityType, + entityId: + line.entityId === undefined + ? undefined + : stringValue(line.entityId, `${itemName}.entityId`), + } + }) + + const debitTotal = lines.reduce( + (sum, line, index) => (line.postingType === 'debit' ? sum + centAmounts[index] : sum), + 0n + ) + const creditTotal = lines.reduce( + (sum, line, index) => (line.postingType === 'credit' ? sum + centAmounts[index] : sum), + 0n + ) + if (debitTotal !== creditTotal) { + throw new Error('Journal entry debit and credit totals must balance') + } + return lines +} + +export function buildQuickBooksJournalLines(lines: QuickBooksJournalLineInput[]): unknown[] { + const validated = parseQuickBooksJournalLines(lines) + if (!validated) throw new Error('lines are required') + const entityTypes: Record = { + customer: 'Customer', + employee: 'Employee', + vendor: 'Vendor', + } + return validated.map((line) => + filterUndefined({ + Amount: line.amount, + Description: line.description, + DetailType: 'JournalEntryLineDetail', + JournalEntryLineDetail: filterUndefined({ + PostingType: line.postingType === 'debit' ? 'Debit' : 'Credit', + AccountRef: quickBooksReference(line.accountId, 'accountId'), + Entity: + line.entityType && line.entityId + ? { + Type: entityTypes[line.entityType], + EntityRef: quickBooksReference(line.entityId, 'entityId'), + } + : undefined, + }), + }) + ) +} + +export function parseQuickBooksDepositLines( + value: unknown, + fieldName = 'lines' +): QuickBooksDepositLineInput[] | undefined { + const parsed = parseJsonArray(value, fieldName) + if (!parsed) return undefined + validateLineCount(parsed, fieldName, 1) + return parsed.map((rawLine, index) => { + const itemName = `${fieldName}[${index}]` + const line = requireObject(rawLine, itemName) + rejectUnknownKeys(line, DEPOSIT_LINE_KEYS, itemName) + return { + amount: quickBooksLineAmount(line.amount, `${itemName}.amount`).number, + accountId: stringValue(line.accountId, `${itemName}.accountId`), + description: optionalStringValue(line.description, `${itemName}.description`), + } + }) +} + +export function buildQuickBooksDepositLines(lines: QuickBooksDepositLineInput[]): unknown[] { + const validated = parseQuickBooksDepositLines(lines) + if (!validated) throw new Error('lines are required') + return validated.map((line) => + filterUndefined({ + Amount: line.amount, + Description: line.description, + DetailType: 'DepositLineDetail', + DepositLineDetail: { + AccountRef: quickBooksReference(line.accountId, 'accountId'), + }, + }) + ) +} + +function transactionHeader(params: { + transactionDate?: string + documentNumber?: string + privateNote?: string +}): Record { + return filterUndefined({ + TxnDate: validateQuickBooksDate(params.transactionDate, 'transactionDate'), + DocNumber: optionalQuickBooksString(params.documentNumber), + PrivateNote: optionalQuickBooksString(params.privateNote), + }) +} + +function requirePostingConfirmation(confirmPosting: boolean): void { + if (confirmPosting !== true) { + throw new Error('Confirm posting must be yes before posting a journal entry') + } +} + +export function buildQuickBooksCreateJournalEntryBody( + params: QuickBooksCreateJournalEntryParams +): Record { + requirePostingConfirmation(params.confirmPosting) + return { + ...transactionHeader(params), + Line: buildQuickBooksJournalLines(params.lines), + } +} + +export function buildQuickBooksUpdateJournalEntryBody( + params: QuickBooksUpdateJournalEntryParams +): Record { + requirePostingConfirmation(params.confirmPosting) + const body = { + Id: requiredQuickBooksString(params.journalEntryId, 'journalEntryId'), + SyncToken: requiredQuickBooksString(params.syncToken, 'syncToken'), + sparse: true, + ...transactionHeader(params), + } + assertQuickBooksSparseUpdate(body) + return body +} + +export function buildQuickBooksCreateDepositBody( + params: QuickBooksCreateDepositParams +): Record { + return { + DepositToAccountRef: quickBooksReference(params.depositAccountId, 'depositAccountId'), + ...transactionHeader(params), + Line: buildQuickBooksDepositLines(params.lines), + } +} + +export function buildQuickBooksUpdateDepositBody( + params: QuickBooksUpdateDepositParams +): Record { + const body = { + Id: requiredQuickBooksString(params.depositId, 'depositId'), + SyncToken: requiredQuickBooksString(params.syncToken, 'syncToken'), + sparse: true, + DepositToAccountRef: quickBooksReference(params.depositAccountId, 'depositAccountId'), + ...transactionHeader(params), + } + assertQuickBooksSparseUpdate(body, 4) + return body +} diff --git a/apps/sim/tools/quickbooks/add_attachment.ts b/apps/sim/tools/quickbooks/add_attachment.ts new file mode 100644 index 00000000000..feff707e16a --- /dev/null +++ b/apps/sim/tools/quickbooks/add_attachment.ts @@ -0,0 +1,123 @@ +import type { + QuickBooksAddAttachmentParams, + QuickBooksAddAttachmentResponse, +} from '@/tools/quickbooks/types' +import { QUICKBOOKS_ATTACHABLE_PROPERTIES } from '@/tools/quickbooks/types' +import type { InternalToolConfig } from '@/tools/types' + +export const quickbooksAddAttachmentTool: InternalToolConfig< + QuickBooksAddAttachmentParams, + QuickBooksAddAttachmentResponse +> = { + id: 'quickbooks_add_attachment', + name: 'QuickBooks Add Attachment', + description: 'Attach one supported file or one note to a fixed QuickBooks entity', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + attachmentKind: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Attachment kind: file or note', + }, + targetType: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Fixed QuickBooks entity type to attach to', + }, + targetId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'QuickBooks target entity ID', + }, + file: { + type: 'file', + required: false, + visibility: 'user-only', + description: 'Single Sim file to upload', + }, + fileName: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional safe filename override', + }, + contentType: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional compatible QuickBooks MIME type override', + }, + description: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional file attachment description', + }, + note: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Required nonempty note text in Note mode', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + operation: { + input: (params) => ({ + accessToken: params.accessToken, + realmId: params.realmId, + attachmentKind: params.attachmentKind, + targetType: params.targetType, + targetId: params.targetId, + file: params.file, + fileName: params.fileName, + contentType: params.contentType, + description: params.description, + note: params.note, + }), + }, + transformResponse: async (response) => { + const data = (await response.json()) as QuickBooksAddAttachmentResponse & { + error?: string + } + if (!response.ok || data.success === false) { + throw new Error(data.error || 'Failed to add QuickBooks attachment') + } + return data + }, + outputs: { + attachment: { + type: 'json', + description: 'Created native QuickBooks attachment metadata', + properties: QUICKBOOKS_ATTACHABLE_PROPERTIES, + }, + attachmentId: { type: 'string', description: 'Created QuickBooks attachment ID' }, + attachmentKind: { type: 'string', description: 'Created attachment kind' }, + targetType: { type: 'string', description: 'QuickBooks target entity type' }, + targetId: { type: 'string', description: 'QuickBooks target entity ID' }, + time: { + type: 'string', + description: 'QuickBooks response timestamp', + optional: true, + nullable: true, + }, + }, +} diff --git a/apps/sim/tools/quickbooks/api_accuracy.test.ts b/apps/sim/tools/quickbooks/api_accuracy.test.ts new file mode 100644 index 00000000000..c1a357b90c1 --- /dev/null +++ b/apps/sim/tools/quickbooks/api_accuracy.test.ts @@ -0,0 +1,89 @@ +/** + * @vitest-environment node + */ +import { describe, expect, it } from 'vitest' +import { + assertQuickBooksAttachmentExtension, + getQuickBooksAttachmentTarget, + getQuickBooksDocumentTransaction, + validateQuickBooksAttachmentFileType, +} from '@/tools/quickbooks/documents_utils' +import { quickbooksEmailTransactionTool } from '@/tools/quickbooks/email_transaction' +import { quickbooksGetCompanyInfoTool } from '@/tools/quickbooks/get_company_info' +import type { QuickBooksAttachmentTargetType } from '@/tools/quickbooks/types' + +describe('QuickBooks documented document operations', () => { + it.each([ + ['credit_memo', 'CreditMemo', 'creditmemo'], + ['estimate', 'Estimate', 'estimate'], + ['invoice', 'Invoice', 'invoice'], + ['payment', 'Payment', 'payment'], + ['purchase_order', 'PurchaseOrder', 'purchaseorder'], + ['refund_receipt', 'RefundReceipt', 'refundreceipt'], + ['sales_receipt', 'SalesReceipt', 'salesreceipt'], + ] as const)('maps %s to the documented entity and resource', (type, entity, resource) => { + expect(getQuickBooksDocumentTransaction(type)).toEqual({ entity, resource }) + }) + + it('requires the documented recipient override for Payment email', () => { + expect(() => + quickbooksEmailTransactionTool.request.url({ + accessToken: 'token', + realmId: '123', + transactionType: 'payment', + transactionId: 'payment-1', + confirmSend: true, + }) + ).toThrow('recipient is required') + }) + + it('rejects a successful-status email response without the documented entity', async () => { + await expect( + quickbooksEmailTransactionTool.transformResponse?.( + Response.json({ time: '2026-08-27T00:00:00Z' }), + { + accessToken: 'token', + realmId: '123', + transactionType: 'invoice', + transactionId: 'invoice-1', + confirmSend: true, + } + ) + ).rejects.toThrow('missing a valid Invoice') + }) +}) + +describe('QuickBooks attachment contract', () => { + it('supports customer and vendor profiles and excludes list items', () => { + expect(getQuickBooksAttachmentTarget('customer')).toEqual({ entityType: 'Customer' }) + expect(getQuickBooksAttachmentTarget('vendor')).toEqual({ entityType: 'Vendor' }) + expect(() => getQuickBooksAttachmentTarget('item' as QuickBooksAttachmentTargetType)).toThrow( + 'Unsupported QuickBooks attachment target type' + ) + }) + + it('accepts documented TIFF files and rejects undocumented DOCX files', () => { + expect(validateQuickBooksAttachmentFileType('scan.tiff', 'image/tiff')).toBe('image/tiff') + expect(() => assertQuickBooksAttachmentExtension('contract.docx')).toThrow( + 'does not support the docx file type' + ) + }) +}) + +describe('QuickBooks sensitive output handling', () => { + it('removes the company employer identifier from tool output', async () => { + const result = await quickbooksGetCompanyInfoTool.transformResponse?.( + Response.json({ + CompanyInfo: { + Id: '123', + CompanyName: 'Example Company', + EmployerId: '12-3456789', + }, + }), + { accessToken: 'token', realmId: '123' } + ) + + expect(result?.output.company).toMatchObject({ Id: '123', CompanyName: 'Example Company' }) + expect(result?.output.company).not.toHaveProperty('EmployerId') + }) +}) diff --git a/apps/sim/tools/quickbooks/client.ts b/apps/sim/tools/quickbooks/client.ts new file mode 100644 index 00000000000..634b2022e29 --- /dev/null +++ b/apps/sim/tools/quickbooks/client.ts @@ -0,0 +1,184 @@ +import { env } from '@/lib/core/config/env' +import { + readResponseJsonWithLimit, + readResponseTextWithLimit, +} from '@/lib/core/utils/stream-limits' +import { formatQuickBooksFaultDetail, sanitizeQuickBooksFaultData } from '@/tools/quickbooks/fault' + +export const QUICKBOOKS_MINOR_VERSION = '75' +export const QUICKBOOKS_MAX_RESPONSE_BYTES = 8 * 1024 * 1024 +export const QUICKBOOKS_MAX_USER_INFO_BYTES = 1024 * 1024 +export const QUICKBOOKS_OAUTH_REQUEST_TIMEOUT_MS = 15_000 +const QUICKBOOKS_MAX_VALIDATION_ERROR_BYTES = 64 * 1024 + +export type QuickBooksEnvironment = 'sandbox' | 'production' + +export function getQuickBooksEnvironment(): QuickBooksEnvironment { + const value = env.QUICKBOOKS_ENV + if (!value) { + throw new Error( + 'QUICKBOOKS_ENV must be explicitly configured as either "sandbox" or "production"' + ) + } + if (value !== 'sandbox' && value !== 'production') { + throw new Error('QUICKBOOKS_ENV must be either "sandbox" or "production"') + } + return value +} + +export function getQuickBooksApiBaseUrl(): string { + return getQuickBooksEnvironment() === 'sandbox' + ? 'https://sandbox-quickbooks.api.intuit.com' + : 'https://quickbooks.api.intuit.com' +} + +export function getQuickBooksUserInfoUrl(): string { + return getQuickBooksEnvironment() === 'sandbox' + ? 'https://sandbox-accounts.platform.intuit.com/v1/openid_connect/userinfo' + : 'https://accounts.platform.intuit.com/v1/openid_connect/userinfo' +} + +export function normalizeQuickBooksRealmId(realmId: string): string { + const normalized = realmId.trim() + if (!/^[1-9]\d*$/.test(normalized)) { + throw new Error('QuickBooks company identity is invalid. Reconnect the QuickBooks credential.') + } + return normalized +} + +export function buildQuickBooksCompanyUrl(realmId: string, resource: string): URL { + const normalizedRealmId = normalizeQuickBooksRealmId(realmId) + const url = new URL( + `/v3/company/${encodeURIComponent(normalizedRealmId)}/${resource}`, + getQuickBooksApiBaseUrl() + ) + url.searchParams.set('minorversion', QUICKBOOKS_MINOR_VERSION) + return url +} + +export function buildQuickBooksHeaders(accessToken: string): Record { + const normalizedToken = accessToken.trim() + if (!normalizedToken) { + throw new Error('QuickBooks access token is missing. Reconnect the QuickBooks credential.') + } + return { + Accept: 'application/json', + Authorization: `Bearer ${normalizedToken}`, + } +} + +export interface QuickBooksCompanyInfoEnvelope { + CompanyInfo?: { + Id?: string + CompanyName?: string + LegalName?: string + [key: string]: unknown + } + time?: string +} + +export function assertQuickBooksCompanyInfo(candidate: unknown): T { + if (!candidate || typeof candidate !== 'object' || Array.isArray(candidate)) { + throw new Error('QuickBooks CompanyInfo response is missing a valid CompanyInfo object') + } + const id = (candidate as { Id?: unknown }).Id + if (typeof id !== 'string' || !id.trim()) { + throw new Error('QuickBooks CompanyInfo response is missing a valid company Id') + } + return candidate as T +} + +function getQuickBooksTrackingId(headers: Headers): string | null { + return ( + headers.get('intuit_tid') ?? headers.get('intuit-tid') ?? headers.get('x-request-id') ?? null + ) +} + +function getQuickBooksCompanyValidationGuidance(status: number): string | null { + if (status === 401) return 'Reconnect the QuickBooks credential.' + if (status === 403) { + return 'Confirm the QuickBooks accounting scope and access to this company.' + } + if (status === 429) { + return 'QuickBooks rate limit reached; retry after the indicated delay.' + } + return null +} + +function createQuickBooksCompanyValidationError(response: Response, responseText: string): Error { + let faultDetail = '' + if (responseText) { + try { + const fault = sanitizeQuickBooksFaultData(JSON.parse(responseText)) + if (fault) faultDetail = formatQuickBooksFaultDetail(fault) + } catch { + // Intuit can return HTML or an empty response for gateway failures. + } + } + + const trackingId = getQuickBooksTrackingId(response.headers) + const retryAfter = response.headers.get('retry-after') + return new Error( + [ + `QuickBooks company validation failed with HTTP ${response.status}.`, + getQuickBooksCompanyValidationGuidance(response.status), + faultDetail, + trackingId ? `(Intuit tracking ID: ${trackingId})` : null, + response.status === 429 && retryAfter ? `(Retry-After: ${retryAfter})` : null, + ] + .filter(Boolean) + .join(' ') + ) +} + +export async function fetchValidatedQuickBooksCompanyInfo( + accessToken: string, + realmId: string +): Promise { + const normalizedRealmId = normalizeQuickBooksRealmId(realmId) + const response = await fetch( + buildQuickBooksCompanyUrl( + normalizedRealmId, + `companyinfo/${encodeURIComponent(normalizedRealmId)}` + ), + { + method: 'GET', + headers: buildQuickBooksHeaders(accessToken), + signal: AbortSignal.timeout(QUICKBOOKS_OAUTH_REQUEST_TIMEOUT_MS), + } + ) + + if (!response.ok) { + let responseText = '' + try { + responseText = await readResponseTextWithLimit(response, { + maxBytes: QUICKBOOKS_MAX_VALIDATION_ERROR_BYTES, + label: 'QuickBooks CompanyInfo error response', + }) + } catch { + throw new Error( + `QuickBooks company validation failed with HTTP ${response.status}. The error response exceeded the safe size limit.` + ) + } + throw createQuickBooksCompanyValidationError(response, responseText) + } + + const data = await readResponseJsonWithLimit(response, { + maxBytes: QUICKBOOKS_MAX_RESPONSE_BYTES, + label: 'QuickBooks CompanyInfo response', + }) + + const fault = sanitizeQuickBooksFaultData(data) + if (fault) { + const detail = formatQuickBooksFaultDetail(fault) + throw new Error( + ['QuickBooks company validation failed.', detail, 'Reconnect the QuickBooks credential.'] + .filter(Boolean) + .join(' ') + ) + } + + assertQuickBooksCompanyInfo(data.CompanyInfo) + + return data +} diff --git a/apps/sim/tools/quickbooks/create_bill.ts b/apps/sim/tools/quickbooks/create_bill.ts new file mode 100644 index 00000000000..d59ec17b6c9 --- /dev/null +++ b/apps/sim/tools/quickbooks/create_bill.ts @@ -0,0 +1,136 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import { + buildQuickBooksCreateBillBody, + verifyQuickBooksBillLinks, +} from '@/tools/quickbooks/purchasing_utils' +import type { + QuickBooksCreateBillParams, + QuickBooksCreateBillResponse, + QuickBooksPurchasingTransaction, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_CREATE_BILL_LINK_OUTPUTS, + QUICKBOOKS_MUTATION_OUTPUTS, + QUICKBOOKS_PURCHASING_TRANSACTION_PROPERTIES, +} from '@/tools/quickbooks/types' +import { + addQuickBooksRequestId, + buildQuickBooksEntityUrl, + getQuickBooksToolHeaders, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksCreateBillTool: ToolConfig< + QuickBooksCreateBillParams, + QuickBooksCreateBillResponse +> = { + id: 'quickbooks_create_bill', + name: 'QuickBooks Create Bill', + description: 'Create a vendor bill with optional Purchase Order line links without paying it', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + vendorId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Bill vendor ID', + }, + lines: { + type: 'json', + required: true, + visibility: 'user-or-llm', + description: + 'Bounded account-based or item-based expense lines with optional paired Purchase Order and line IDs', + }, + apAccountId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional accounts-payable account ID', + }, + transactionDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Bill date in YYYY-MM-DD format', + }, + dueDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Bill due date in YYYY-MM-DD format', + }, + documentNumber: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional bill number', + }, + privateNote: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Internal bill note', + }, + requestId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional Intuit idempotency request ID, up to 50 characters', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (p) => + addQuickBooksRequestId(buildQuickBooksEntityUrl(p.realmId, 'bill'), p.requestId).toString(), + method: 'POST', + headers: (p) => getQuickBooksToolHeaders(p.accessToken, 'application/json'), + body: buildQuickBooksCreateBillBody, + retry: { enabled: false }, + }, + transformResponse: async (response, params) => { + if (!params) throw new Error('QuickBooks Create Bill parameters are required') + const transformed = await transformQuickBooksMutationResponse( + response, + 'Bill' + ) + return { + ...transformed, + output: { + ...transformed.output, + ...verifyQuickBooksBillLinks( + transformed.output.record, + params.lines, + transformed.output.recordId + ), + }, + } + }, + outputs: { + record: { + type: 'json', + description: 'Created native QuickBooks Bill', + properties: QUICKBOOKS_PURCHASING_TRANSACTION_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + ...QUICKBOOKS_CREATE_BILL_LINK_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/create_bill_payment.ts b/apps/sim/tools/quickbooks/create_bill_payment.ts new file mode 100644 index 00000000000..75e9521bed4 --- /dev/null +++ b/apps/sim/tools/quickbooks/create_bill_payment.ts @@ -0,0 +1,188 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import { buildQuickBooksCreateBillPaymentBody } from '@/tools/quickbooks/purchasing_utils' +import type { + QuickBooksAccount, + QuickBooksCreateBillPaymentParams, + QuickBooksMutationResponse, + QuickBooksPurchasingTransaction, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_MUTATION_OUTPUTS, + QUICKBOOKS_PURCHASING_TRANSACTION_PROPERTIES, +} from '@/tools/quickbooks/types' +import { + addQuickBooksRequestId, + buildQuickBooksEntityUrl, + getQuickBooksDirectExecutionError, + getQuickBooksToolHeaders, + transformQuickBooksEntityResponse, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import type { ToolConfig } from '@/tools/types' + +function assertCompatiblePaymentAccount( + account: QuickBooksAccount, + paymentType: QuickBooksCreateBillPaymentParams['paymentType'], + paymentAccountId: string +): void { + const accountId = account.Id.trim() + if (accountId !== paymentAccountId) { + throw new Error('QuickBooks returned a different payment account than requested') + } + if (account.Active === false) { + throw new Error('QuickBooks payment account is inactive. Select an active account.') + } + + const expectedAccountType = paymentType === 'check' ? 'Bank' : 'Credit Card' + if (account.AccountType !== expectedAccountType) { + throw new Error( + `${paymentType === 'check' ? 'Check' : 'Credit-card'} Bill Payments require a QuickBooks ${expectedAccountType} account. Account ${paymentAccountId} is ${account.AccountType || 'missing an account type'}.` + ) + } +} + +export const quickbooksCreateBillPaymentTool: ToolConfig< + QuickBooksCreateBillPaymentParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_create_bill_payment', + name: 'QuickBooks Create Bill Payment', + description: 'Record a check or credit-card payment allocated to one or more bills', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + vendorId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Vendor whose bills are being paid', + }, + totalAmount: { + type: 'number', + required: true, + visibility: 'user-or-llm', + description: 'Positive total payment amount', + }, + paymentType: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Check or credit-card payment type', + }, + paymentAccountId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Bank or credit-card account ID matching the payment type', + }, + billAllocations: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: + 'Optional bounded Bill-only allocations; any unallocated amount becomes vendor credit', + }, + transactionDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Payment date in YYYY-MM-DD format', + }, + privateNote: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Internal payment note', + }, + requestId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional Intuit idempotency request ID, up to 50 characters', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (p) => + addQuickBooksRequestId( + buildQuickBooksEntityUrl(p.realmId, 'billpayment'), + p.requestId + ).toString(), + method: 'POST', + headers: (p) => getQuickBooksToolHeaders(p.accessToken, 'application/json'), + body: buildQuickBooksCreateBillPaymentBody, + retry: { enabled: false }, + }, + directExecution: async (params, signal) => { + const body = buildQuickBooksCreateBillPaymentBody(params) + const paymentAccountId = params.paymentAccountId.trim() + if (!paymentAccountId) throw new Error('paymentAccountId is required') + + const accountResponse = await fetch( + buildQuickBooksEntityUrl(params.realmId, 'account', paymentAccountId), + { + method: 'GET', + headers: getQuickBooksToolHeaders(params.accessToken), + signal, + } + ) + if (!accountResponse.ok) { + throw await getQuickBooksDirectExecutionError(accountResponse, 'BillPayment', signal) + } + const { item: account } = await transformQuickBooksEntityResponse( + accountResponse, + 'Account', + signal + ) + assertCompatiblePaymentAccount(account, params.paymentType, paymentAccountId) + signal?.throwIfAborted() + + const paymentResponse = await fetch( + addQuickBooksRequestId( + buildQuickBooksEntityUrl(params.realmId, 'billpayment'), + params.requestId + ), + { + method: 'POST', + headers: getQuickBooksToolHeaders(params.accessToken, 'application/json'), + body: JSON.stringify(body), + signal, + } + ) + if (!paymentResponse.ok) { + throw await getQuickBooksDirectExecutionError(paymentResponse, 'BillPayment', signal) + } + return transformQuickBooksMutationResponse( + paymentResponse, + 'BillPayment', + undefined, + signal + ) + }, + transformResponse: (r) => + transformQuickBooksMutationResponse(r, 'BillPayment'), + outputs: { + record: { + type: 'json', + description: 'Created native QuickBooks BillPayment', + properties: QUICKBOOKS_PURCHASING_TRANSACTION_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/create_credit_memo.ts b/apps/sim/tools/quickbooks/create_credit_memo.ts new file mode 100644 index 00000000000..678dfd34b8d --- /dev/null +++ b/apps/sim/tools/quickbooks/create_credit_memo.ts @@ -0,0 +1,111 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import { buildQuickBooksCreateSalesDocumentBody } from '@/tools/quickbooks/sales_utils' +import type { + QuickBooksCreateCreditMemoParams, + QuickBooksMutationResponse, + QuickBooksSalesTransaction, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_MUTATION_OUTPUTS, + QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, +} from '@/tools/quickbooks/types' +import { + addQuickBooksRequestId, + buildQuickBooksEntityUrl, + getQuickBooksToolHeaders, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksCreateCreditMemoTool: ToolConfig< + QuickBooksCreateCreditMemoParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_create_credit_memo', + name: 'QuickBooks Create Credit Memo', + description: 'Create a customer credit memo with bounded sales lines', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + customerId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Customer receiving the credit memo', + }, + lines: { + type: 'json', + required: true, + visibility: 'user-or-llm', + description: 'Bounded item and description lines', + }, + transactionDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Credit memo date in YYYY-MM-DD format', + }, + documentNumber: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional credit memo number', + }, + privateNote: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Internal credit memo note', + }, + customerMemo: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Customer-facing credit memo memo', + }, + requestId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional Intuit idempotency request ID, up to 50 characters', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => + addQuickBooksRequestId( + buildQuickBooksEntityUrl(params.realmId, 'creditmemo'), + params.requestId + ).toString(), + method: 'POST', + headers: (params) => getQuickBooksToolHeaders(params.accessToken, 'application/json'), + body: (params) => buildQuickBooksCreateSalesDocumentBody(params), + retry: { enabled: false }, + }, + transformResponse: (response) => + transformQuickBooksMutationResponse(response, 'CreditMemo'), + outputs: { + record: { + type: 'json', + description: 'Created native QuickBooks CreditMemo', + properties: QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/create_customer.ts b/apps/sim/tools/quickbooks/create_customer.ts new file mode 100644 index 00000000000..dcc874d3c4c --- /dev/null +++ b/apps/sim/tools/quickbooks/create_customer.ts @@ -0,0 +1,152 @@ +import { filterUndefined } from '@sim/utils/object' +import { ErrorExtractorId } from '@/tools/error-extractors' +import type { + QuickBooksCreateCustomerParams, + QuickBooksCustomer, + QuickBooksMutationResponse, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_CUSTOMER_PROPERTIES, + QUICKBOOKS_MUTATION_OUTPUTS, +} from '@/tools/quickbooks/types' +import { + addQuickBooksRequestId, + buildQuickBooksEntityUrl, + getQuickBooksToolHeaders, + sanitizeQuickBooksCustomer, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import { + optionalQuickBooksString, + parseQuickBooksAddress, + quickBooksEmailAddress, + quickBooksPhoneNumber, + requiredQuickBooksString, +} from '@/tools/quickbooks/values' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksCreateCustomerTool: ToolConfig< + QuickBooksCreateCustomerParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_create_customer', + name: 'QuickBooks Create Customer', + description: 'Create a customer in the connected QuickBooks Online company', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + displayName: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Unique customer display name', + }, + companyName: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Customer company name', + }, + givenName: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Customer given name', + }, + familyName: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Customer family name', + }, + primaryEmail: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Customer primary email address', + }, + primaryPhone: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Customer primary phone number', + }, + billingAddress: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: 'Customer billing address', + }, + shippingAddress: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: 'Customer shipping address', + }, + taxable: { + type: 'boolean', + required: false, + visibility: 'user-or-llm', + description: 'Whether sales to this customer are taxable', + }, + requestId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional Intuit idempotency request ID, up to 50 characters', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => + addQuickBooksRequestId( + buildQuickBooksEntityUrl(params.realmId, 'customer'), + params.requestId + ).toString(), + method: 'POST', + headers: (params) => getQuickBooksToolHeaders(params.accessToken, 'application/json'), + body: (params) => + filterUndefined({ + DisplayName: requiredQuickBooksString(params.displayName, 'displayName'), + CompanyName: optionalQuickBooksString(params.companyName), + GivenName: optionalQuickBooksString(params.givenName), + FamilyName: optionalQuickBooksString(params.familyName), + PrimaryEmailAddr: quickBooksEmailAddress(params.primaryEmail), + PrimaryPhone: quickBooksPhoneNumber(params.primaryPhone), + BillAddr: parseQuickBooksAddress(params.billingAddress, 'billingAddress'), + ShipAddr: parseQuickBooksAddress(params.shippingAddress, 'shippingAddress'), + Taxable: params.taxable, + }), + retry: { enabled: false }, + }, + transformResponse: (response) => + transformQuickBooksMutationResponse( + response, + 'Customer', + sanitizeQuickBooksCustomer + ), + outputs: { + record: { + type: 'json', + description: 'Created QuickBooks Customer record', + properties: QUICKBOOKS_CUSTOMER_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/create_customer_payment.ts b/apps/sim/tools/quickbooks/create_customer_payment.ts new file mode 100644 index 00000000000..e7d88655108 --- /dev/null +++ b/apps/sim/tools/quickbooks/create_customer_payment.ts @@ -0,0 +1,123 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import { buildQuickBooksCreatePaymentBody } from '@/tools/quickbooks/sales_utils' +import type { + QuickBooksCreateCustomerPaymentParams, + QuickBooksMutationResponse, + QuickBooksSalesTransaction, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_MUTATION_OUTPUTS, + QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, +} from '@/tools/quickbooks/types' +import { + addQuickBooksRequestId, + buildQuickBooksEntityUrl, + getQuickBooksToolHeaders, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksCreateCustomerPaymentTool: ToolConfig< + QuickBooksCreateCustomerPaymentParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_create_customer_payment', + name: 'QuickBooks Create Customer Payment', + description: 'Record a customer payment with optional bounded invoice allocations', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + customerId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Customer making the payment', + }, + totalAmount: { + type: 'number', + required: true, + visibility: 'user-or-llm', + description: 'Positive total payment amount', + }, + transactionDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Payment date in YYYY-MM-DD format', + }, + privateNote: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Internal payment note', + }, + paymentReferenceNumber: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Payment reference number such as a check number', + }, + paymentMethodId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'QuickBooks payment method ID', + }, + depositAccountId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'QuickBooks deposit account ID', + }, + invoiceAllocations: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: 'Up to 100 invoice allocations with invoiceId and positive amount', + }, + requestId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional Intuit idempotency request ID, up to 50 characters', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => + addQuickBooksRequestId( + buildQuickBooksEntityUrl(params.realmId, 'payment'), + params.requestId + ).toString(), + method: 'POST', + headers: (params) => getQuickBooksToolHeaders(params.accessToken, 'application/json'), + body: (params) => buildQuickBooksCreatePaymentBody(params), + retry: { enabled: false }, + }, + transformResponse: (response) => + transformQuickBooksMutationResponse(response, 'Payment'), + outputs: { + record: { + type: 'json', + description: 'Created native QuickBooks Payment', + properties: QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/create_deposit.ts b/apps/sim/tools/quickbooks/create_deposit.ts new file mode 100644 index 00000000000..e79961e13d7 --- /dev/null +++ b/apps/sim/tools/quickbooks/create_deposit.ts @@ -0,0 +1,99 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import { buildQuickBooksCreateDepositBody } from '@/tools/quickbooks/accounting_utils' +import type { + QuickBooksAccountingTransaction, + QuickBooksCreateDepositParams, + QuickBooksMutationResponse, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_ACCOUNTING_TRANSACTION_PROPERTIES, + QUICKBOOKS_MUTATION_OUTPUTS, +} from '@/tools/quickbooks/types' +import { + addQuickBooksRequestId, + buildQuickBooksEntityUrl, + getQuickBooksToolHeaders, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksCreateDepositTool: ToolConfig< + QuickBooksCreateDepositParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_create_deposit', + name: 'QuickBooks Create Deposit', + description: 'Create a deposit with bounded account lines', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + depositAccountId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Bank or asset account receiving the deposit', + }, + lines: { + type: 'json', + required: true, + visibility: 'user-or-llm', + description: 'One to 100 account-based deposit lines', + }, + transactionDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Deposit date in YYYY-MM-DD format', + }, + privateNote: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Internal deposit note', + }, + requestId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional Intuit idempotency request ID, up to 50 characters', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (p) => + addQuickBooksRequestId( + buildQuickBooksEntityUrl(p.realmId, 'deposit'), + p.requestId + ).toString(), + method: 'POST', + headers: (p) => getQuickBooksToolHeaders(p.accessToken, 'application/json'), + body: buildQuickBooksCreateDepositBody, + retry: { enabled: false }, + }, + transformResponse: (r) => + transformQuickBooksMutationResponse(r, 'Deposit'), + outputs: { + record: { + type: 'json', + description: 'Created native QuickBooks Deposit', + properties: QUICKBOOKS_ACCOUNTING_TRANSACTION_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/create_employee.ts b/apps/sim/tools/quickbooks/create_employee.ts new file mode 100644 index 00000000000..5270acbbc61 --- /dev/null +++ b/apps/sim/tools/quickbooks/create_employee.ts @@ -0,0 +1,151 @@ +import { filterUndefined } from '@sim/utils/object' +import { ErrorExtractorId } from '@/tools/error-extractors' +import type { + QuickBooksCreateEmployeeParams, + QuickBooksEmployee, + QuickBooksMutationResponse, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_EMPLOYEE_PROPERTIES, + QUICKBOOKS_MUTATION_OUTPUTS, +} from '@/tools/quickbooks/types' +import { + addQuickBooksRequestId, + buildQuickBooksEntityUrl, + getQuickBooksToolHeaders, + sanitizeQuickBooksEmployee, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import { + optionalQuickBooksString, + parseQuickBooksAddress, + quickBooksEmailAddress, + quickBooksPhoneNumber, +} from '@/tools/quickbooks/values' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksCreateEmployeeTool: ToolConfig< + QuickBooksCreateEmployeeParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_create_employee', + name: 'QuickBooks Create Employee', + description: 'Create a non-payroll employee profile in the connected QuickBooks Online company', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + displayName: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: + 'Unique employee display name. When omitted QuickBooks derives it from the supplied name components, and it is read-only when QuickBooks Payroll is enabled', + }, + givenName: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Employee given name. At least one of givenName or familyName is required', + }, + familyName: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Employee family name. At least one of givenName or familyName is required', + }, + primaryEmail: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Employee primary email address', + }, + primaryPhone: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Employee primary phone number', + }, + primaryAddress: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: 'Employee primary address', + }, + printOnCheckName: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Employee name printed on checks', + }, + billableTime: { + type: 'boolean', + required: false, + visibility: 'user-or-llm', + description: 'Whether employee time is billable', + }, + requestId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional Intuit idempotency request ID, up to 50 characters', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => + addQuickBooksRequestId( + buildQuickBooksEntityUrl(params.realmId, 'employee'), + params.requestId + ).toString(), + method: 'POST', + headers: (params) => getQuickBooksToolHeaders(params.accessToken, 'application/json'), + body: (params) => { + const givenName = optionalQuickBooksString(params.givenName) + const familyName = optionalQuickBooksString(params.familyName) + if (givenName === undefined && familyName === undefined) { + throw new Error('At least one of givenName or familyName must be supplied') + } + return filterUndefined({ + DisplayName: optionalQuickBooksString(params.displayName), + GivenName: givenName, + FamilyName: familyName, + PrimaryEmailAddr: quickBooksEmailAddress(params.primaryEmail), + PrimaryPhone: quickBooksPhoneNumber(params.primaryPhone), + PrimaryAddr: parseQuickBooksAddress(params.primaryAddress, 'primaryAddress'), + PrintOnCheckName: optionalQuickBooksString(params.printOnCheckName), + BillableTime: params.billableTime, + }) + }, + retry: { enabled: false }, + }, + transformResponse: (response) => + transformQuickBooksMutationResponse( + response, + 'Employee', + sanitizeQuickBooksEmployee + ), + outputs: { + record: { + type: 'json', + description: 'Created QuickBooks Employee record', + properties: QUICKBOOKS_EMPLOYEE_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/create_estimate.ts b/apps/sim/tools/quickbooks/create_estimate.ts new file mode 100644 index 00000000000..b686645df26 --- /dev/null +++ b/apps/sim/tools/quickbooks/create_estimate.ts @@ -0,0 +1,117 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import { buildQuickBooksCreateSalesDocumentBody } from '@/tools/quickbooks/sales_utils' +import type { + QuickBooksCreateEstimateParams, + QuickBooksMutationResponse, + QuickBooksSalesTransaction, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_MUTATION_OUTPUTS, + QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, +} from '@/tools/quickbooks/types' +import { + addQuickBooksRequestId, + buildQuickBooksEntityUrl, + getQuickBooksToolHeaders, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksCreateEstimateTool: ToolConfig< + QuickBooksCreateEstimateParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_create_estimate', + name: 'QuickBooks Create Estimate', + description: 'Create an estimate with bounded item and description lines', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + customerId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Customer receiving the estimate', + }, + lines: { + type: 'json', + required: true, + visibility: 'user-or-llm', + description: 'Bounded item and description lines', + }, + transactionDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Estimate date in YYYY-MM-DD format', + }, + expirationDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Estimate expiration date in YYYY-MM-DD format', + }, + documentNumber: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional estimate number', + }, + privateNote: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Internal estimate note', + }, + customerMemo: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Customer-facing estimate memo', + }, + requestId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional Intuit idempotency request ID, up to 50 characters', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => + addQuickBooksRequestId( + buildQuickBooksEntityUrl(params.realmId, 'estimate'), + params.requestId + ).toString(), + method: 'POST', + headers: (params) => getQuickBooksToolHeaders(params.accessToken, 'application/json'), + body: (params) => buildQuickBooksCreateSalesDocumentBody(params), + retry: { enabled: false }, + }, + transformResponse: (response) => + transformQuickBooksMutationResponse(response, 'Estimate'), + outputs: { + record: { + type: 'json', + description: 'Created native QuickBooks Estimate', + properties: QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/create_invoice.ts b/apps/sim/tools/quickbooks/create_invoice.ts new file mode 100644 index 00000000000..fdfd0ea4021 --- /dev/null +++ b/apps/sim/tools/quickbooks/create_invoice.ts @@ -0,0 +1,117 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import { buildQuickBooksCreateSalesDocumentBody } from '@/tools/quickbooks/sales_utils' +import type { + QuickBooksCreateInvoiceParams, + QuickBooksMutationResponse, + QuickBooksSalesTransaction, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_MUTATION_OUTPUTS, + QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, +} from '@/tools/quickbooks/types' +import { + addQuickBooksRequestId, + buildQuickBooksEntityUrl, + getQuickBooksToolHeaders, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksCreateInvoiceTool: ToolConfig< + QuickBooksCreateInvoiceParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_create_invoice', + name: 'QuickBooks Create Invoice', + description: 'Create an invoice without emailing or collecting payment', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + customerId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Customer receiving the invoice', + }, + lines: { + type: 'json', + required: true, + visibility: 'user-or-llm', + description: 'Bounded item and description lines', + }, + transactionDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Invoice date in YYYY-MM-DD format', + }, + dueDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Invoice due date in YYYY-MM-DD format', + }, + documentNumber: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional invoice number', + }, + privateNote: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Internal invoice note', + }, + customerMemo: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Customer-facing invoice memo', + }, + requestId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional Intuit idempotency request ID, up to 50 characters', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => + addQuickBooksRequestId( + buildQuickBooksEntityUrl(params.realmId, 'invoice'), + params.requestId + ).toString(), + method: 'POST', + headers: (params) => getQuickBooksToolHeaders(params.accessToken, 'application/json'), + body: (params) => buildQuickBooksCreateSalesDocumentBody(params), + retry: { enabled: false }, + }, + transformResponse: (response) => + transformQuickBooksMutationResponse(response, 'Invoice'), + outputs: { + record: { + type: 'json', + description: 'Created native QuickBooks Invoice', + properties: QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/create_item.ts b/apps/sim/tools/quickbooks/create_item.ts new file mode 100644 index 00000000000..9c0d298ddb4 --- /dev/null +++ b/apps/sim/tools/quickbooks/create_item.ts @@ -0,0 +1,158 @@ +import { filterUndefined } from '@sim/utils/object' +import { ErrorExtractorId } from '@/tools/error-extractors' +import type { + QuickBooksCreateItemParams, + QuickBooksItem, + QuickBooksMutationResponse, +} from '@/tools/quickbooks/types' +import { QUICKBOOKS_ITEM_PROPERTIES, QUICKBOOKS_MUTATION_OUTPUTS } from '@/tools/quickbooks/types' +import { + addQuickBooksRequestId, + buildQuickBooksEntityUrl, + getQuickBooksToolHeaders, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import { + optionalQuickBooksString, + quickBooksReference, + quickBooksWritableItemType, + requiredQuickBooksString, + validateQuickBooksOptionalNumber, +} from '@/tools/quickbooks/values' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksCreateItemTool: ToolConfig< + QuickBooksCreateItemParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_create_item', + name: 'QuickBooks Create Item', + description: 'Create a Service or Non-inventory item in QuickBooks Online', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + name: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Unique item name', + }, + itemType: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Writable item type: service or non_inventory', + }, + incomeAccountId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: + 'Sales of Product Income account ID recording proceeds from the sale. Required for Service items, optional for Non-inventory items and for France locales', + }, + description: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Sales description', + }, + unitPrice: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: 'Sales price per unit', + }, + purchaseDescription: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Purchase description', + }, + purchaseCost: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: 'Purchase cost per unit', + }, + expenseAccountId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: + 'Cost of Goods Sold account ID used to pay the vendor for this item. Required for both Service and Non-inventory items, except in France locales where it is optional', + }, + taxable: { + type: 'boolean', + required: false, + visibility: 'user-or-llm', + description: 'Whether the item is taxable', + }, + requestId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional Intuit idempotency request ID, up to 50 characters', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => + addQuickBooksRequestId( + buildQuickBooksEntityUrl(params.realmId, 'item'), + params.requestId + ).toString(), + method: 'POST', + headers: (params) => getQuickBooksToolHeaders(params.accessToken, 'application/json'), + body: (params) => { + const type = quickBooksWritableItemType(params.itemType) + const incomeAccountId = optionalQuickBooksString(params.incomeAccountId) + if (type === 'Service' && incomeAccountId === undefined) { + throw new Error('incomeAccountId is required for Service items') + } + return filterUndefined({ + Name: requiredQuickBooksString(params.name, 'name'), + Type: type, + IncomeAccountRef: + incomeAccountId === undefined + ? undefined + : quickBooksReference(incomeAccountId, 'incomeAccountId'), + Description: optionalQuickBooksString(params.description), + UnitPrice: validateQuickBooksOptionalNumber(params.unitPrice, 'unitPrice'), + PurchaseDesc: optionalQuickBooksString(params.purchaseDescription), + PurchaseCost: validateQuickBooksOptionalNumber(params.purchaseCost, 'purchaseCost'), + ExpenseAccountRef: quickBooksReference( + requiredQuickBooksString(params.expenseAccountId ?? '', 'expenseAccountId'), + 'expenseAccountId' + ), + Taxable: params.taxable, + }) + }, + retry: { enabled: false }, + }, + transformResponse: (response) => + transformQuickBooksMutationResponse(response, 'Item'), + outputs: { + record: { + type: 'json', + description: 'Created QuickBooks Item record', + properties: QUICKBOOKS_ITEM_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/create_journal_entry.ts b/apps/sim/tools/quickbooks/create_journal_entry.ts new file mode 100644 index 00000000000..7e4d6bf7e23 --- /dev/null +++ b/apps/sim/tools/quickbooks/create_journal_entry.ts @@ -0,0 +1,105 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import { buildQuickBooksCreateJournalEntryBody } from '@/tools/quickbooks/accounting_utils' +import type { + QuickBooksAccountingTransaction, + QuickBooksCreateJournalEntryParams, + QuickBooksMutationResponse, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_ACCOUNTING_TRANSACTION_PROPERTIES, + QUICKBOOKS_MUTATION_OUTPUTS, +} from '@/tools/quickbooks/types' +import { + addQuickBooksRequestId, + buildQuickBooksEntityUrl, + getQuickBooksToolHeaders, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksCreateJournalEntryTool: ToolConfig< + QuickBooksCreateJournalEntryParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_create_journal_entry', + name: 'QuickBooks Create Journal Entry', + description: 'Post a balanced journal entry after explicit confirmation', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + lines: { + type: 'json', + required: true, + visibility: 'user-or-llm', + description: 'Two to 100 balanced debit and credit lines', + }, + confirmPosting: { + type: 'boolean', + required: true, + visibility: 'user-only', + description: 'Explicit confirmation that this journal entry should be posted', + }, + transactionDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Journal-entry date in YYYY-MM-DD format', + }, + documentNumber: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional journal-entry number', + }, + privateNote: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Internal journal-entry note', + }, + requestId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional Intuit idempotency request ID, up to 50 characters', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (p) => + addQuickBooksRequestId( + buildQuickBooksEntityUrl(p.realmId, 'journalentry'), + p.requestId + ).toString(), + method: 'POST', + headers: (p) => getQuickBooksToolHeaders(p.accessToken, 'application/json'), + body: buildQuickBooksCreateJournalEntryBody, + retry: { enabled: false }, + }, + transformResponse: (r) => + transformQuickBooksMutationResponse(r, 'JournalEntry'), + outputs: { + record: { + type: 'json', + description: 'Created native QuickBooks JournalEntry', + properties: QUICKBOOKS_ACCOUNTING_TRANSACTION_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/create_purchase.ts b/apps/sim/tools/quickbooks/create_purchase.ts new file mode 100644 index 00000000000..8b2b6f77fc0 --- /dev/null +++ b/apps/sim/tools/quickbooks/create_purchase.ts @@ -0,0 +1,118 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import { buildQuickBooksCreatePurchaseBody } from '@/tools/quickbooks/purchasing_utils' +import type { + QuickBooksCreatePurchaseParams, + QuickBooksMutationResponse, + QuickBooksPurchasingTransaction, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_MUTATION_OUTPUTS, + QUICKBOOKS_PURCHASING_TRANSACTION_PROPERTIES, +} from '@/tools/quickbooks/types' +import { + addQuickBooksRequestId, + buildQuickBooksEntityUrl, + getQuickBooksToolHeaders, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksCreatePurchaseTool: ToolConfig< + QuickBooksCreatePurchaseParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_create_purchase', + name: 'QuickBooks Create Purchase', + description: 'Record a cash, check, or credit-card purchase with bounded expense lines', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + paymentType: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Cash, check, or credit-card purchase type', + }, + paymentAccountId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Bank or credit-card account ID matching the purchase type', + }, + lines: { + type: 'json', + required: true, + visibility: 'user-or-llm', + description: 'Bounded account-based or item-based expense lines', + }, + vendorId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional vendor payee ID', + }, + transactionDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Purchase date in YYYY-MM-DD format', + }, + paymentReference: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: + 'Optional transaction reference number, such as a check number, sent as the purchase DocNumber', + }, + privateNote: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Internal purchase note', + }, + requestId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional Intuit idempotency request ID, up to 50 characters', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (p) => + addQuickBooksRequestId( + buildQuickBooksEntityUrl(p.realmId, 'purchase'), + p.requestId + ).toString(), + method: 'POST', + headers: (p) => getQuickBooksToolHeaders(p.accessToken, 'application/json'), + body: buildQuickBooksCreatePurchaseBody, + retry: { enabled: false }, + }, + transformResponse: (r) => + transformQuickBooksMutationResponse(r, 'Purchase'), + outputs: { + record: { + type: 'json', + description: 'Created native QuickBooks Purchase', + properties: QUICKBOOKS_PURCHASING_TRANSACTION_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/create_purchase_order.ts b/apps/sim/tools/quickbooks/create_purchase_order.ts new file mode 100644 index 00000000000..6ab0318b318 --- /dev/null +++ b/apps/sim/tools/quickbooks/create_purchase_order.ts @@ -0,0 +1,111 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import { buildQuickBooksCreatePurchaseOrderBody } from '@/tools/quickbooks/purchasing_utils' +import type { + QuickBooksCreatePurchaseOrderParams, + QuickBooksMutationResponse, + QuickBooksPurchasingTransaction, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_MUTATION_OUTPUTS, + QUICKBOOKS_PURCHASING_TRANSACTION_PROPERTIES, +} from '@/tools/quickbooks/types' +import { + addQuickBooksRequestId, + buildQuickBooksEntityUrl, + getQuickBooksToolHeaders, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksCreatePurchaseOrderTool: ToolConfig< + QuickBooksCreatePurchaseOrderParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_create_purchase_order', + name: 'QuickBooks Create Purchase Order', + description: 'Create a purchase order with bounded expense lines', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + vendorId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Purchase-order vendor ID', + }, + apAccountId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Accounts-payable account ID', + }, + lines: { + type: 'json', + required: true, + visibility: 'user-or-llm', + description: 'Bounded account-based or item-based expense lines', + }, + transactionDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Purchase-order date in YYYY-MM-DD format', + }, + documentNumber: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional purchase-order number', + }, + privateNote: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Internal purchase-order note', + }, + requestId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional Intuit idempotency request ID, up to 50 characters', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (p) => + addQuickBooksRequestId( + buildQuickBooksEntityUrl(p.realmId, 'purchaseorder'), + p.requestId + ).toString(), + method: 'POST', + headers: (p) => getQuickBooksToolHeaders(p.accessToken, 'application/json'), + body: buildQuickBooksCreatePurchaseOrderBody, + retry: { enabled: false }, + }, + transformResponse: (r) => + transformQuickBooksMutationResponse(r, 'PurchaseOrder'), + outputs: { + record: { + type: 'json', + description: 'Created native QuickBooks PurchaseOrder', + properties: QUICKBOOKS_PURCHASING_TRANSACTION_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/create_refund_receipt.ts b/apps/sim/tools/quickbooks/create_refund_receipt.ts new file mode 100644 index 00000000000..84fcd9550de --- /dev/null +++ b/apps/sim/tools/quickbooks/create_refund_receipt.ts @@ -0,0 +1,130 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import { buildQuickBooksCreateSalesDocumentBody } from '@/tools/quickbooks/sales_utils' +import type { + QuickBooksCreateRefundReceiptParams, + QuickBooksMutationResponse, + QuickBooksSalesTransaction, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_MUTATION_OUTPUTS, + QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, +} from '@/tools/quickbooks/types' +import { + addQuickBooksRequestId, + buildQuickBooksEntityUrl, + getQuickBooksToolHeaders, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksCreateRefundReceiptTool: ToolConfig< + QuickBooksCreateRefundReceiptParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_create_refund_receipt', + name: 'QuickBooks Create Refund Receipt', + description: 'Create a customer refund receipt against a required deposit account', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + customerId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Customer receiving the refund', + }, + lines: { + type: 'json', + required: true, + visibility: 'user-or-llm', + description: 'Bounded item and description lines', + }, + depositAccountId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'QuickBooks bank account funding the refund', + }, + transactionDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Refund receipt date in YYYY-MM-DD format', + }, + documentNumber: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional refund receipt number', + }, + privateNote: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Internal refund receipt note', + }, + customerMemo: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Customer-facing refund memo', + }, + paymentMethodId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'QuickBooks payment method ID', + }, + paymentReferenceNumber: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Refund payment reference number', + }, + requestId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional Intuit idempotency request ID, up to 50 characters', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => + addQuickBooksRequestId( + buildQuickBooksEntityUrl(params.realmId, 'refundreceipt'), + params.requestId + ).toString(), + method: 'POST', + headers: (params) => getQuickBooksToolHeaders(params.accessToken, 'application/json'), + body: (params) => + buildQuickBooksCreateSalesDocumentBody(params, { requireDepositAccount: true }), + retry: { enabled: false }, + }, + transformResponse: (response) => + transformQuickBooksMutationResponse(response, 'RefundReceipt'), + outputs: { + record: { + type: 'json', + description: 'Created native QuickBooks RefundReceipt', + properties: QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/create_sales_receipt.ts b/apps/sim/tools/quickbooks/create_sales_receipt.ts new file mode 100644 index 00000000000..41a480793f6 --- /dev/null +++ b/apps/sim/tools/quickbooks/create_sales_receipt.ts @@ -0,0 +1,129 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import { buildQuickBooksCreateSalesDocumentBody } from '@/tools/quickbooks/sales_utils' +import type { + QuickBooksCreateSalesReceiptParams, + QuickBooksMutationResponse, + QuickBooksSalesTransaction, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_MUTATION_OUTPUTS, + QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, +} from '@/tools/quickbooks/types' +import { + addQuickBooksRequestId, + buildQuickBooksEntityUrl, + getQuickBooksToolHeaders, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksCreateSalesReceiptTool: ToolConfig< + QuickBooksCreateSalesReceiptParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_create_sales_receipt', + name: 'QuickBooks Create Sales Receipt', + description: 'Create a sales receipt for a completed customer sale', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + customerId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Customer for the sales receipt', + }, + lines: { + type: 'json', + required: true, + visibility: 'user-or-llm', + description: 'Bounded item and description lines', + }, + transactionDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Sales receipt date in YYYY-MM-DD format', + }, + documentNumber: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional sales receipt number', + }, + privateNote: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Internal sales receipt note', + }, + customerMemo: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Customer-facing sales receipt memo', + }, + paymentMethodId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'QuickBooks payment method ID', + }, + paymentReferenceNumber: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Payment reference number', + }, + depositAccountId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'QuickBooks deposit account ID', + }, + requestId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional Intuit idempotency request ID, up to 50 characters', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => + addQuickBooksRequestId( + buildQuickBooksEntityUrl(params.realmId, 'salesreceipt'), + params.requestId + ).toString(), + method: 'POST', + headers: (params) => getQuickBooksToolHeaders(params.accessToken, 'application/json'), + body: (params) => buildQuickBooksCreateSalesDocumentBody(params), + retry: { enabled: false }, + }, + transformResponse: (response) => + transformQuickBooksMutationResponse(response, 'SalesReceipt'), + outputs: { + record: { + type: 'json', + description: 'Created native QuickBooks SalesReceipt', + properties: QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/create_vendor.ts b/apps/sim/tools/quickbooks/create_vendor.ts new file mode 100644 index 00000000000..5d5668cc0a9 --- /dev/null +++ b/apps/sim/tools/quickbooks/create_vendor.ts @@ -0,0 +1,156 @@ +import { filterUndefined } from '@sim/utils/object' +import { ErrorExtractorId } from '@/tools/error-extractors' +import type { + QuickBooksCreateVendorParams, + QuickBooksMutationResponse, + QuickBooksVendor, +} from '@/tools/quickbooks/types' +import { QUICKBOOKS_MUTATION_OUTPUTS, QUICKBOOKS_VENDOR_PROPERTIES } from '@/tools/quickbooks/types' +import { + addQuickBooksRequestId, + buildQuickBooksEntityUrl, + getQuickBooksToolHeaders, + sanitizeQuickBooksVendor, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import { + optionalQuickBooksString, + parseQuickBooksAddress, + quickBooksEmailAddress, + quickBooksPhoneNumber, + requiredQuickBooksString, +} from '@/tools/quickbooks/values' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksCreateVendorTool: ToolConfig< + QuickBooksCreateVendorParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_create_vendor', + name: 'QuickBooks Create Vendor', + description: 'Create a vendor in the connected QuickBooks Online company', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + displayName: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Unique vendor display name', + }, + companyName: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Vendor company name', + }, + givenName: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Vendor given name', + }, + familyName: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Vendor family name', + }, + primaryEmail: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Vendor primary email address', + }, + primaryPhone: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Vendor primary phone number', + }, + billingAddress: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: 'Vendor billing address', + }, + printOnCheckName: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Name to print on checks', + }, + accountNumber: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Vendor account number', + }, + vendor1099: { + type: 'boolean', + required: false, + visibility: 'user-or-llm', + description: 'Whether the vendor is tracked for 1099 reporting', + }, + requestId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional Intuit idempotency request ID, up to 50 characters', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => + addQuickBooksRequestId( + buildQuickBooksEntityUrl(params.realmId, 'vendor'), + params.requestId + ).toString(), + method: 'POST', + headers: (params) => getQuickBooksToolHeaders(params.accessToken, 'application/json'), + body: (params) => + filterUndefined({ + DisplayName: requiredQuickBooksString(params.displayName, 'displayName'), + CompanyName: optionalQuickBooksString(params.companyName), + GivenName: optionalQuickBooksString(params.givenName), + FamilyName: optionalQuickBooksString(params.familyName), + PrimaryEmailAddr: quickBooksEmailAddress(params.primaryEmail), + PrimaryPhone: quickBooksPhoneNumber(params.primaryPhone), + BillAddr: parseQuickBooksAddress(params.billingAddress, 'billingAddress'), + PrintOnCheckName: optionalQuickBooksString(params.printOnCheckName), + AcctNum: optionalQuickBooksString(params.accountNumber), + Vendor1099: params.vendor1099, + }), + retry: { enabled: false }, + }, + transformResponse: (response) => + transformQuickBooksMutationResponse( + response, + 'Vendor', + sanitizeQuickBooksVendor + ), + outputs: { + record: { + type: 'json', + description: 'Created QuickBooks Vendor record', + properties: QUICKBOOKS_VENDOR_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/create_vendor_credit.ts b/apps/sim/tools/quickbooks/create_vendor_credit.ts new file mode 100644 index 00000000000..7b4a1d6d00f --- /dev/null +++ b/apps/sim/tools/quickbooks/create_vendor_credit.ts @@ -0,0 +1,111 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import { buildQuickBooksCreateVendorCreditBody } from '@/tools/quickbooks/purchasing_utils' +import type { + QuickBooksCreateVendorCreditParams, + QuickBooksMutationResponse, + QuickBooksPurchasingTransaction, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_MUTATION_OUTPUTS, + QUICKBOOKS_PURCHASING_TRANSACTION_PROPERTIES, +} from '@/tools/quickbooks/types' +import { + addQuickBooksRequestId, + buildQuickBooksEntityUrl, + getQuickBooksToolHeaders, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksCreateVendorCreditTool: ToolConfig< + QuickBooksCreateVendorCreditParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_create_vendor_credit', + name: 'QuickBooks Create Vendor Credit', + description: 'Create a vendor credit without applying it to a bill', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + vendorId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Vendor issuing the credit', + }, + lines: { + type: 'json', + required: true, + visibility: 'user-or-llm', + description: 'Bounded account-based or item-based expense lines', + }, + apAccountId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional accounts-payable account ID', + }, + transactionDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Credit date in YYYY-MM-DD format', + }, + documentNumber: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional vendor-credit number', + }, + privateNote: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Internal vendor-credit note', + }, + requestId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional Intuit idempotency request ID, up to 50 characters', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (p) => + addQuickBooksRequestId( + buildQuickBooksEntityUrl(p.realmId, 'vendorcredit'), + p.requestId + ).toString(), + method: 'POST', + headers: (p) => getQuickBooksToolHeaders(p.accessToken, 'application/json'), + body: buildQuickBooksCreateVendorCreditBody, + retry: { enabled: false }, + }, + transformResponse: (r) => + transformQuickBooksMutationResponse(r, 'VendorCredit'), + outputs: { + record: { + type: 'json', + description: 'Created native QuickBooks VendorCredit', + properties: QUICKBOOKS_PURCHASING_TRANSACTION_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/documents_utils.ts b/apps/sim/tools/quickbooks/documents_utils.ts new file mode 100644 index 00000000000..7c9d2616a5a --- /dev/null +++ b/apps/sim/tools/quickbooks/documents_utils.ts @@ -0,0 +1,352 @@ +import { readResponseTextWithLimit } from '@/lib/core/utils/stream-limits' +import type { RawFileInput } from '@/lib/uploads/utils/file-schemas' +import { QUICKBOOKS_MAX_RESPONSE_BYTES } from '@/tools/quickbooks/client' +import { formatQuickBooksFaultDetail, sanitizeQuickBooksFaultData } from '@/tools/quickbooks/fault' +import type { + QuickBooksAttachable, + QuickBooksAttachmentTargetType, + QuickBooksDocumentTransactionType, +} from '@/tools/quickbooks/types' +import { parseQuickBooksJson } from '@/tools/quickbooks/utils' +import { requiredQuickBooksString } from '@/tools/quickbooks/values' + +export const QUICKBOOKS_DOCUMENT_TRANSACTIONS = { + credit_memo: { entity: 'CreditMemo', resource: 'creditmemo' }, + estimate: { entity: 'Estimate', resource: 'estimate' }, + invoice: { entity: 'Invoice', resource: 'invoice' }, + payment: { entity: 'Payment', resource: 'payment' }, + purchase_order: { entity: 'PurchaseOrder', resource: 'purchaseorder' }, + refund_receipt: { entity: 'RefundReceipt', resource: 'refundreceipt' }, + sales_receipt: { entity: 'SalesReceipt', resource: 'salesreceipt' }, +} as const satisfies Record + +export const QUICKBOOKS_ATTACHMENT_TARGETS = { + bill: { entityType: 'Bill' }, + credit_memo: { entityType: 'CreditMemo' }, + customer: { entityType: 'Customer' }, + estimate: { entityType: 'Estimate' }, + invoice: { entityType: 'Invoice' }, + payment: { entityType: 'Payment' }, + purchase: { entityType: 'Purchase' }, + refund_receipt: { entityType: 'RefundReceipt' }, + sales_receipt: { entityType: 'SalesReceipt' }, + vendor: { entityType: 'Vendor' }, + vendor_credit: { entityType: 'VendorCredit' }, +} as const satisfies Record + +/** + * Sim caps a single QuickBooks attachment at the 20 MB limit Intuit documents + * for files entering QuickBooks document workflows. + * @see https://quickbooks.intuit.com/learn-support/en-us/help-article/accounts-payable/email-receipts-bills-quickbooks-online/L7r2LAQ7C_US_en_US + */ +export const QUICKBOOKS_MAX_ATTACHMENT_BYTES = 20 * 1024 * 1024 + +/** Wall-clock ceiling for Intuit document calls that move no file bytes. */ +export const QUICKBOOKS_DOCUMENT_METADATA_TIMEOUT_MS = 15_000 + +/** Wall-clock ceiling for Intuit document calls that stream attachment bytes. */ +export const QUICKBOOKS_DOCUMENT_TRANSFER_TIMEOUT_MS = 60_000 + +/** + * Bounds an outbound Intuit call by both client disconnect and a wall-clock + * timeout so a stalled connection cannot pin a handler and its buffered file. + */ +export function quickBooksDocumentSignal(signal: AbortSignal, timeoutMs: number): AbortSignal { + return AbortSignal.any([signal, AbortSignal.timeout(timeoutMs)]) +} + +const QUICKBOOKS_OCTET_STREAM = 'application/octet-stream' + +interface QuickBooksFileType { + /** Content type sent to Intuit for this extension. */ + canonical: string + /** Content types tolerated from browser-supplied stored-file metadata. */ + accepted: readonly string[] +} + +/** + * Extension allowlist for QuickBooks attachments. Intuit publishes accepted + * extensions but not MIME types, so each entry tolerates the common aliases a + * browser or operating system may report and normalizes them to one canonical + * content type before upload. + */ +const QUICKBOOKS_FILE_TYPES: Record = { + csv: { + canonical: 'text/csv', + accepted: [ + 'text/csv', + 'application/csv', + 'text/plain', + 'application/vnd.ms-excel', + QUICKBOOKS_OCTET_STREAM, + ], + }, + doc: { + canonical: 'application/msword', + accepted: ['application/msword', 'application/vnd.ms-word', QUICKBOOKS_OCTET_STREAM], + }, + gif: { canonical: 'image/gif', accepted: ['image/gif'] }, + jpeg: { canonical: 'image/jpeg', accepted: ['image/jpeg', 'image/jpg', 'image/pjpeg'] }, + jpg: { canonical: 'image/jpeg', accepted: ['image/jpeg', 'image/jpg', 'image/pjpeg'] }, + pdf: { + canonical: 'application/pdf', + accepted: ['application/pdf', 'application/x-pdf', QUICKBOOKS_OCTET_STREAM], + }, + png: { canonical: 'image/png', accepted: ['image/png', 'image/x-png'] }, + tif: { + canonical: 'image/tiff', + accepted: ['image/tiff', 'image/tif', 'image/x-tiff', QUICKBOOKS_OCTET_STREAM], + }, + tiff: { + canonical: 'image/tiff', + accepted: ['image/tiff', 'image/tif', 'image/x-tiff', QUICKBOOKS_OCTET_STREAM], + }, + xlsx: { + canonical: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + accepted: [ + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'application/vnd.ms-excel', + QUICKBOOKS_OCTET_STREAM, + ], + }, + xml: { + canonical: 'text/xml', + accepted: ['text/xml', 'application/xml', QUICKBOOKS_OCTET_STREAM], + }, +} + +export function getQuickBooksDocumentTransaction(type: QuickBooksDocumentTransactionType) { + const config = QUICKBOOKS_DOCUMENT_TRANSACTIONS[type] + if (!config) throw new Error(`Unsupported QuickBooks document transaction type: ${String(type)}`) + return config +} + +export function getQuickBooksAttachmentTarget(type: QuickBooksAttachmentTargetType) { + const config = QUICKBOOKS_ATTACHMENT_TARGETS[type] + if (!config) throw new Error(`Unsupported QuickBooks attachment target type: ${String(type)}`) + return config +} + +export function validateQuickBooksRecipient(recipient?: string): string | undefined { + if (recipient === undefined) return undefined + const normalized = recipient.trim() + if (!normalized) return undefined + if (/[,;\r\n]/.test(normalized) || !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(normalized)) { + throw new Error('recipient must be one valid email address') + } + return normalized +} + +const QUICKBOOKS_MAX_FILE_NAME_LENGTH = 180 + +/** + * Bounds a filename without destroying its extension. Truncating the whole + * string cuts a long name mid-extension and leaves the file looking + * extensionless, which every downstream QuickBooks type check then rejects. + */ +function boundQuickBooksFileName(name: string): string { + if (name.length <= QUICKBOOKS_MAX_FILE_NAME_LENGTH) return name + const dotIndex = name.lastIndexOf('.') + if (dotIndex > 0 && dotIndex < name.length - 1) { + const extension = name.slice(dotIndex) + const base = name.slice(0, QUICKBOOKS_MAX_FILE_NAME_LENGTH - extension.length).trimEnd() + if (base) return `${base}${extension}` + } + return name.slice(0, QUICKBOOKS_MAX_FILE_NAME_LENGTH) +} + +/** + * Reduces a candidate to one safe filename leaf bounded to the contract's + * length. Letters and digits in any script survive; path separators, control + * characters, and every other character collapse to underscores. + */ +export function sanitizeQuickBooksFileName(value: string | undefined, fallback: string): string { + const sanitize = (candidate: string): string | undefined => { + const leaf = candidate.trim().split(/[\\/]/).pop() ?? '' + const cleaned = leaf + .replace(/[\u0000-\u001f\u007f]/g, '') + .replace(/[^\p{L}\p{N}._()\- ]/gu, '_') + .trim() + const bounded = boundQuickBooksFileName(cleaned) + return bounded && bounded !== '.' && bounded !== '..' ? bounded : undefined + } + + return (value ? sanitize(value) : undefined) ?? sanitize(fallback) ?? 'quickbooks-file' +} + +function getQuickBooksFileExtension(fileName: string): string { + return fileName.split('.').pop()?.toLowerCase() ?? '' +} + +/** + * Rejects unsupported extensions before any file bytes are read, so an + * unattachable file never costs a full storage download. + */ +export function assertQuickBooksAttachmentExtension(fileName: string): void { + const extension = getQuickBooksFileExtension(fileName) + if (!QUICKBOOKS_FILE_TYPES[extension]) { + throw new Error( + `QuickBooks does not support ${extension ? `the ${extension}` : 'an extensionless'} file type` + ) + } +} + +/** + * Validates an extension/MIME pair and returns the canonical content type that + * QuickBooks should record for that extension. + */ +export function validateQuickBooksAttachmentFileType(fileName: string, mimeType: string): string { + const extension = getQuickBooksFileExtension(fileName) + const normalizedMime = mimeType.split(';', 1)[0].trim().toLowerCase() + const fileType = QUICKBOOKS_FILE_TYPES[extension] + if (!fileType || !fileType.accepted.includes(normalizedMime)) { + throw new Error( + `QuickBooks does not support the ${extension || 'extensionless'} / ${normalizedMime || 'unknown'} file type combination` + ) + } + return fileType.canonical +} + +export function escapeQuickBooksQueryLiteral(value: string, fieldName: string): string { + return requiredQuickBooksString(value, fieldName).replace(/\\/g, '\\\\').replace(/'/g, "\\'") +} + +export interface QuickBooksAttachableEnvelope { + Attachable?: QuickBooksAttachable + AttachableResponse?: Array<{ + Attachable?: QuickBooksAttachable + Fault?: unknown + time?: string + }> + time?: string +} + +/** + * Removes Intuit-managed attachment URLs before records enter tool outputs or execution logs. + * These URLs can be short-lived capability links and are not needed by callers because file + * downloads go through the authenticated Download Attachment operation. + */ +export function sanitizeQuickBooksAttachable( + attachment: QuickBooksAttachable +): QuickBooksAttachable { + const { + FileAccessUri: _fileAccessUri, + TempDownloadUri: _tempDownloadUri, + TemporaryDownloadUri: _temporaryDownloadUri, + ThumbnailFileAccessUri: _thumbnailFileAccessUri, + ThumbnailTempDownloadUri: _thumbnailTempDownloadUri, + ...safeAttachment + } = attachment + return safeAttachment as QuickBooksAttachable +} + +export async function parseQuickBooksAttachableResponse( + response: Response, + signal?: AbortSignal +): Promise<{ attachment: QuickBooksAttachable; time: string | null }> { + const data = await parseQuickBooksJson( + response, + 'QuickBooks Attachable response', + signal + ) + const nestedFault = data.AttachableResponse?.find((entry) => entry.Fault)?.Fault + const sanitizedFault = sanitizeQuickBooksFaultData({ Fault: nestedFault }) + if (sanitizedFault) { + throw new Error( + `QuickBooks attachment upload failed: ${formatQuickBooksFaultDetail(sanitizedFault)}` + ) + } + const attachment = data.Attachable ?? data.AttachableResponse?.[0]?.Attachable + if (!attachment || typeof attachment !== 'object' || Array.isArray(attachment)) { + throw new Error('QuickBooks Attachable response is missing a valid attachment') + } + if (typeof attachment.Id !== 'string' || !attachment.Id.trim()) { + throw new Error('QuickBooks Attachable response is missing a valid attachment ID') + } + const responseTime = data.time ?? data.AttachableResponse?.[0]?.time + return { + attachment: sanitizeQuickBooksAttachable(attachment), + time: typeof responseTime === 'string' ? responseTime : null, + } +} + +export function buildQuickBooksAttachableMetadata( + targetType: QuickBooksAttachmentTargetType, + targetId: string, + options: { fileName?: string; contentType?: string; description?: string; note?: string } +) { + const target = getQuickBooksAttachmentTarget(targetType) + return { + AttachableRef: [ + { + EntityRef: { + type: target.entityType, + value: requiredQuickBooksString(targetId, 'targetId'), + }, + }, + ], + ...(options.fileName ? { FileName: options.fileName } : {}), + ...(options.contentType ? { ContentType: options.contentType } : {}), + ...(options.description ? { Note: options.description } : {}), + ...(options.note ? { Note: options.note } : {}), + } +} + +export function assertSingleQuickBooksFile(file: RawFileInput | undefined): RawFileInput { + if (!file || typeof file !== 'object' || Array.isArray(file)) { + throw new Error('Exactly one file is required for a QuickBooks file attachment') + } + return file +} + +export const QUICKBOOKS_TEMP_URL_MAX_BYTES = 64 * 1024 +export const QUICKBOOKS_DOCUMENT_JSON_MAX_BYTES = QUICKBOOKS_MAX_RESPONSE_BYTES + +export async function getQuickBooksDocumentError( + response: Response, + signal?: AbortSignal +): Promise { + let detail = '' + try { + const text = await readResponseTextWithLimit(response, { + maxBytes: QUICKBOOKS_TEMP_URL_MAX_BYTES, + label: 'QuickBooks document error response', + signal, + }) + if (text) { + try { + const fault = sanitizeQuickBooksFaultData(JSON.parse(text)) + if (fault) detail = formatQuickBooksFaultDetail(fault) + } catch { + // Empty, plain-text, and HTML gateway errors intentionally remain opaque. + } + } + } catch { + detail = 'The error response exceeded the safe size limit.' + } + + const guidance = + response.status === 401 + ? 'Reconnect the QuickBooks credential.' + : response.status === 403 + ? 'Confirm the QuickBooks accounting scope and access to this company.' + : response.status === 429 + ? 'QuickBooks rate limit reached; retry after the indicated delay.' + : '' + const trackingId = + response.headers.get('intuit_tid') ?? + response.headers.get('intuit-tid') ?? + response.headers.get('x-request-id') + const retryAfter = response.status === 429 ? response.headers.get('retry-after') : null + return new Error( + [ + `QuickBooks request failed with HTTP ${response.status}.`, + guidance, + detail, + trackingId ? `(Intuit tracking ID: ${trackingId})` : '', + retryAfter ? `(Retry-After: ${retryAfter})` : '', + ] + .filter(Boolean) + .join(' ') + ) +} diff --git a/apps/sim/tools/quickbooks/download_attachment.ts b/apps/sim/tools/quickbooks/download_attachment.ts new file mode 100644 index 00000000000..8a941020fcc --- /dev/null +++ b/apps/sim/tools/quickbooks/download_attachment.ts @@ -0,0 +1,66 @@ +import type { + QuickBooksDownloadAttachmentParams, + QuickBooksFileResponse, +} from '@/tools/quickbooks/types' +import { QUICKBOOKS_FILE_OUTPUTS } from '@/tools/quickbooks/types' +import type { InternalToolConfig } from '@/tools/types' + +export const quickbooksDownloadAttachmentTool: InternalToolConfig< + QuickBooksDownloadAttachmentParams, + QuickBooksFileResponse +> = { + id: 'quickbooks_download_attachment', + name: 'QuickBooks Download Attachment', + description: 'Download a QuickBooks file attachment as a stored Sim file', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + attachmentId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'QuickBooks attachment ID', + }, + fileName: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional safe filename override', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + operation: { + input: (params) => ({ + accessToken: params.accessToken, + realmId: params.realmId, + attachmentId: params.attachmentId, + fileName: params.fileName, + }), + }, + transformResponse: async (response) => { + const data = (await response.json()) as QuickBooksFileResponse & { error?: string } + if (!response.ok || data.success === false) { + throw new Error(data.error || 'Failed to download QuickBooks attachment') + } + return data + }, + outputs: { + ...QUICKBOOKS_FILE_OUTPUTS, + attachmentId: { type: 'string', description: 'Downloaded QuickBooks attachment ID' }, + }, +} diff --git a/apps/sim/tools/quickbooks/download_transaction_pdf.ts b/apps/sim/tools/quickbooks/download_transaction_pdf.ts new file mode 100644 index 00000000000..859efee9273 --- /dev/null +++ b/apps/sim/tools/quickbooks/download_transaction_pdf.ts @@ -0,0 +1,74 @@ +import type { + QuickBooksDownloadTransactionPdfParams, + QuickBooksFileResponse, +} from '@/tools/quickbooks/types' +import { QUICKBOOKS_FILE_OUTPUTS } from '@/tools/quickbooks/types' +import type { InternalToolConfig } from '@/tools/types' + +export const quickbooksDownloadTransactionPdfTool: InternalToolConfig< + QuickBooksDownloadTransactionPdfParams, + QuickBooksFileResponse +> = { + id: 'quickbooks_download_transaction_pdf', + name: 'QuickBooks Download Transaction PDF', + description: 'Download a supported QuickBooks transaction as a bounded PDF file', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + transactionType: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Supported transaction type to download', + }, + transactionId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'QuickBooks transaction ID', + }, + fileName: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Optional safe PDF filename override', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + operation: { + input: (params) => ({ + accessToken: params.accessToken, + realmId: params.realmId, + transactionType: params.transactionType, + transactionId: params.transactionId, + fileName: params.fileName, + }), + }, + transformResponse: async (response) => { + const data = (await response.json()) as QuickBooksFileResponse & { error?: string } + if (!response.ok || data.success === false) { + throw new Error(data.error || 'Failed to download QuickBooks transaction PDF') + } + return data + }, + outputs: { + ...QUICKBOOKS_FILE_OUTPUTS, + transactionType: { type: 'string', description: 'Downloaded QuickBooks transaction type' }, + transactionId: { type: 'string', description: 'Downloaded QuickBooks transaction ID' }, + }, +} diff --git a/apps/sim/tools/quickbooks/email_transaction.ts b/apps/sim/tools/quickbooks/email_transaction.ts new file mode 100644 index 00000000000..93b86261ebf --- /dev/null +++ b/apps/sim/tools/quickbooks/email_transaction.ts @@ -0,0 +1,138 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import { buildQuickBooksCompanyUrl, buildQuickBooksHeaders } from '@/tools/quickbooks/client' +import { + getQuickBooksDocumentTransaction, + validateQuickBooksRecipient, +} from '@/tools/quickbooks/documents_utils' +import type { + QuickBooksEmailTransactionParams, + QuickBooksEmailTransactionResponse, + QuickBooksTransaction, +} from '@/tools/quickbooks/types' +import { QUICKBOOKS_EMAILABLE_TRANSACTION_PROPERTIES } from '@/tools/quickbooks/types' +import { parseQuickBooksJson } from '@/tools/quickbooks/utils' +import { requiredQuickBooksString } from '@/tools/quickbooks/values' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksEmailTransactionTool: ToolConfig< + QuickBooksEmailTransactionParams, + QuickBooksEmailTransactionResponse +> = { + id: 'quickbooks_email_transaction', + name: 'QuickBooks Email Transaction', + description: + 'Send a supported QuickBooks transaction by email. This causes an external email and Intuit limits sandbox email delivery.', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + transactionType: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Supported transaction type to email', + }, + transactionId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'QuickBooks transaction ID', + }, + recipient: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: + 'Required for Customer Payments; otherwise an optional single recipient override', + }, + confirmSend: { + type: 'boolean', + required: true, + visibility: 'user-only', + description: 'Explicit confirmation that an external email should be sent', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => { + if (params.confirmSend !== true) + throw new Error('Confirm sending before emailing a QuickBooks transaction') + const { resource } = getQuickBooksDocumentTransaction(params.transactionType) + const id = requiredQuickBooksString(params.transactionId, 'transactionId') + const recipient = validateQuickBooksRecipient(params.recipient) + if (params.transactionType === 'payment' && !recipient) { + throw new Error('recipient is required when emailing a QuickBooks Customer Payment') + } + const url = buildQuickBooksCompanyUrl( + params.realmId, + `${resource}/${encodeURIComponent(id)}/send` + ) + if (recipient) url.searchParams.set('sendTo', recipient) + return url.toString() + }, + method: 'POST', + headers: (params) => ({ + ...buildQuickBooksHeaders(params.accessToken), + 'Content-Type': 'application/octet-stream', + }), + retry: { enabled: false }, + }, + transformResponse: async (response, params) => { + if (!params) throw new Error('QuickBooks Email Transaction parameters are required') + const { entity } = getQuickBooksDocumentTransaction(params.transactionType) + const data = await parseQuickBooksJson & { time?: string }>( + response, + `QuickBooks ${entity} email response` + ) + const record = data[entity] + if (!record || typeof record !== 'object' || Array.isArray(record)) { + throw new Error(`QuickBooks ${entity} email response is missing a valid ${entity}`) + } + const transactionId = requiredQuickBooksString(params.transactionId, 'transactionId') + if ((record as { Id?: unknown }).Id !== transactionId) { + throw new Error(`QuickBooks ${entity} email response returned an unexpected transaction ID`) + } + return { + success: true, + output: { + transactionType: params.transactionType, + transactionId, + sent: true, + record: record as QuickBooksTransaction, + time: typeof data.time === 'string' ? data.time : null, + }, + } + }, + outputs: { + transactionType: { type: 'string', description: 'Emailed QuickBooks transaction type' }, + transactionId: { type: 'string', description: 'Emailed QuickBooks transaction ID' }, + sent: { type: 'boolean', description: 'Whether QuickBooks accepted the email send request' }, + record: { + type: 'json', + description: 'Native QuickBooks transaction returned after sending', + optional: true, + properties: QUICKBOOKS_EMAILABLE_TRANSACTION_PROPERTIES, + }, + time: { + type: 'string', + description: 'QuickBooks response timestamp', + optional: true, + nullable: true, + }, + }, +} diff --git a/apps/sim/tools/quickbooks/fault.test.ts b/apps/sim/tools/quickbooks/fault.test.ts new file mode 100644 index 00000000000..1bc99a0a0f1 --- /dev/null +++ b/apps/sim/tools/quickbooks/fault.test.ts @@ -0,0 +1,65 @@ +/** + * @vitest-environment node + */ +import { describe, expect, it } from 'vitest' +import { formatQuickBooksFaultDetail, sanitizeQuickBooksFaultData } from '@/tools/quickbooks/fault' + +describe('QuickBooks fault handling', () => { + it('retains only documented fields and bounds remote error content', () => { + const fault = sanitizeQuickBooksFaultData({ + Fault: { + Error: Array.from({ length: 7 }, (_, index) => ({ + code: String(index), + Message: `message-${index}`, + Detail: 'x'.repeat(600), + injected: 'must not escape', + })), + }, + }) + + expect(fault?.Fault.Error).toHaveLength(5) + expect(fault?.Fault.omittedErrorCount).toBe(2) + expect(fault?.Fault.Error[0]).not.toHaveProperty('injected') + expect(fault?.Fault.Error[0].Detail).toHaveLength(500) + }) + + it('preserves omission counts across repeated sanitization', () => { + const first = sanitizeQuickBooksFaultData({ + Fault: { + Error: Array.from({ length: 6 }, (_, index) => ({ + Message: `error-${index}`, + })), + }, + }) + const second = sanitizeQuickBooksFaultData(first) + + expect(second?.Fault.omittedErrorCount).toBe(1) + }) + + it('adds actionable stale SyncToken guidance', () => { + const fault = sanitizeQuickBooksFaultData({ + Fault: { + Error: [ + { + code: '5010', + Message: 'Stale Object Error', + Detail: 'You and another user were working on this at the same time.', + element: 'SyncToken', + }, + ], + }, + }) + + expect(fault).not.toBeNull() + expect(formatQuickBooksFaultDetail(fault!)).toContain( + 'Re-read the record to obtain its current SyncToken, then retry the write.' + ) + }) + + it.each([null, [], {}, { Fault: {} }, { Fault: { Error: [] } }])( + 'does not claim malformed fault payloads: %j', + (payload) => { + expect(sanitizeQuickBooksFaultData(payload)).toBeNull() + } + ) +}) diff --git a/apps/sim/tools/quickbooks/fault.ts b/apps/sim/tools/quickbooks/fault.ts new file mode 100644 index 00000000000..fc79c5fe3e9 --- /dev/null +++ b/apps/sim/tools/quickbooks/fault.ts @@ -0,0 +1,119 @@ +import { truncate } from '@sim/utils/string' + +/** + * Maximum number of `Fault.Error` entries retained from a QuickBooks response. + * Intuit does not bound the array, so an unbounded concatenation would let a + * remote response dictate the size of the thrown error message. + */ +const QUICKBOOKS_MAX_FAULT_ERRORS = 5 + +/** Maximum retained length of any single sanitized fault field. */ +const QUICKBOOKS_MAX_FAULT_FIELD_CHARS = 500 + +/** Documented Intuit fault fields retained during sanitization. */ +const QUICKBOOKS_FAULT_FIELDS = ['code', 'Message', 'Detail', 'element'] as const + +/** + * Intuit error code and message for an outdated `SyncToken`. + * @see Fault sample `{"Message": "Stale Object Error", "code": "5010"}` + */ +const QUICKBOOKS_STALE_OBJECT_CODE = '5010' +const QUICKBOOKS_STALE_OBJECT_MESSAGE = 'stale object error' + +const QUICKBOOKS_STALE_OBJECT_GUIDANCE = + 'Re-read the record to obtain its current SyncToken, then retry the write.' + +export interface SanitizedQuickBooksFault { + Fault: { + Error: Array> + /** + * Count of `Error` entries dropped by {@link QUICKBOOKS_MAX_FAULT_ERRORS}. + * Preserved across repeated sanitization so a value that round-trips + * through an error payload does not lose or double-count omissions. + */ + omittedErrorCount?: number + } +} + +/** + * Extracts the documented Intuit fault fields from an arbitrary response body, + * discarding everything else so unvetted remote content never reaches an error + * message. Entry count and per-field length are both bounded. + * + * Returns `null` when `data` carries no usable fault, which callers treat as + * "this response is not a fault". + */ +export function sanitizeQuickBooksFaultData(data: unknown): SanitizedQuickBooksFault | null { + if (!data || typeof data !== 'object' || Array.isArray(data)) return null + const fault = (data as Record).Fault + if (!fault || typeof fault !== 'object' || Array.isArray(fault)) return null + const errors = (fault as Record).Error + if (!Array.isArray(errors)) return null + + const sanitizedErrors = errors.flatMap((entry) => { + if (!entry || typeof entry !== 'object' || Array.isArray(entry)) return [] + const value = entry as Record + const sanitized = Object.fromEntries( + QUICKBOOKS_FAULT_FIELDS.flatMap((key) => { + const field = typeof value[key] === 'string' ? value[key].trim() : '' + return field ? [[key, truncate(field, QUICKBOOKS_MAX_FAULT_FIELD_CHARS, '')]] : [] + }) + ) + return Object.keys(sanitized).length > 0 ? [sanitized] : [] + }) + if (sanitizedErrors.length === 0) return null + + const priorOmitted = (fault as Record).omittedErrorCount + const carriedOmitted = typeof priorOmitted === 'number' && priorOmitted > 0 ? priorOmitted : 0 + const omittedErrorCount = + carriedOmitted + Math.max(0, sanitizedErrors.length - QUICKBOOKS_MAX_FAULT_ERRORS) + + return { + Fault: { + Error: sanitizedErrors.slice(0, QUICKBOOKS_MAX_FAULT_ERRORS), + ...(omittedErrorCount > 0 ? { omittedErrorCount } : {}), + }, + } +} + +/** Reports whether any retained fault entry is Intuit's stale-`SyncToken` error. */ +function hasQuickBooksStaleObjectError(fault: SanitizedQuickBooksFault): boolean { + return fault.Fault.Error.some( + (error) => + error.code?.trim() === QUICKBOOKS_STALE_OBJECT_CODE || + error.Message?.trim().toLowerCase() === QUICKBOOKS_STALE_OBJECT_MESSAGE + ) +} + +/** + * Renders a sanitized fault as a single human-readable detail string. + * + * Each entry becomes `code: Message: Detail (element)`. Entries dropped by the + * sanitizer are reported as a trailing count, and a stale-`SyncToken` fault + * gains explicit remediation guidance because retrying is never correct. + */ +export function formatQuickBooksFaultDetail(fault: SanitizedQuickBooksFault): string { + const details = fault.Fault.Error.map((error) => { + const code = error.code?.trim() ?? '' + const message = error.Message?.trim() ?? '' + const detail = error.Detail?.trim() ?? '' + const element = error.element?.trim() ?? '' + const text = [message, detail].filter(Boolean).join(': ') + if (!text) return '' + const prefixed = code ? `${code}: ${text}` : text + return element ? `${prefixed} (element: ${element})` : prefixed + }).filter(Boolean) + + const omitted = fault.Fault.omittedErrorCount ?? 0 + return [ + details.join('; '), + omitted > 0 + ? `(${omitted} additional QuickBooks error${omitted === 1 ? '' : 's'} omitted)` + : '', + details.length > 0 && hasQuickBooksStaleObjectError(fault) + ? QUICKBOOKS_STALE_OBJECT_GUIDANCE + : '', + ] + .filter(Boolean) + .join(' ') +} diff --git a/apps/sim/tools/quickbooks/file_operations.test.ts b/apps/sim/tools/quickbooks/file_operations.test.ts new file mode 100644 index 00000000000..ab2719a061b --- /dev/null +++ b/apps/sim/tools/quickbooks/file_operations.test.ts @@ -0,0 +1,70 @@ +/** + * @vitest-environment node + */ +import { describe, expect, it } from 'vitest' +import { quickbooksAddAttachmentTool } from '@/tools/quickbooks/add_attachment' +import { quickbooksDownloadAttachmentTool } from '@/tools/quickbooks/download_attachment' +import { quickbooksDownloadTransactionPdfTool } from '@/tools/quickbooks/download_transaction_pdf' + +describe('QuickBooks file tools', () => { + it('materializes only provider input for attachment creation', () => { + const input = quickbooksAddAttachmentTool.operation.input({ + accessToken: 'token', + realmId: '123', + attachmentKind: 'note', + targetType: 'invoice', + targetId: 'invoice-1', + note: 'Follow up', + }) + + expect(quickbooksAddAttachmentTool.request).toBeUndefined() + expect(input).toEqual({ + accessToken: 'token', + realmId: '123', + attachmentKind: 'note', + targetType: 'invoice', + targetId: 'invoice-1', + file: undefined, + fileName: undefined, + contentType: undefined, + description: undefined, + note: 'Follow up', + }) + }) + + it('does not accept execution scope from attachment download parameters', () => { + const input = quickbooksDownloadAttachmentTool.operation.input({ + accessToken: 'token', + realmId: '123', + attachmentId: 'attachment-1', + fileName: 'receipt.pdf', + }) + + expect(quickbooksDownloadAttachmentTool.request).toBeUndefined() + expect(input).toEqual({ + accessToken: 'token', + realmId: '123', + attachmentId: 'attachment-1', + fileName: 'receipt.pdf', + }) + }) + + it('materializes only provider input for PDF downloads', () => { + const input = quickbooksDownloadTransactionPdfTool.operation.input({ + accessToken: 'token', + realmId: '123', + transactionType: 'invoice', + transactionId: 'invoice-1', + fileName: 'invoice.pdf', + }) + + expect(quickbooksDownloadTransactionPdfTool.request).toBeUndefined() + expect(input).toEqual({ + accessToken: 'token', + realmId: '123', + transactionType: 'invoice', + transactionId: 'invoice-1', + fileName: 'invoice.pdf', + }) + }) +}) diff --git a/apps/sim/tools/quickbooks/full_update.test.ts b/apps/sim/tools/quickbooks/full_update.test.ts new file mode 100644 index 00000000000..051d8d09c77 --- /dev/null +++ b/apps/sim/tools/quickbooks/full_update.test.ts @@ -0,0 +1,89 @@ +/** + * @vitest-environment node + */ +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' + +vi.mock('@/lib/core/config/env', () => ({ + env: { QUICKBOOKS_ENV: 'production' }, +})) + +import { executeQuickBooksFullUpdate } from '@/tools/quickbooks/utils' + +describe('QuickBooks documented full updates', () => { + beforeEach(() => { + vi.stubGlobal('fetch', vi.fn()) + }) + + afterEach(() => { + vi.unstubAllGlobals() + }) + + it('reads, verifies, preserves, merges, and posts a complete entity', async () => { + vi.mocked(fetch) + .mockResolvedValueOnce( + Response.json({ + Bill: { + Id: 'bill-1', + SyncToken: '2', + VendorRef: { value: 'vendor-1' }, + APAccountRef: { value: 'ap-1' }, + Line: [{ Id: 'line-1', Amount: 25 }], + PrivateNote: 'old note', + MetaData: { CreateTime: '2026-08-01T00:00:00Z' }, + domain: 'QBO', + sparse: false, + }, + }) + ) + .mockResolvedValueOnce( + Response.json({ + Bill: { + Id: 'bill-1', + SyncToken: '3', + VendorRef: { value: 'vendor-1' }, + Line: [{ Id: 'line-1', Amount: 25 }], + PrivateNote: 'new note', + }, + }) + ) + + const result = await executeQuickBooksFullUpdate({ + params: { accessToken: 'token', realmId: '123', privateNote: 'new note' }, + entity: 'Bill', + resource: 'bill', + recordId: 'bill-1', + syncToken: '2', + buildPatch: (params) => ({ sparse: true, PrivateNote: params.privateNote }), + }) + + expect(fetch).toHaveBeenCalledTimes(2) + const updateRequest = vi.mocked(fetch).mock.calls[1]?.[1] + expect(JSON.parse(String(updateRequest?.body))).toEqual({ + Id: 'bill-1', + SyncToken: '2', + VendorRef: { value: 'vendor-1' }, + APAccountRef: { value: 'ap-1' }, + Line: [{ Id: 'line-1', Amount: 25 }], + PrivateNote: 'new note', + }) + expect(result.output).toMatchObject({ recordId: 'bill-1', syncToken: '3' }) + }) + + it('rejects a stale sync token without posting an update', async () => { + vi.mocked(fetch).mockResolvedValueOnce( + Response.json({ Bill: { Id: 'bill-1', SyncToken: '3', Line: [] } }) + ) + + await expect( + executeQuickBooksFullUpdate({ + params: { accessToken: 'token', realmId: '123' }, + entity: 'Bill', + resource: 'bill', + recordId: 'bill-1', + syncToken: '2', + buildPatch: () => ({ sparse: true, PrivateNote: 'new note' }), + }) + ).rejects.toThrow('changed since sync token 2 was read') + expect(fetch).toHaveBeenCalledOnce() + }) +}) diff --git a/apps/sim/tools/quickbooks/get_company_info.ts b/apps/sim/tools/quickbooks/get_company_info.ts new file mode 100644 index 00000000000..7ba4aab25a9 --- /dev/null +++ b/apps/sim/tools/quickbooks/get_company_info.ts @@ -0,0 +1,91 @@ +import { omit } from '@sim/utils/object' +import { ErrorExtractorId } from '@/tools/error-extractors' +import { + assertQuickBooksCompanyInfo, + buildQuickBooksCompanyUrl, + normalizeQuickBooksRealmId, +} from '@/tools/quickbooks/client' +import type { + QuickBooksAuthParams, + QuickBooksCompanyInfo, + QuickBooksCompanyInfoResponse, +} from '@/tools/quickbooks/types' +import { QUICKBOOKS_COMPANY_INFO_PROPERTIES } from '@/tools/quickbooks/types' +import { getQuickBooksToolHeaders, parseQuickBooksJson } from '@/tools/quickbooks/utils' +import type { ToolConfig } from '@/tools/types' + +interface CompanyInfoEnvelope { + CompanyInfo?: QuickBooksCompanyInfo + time?: string +} + +export const quickbooksGetCompanyInfoTool: ToolConfig< + QuickBooksAuthParams, + QuickBooksCompanyInfoResponse +> = { + id: 'quickbooks_get_company_info', + name: 'QuickBooks Get Company Info', + description: 'Get information about the connected QuickBooks Online company', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => { + const realmId = normalizeQuickBooksRealmId(params.realmId) + return buildQuickBooksCompanyUrl( + realmId, + `companyinfo/${encodeURIComponent(realmId)}` + ).toString() + }, + method: 'GET', + headers: (params) => getQuickBooksToolHeaders(params.accessToken), + retry: { enabled: false }, + }, + transformResponse: async (response, params) => { + normalizeQuickBooksRealmId(params?.realmId ?? '') + const data = await parseQuickBooksJson( + response, + 'QuickBooks CompanyInfo response' + ) + const company = assertQuickBooksCompanyInfo(data.CompanyInfo) + const sanitizedCompany = omit(company, ['EmployerId']) as QuickBooksCompanyInfo + return { + success: true, + output: { + company: sanitizedCompany, + time: typeof data.time === 'string' ? data.time : null, + }, + } + }, + outputs: { + company: { + type: 'json', + description: 'Verified QuickBooks CompanyInfo object with tax identifiers removed', + properties: QUICKBOOKS_COMPANY_INFO_PROPERTIES, + }, + time: { + type: 'string', + description: 'QuickBooks response timestamp', + optional: true, + nullable: true, + }, + }, +} diff --git a/apps/sim/tools/quickbooks/index.ts b/apps/sim/tools/quickbooks/index.ts new file mode 100644 index 00000000000..b8acb3bb519 --- /dev/null +++ b/apps/sim/tools/quickbooks/index.ts @@ -0,0 +1,48 @@ +export { quickbooksAddAttachmentTool } from '@/tools/quickbooks/add_attachment' +export { quickbooksCreateBillTool } from '@/tools/quickbooks/create_bill' +export { quickbooksCreateBillPaymentTool } from '@/tools/quickbooks/create_bill_payment' +export { quickbooksCreateCreditMemoTool } from '@/tools/quickbooks/create_credit_memo' +export { quickbooksCreateCustomerTool } from '@/tools/quickbooks/create_customer' +export { quickbooksCreateCustomerPaymentTool } from '@/tools/quickbooks/create_customer_payment' +export { quickbooksCreateDepositTool } from '@/tools/quickbooks/create_deposit' +export { quickbooksCreateEmployeeTool } from '@/tools/quickbooks/create_employee' +export { quickbooksCreateEstimateTool } from '@/tools/quickbooks/create_estimate' +export { quickbooksCreateInvoiceTool } from '@/tools/quickbooks/create_invoice' +export { quickbooksCreateItemTool } from '@/tools/quickbooks/create_item' +export { quickbooksCreateJournalEntryTool } from '@/tools/quickbooks/create_journal_entry' +export { quickbooksCreatePurchaseTool } from '@/tools/quickbooks/create_purchase' +export { quickbooksCreatePurchaseOrderTool } from '@/tools/quickbooks/create_purchase_order' +export { quickbooksCreateRefundReceiptTool } from '@/tools/quickbooks/create_refund_receipt' +export { quickbooksCreateSalesReceiptTool } from '@/tools/quickbooks/create_sales_receipt' +export { quickbooksCreateVendorTool } from '@/tools/quickbooks/create_vendor' +export { quickbooksCreateVendorCreditTool } from '@/tools/quickbooks/create_vendor_credit' +export { quickbooksDownloadAttachmentTool } from '@/tools/quickbooks/download_attachment' +export { quickbooksDownloadTransactionPdfTool } from '@/tools/quickbooks/download_transaction_pdf' +export { quickbooksEmailTransactionTool } from '@/tools/quickbooks/email_transaction' +export { quickbooksGetCompanyInfoTool } from '@/tools/quickbooks/get_company_info' +export { quickbooksReadAccountingTransactionsTool } from '@/tools/quickbooks/read_accounting_transactions' +export { quickbooksReadAttachmentsTool } from '@/tools/quickbooks/read_attachments' +export { quickbooksReadMasterDataTool } from '@/tools/quickbooks/read_master_data' +export { quickbooksReadPurchasingTransactionsTool } from '@/tools/quickbooks/read_purchasing_transactions' +export { quickbooksReadSalesTransactionsTool } from '@/tools/quickbooks/read_sales_transactions' +export { quickbooksRunFinancialReportTool } from '@/tools/quickbooks/run_financial_report' +export * from '@/tools/quickbooks/types' +export { quickbooksUpdateBillTool } from '@/tools/quickbooks/update_bill' +export { quickbooksUpdateBillPaymentTool } from '@/tools/quickbooks/update_bill_payment' +export { quickbooksUpdateCreditMemoTool } from '@/tools/quickbooks/update_credit_memo' +export { quickbooksUpdateCustomerTool } from '@/tools/quickbooks/update_customer' +export { quickbooksUpdateCustomerPaymentTool } from '@/tools/quickbooks/update_customer_payment' +export { quickbooksUpdateDepositTool } from '@/tools/quickbooks/update_deposit' +export { quickbooksUpdateEmployeeTool } from '@/tools/quickbooks/update_employee' +export { quickbooksUpdateEstimateTool } from '@/tools/quickbooks/update_estimate' +export { quickbooksUpdateInvoiceTool } from '@/tools/quickbooks/update_invoice' +export { quickbooksUpdateItemTool } from '@/tools/quickbooks/update_item' +export { quickbooksUpdateJournalEntryTool } from '@/tools/quickbooks/update_journal_entry' +export { quickbooksUpdatePurchaseTool } from '@/tools/quickbooks/update_purchase' +export { quickbooksUpdatePurchaseOrderTool } from '@/tools/quickbooks/update_purchase_order' +export { quickbooksUpdateRefundReceiptTool } from '@/tools/quickbooks/update_refund_receipt' +export { quickbooksUpdateSalesReceiptTool } from '@/tools/quickbooks/update_sales_receipt' +export { quickbooksUpdateVendorTool } from '@/tools/quickbooks/update_vendor' +export { quickbooksUpdateVendorCreditTool } from '@/tools/quickbooks/update_vendor_credit' +export { quickbooksVoidCustomerPaymentTool } from '@/tools/quickbooks/void_customer_payment' +export { quickbooksVoidInvoiceTool } from '@/tools/quickbooks/void_invoice' diff --git a/apps/sim/tools/quickbooks/purchasing_utils.test.ts b/apps/sim/tools/quickbooks/purchasing_utils.test.ts new file mode 100644 index 00000000000..a6f61abe84d --- /dev/null +++ b/apps/sim/tools/quickbooks/purchasing_utils.test.ts @@ -0,0 +1,175 @@ +import { describe, expect, it } from 'vitest' +import { + buildQuickBooksCreateBillBody, + buildQuickBooksCreateBillPaymentBody, + buildQuickBooksUpdatePurchaseBody, + verifyQuickBooksBillLinks, +} from '@/tools/quickbooks/purchasing_utils' +import type { QuickBooksCreateBillParams } from '@/tools/quickbooks/types' + +const BASE_PARAMS: QuickBooksCreateBillParams = { + accessToken: 'token', + realmId: 'realm', + vendorId: 'vendor-1', + lines: [{ lineType: 'account', amount: 20, accountId: 'account-1' }], +} + +describe('QuickBooks Create Bill Purchase Order linking', () => { + it('keeps the standalone Bill payload free of linked transactions', () => { + const body = buildQuickBooksCreateBillBody(BASE_PARAMS) + + expect(body).not.toHaveProperty('LinkedTxn') + expect(body.Line).toEqual([ + { + Amount: 20, + DetailType: 'AccountBasedExpenseLineDetail', + AccountBasedExpenseLineDetail: { + AccountRef: { value: 'account-1' }, + }, + }, + ]) + }) + + it('adds unique transaction-level PO links and exact line-level PO links', () => { + const body = buildQuickBooksCreateBillBody({ + ...BASE_PARAMS, + lines: [ + { + lineType: 'account', + amount: 10, + accountId: 'account-1', + purchaseOrderId: ' po-2 ', + purchaseOrderLineId: ' line-1 ', + }, + { + lineType: 'account', + amount: 5, + accountId: 'account-1', + purchaseOrderId: 'po-2', + purchaseOrderLineId: 'line-2', + }, + { lineType: 'account', amount: 3, accountId: 'account-1' }, + { + lineType: 'item', + amount: 2, + itemId: 'item-1', + purchaseOrderId: 'po-1', + purchaseOrderLineId: 'line-3', + }, + ], + }) + + expect(body.LinkedTxn).toEqual([ + { TxnId: 'po-2', TxnType: 'PurchaseOrder' }, + { TxnId: 'po-1', TxnType: 'PurchaseOrder' }, + ]) + expect(body.Line).toMatchObject([ + { + LinkedTxn: [{ TxnId: 'po-2', TxnType: 'PurchaseOrder', TxnLineId: 'line-1' }], + }, + { + LinkedTxn: [{ TxnId: 'po-2', TxnType: 'PurchaseOrder', TxnLineId: 'line-2' }], + }, + { Amount: 3 }, + { + LinkedTxn: [{ TxnId: 'po-1', TxnType: 'PurchaseOrder', TxnLineId: 'line-3' }], + }, + ]) + expect((body.Line as Array>)[2]).not.toHaveProperty('LinkedTxn') + }) + + it('reports successful linkage when QuickBooks returns every requested pair', () => { + const lines = [ + { + lineType: 'account' as const, + amount: 20, + accountId: 'account-1', + purchaseOrderId: 'po-1', + purchaseOrderLineId: 'po-line-1', + }, + ] + + expect( + verifyQuickBooksBillLinks( + { + Id: 'bill-1', + Line: [ + { + Id: 'bill-line-1', + LinkedTxn: [ + { + TxnId: 'po-1', + TxnType: 'PurchaseOrder', + TxnLineId: 'po-line-1', + }, + ], + }, + ], + }, + lines, + 'bill-1' + ) + ).toEqual({ + linkingRequested: true, + linkingSucceeded: true, + linkedLines: [ + { + purchaseOrderId: 'po-1', + purchaseOrderLineId: 'po-line-1', + billLineId: 'bill-line-1', + }, + ], + missingLinks: [], + }) + }) +}) + +describe('QuickBooks BillPayment allocation behavior', () => { + const payment = { + accessToken: 'token', + realmId: '123', + vendorId: 'vendor-1', + totalAmount: 100, + paymentType: 'check' as const, + paymentAccountId: 'bank-1', + } + + it('allows an unallocated payment that becomes vendor credit', () => { + expect(buildQuickBooksCreateBillPaymentBody(payment)).not.toHaveProperty('Line') + }) + + it('allows allocations below totalAmount and rejects allocations above it', () => { + expect( + buildQuickBooksCreateBillPaymentBody({ + ...payment, + billAllocations: [{ billId: 'bill-1', amount: 75 }], + }) + ).toMatchObject({ TotalAmt: 100, Line: [{ Amount: 75 }] }) + + expect(() => + buildQuickBooksCreateBillPaymentBody({ + ...payment, + billAllocations: [{ billId: 'bill-1', amount: 125 }], + }) + ).toThrow('cannot exceed totalAmount') + }) +}) + +describe('QuickBooks Purchase full-update patch', () => { + it('does not require or overwrite the current PaymentType', () => { + expect( + buildQuickBooksUpdatePurchaseBody({ + accessToken: 'token', + realmId: '123', + purchaseId: 'purchase-1', + syncToken: '2', + privateNote: 'Updated note', + }) + ).toEqual({ + Id: 'purchase-1', + SyncToken: '2', + sparse: true, + PrivateNote: 'Updated note', + }) + }) +}) diff --git a/apps/sim/tools/quickbooks/purchasing_utils.ts b/apps/sim/tools/quickbooks/purchasing_utils.ts new file mode 100644 index 00000000000..5ca1db67240 --- /dev/null +++ b/apps/sim/tools/quickbooks/purchasing_utils.ts @@ -0,0 +1,607 @@ +import { filterUndefined } from '@sim/utils/object' +import Decimal from 'decimal.js' +import type { + QuickBooksBillAllocationInput, + QuickBooksBillLineInput, + QuickBooksBillLinkInput, + QuickBooksCreateBillParams, + QuickBooksCreateBillPaymentParams, + QuickBooksCreatePurchaseOrderParams, + QuickBooksCreatePurchaseParams, + QuickBooksCreateVendorCreditParams, + QuickBooksLinkedBillLine, + QuickBooksPurchasingLineInput, + QuickBooksPurchasingTransaction, + QuickBooksUpdateBillParams, + QuickBooksUpdateBillPaymentParams, + QuickBooksUpdatePurchaseOrderParams, + QuickBooksUpdatePurchaseParams, + QuickBooksUpdateVendorCreditParams, +} from '@/tools/quickbooks/types' +import { + assertQuickBooksSparseUpdate, + optionalQuickBooksString, + quickBooksReference, + requiredQuickBooksString, + validateQuickBooksDate, +} from '@/tools/quickbooks/values' + +const MAX_PURCHASING_LINES = 100 +const MAX_BILL_ALLOCATIONS = 100 +const ACCOUNT_LINE_KEYS = new Set(['lineType', 'amount', 'accountId', 'description']) +const ITEM_LINE_KEYS = new Set([ + 'lineType', + 'amount', + 'itemId', + 'description', + 'quantity', + 'unitPrice', +]) +const BILL_LINK_KEYS = ['purchaseOrderId', 'purchaseOrderLineId'] as const +const BILL_ALLOCATION_KEYS = new Set(['billId', 'amount']) + +function parseJsonArray(value: unknown, fieldName: string): unknown[] | undefined { + if (value == null || value === '') return undefined + let parsed = value + if (typeof value === 'string') { + try { + parsed = JSON.parse(value) + } catch { + throw new Error(`${fieldName} must be valid JSON`) + } + } + if (!Array.isArray(parsed)) throw new Error(`${fieldName} must be a JSON array`) + return parsed +} + +function assertObject(value: unknown, fieldName: string): Record { + if (!value || typeof value !== 'object' || Array.isArray(value)) { + throw new Error(`${fieldName} must be a JSON object`) + } + return value as Record +} + +function assertAllowedKeys( + value: Record, + allowed: Set, + fieldName: string +): void { + const unknownKey = Object.keys(value).find((key) => !allowed.has(key)) + if (unknownKey) throw new Error(`${fieldName} contains unsupported field "${unknownKey}"`) +} + +/** + * Parses a monetary value into a `Decimal`, rejecting non-numeric input, values carrying more than + * two decimal places, and magnitudes outside the range QuickBooks amounts can safely round-trip. + */ +function quickBooksMoneyDecimal(value: unknown, fieldName: string, requirement: string): Decimal { + if (typeof value !== 'number' && typeof value !== 'string') { + throw new Error(`${fieldName} must be a ${requirement}`) + } + const normalized = typeof value === 'string' ? value.trim() : value + if (normalized === '') throw new Error(`${fieldName} must be a ${requirement}`) + + let decimal: Decimal + try { + decimal = new Decimal(normalized) + } catch { + throw new Error(`${fieldName} must be a ${requirement}`) + } + if (!decimal.isFinite()) throw new Error(`${fieldName} must be a ${requirement}`) + if (decimal.decimalPlaces() > 2) { + throw new Error(`${fieldName} cannot have more than two decimal places`) + } + + const number = decimal.toNumber() + if ( + !Number.isSafeInteger(decimal.times(100).toNumber()) || + !Number.isFinite(number) || + !new Decimal(number).equals(decimal) + ) { + throw new Error(`${fieldName} is outside the safely supported amount range`) + } + return decimal +} + +function requiredPositiveNumber(value: unknown, fieldName: string): number { + const decimal = quickBooksMoneyDecimal(value, fieldName, 'positive finite number') + if (decimal.lte(0)) throw new Error(`${fieldName} must be a positive finite number`) + return decimal.toNumber() +} + +/** + * Line amounts may be negative — QuickBooks expresses discounts, returns, and credits that way — + * so only zero and non-numeric input are rejected. + */ +function requiredLineAmount(value: unknown, fieldName: string): number { + const decimal = quickBooksMoneyDecimal(value, fieldName, 'non-zero finite number') + if (decimal.isZero()) throw new Error(`${fieldName} must be a non-zero finite number`) + return decimal.toNumber() +} + +function optionalPositiveNumber(value: unknown, fieldName: string): number | undefined { + if (value == null || value === '') return undefined + if (typeof value !== 'number' && typeof value !== 'string') { + throw new Error(`${fieldName} must be a positive finite number`) + } + const parsed = typeof value === 'number' ? value : Number(value) + if (!Number.isFinite(parsed) || parsed <= 0) { + throw new Error(`${fieldName} must be a positive finite number`) + } + return parsed +} + +function requiredStringValue(value: unknown, fieldName: string): string { + if (typeof value !== 'string') throw new Error(`${fieldName} must be a string`) + return requiredQuickBooksString(value, fieldName) +} + +function optionalStringValue(value: unknown, fieldName: string): string | undefined { + if (value === undefined) return undefined + if (typeof value !== 'string') throw new Error(`${fieldName} must be a string`) + return optionalQuickBooksString(value) +} + +function parseQuickBooksPurchasingLinesInternal( + value: unknown, + fieldName: string, + allowBillLinks: boolean +): QuickBooksBillLineInput[] | undefined { + const parsed = parseJsonArray(value, fieldName) + if (!parsed) return undefined + if (parsed.length === 0) throw new Error(`${fieldName} must contain at least one line`) + if (parsed.length > MAX_PURCHASING_LINES) { + throw new Error(`${fieldName} cannot contain more than ${MAX_PURCHASING_LINES} lines`) + } + + const linkedPairs = new Set() + return parsed.map((rawLine, index) => { + const itemName = `${fieldName}[${index}]` + const line = assertObject(rawLine, itemName) + const allowedKeys = + line.lineType === 'account' ? new Set(ACCOUNT_LINE_KEYS) : new Set(ITEM_LINE_KEYS) + if (allowBillLinks) { + for (const key of BILL_LINK_KEYS) allowedKeys.add(key) + } + + let parsedLine: QuickBooksBillLineInput + if (line.lineType === 'account') { + assertAllowedKeys(line, allowedKeys, itemName) + parsedLine = { + lineType: 'account', + amount: requiredLineAmount(line.amount, `${itemName}.amount`), + accountId: requiredStringValue(line.accountId, `${itemName}.accountId`), + description: optionalStringValue(line.description, `${itemName}.description`), + } + } else if (line.lineType === 'item') { + assertAllowedKeys(line, allowedKeys, itemName) + const amount = requiredLineAmount(line.amount, `${itemName}.amount`) + const quantity = optionalPositiveNumber(line.quantity, `${itemName}.quantity`) + const unitPrice = optionalPositiveNumber(line.unitPrice, `${itemName}.unitPrice`) + if ( + quantity !== undefined && + unitPrice !== undefined && + !new Decimal(quantity).times(unitPrice).toDecimalPlaces(2).equals(new Decimal(amount)) + ) { + throw new Error(`${itemName}.amount must equal quantity multiplied by unitPrice`) + } + parsedLine = { + lineType: 'item', + amount, + itemId: requiredStringValue(line.itemId, `${itemName}.itemId`), + description: optionalStringValue(line.description, `${itemName}.description`), + quantity, + unitPrice, + } + } else { + throw new Error(`${itemName}.lineType must be account or item`) + } + + if (allowBillLinks) { + const hasPurchaseOrderId = Object.hasOwn(line, 'purchaseOrderId') + const hasPurchaseOrderLineId = Object.hasOwn(line, 'purchaseOrderLineId') + if (hasPurchaseOrderId !== hasPurchaseOrderLineId) { + throw new Error( + `${itemName}.purchaseOrderId and ${itemName}.purchaseOrderLineId must be supplied together` + ) + } + if (hasPurchaseOrderId) { + const purchaseOrderId = requiredStringValue( + line.purchaseOrderId, + `${itemName}.purchaseOrderId` + ) + const purchaseOrderLineId = requiredStringValue( + line.purchaseOrderLineId, + `${itemName}.purchaseOrderLineId` + ) + const pairKey = `${purchaseOrderId}\0${purchaseOrderLineId}` + if (linkedPairs.has(pairKey)) { + throw new Error( + `${fieldName} contains duplicate Purchase Order line link "${purchaseOrderId}:${purchaseOrderLineId}"` + ) + } + linkedPairs.add(pairKey) + parsedLine.purchaseOrderId = purchaseOrderId + parsedLine.purchaseOrderLineId = purchaseOrderLineId + } + } + + return parsedLine + }) +} + +export function parseQuickBooksPurchasingLines( + value: unknown, + fieldName = 'lines' +): QuickBooksPurchasingLineInput[] | undefined { + return parseQuickBooksPurchasingLinesInternal(value, fieldName, false) +} + +export function parseQuickBooksBillLines( + value: unknown, + fieldName = 'lines' +): QuickBooksBillLineInput[] | undefined { + return parseQuickBooksPurchasingLinesInternal(value, fieldName, true) +} + +function buildQuickBooksPurchasingLine( + line: QuickBooksPurchasingLineInput +): Record { + if (line.lineType === 'account') { + return filterUndefined({ + Amount: line.amount, + Description: line.description, + DetailType: 'AccountBasedExpenseLineDetail', + AccountBasedExpenseLineDetail: { + AccountRef: quickBooksReference(line.accountId!, 'accountId'), + }, + }) + } + return filterUndefined({ + Amount: line.amount, + Description: line.description, + DetailType: 'ItemBasedExpenseLineDetail', + ItemBasedExpenseLineDetail: filterUndefined({ + ItemRef: quickBooksReference(line.itemId!, 'itemId'), + Qty: line.quantity, + UnitPrice: line.unitPrice, + }), + }) +} + +function buildValidatedQuickBooksBillLines(lines: QuickBooksBillLineInput[]): unknown[] { + return lines.map((line) => ({ + ...buildQuickBooksPurchasingLine(line), + ...(line.purchaseOrderId && line.purchaseOrderLineId + ? { + LinkedTxn: [ + { + TxnId: line.purchaseOrderId, + TxnType: 'PurchaseOrder', + TxnLineId: line.purchaseOrderLineId, + }, + ], + } + : {}), + })) +} + +export function buildQuickBooksPurchasingLines(lines: QuickBooksPurchasingLineInput[]): unknown[] { + const validated = parseQuickBooksPurchasingLines(lines) + if (!validated) throw new Error('lines are required') + return validated.map(buildQuickBooksPurchasingLine) +} + +export function buildQuickBooksBillLines(lines: QuickBooksBillLineInput[]): unknown[] { + const validated = parseQuickBooksBillLines(lines) + if (!validated) throw new Error('lines are required') + return buildValidatedQuickBooksBillLines(validated) +} + +export function parseQuickBooksBillAllocations( + value: unknown, + fieldName = 'billAllocations' +): QuickBooksBillAllocationInput[] | undefined { + const parsed = parseJsonArray(value, fieldName) + if (!parsed) return undefined + if (parsed.length > MAX_BILL_ALLOCATIONS) { + throw new Error(`${fieldName} cannot contain more than ${MAX_BILL_ALLOCATIONS} allocations`) + } + const billIds = new Set() + return parsed.map((rawAllocation, index) => { + const itemName = `${fieldName}[${index}]` + const allocation = assertObject(rawAllocation, itemName) + assertAllowedKeys(allocation, BILL_ALLOCATION_KEYS, itemName) + const billId = requiredStringValue(allocation.billId, `${itemName}.billId`) + if (billIds.has(billId)) throw new Error(`${fieldName} contains duplicate Bill ID "${billId}"`) + billIds.add(billId) + return { + billId, + amount: requiredPositiveNumber(allocation.amount, `${itemName}.amount`), + } + }) +} + +function buildBillPaymentLines( + allocations: QuickBooksBillAllocationInput[] | undefined, + totalAmount: number +): unknown[] { + const validated = parseQuickBooksBillAllocations(allocations) + if (!validated) return [] + const allocationTotal = validated.reduce( + (sum, allocation) => sum.plus(allocation.amount), + new Decimal(0) + ) + if (allocationTotal.greaterThan(new Decimal(totalAmount))) { + throw new Error('Bill allocation amounts cannot exceed totalAmount') + } + return validated.map((allocation) => ({ + Amount: allocation.amount, + LinkedTxn: [{ TxnId: allocation.billId, TxnType: 'Bill' }], + })) +} + +function purchasingHeader(params: { + vendorId?: string + apAccountId?: string + transactionDate?: string + dueDate?: string + documentNumber?: string + privateNote?: string +}): Record { + return filterUndefined({ + VendorRef: params.vendorId ? quickBooksReference(params.vendorId, 'vendorId') : undefined, + APAccountRef: params.apAccountId + ? quickBooksReference(params.apAccountId, 'apAccountId') + : undefined, + TxnDate: validateQuickBooksDate(params.transactionDate, 'transactionDate'), + DueDate: validateQuickBooksDate(params.dueDate, 'dueDate'), + DocNumber: optionalQuickBooksString(params.documentNumber), + PrivateNote: optionalQuickBooksString(params.privateNote), + }) +} + +export function buildQuickBooksCreatePurchaseOrderBody( + params: QuickBooksCreatePurchaseOrderParams +): Record { + return { + ...purchasingHeader(params), + VendorRef: quickBooksReference(params.vendorId, 'vendorId'), + APAccountRef: quickBooksReference(params.apAccountId, 'apAccountId'), + Line: buildQuickBooksPurchasingLines(params.lines), + } +} + +export function buildQuickBooksUpdatePurchaseOrderBody( + params: QuickBooksUpdatePurchaseOrderParams +): Record { + const body = { + Id: requiredQuickBooksString(params.purchaseOrderId, 'purchaseOrderId'), + SyncToken: requiredQuickBooksString(params.syncToken, 'syncToken'), + sparse: true, + ...purchasingHeader(params), + } + assertQuickBooksSparseUpdate(body) + return body +} + +export function buildQuickBooksCreateBillBody( + params: QuickBooksCreateBillParams +): Record { + const lines = parseQuickBooksBillLines(params.lines) + if (!lines) throw new Error('lines are required') + const purchaseOrderIds = [ + ...new Set(lines.flatMap((line) => (line.purchaseOrderId ? [line.purchaseOrderId] : []))), + ] + return { + ...purchasingHeader(params), + VendorRef: quickBooksReference(params.vendorId, 'vendorId'), + Line: buildValidatedQuickBooksBillLines(lines), + ...(purchaseOrderIds.length > 0 + ? { + LinkedTxn: purchaseOrderIds.map((TxnId) => ({ + TxnId, + TxnType: 'PurchaseOrder', + })), + } + : {}), + } +} + +export function verifyQuickBooksBillLinks( + record: QuickBooksPurchasingTransaction, + lines: QuickBooksBillLineInput[], + recordId: string +): { + linkingRequested: boolean + linkingSucceeded: boolean | null + linkedLines: QuickBooksLinkedBillLine[] + missingLinks: QuickBooksBillLinkInput[] + linkingWarning?: string +} { + const validated = parseQuickBooksBillLines(lines) + if (!validated) throw new Error('lines are required') + const requested = validated.flatMap((line) => + line.purchaseOrderId && line.purchaseOrderLineId + ? [ + { + purchaseOrderId: line.purchaseOrderId, + purchaseOrderLineId: line.purchaseOrderLineId, + }, + ] + : [] + ) + if (requested.length === 0) { + return { + linkingRequested: false, + linkingSucceeded: null, + linkedLines: [], + missingLinks: [], + } + } + + const returnedLinks = new Map() + for (const billLine of record.Line ?? []) { + for (const link of billLine.LinkedTxn ?? []) { + if (link.TxnType?.trim() !== 'PurchaseOrder') continue + const purchaseOrderId = link.TxnId?.trim() + const purchaseOrderLineId = link.TxnLineId?.trim() + if (!purchaseOrderId || !purchaseOrderLineId) continue + const billLineId = + typeof billLine.Id === 'string' ? billLine.Id.trim() || undefined : undefined + returnedLinks.set(`${purchaseOrderId}\0${purchaseOrderLineId}`, billLineId) + } + } + + const linkedLines: QuickBooksLinkedBillLine[] = [] + const missingLinks: QuickBooksBillLinkInput[] = [] + for (const requestedLink of requested) { + const key = `${requestedLink.purchaseOrderId}\0${requestedLink.purchaseOrderLineId}` + if (returnedLinks.has(key)) { + linkedLines.push({ + ...requestedLink, + billLineId: returnedLinks.get(key), + }) + } else { + missingLinks.push(requestedLink) + } + } + + const linkingSucceeded = missingLinks.length === 0 + return { + linkingRequested: true, + linkingSucceeded, + linkedLines, + missingLinks, + ...(linkingSucceeded + ? {} + : { + linkingWarning: `QuickBooks created Bill ${recordId}, but did not establish ${missingLinks.length} requested Purchase Order line link(s). Review missingLinks before continuing.`, + }), + } +} + +export function buildQuickBooksUpdateBillBody( + params: QuickBooksUpdateBillParams +): Record { + const body = { + Id: requiredQuickBooksString(params.billId, 'billId'), + SyncToken: requiredQuickBooksString(params.syncToken, 'syncToken'), + sparse: true, + ...purchasingHeader(params), + VendorRef: quickBooksReference(params.vendorId, 'vendorId'), + } + assertQuickBooksSparseUpdate(body, 4) + return body +} + +export function buildQuickBooksCreateBillPaymentBody( + params: QuickBooksCreateBillPaymentParams +): Record { + const totalAmount = requiredPositiveNumber(params.totalAmount, 'totalAmount') + const paymentAccountId = requiredQuickBooksString(params.paymentAccountId, 'paymentAccountId') + const paymentDetails = + params.paymentType === 'check' + ? { PayType: 'Check', CheckPayment: { BankAccountRef: { value: paymentAccountId } } } + : params.paymentType === 'credit_card' + ? { + PayType: 'CreditCard', + CreditCardPayment: { CCAccountRef: { value: paymentAccountId } }, + } + : (() => { + throw new Error( + `Unsupported QuickBooks BillPayment type: ${String(params.paymentType)}` + ) + })() + const lines = buildBillPaymentLines(params.billAllocations, totalAmount) + return { + VendorRef: quickBooksReference(params.vendorId, 'vendorId'), + TotalAmt: totalAmount, + ...paymentDetails, + ...(lines.length > 0 ? { Line: lines } : {}), + ...filterUndefined({ + TxnDate: validateQuickBooksDate(params.transactionDate, 'transactionDate'), + PrivateNote: optionalQuickBooksString(params.privateNote), + }), + } +} + +export function buildQuickBooksUpdateBillPaymentBody( + params: QuickBooksUpdateBillPaymentParams +): Record { + const body = filterUndefined({ + Id: requiredQuickBooksString(params.billPaymentId, 'billPaymentId'), + SyncToken: requiredQuickBooksString(params.syncToken, 'syncToken'), + sparse: true, + VendorRef: quickBooksReference(params.vendorId, 'vendorId'), + TxnDate: validateQuickBooksDate(params.transactionDate, 'transactionDate'), + PrivateNote: optionalQuickBooksString(params.privateNote), + }) as Record + assertQuickBooksSparseUpdate(body, 4) + return body +} + +export function buildQuickBooksCreateVendorCreditBody( + params: QuickBooksCreateVendorCreditParams +): Record { + return { + ...purchasingHeader(params), + VendorRef: quickBooksReference(params.vendorId, 'vendorId'), + Line: buildQuickBooksPurchasingLines(params.lines), + } +} + +export function buildQuickBooksUpdateVendorCreditBody( + params: QuickBooksUpdateVendorCreditParams +): Record { + const body = { + Id: requiredQuickBooksString(params.vendorCreditId, 'vendorCreditId'), + SyncToken: requiredQuickBooksString(params.syncToken, 'syncToken'), + sparse: true, + ...purchasingHeader(params), + VendorRef: quickBooksReference(params.vendorId, 'vendorId'), + } + assertQuickBooksSparseUpdate(body, 4) + return body +} + +function quickBooksPurchasePaymentType(paymentType: string): string { + if (paymentType === 'cash') return 'Cash' + if (paymentType === 'check') return 'Check' + if (paymentType === 'credit_card') return 'CreditCard' + throw new Error(`Unsupported QuickBooks Purchase payment type: ${paymentType}`) +} + +export function buildQuickBooksCreatePurchaseBody( + params: QuickBooksCreatePurchaseParams +): Record { + return filterUndefined({ + PaymentType: quickBooksPurchasePaymentType(params.paymentType), + AccountRef: quickBooksReference(params.paymentAccountId, 'paymentAccountId'), + EntityRef: params.vendorId + ? { ...quickBooksReference(params.vendorId, 'vendorId'), type: 'Vendor' } + : undefined, + Line: buildQuickBooksPurchasingLines(params.lines), + TxnDate: validateQuickBooksDate(params.transactionDate, 'transactionDate'), + DocNumber: optionalQuickBooksString(params.paymentReference), + PrivateNote: optionalQuickBooksString(params.privateNote), + }) +} + +export function buildQuickBooksUpdatePurchaseBody( + params: QuickBooksUpdatePurchaseParams +): Record { + const body = filterUndefined({ + Id: requiredQuickBooksString(params.purchaseId, 'purchaseId'), + SyncToken: requiredQuickBooksString(params.syncToken, 'syncToken'), + sparse: true, + EntityRef: params.vendorId + ? { ...quickBooksReference(params.vendorId, 'vendorId'), type: 'Vendor' } + : undefined, + TxnDate: validateQuickBooksDate(params.transactionDate, 'transactionDate'), + DocNumber: optionalQuickBooksString(params.paymentReference), + PrivateNote: optionalQuickBooksString(params.privateNote), + }) as Record + assertQuickBooksSparseUpdate(body) + return body +} diff --git a/apps/sim/tools/quickbooks/read_accounting_transactions.ts b/apps/sim/tools/quickbooks/read_accounting_transactions.ts new file mode 100644 index 00000000000..926e5607866 --- /dev/null +++ b/apps/sim/tools/quickbooks/read_accounting_transactions.ts @@ -0,0 +1,188 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import type { + QuickBooksAccountingTransaction, + QuickBooksReadAccountingTransactionsParams, + QuickBooksReadAccountingTransactionsResponse, +} from '@/tools/quickbooks/types' +import { QUICKBOOKS_ACCOUNTING_TRANSACTION_PROPERTIES } from '@/tools/quickbooks/types' +import { + buildQuickBooksAccountingQueryUrl, + buildQuickBooksEntityUrl, + getQuickBooksAccountingEntity, + getQuickBooksToolHeaders, + transformQuickBooksEntityResponse, + transformQuickBooksListResponse, +} from '@/tools/quickbooks/utils' +import { assertQuickBooksListOnlyFilters } from '@/tools/quickbooks/values' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksReadAccountingTransactionsTool: ToolConfig< + QuickBooksReadAccountingTransactionsParams, + QuickBooksReadAccountingTransactionsResponse +> = { + id: 'quickbooks_read_accounting_transactions', + name: 'QuickBooks Read Accounting Transactions', + description: 'List or read one journal entry, deposit, or transfer', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + transactionType: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Accounting transaction type to read', + }, + readMode: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Whether to list transactions or read one transaction by ID', + }, + transactionId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'QuickBooks transaction ID, required for by-ID reads', + }, + startPosition: { + type: 'number', + required: false, + visibility: 'user-or-llm', + default: 1, + description: 'One-based position of the first list record to return', + }, + maxResults: { + type: 'number', + required: false, + visibility: 'user-or-llm', + default: 25, + description: 'Number of list records to request (1–100)', + }, + startDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'List transactions on or after this date in YYYY-MM-DD format', + }, + endDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'List transactions on or before this date in YYYY-MM-DD format', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => { + const config = getQuickBooksAccountingEntity(params.transactionType) + if (params.readMode === 'list') { + return buildQuickBooksAccountingQueryUrl(params).toString() + } + if (params.readMode === 'by_id') { + assertQuickBooksListOnlyFilters(params.readMode, { + startDate: params.startDate, + endDate: params.endDate, + }) + if (!params.transactionId?.trim()) { + throw new Error('QuickBooks transaction ID is required for by-ID reads') + } + return buildQuickBooksEntityUrl( + params.realmId, + config.resource, + params.transactionId + ).toString() + } + throw new Error(`Unsupported QuickBooks accounting read mode: ${String(params.readMode)}`) + }, + method: 'GET', + headers: (params) => getQuickBooksToolHeaders(params.accessToken), + retry: { enabled: false }, + }, + transformResponse: async (response, params) => { + if (!params) throw new Error('QuickBooks accounting transaction parameters are required') + const config = getQuickBooksAccountingEntity(params.transactionType) + if (params.readMode === 'list') { + const result = await transformQuickBooksListResponse( + response, + { + ...params, + startPosition: params.startPosition ?? 1, + maxResults: params.maxResults ?? 25, + }, + config.entity + ) + return { + success: true, + output: { transactionType: params.transactionType, ...result.output }, + } + } + if (params.readMode === 'by_id') { + const result = await transformQuickBooksEntityResponse( + response, + config.entity + ) + return { + success: true, + output: { transactionType: params.transactionType, item: result.item, time: result.time }, + } + } + throw new Error(`Unsupported QuickBooks accounting read mode: ${String(params.readMode)}`) + }, + outputs: { + transactionType: { type: 'string', description: 'Accounting transaction type returned' }, + item: { + type: 'json', + description: 'Single native QuickBooks accounting transaction', + optional: true, + properties: QUICKBOOKS_ACCOUNTING_TRANSACTION_PROPERTIES, + }, + items: { + type: 'array', + description: 'Native QuickBooks accounting transactions', + optional: true, + items: { type: 'json', properties: QUICKBOOKS_ACCOUNTING_TRANSACTION_PROPERTIES }, + }, + startPosition: { + type: 'number', + description: 'One-based position of the first item in this response', + optional: true, + }, + maxResults: { + type: 'number', + description: 'Actual number of items reported for this response', + optional: true, + }, + nextStartPosition: { + type: 'number', + description: 'Position to use when explicitly requesting the next page', + optional: true, + }, + hasMore: { + type: 'boolean', + description: 'Conservative indication that another page may exist', + optional: true, + }, + time: { + type: 'string', + description: 'QuickBooks response timestamp', + optional: true, + nullable: true, + }, + }, +} diff --git a/apps/sim/tools/quickbooks/read_attachments.ts b/apps/sim/tools/quickbooks/read_attachments.ts new file mode 100644 index 00000000000..4da0d123da4 --- /dev/null +++ b/apps/sim/tools/quickbooks/read_attachments.ts @@ -0,0 +1,183 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import { buildQuickBooksCompanyUrl } from '@/tools/quickbooks/client' +import { + escapeQuickBooksQueryLiteral, + getQuickBooksAttachmentTarget, + parseQuickBooksAttachableResponse, + sanitizeQuickBooksAttachable, +} from '@/tools/quickbooks/documents_utils' +import type { + QuickBooksAttachable, + QuickBooksReadAttachmentsParams, + QuickBooksReadAttachmentsResponse, +} from '@/tools/quickbooks/types' +import { QUICKBOOKS_ATTACHABLE_PROPERTIES, QUICKBOOKS_LIST_OUTPUTS } from '@/tools/quickbooks/types' +import { + buildQuickBooksEntityUrl, + getQuickBooksToolHeaders, + parseQuickBooksJson, +} from '@/tools/quickbooks/utils' +import { requiredQuickBooksString, validateQuickBooksPagination } from '@/tools/quickbooks/values' +import type { ToolConfig } from '@/tools/types' + +interface AttachableQueryEnvelope { + QueryResponse?: { + Attachable?: QuickBooksAttachable[] + startPosition?: number + maxResults?: number + } + time?: string +} + +export const quickbooksReadAttachmentsTool: ToolConfig< + QuickBooksReadAttachmentsParams, + QuickBooksReadAttachmentsResponse +> = { + id: 'quickbooks_read_attachments', + name: 'QuickBooks Read Attachments', + description: + 'List attachment metadata for a fixed QuickBooks entity or read one attachment by ID', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + readMode: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Read mode: list or by_id', + }, + targetType: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Fixed QuickBooks entity type for List mode', + }, + targetId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'QuickBooks entity ID for List mode', + }, + attachmentId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'QuickBooks attachment ID for By ID mode', + }, + startPosition: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: 'One-based list start position; defaults to 1', + }, + maxResults: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: 'List page size from 1 through 100; defaults to 25', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => { + if (params.readMode === 'by_id') { + return buildQuickBooksEntityUrl( + params.realmId, + 'attachable', + requiredQuickBooksString(params.attachmentId ?? '', 'attachmentId') + ).toString() + } + if (params.readMode !== 'list') + throw new Error(`Unsupported QuickBooks attachment read mode: ${String(params.readMode)}`) + const target = getQuickBooksAttachmentTarget(params.targetType!) + const targetId = escapeQuickBooksQueryLiteral(params.targetId ?? '', 'targetId') + const pagination = validateQuickBooksPagination( + params.startPosition ?? 1, + params.maxResults ?? 25 + ) + const url = buildQuickBooksCompanyUrl(params.realmId, 'query') + url.searchParams.set( + 'query', + `SELECT * FROM Attachable WHERE AttachableRef.EntityRef.Type = '${target.entityType}' AND AttachableRef.EntityRef.value = '${targetId}' STARTPOSITION ${pagination.startPosition} MAXRESULTS ${pagination.maxResults}` + ) + return url.toString() + }, + method: 'GET', + headers: (params) => getQuickBooksToolHeaders(params.accessToken), + retry: { enabled: false }, + }, + transformResponse: async (response, params) => { + if (!params) throw new Error('QuickBooks Read Attachments parameters are required') + if (params.readMode === 'by_id') { + const parsed = await parseQuickBooksAttachableResponse(response) + return { success: true, output: { item: parsed.attachment, time: parsed.time } } + } + const pagination = validateQuickBooksPagination( + params.startPosition ?? 1, + params.maxResults ?? 25 + ) + const data = await parseQuickBooksJson( + response, + 'QuickBooks Attachable query response' + ) + if ( + !data.QueryResponse || + typeof data.QueryResponse !== 'object' || + Array.isArray(data.QueryResponse) + ) { + throw new Error('QuickBooks Attachable response is missing QueryResponse') + } + const attachments = data.QueryResponse.Attachable ?? [] + if (!Array.isArray(attachments)) + throw new Error('QuickBooks Attachable response contains a malformed attachment list') + const items = attachments.map(sanitizeQuickBooksAttachable) + const startPosition = Number.isInteger(data.QueryResponse.startPosition) + ? data.QueryResponse.startPosition! + : pagination.startPosition + const maxResults = Number.isInteger(data.QueryResponse.maxResults) + ? data.QueryResponse.maxResults! + : items.length + return { + success: true, + output: { + items, + startPosition, + maxResults, + nextStartPosition: startPosition + items.length, + hasMore: items.length === pagination.maxResults, + time: typeof data.time === 'string' ? data.time : null, + }, + } + }, + outputs: { + item: { + type: 'json', + description: 'Native QuickBooks attachment metadata', + optional: true, + properties: QUICKBOOKS_ATTACHABLE_PROPERTIES, + }, + items: { + type: 'array', + description: 'Native QuickBooks attachment metadata page', + optional: true, + items: { type: 'json', properties: QUICKBOOKS_ATTACHABLE_PROPERTIES }, + }, + ...QUICKBOOKS_LIST_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/read_master_data.ts b/apps/sim/tools/quickbooks/read_master_data.ts new file mode 100644 index 00000000000..3032bee00b9 --- /dev/null +++ b/apps/sim/tools/quickbooks/read_master_data.ts @@ -0,0 +1,211 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import type { + QuickBooksCustomer, + QuickBooksEmployee, + QuickBooksMasterDataRecord, + QuickBooksReadMasterDataParams, + QuickBooksReadMasterDataResponse, + QuickBooksVendor, +} from '@/tools/quickbooks/types' +import { QUICKBOOKS_MASTER_DATA_PROPERTIES } from '@/tools/quickbooks/types' +import { + buildQuickBooksEntityUrl, + buildQuickBooksMasterDataQueryUrl, + getQuickBooksMasterDataEntity, + getQuickBooksToolHeaders, + sanitizeQuickBooksCustomer, + sanitizeQuickBooksEmployee, + sanitizeQuickBooksVendor, + transformQuickBooksEntityResponse, + transformQuickBooksListResponse, +} from '@/tools/quickbooks/utils' +import { assertQuickBooksListOnlyFilters } from '@/tools/quickbooks/values' +import type { ToolConfig } from '@/tools/types' + +function sanitizeMasterDataRecord( + recordType: QuickBooksReadMasterDataParams['recordType'], + value: QuickBooksMasterDataRecord +): QuickBooksMasterDataRecord { + if (recordType === 'employee') { + return sanitizeQuickBooksEmployee(value as QuickBooksEmployee) + } + if (recordType === 'customer') return sanitizeQuickBooksCustomer(value as QuickBooksCustomer) + if (recordType === 'vendor') return sanitizeQuickBooksVendor(value as QuickBooksVendor) + return value +} + +export const quickbooksReadMasterDataTool: ToolConfig< + QuickBooksReadMasterDataParams, + QuickBooksReadMasterDataResponse +> = { + id: 'quickbooks_read_master_data', + name: 'QuickBooks Read Master Data', + description: 'List or read one account, class, customer, department, employee, item, or vendor', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + recordType: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: + 'Master-data entity to read: account, class, customer, department, employee, item, or vendor', + }, + readMode: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Whether to list records or read one record by ID', + }, + recordId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'QuickBooks record ID, required for by-ID reads', + }, + startPosition: { + type: 'number', + required: false, + visibility: 'user-or-llm', + default: 1, + description: 'One-based position of the first list record to return', + }, + maxResults: { + type: 'number', + required: false, + visibility: 'user-or-llm', + default: 25, + description: 'Number of list records to request (1–100)', + }, + activeStatus: { + type: 'string', + required: false, + visibility: 'user-or-llm', + default: 'default', + description: 'List records using the QuickBooks default, active, or inactive status', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => { + const config = getQuickBooksMasterDataEntity(params.recordType) + if (params.readMode === 'list') { + return buildQuickBooksMasterDataQueryUrl(params).toString() + } + if (params.readMode === 'by_id') { + assertQuickBooksListOnlyFilters(params.readMode, { activeStatus: params.activeStatus }) + if (!params.recordId?.trim()) { + throw new Error('QuickBooks record ID is required for by-ID reads') + } + return buildQuickBooksEntityUrl(params.realmId, config.resource, params.recordId).toString() + } + throw new Error(`Unsupported QuickBooks master data read mode: ${String(params.readMode)}`) + }, + method: 'GET', + headers: (params) => getQuickBooksToolHeaders(params.accessToken), + retry: { enabled: false }, + }, + transformResponse: async (response, params) => { + if (!params) throw new Error('QuickBooks master data parameters are required') + const config = getQuickBooksMasterDataEntity(params.recordType) + if (params.readMode === 'list') { + const result = await transformQuickBooksListResponse( + response, + { + ...params, + startPosition: params.startPosition ?? 1, + maxResults: params.maxResults ?? 25, + }, + config.entity + ) + return { + success: true, + output: { + recordType: params.recordType, + ...result.output, + items: result.output.items.map((item) => + sanitizeMasterDataRecord(params.recordType, item) + ), + }, + } + } + if (params.readMode === 'by_id') { + const result = await transformQuickBooksEntityResponse( + response, + config.entity + ) + return { + success: true, + output: { + recordType: params.recordType, + item: sanitizeMasterDataRecord(params.recordType, result.item), + time: result.time, + }, + } + } + throw new Error(`Unsupported QuickBooks master data read mode: ${String(params.readMode)}`) + }, + outputs: { + recordType: { + type: 'string', + description: 'Master-data record type returned by this action', + }, + item: { + type: 'json', + description: 'Single QuickBooks master-data record returned by a by-ID read', + optional: true, + properties: QUICKBOOKS_MASTER_DATA_PROPERTIES, + }, + items: { + type: 'array', + description: 'QuickBooks master-data records returned by a list read', + optional: true, + items: { + type: 'json', + properties: QUICKBOOKS_MASTER_DATA_PROPERTIES, + }, + }, + startPosition: { + type: 'number', + description: 'One-based position of the first record in this page', + optional: true, + }, + maxResults: { + type: 'number', + description: 'Actual number of records returned in this page', + optional: true, + }, + nextStartPosition: { + type: 'number', + description: 'Position to use when explicitly requesting the next page', + optional: true, + }, + hasMore: { + type: 'boolean', + description: 'Conservative indication that another page may exist', + optional: true, + }, + time: { + type: 'string', + description: 'QuickBooks response timestamp', + optional: true, + nullable: true, + }, + }, +} diff --git a/apps/sim/tools/quickbooks/read_purchasing_transactions.ts b/apps/sim/tools/quickbooks/read_purchasing_transactions.ts new file mode 100644 index 00000000000..40a33e32f4c --- /dev/null +++ b/apps/sim/tools/quickbooks/read_purchasing_transactions.ts @@ -0,0 +1,194 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import type { + QuickBooksPurchasingTransaction, + QuickBooksReadPurchasingTransactionsParams, + QuickBooksReadPurchasingTransactionsResponse, +} from '@/tools/quickbooks/types' +import { QUICKBOOKS_PURCHASING_TRANSACTION_PROPERTIES } from '@/tools/quickbooks/types' +import { + buildQuickBooksEntityUrl, + buildQuickBooksPurchasingQueryUrl, + getQuickBooksPurchasingEntity, + getQuickBooksToolHeaders, + transformQuickBooksEntityResponse, + transformQuickBooksListResponse, +} from '@/tools/quickbooks/utils' +import { assertQuickBooksListOnlyFilters } from '@/tools/quickbooks/values' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksReadPurchasingTransactionsTool: ToolConfig< + QuickBooksReadPurchasingTransactionsParams, + QuickBooksReadPurchasingTransactionsResponse +> = { + id: 'quickbooks_read_purchasing_transactions', + name: 'QuickBooks Read Purchasing Transactions', + description: 'List or read one purchase order, bill, bill payment, vendor credit, or purchase', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + transactionType: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Purchasing transaction type to read', + }, + readMode: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Whether to list transactions or read one transaction by ID', + }, + transactionId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'QuickBooks transaction ID, required for by-ID reads', + }, + startPosition: { + type: 'number', + required: false, + visibility: 'user-or-llm', + default: 1, + description: 'One-based position of the first list record to return', + }, + maxResults: { + type: 'number', + required: false, + visibility: 'user-or-llm', + default: 25, + description: 'Number of list records to request (1–100)', + }, + startDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'List transactions on or after this date in YYYY-MM-DD format', + }, + endDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'List transactions on or before this date in YYYY-MM-DD format', + }, + vendorId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'List transactions for one supported QuickBooks vendor ID', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => { + const config = getQuickBooksPurchasingEntity(params.transactionType) + if (params.readMode === 'list') { + return buildQuickBooksPurchasingQueryUrl(params).toString() + } + if (params.readMode === 'by_id') { + assertQuickBooksListOnlyFilters(params.readMode, { + startDate: params.startDate, + endDate: params.endDate, + vendorId: params.vendorId, + }) + if (!params.transactionId?.trim()) + throw new Error('QuickBooks transaction ID is required for by-ID reads') + return buildQuickBooksEntityUrl( + params.realmId, + config.resource, + params.transactionId + ).toString() + } + throw new Error(`Unsupported QuickBooks purchasing read mode: ${String(params.readMode)}`) + }, + method: 'GET', + headers: (params) => getQuickBooksToolHeaders(params.accessToken), + retry: { enabled: false }, + }, + transformResponse: async (response, params) => { + if (!params) throw new Error('QuickBooks purchasing transaction parameters are required') + const config = getQuickBooksPurchasingEntity(params.transactionType) + if (params.readMode === 'list') { + const result = await transformQuickBooksListResponse( + response, + { + ...params, + startPosition: params.startPosition ?? 1, + maxResults: params.maxResults ?? 25, + }, + config.entity + ) + return { + success: true, + output: { transactionType: params.transactionType, ...result.output }, + } + } + if (params.readMode === 'by_id') { + const result = await transformQuickBooksEntityResponse( + response, + config.entity + ) + return { + success: true, + output: { transactionType: params.transactionType, item: result.item, time: result.time }, + } + } + throw new Error(`Unsupported QuickBooks purchasing read mode: ${String(params.readMode)}`) + }, + outputs: { + transactionType: { type: 'string', description: 'Purchasing transaction type returned' }, + item: { + type: 'json', + description: 'Single native QuickBooks purchasing transaction', + optional: true, + properties: QUICKBOOKS_PURCHASING_TRANSACTION_PROPERTIES, + }, + items: { + type: 'array', + description: 'Native QuickBooks purchasing transactions', + optional: true, + items: { type: 'json', properties: QUICKBOOKS_PURCHASING_TRANSACTION_PROPERTIES }, + }, + startPosition: { + type: 'number', + description: 'One-based position of the first item in this response', + optional: true, + }, + maxResults: { + type: 'number', + description: 'Actual number of items reported for this response', + optional: true, + }, + nextStartPosition: { + type: 'number', + description: 'Position to use when explicitly requesting the next page', + optional: true, + }, + hasMore: { + type: 'boolean', + description: 'Conservative indication that another page may exist', + optional: true, + }, + time: { + type: 'string', + description: 'QuickBooks response timestamp', + optional: true, + nullable: true, + }, + }, +} diff --git a/apps/sim/tools/quickbooks/read_sales_transactions.ts b/apps/sim/tools/quickbooks/read_sales_transactions.ts new file mode 100644 index 00000000000..5c1c393a5fe --- /dev/null +++ b/apps/sim/tools/quickbooks/read_sales_transactions.ts @@ -0,0 +1,196 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import type { + QuickBooksReadSalesTransactionsParams, + QuickBooksReadSalesTransactionsResponse, + QuickBooksSalesTransaction, +} from '@/tools/quickbooks/types' +import { QUICKBOOKS_SALES_TRANSACTION_PROPERTIES } from '@/tools/quickbooks/types' +import { + buildQuickBooksEntityUrl, + buildQuickBooksSalesQueryUrl, + getQuickBooksSalesEntity, + getQuickBooksToolHeaders, + transformQuickBooksEntityResponse, + transformQuickBooksListResponse, +} from '@/tools/quickbooks/utils' +import { assertQuickBooksListOnlyFilters } from '@/tools/quickbooks/values' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksReadSalesTransactionsTool: ToolConfig< + QuickBooksReadSalesTransactionsParams, + QuickBooksReadSalesTransactionsResponse +> = { + id: 'quickbooks_read_sales_transactions', + name: 'QuickBooks Read Sales Transactions', + description: + 'List or read one estimate, invoice, sales receipt, payment, credit memo, or refund receipt', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + transactionType: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Sales transaction type to read', + }, + readMode: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Whether to list transactions or read one transaction by ID', + }, + transactionId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'QuickBooks transaction ID, required for by-ID reads', + }, + startPosition: { + type: 'number', + required: false, + visibility: 'user-or-llm', + default: 1, + description: 'One-based position of the first list record to return', + }, + maxResults: { + type: 'number', + required: false, + visibility: 'user-or-llm', + default: 25, + description: 'Number of list records to request (1–100)', + }, + startDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'List transactions on or after this date in YYYY-MM-DD format', + }, + endDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'List transactions on or before this date in YYYY-MM-DD format', + }, + customerId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'List transactions for one QuickBooks customer ID', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => { + const config = getQuickBooksSalesEntity(params.transactionType) + if (params.readMode === 'list') { + return buildQuickBooksSalesQueryUrl(params).toString() + } + if (params.readMode === 'by_id') { + assertQuickBooksListOnlyFilters(params.readMode, { + startDate: params.startDate, + endDate: params.endDate, + customerId: params.customerId, + }) + if (!params.transactionId?.trim()) { + throw new Error('QuickBooks transaction ID is required for by-ID reads') + } + return buildQuickBooksEntityUrl( + params.realmId, + config.resource, + params.transactionId + ).toString() + } + throw new Error(`Unsupported QuickBooks sales read mode: ${String(params.readMode)}`) + }, + method: 'GET', + headers: (params) => getQuickBooksToolHeaders(params.accessToken), + retry: { enabled: false }, + }, + transformResponse: async (response, params) => { + if (!params) throw new Error('QuickBooks sales transaction parameters are required') + const config = getQuickBooksSalesEntity(params.transactionType) + if (params.readMode === 'list') { + const result = await transformQuickBooksListResponse( + response, + { + ...params, + startPosition: params.startPosition ?? 1, + maxResults: params.maxResults ?? 25, + }, + config.entity + ) + return { + success: true, + output: { transactionType: params.transactionType, ...result.output }, + } + } + if (params.readMode === 'by_id') { + const result = await transformQuickBooksEntityResponse( + response, + config.entity + ) + return { + success: true, + output: { transactionType: params.transactionType, item: result.item, time: result.time }, + } + } + throw new Error(`Unsupported QuickBooks sales read mode: ${String(params.readMode)}`) + }, + outputs: { + transactionType: { type: 'string', description: 'Sales transaction type returned' }, + item: { + type: 'json', + description: 'Single native QuickBooks sales transaction', + optional: true, + properties: QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, + }, + items: { + type: 'array', + description: 'Native QuickBooks sales transactions', + optional: true, + items: { type: 'json', properties: QUICKBOOKS_SALES_TRANSACTION_PROPERTIES }, + }, + startPosition: { + type: 'number', + description: 'One-based position of the first item in this response', + optional: true, + }, + maxResults: { + type: 'number', + description: 'Actual number of items reported for this response', + optional: true, + }, + nextStartPosition: { + type: 'number', + description: 'Position to use when explicitly requesting the next page', + optional: true, + }, + hasMore: { + type: 'boolean', + description: 'Conservative indication that another page may exist', + optional: true, + }, + time: { + type: 'string', + description: 'QuickBooks response timestamp', + optional: true, + nullable: true, + }, + }, +} diff --git a/apps/sim/tools/quickbooks/reports.test.ts b/apps/sim/tools/quickbooks/reports.test.ts new file mode 100644 index 00000000000..ac64add0e77 --- /dev/null +++ b/apps/sim/tools/quickbooks/reports.test.ts @@ -0,0 +1,141 @@ +/** + * @vitest-environment node + */ +import { describe, expect, it } from 'vitest' +import { + applyQuickBooksReportParams, + getQuickBooksReportTypesSupporting, + resolveQuickBooksReportEndpoint, +} from '@/tools/quickbooks/reports' +import type { QuickBooksRunFinancialReportParams } from '@/tools/quickbooks/types' + +const AUTH = { accessToken: 'token', realmId: '123' } as const + +function reportParams( + overrides: Partial = {} +): QuickBooksRunFinancialReportParams { + return { ...AUTH, reportType: 'profit_and_loss', ...overrides } +} + +describe('QuickBooks report capabilities', () => { + it('maps range and as-of reports to their documented date parameters', () => { + expect( + resolveQuickBooksReportEndpoint( + reportParams({ + reportType: 'profit_and_loss', + startDate: '2026-01-01', + endDate: '2026-06-30', + }) + ) + ).toEqual({ + endpoint: 'ProfitAndLoss', + dateParams: [ + ['start_date', '2026-01-01'], + ['end_date', '2026-06-30'], + ], + }) + + expect( + resolveQuickBooksReportEndpoint( + reportParams({ reportType: 'ar_aging_summary', endDate: '2026-06-30' }) + ) + ).toEqual({ + endpoint: 'AgedReceivables', + dateParams: [['report_date', '2026-06-30']], + }) + }) + + it('rejects invalid date ranges and range inputs on as-of reports', () => { + expect(() => + resolveQuickBooksReportEndpoint( + reportParams({ reportType: 'vendor_balance', startDate: '2026-01-01' }) + ) + ).toThrow('vendor_balance does not support startDate') + expect(() => + resolveQuickBooksReportEndpoint( + reportParams({ startDate: '2026-07-01', endDate: '2026-06-30' }) + ) + ).toThrow('startDate cannot be after endDate') + }) + + it('encodes only report-supported accounting, summary, and entity filters', () => { + const url = new URL('https://quickbooks.api.intuit.com/v3/company/123/reports/ProfitAndLoss') + applyQuickBooksReportParams( + url, + reportParams({ + accountingMethod: 'accrual', + summarizeBy: 'customer', + customerId: 'customer-1', + departmentId: 'department-1', + }) + ) + + expect(Object.fromEntries(url.searchParams)).toEqual({ + accounting_method: 'Accrual', + summarize_column_by: 'Customers', + customer: 'customer-1', + department: 'department-1', + }) + expect(() => + applyQuickBooksReportParams( + new URL('https://example.com'), + reportParams({ reportType: 'trial_balance', customerId: 'customer-1' }) + ) + ).toThrow('trial_balance does not support customerId') + }) + + it('keeps aging controls distinct by endpoint capability', () => { + expect(getQuickBooksReportTypesSupporting('agingMethod')).toEqual([ + 'ap_aging_summary', + 'ar_aging_detail', + 'ar_aging_summary', + ]) + expect(getQuickBooksReportTypesSupporting('agingPeriod')).toEqual([ + 'ap_aging_detail', + 'ar_aging_detail', + ]) + + const url = new URL('https://example.com') + applyQuickBooksReportParams( + url, + reportParams({ + reportType: 'ar_aging_detail', + agingMethod: 'report_date', + agingDays: 30, + }) + ) + expect(Object.fromEntries(url.searchParams)).toEqual({ + aging_method: 'Report_Date', + aging_period: '30', + }) + }) + + it('encodes Transaction List-only controls and rejects them elsewhere', () => { + const url = new URL('https://example.com') + applyQuickBooksReportParams( + url, + reportParams({ + reportType: 'transaction_list', + transactionType: 'invoice', + groupBy: 'payment_method', + accountsReceivablePaid: 'unpaid', + documentNumber: 'INV-100', + sourceAccountType: 'accounts_receivable', + }) + ) + expect(Object.fromEntries(url.searchParams)).toEqual({ + transaction_type: 'Invoice', + group_by: 'Payment Method', + arpaid: 'Unpaid', + docnum: 'INV-100', + source_account_type: 'AccountsReceivable', + }) + + expect(() => + applyQuickBooksReportParams( + new URL('https://example.com'), + reportParams({ documentNumber: 'INV-100' }) + ) + ).toThrow('profit_and_loss does not support docnum') + }) +}) diff --git a/apps/sim/tools/quickbooks/reports.ts b/apps/sim/tools/quickbooks/reports.ts new file mode 100644 index 00000000000..51b828f417e --- /dev/null +++ b/apps/sim/tools/quickbooks/reports.ts @@ -0,0 +1,533 @@ +import type { + QuickBooksAccountingMethod, + QuickBooksAgingMethod, + QuickBooksReportSummarizeBy, + QuickBooksReportType, + QuickBooksRunFinancialReportParams, +} from '@/tools/quickbooks/types' +import { optionalQuickBooksString, validateQuickBooksDate } from '@/tools/quickbooks/values' + +/** + * The QuickBooks reporting capability table and everything derived from it. + * + * This module is runtime-free — it validates and shapes report query + * parameters but never builds a request or touches the API client — so the + * block definition can read the same capability table the tool executes + * against without pulling the QuickBooks HTTP client into the client bundle. + */ + +type QuickBooksReportFilter = + | 'customerId' + | 'vendorId' + | 'accountId' + | 'itemId' + | 'classId' + | 'departmentId' + +type QuickBooksReportDateMode = 'range' | 'as_of' + +/** + * Capabilities of a single QuickBooks report endpoint, mirroring the query + * parameters Intuit documents for it. This table is the only source of truth: + * both URL construction and the block's control visibility derive from it, so + * a capability must never be restated anywhere else. + * + * `agingMethod` and `agingPeriod` are tracked separately because no aging + * report supports both: the summary endpoints document `aging_method` only, + * `AgedPayableDetail` documents `aging_period` only, and `AgedReceivableDetail` + * is the sole endpoint documenting both. + */ +interface QuickBooksReportDefinition { + endpoint: string + dateMode: QuickBooksReportDateMode + accountingMethod: boolean + summarizeBy: readonly Exclude[] + filters: readonly QuickBooksReportFilter[] + agingMethod: boolean + agingPeriod: boolean +} + +const TIME_SUMMARIES = ['total', 'day', 'week', 'month', 'quarter', 'year'] as const +const ALL_SUMMARIES = [ + ...TIME_SUMMARIES, + 'customer', + 'vendor', + 'item', + 'class', + 'department', +] as const +const CUSTOMER_SALES_SUMMARIES = [ + ...TIME_SUMMARIES, + 'customer', + 'item', + 'class', + 'department', +] as const +const VENDOR_EXPENSE_SUMMARIES = [ + ...TIME_SUMMARIES, + 'customer', + 'vendor', + 'class', + 'department', +] as const + +export const QUICKBOOKS_REPORT_TYPES_WITH_ALL_SUMMARIES = [ + 'balance_sheet', + 'cash_flow', + 'customer_balance', + 'profit_and_loss', + 'vendor_balance', +] as const satisfies readonly QuickBooksReportType[] + +export const QUICKBOOKS_REPORT_TYPES_WITH_CUSTOMER_SALES_SUMMARIES = [ + 'sales_by_customer', + 'sales_by_item', +] as const satisfies readonly QuickBooksReportType[] + +export const QUICKBOOKS_REPORT_TYPES_WITH_VENDOR_EXPENSE_SUMMARIES = [ + 'expenses_by_vendor', +] as const satisfies readonly QuickBooksReportType[] + +export const QUICKBOOKS_REPORT_TYPES_WITH_TIME_SUMMARIES = [ + 'trial_balance', +] as const satisfies readonly QuickBooksReportType[] + +export const QUICKBOOKS_REPORTS = { + ap_aging_detail: { + endpoint: 'AgedPayableDetail', + dateMode: 'as_of', + accountingMethod: false, + summarizeBy: [], + filters: ['vendorId'], + agingMethod: false, + agingPeriod: true, + }, + ap_aging_summary: { + endpoint: 'AgedPayables', + dateMode: 'as_of', + accountingMethod: false, + summarizeBy: [], + filters: ['vendorId', 'departmentId'], + agingMethod: true, + agingPeriod: false, + }, + ar_aging_detail: { + endpoint: 'AgedReceivableDetail', + dateMode: 'as_of', + accountingMethod: false, + summarizeBy: [], + filters: ['customerId'], + agingMethod: true, + agingPeriod: true, + }, + ar_aging_summary: { + endpoint: 'AgedReceivables', + dateMode: 'as_of', + accountingMethod: false, + summarizeBy: [], + filters: ['customerId', 'departmentId'], + agingMethod: true, + agingPeriod: false, + }, + balance_sheet: { + endpoint: 'BalanceSheet', + dateMode: 'range', + accountingMethod: true, + summarizeBy: ALL_SUMMARIES, + filters: ['customerId', 'vendorId', 'itemId', 'classId', 'departmentId'], + agingMethod: false, + agingPeriod: false, + }, + cash_flow: { + endpoint: 'CashFlow', + dateMode: 'range', + accountingMethod: false, + summarizeBy: ALL_SUMMARIES, + filters: ['customerId', 'vendorId', 'itemId', 'classId', 'departmentId'], + agingMethod: false, + agingPeriod: false, + }, + customer_balance: { + endpoint: 'CustomerBalance', + dateMode: 'as_of', + accountingMethod: true, + summarizeBy: ALL_SUMMARIES, + filters: ['customerId', 'departmentId'], + agingMethod: false, + agingPeriod: false, + }, + expenses_by_vendor: { + endpoint: 'VendorExpenses', + dateMode: 'range', + accountingMethod: true, + summarizeBy: VENDOR_EXPENSE_SUMMARIES, + filters: ['customerId', 'vendorId', 'classId', 'departmentId'], + agingMethod: false, + agingPeriod: false, + }, + profit_and_loss: { + endpoint: 'ProfitAndLoss', + dateMode: 'range', + accountingMethod: true, + summarizeBy: ALL_SUMMARIES, + filters: ['customerId', 'vendorId', 'itemId', 'classId', 'departmentId'], + agingMethod: false, + agingPeriod: false, + }, + profit_and_loss_detail: { + endpoint: 'ProfitAndLossDetail', + dateMode: 'range', + accountingMethod: true, + summarizeBy: [], + filters: ['customerId', 'vendorId', 'accountId', 'classId', 'departmentId'], + agingMethod: false, + agingPeriod: false, + }, + sales_by_customer: { + endpoint: 'CustomerSales', + dateMode: 'range', + accountingMethod: true, + summarizeBy: CUSTOMER_SALES_SUMMARIES, + filters: ['customerId', 'itemId', 'classId', 'departmentId'], + agingMethod: false, + agingPeriod: false, + }, + sales_by_item: { + endpoint: 'ItemSales', + dateMode: 'range', + accountingMethod: true, + summarizeBy: CUSTOMER_SALES_SUMMARIES, + filters: ['customerId', 'itemId', 'classId', 'departmentId'], + agingMethod: false, + agingPeriod: false, + }, + trial_balance: { + endpoint: 'TrialBalance', + dateMode: 'range', + accountingMethod: true, + summarizeBy: TIME_SUMMARIES, + filters: [], + agingMethod: false, + agingPeriod: false, + }, + transaction_list: { + endpoint: 'TransactionList', + dateMode: 'range', + accountingMethod: false, + summarizeBy: [], + filters: ['customerId', 'vendorId', 'departmentId'], + agingMethod: false, + agingPeriod: false, + }, + vendor_balance: { + endpoint: 'VendorBalance', + dateMode: 'as_of', + accountingMethod: true, + summarizeBy: ALL_SUMMARIES, + filters: ['vendorId', 'departmentId'], + agingMethod: false, + agingPeriod: false, + }, +} as const satisfies Record + +/** + * A user-facing report control. `agingMethod` and `agingPeriod` correspond + * one-to-one with Intuit's `aging_method` and `aging_period` query parameters + * and must stay distinct: the detail and summary aging reports each support one + * and reject the other, so a control matching either would surface an input the + * report refuses at execution time. + */ +export type QuickBooksReportControl = + | 'startDate' + | 'endDate' + | 'accountingMethod' + | 'summarizeBy' + | QuickBooksReportFilter + | 'agingMethod' + | 'agingPeriod' + +export function getQuickBooksReportTypesSupporting( + control: QuickBooksReportControl +): QuickBooksReportType[] { + return ( + Object.entries(QUICKBOOKS_REPORTS) as Array<[QuickBooksReportType, QuickBooksReportDefinition]> + ) + .filter(([, definition]) => { + if (control === 'startDate') return definition.dateMode === 'range' + if (control === 'endDate') return true + if (control === 'accountingMethod') return definition.accountingMethod + if (control === 'summarizeBy') return definition.summarizeBy.length > 0 + if (control === 'agingMethod') return definition.agingMethod + if (control === 'agingPeriod') return definition.agingPeriod + return definition.filters.includes(control) + }) + .map(([reportType]) => reportType) +} + +const QUICKBOOKS_REPORT_SUMMARIZE_VALUES: Record< + Exclude, + string +> = { + total: 'Total', + day: 'Days', + week: 'Week', + month: 'Month', + quarter: 'Quarter', + year: 'Year', + customer: 'Customers', + vendor: 'Vendors', + item: 'ProductsAndServices', + class: 'Classes', + department: 'Departments', +} + +const QUICKBOOKS_ACCOUNTING_METHOD_VALUES: Record< + Exclude, + string +> = { + cash: 'Cash', + accrual: 'Accrual', +} + +const QUICKBOOKS_AGING_METHOD_VALUES: Record, string> = { + report_date: 'Report_Date', + current: 'Current', +} + +const QUICKBOOKS_REPORT_FILTER_PARAMS: Record = { + customerId: 'customer', + vendorId: 'vendor', + accountId: 'account', + itemId: 'item', + classId: 'class', + departmentId: 'department', +} + +const QUICKBOOKS_TRANSACTION_LIST_VALUES = { + transactionType: { + default: '', + bill: 'Bill', + bill_payment_check: 'BillPaymentCheck', + bill_payment_credit_card: 'BillPaymentCreditCard', + cash_purchase: 'CashPurchase', + check: 'Check', + credit_card_charge: 'CreditCardCharge', + credit_card_credit: 'CreditCardCredit', + credit_memo: 'CreditMemo', + deposit: 'Deposit', + estimate: 'Estimate', + invoice: 'Invoice', + journal_entry: 'JournalEntry', + payment: 'ReceivePayment', + purchase_order: 'PurchaseOrder', + sales_receipt: 'SalesReceipt', + transfer: 'Transfer', + vendor_credit: 'VendorCredit', + }, + groupBy: { + default: '', + account: 'Account', + customer: 'Customer', + day: 'Day', + department: 'Location', + employee: 'Employee', + month: 'Month', + name: 'Name', + none: 'None', + payment_method: 'Payment Method', + quarter: 'Quarter', + transaction_type: 'Transaction Type', + vendor: 'Vendor', + week: 'Week', + year: 'Year', + }, + paidStatus: { default: '', all: 'All', paid: 'Paid', unpaid: 'Unpaid' }, + clearedStatus: { + default: '', + cleared: 'Cleared', + deposited: 'Deposited', + reconciled: 'Reconciled', + uncleared: 'Uncleared', + }, + sourceAccountType: { + default: '', + accounts_payable: 'AccountsPayable', + accounts_receivable: 'AccountsReceivable', + bank: 'Bank', + cost_of_goods_sold: 'CostOfGoodsSold', + credit_card: 'CreditCard', + equity: 'Equity', + expense: 'Expense', + fixed_asset: 'FixedAsset', + income: 'Income', + long_term_liability: 'LongTermLiability', + non_posting: 'NonPosting', + other_asset: 'OtherAsset', + other_current_asset: 'OtherCurrentAsset', + other_current_liability: 'OtherCurrentLiability', + other_expense: 'OtherExpense', + other_income: 'OtherIncome', + }, +} as const + +function getQuickBooksTransactionListControl( + value: unknown, + values: Record, + field: string +): string | undefined { + if (value === undefined || value === 'default') return undefined + if (typeof value !== 'string' || !Object.hasOwn(values, value) || !values[value]) { + throw new Error(`Unsupported QuickBooks ${field}: ${String(value)}`) + } + return values[value] +} + +function addQuickBooksTransactionListFilters( + url: URL, + params: QuickBooksRunFinancialReportParams +): void { + const transactionType = getQuickBooksTransactionListControl( + params.transactionType, + QUICKBOOKS_TRANSACTION_LIST_VALUES.transactionType, + 'transactionType' + ) + const groupBy = getQuickBooksTransactionListControl( + params.groupBy, + QUICKBOOKS_TRANSACTION_LIST_VALUES.groupBy, + 'groupBy' + ) + const accountsPayablePaid = getQuickBooksTransactionListControl( + params.accountsPayablePaid, + QUICKBOOKS_TRANSACTION_LIST_VALUES.paidStatus, + 'accountsPayablePaid' + ) + const accountsReceivablePaid = getQuickBooksTransactionListControl( + params.accountsReceivablePaid, + QUICKBOOKS_TRANSACTION_LIST_VALUES.paidStatus, + 'accountsReceivablePaid' + ) + const clearedStatus = getQuickBooksTransactionListControl( + params.clearedStatus, + QUICKBOOKS_TRANSACTION_LIST_VALUES.clearedStatus, + 'clearedStatus' + ) + const sourceAccountType = getQuickBooksTransactionListControl( + params.sourceAccountType, + QUICKBOOKS_TRANSACTION_LIST_VALUES.sourceAccountType, + 'sourceAccountType' + ) + const controls = { + transaction_type: transactionType, + group_by: groupBy, + appaid: accountsPayablePaid, + arpaid: accountsReceivablePaid, + cleared: clearedStatus, + docnum: optionalQuickBooksString(params.documentNumber), + source_account_type: sourceAccountType, + } + const supplied = Object.entries(controls).find(([, value]) => value !== undefined) + if (params.reportType !== 'transaction_list') { + if (supplied) throw new Error(`${params.reportType} does not support ${supplied[0]}`) + return + } + + if (transactionType) url.searchParams.set('transaction_type', transactionType) + if (groupBy) url.searchParams.set('group_by', groupBy) + if (accountsPayablePaid) url.searchParams.set('appaid', accountsPayablePaid) + if (accountsReceivablePaid) url.searchParams.set('arpaid', accountsReceivablePaid) + if (clearedStatus) url.searchParams.set('cleared', clearedStatus) + if (controls.docnum) url.searchParams.set('docnum', controls.docnum) + if (sourceAccountType) url.searchParams.set('source_account_type', sourceAccountType) +} + +/** + * Resolves the Intuit report endpoint and its date query parameters. + * + * Split from {@link applyQuickBooksReportParams} so the caller can build the + * company URL — the only part of report URL construction that needs the API + * client — between the two, preserving the original validation order. + */ +export function resolveQuickBooksReportEndpoint(params: QuickBooksRunFinancialReportParams): { + endpoint: string + dateParams: Array<[string, string]> +} { + const definition = QUICKBOOKS_REPORTS[params.reportType] + if (!definition) { + throw new Error(`Unsupported QuickBooks report type: ${String(params.reportType)}`) + } + + const startDate = validateQuickBooksDate(params.startDate, 'startDate') + const endDate = validateQuickBooksDate(params.endDate, 'endDate') + if (startDate && definition.dateMode !== 'range') { + throw new Error(`${params.reportType} does not support startDate`) + } + if (startDate && endDate && startDate > endDate) { + throw new Error('startDate cannot be after endDate') + } + + const dateParams: Array<[string, string]> = [] + if (startDate) dateParams.push(['start_date', startDate]) + if (endDate) { + dateParams.push([definition.dateMode === 'as_of' ? 'report_date' : 'end_date', endDate]) + } + return { endpoint: definition.endpoint, dateParams } +} + +/** + * Applies every non-date report query parameter to `url`, rejecting any + * control the requested report does not document support for. + */ +export function applyQuickBooksReportParams( + url: URL, + params: QuickBooksRunFinancialReportParams +): void { + const definition: QuickBooksReportDefinition = QUICKBOOKS_REPORTS[params.reportType] + + const accountingMethod = params.accountingMethod ?? 'default' + if (accountingMethod !== 'default') { + if (!definition.accountingMethod) { + throw new Error(`${params.reportType} does not support accountingMethod`) + } + const value = QUICKBOOKS_ACCOUNTING_METHOD_VALUES[accountingMethod] + if (!value) throw new Error(`Unsupported QuickBooks accounting method: ${accountingMethod}`) + url.searchParams.set('accounting_method', value) + } + + const summarizeBy = params.summarizeBy ?? 'default' + if (summarizeBy !== 'default') { + if (!(definition.summarizeBy as readonly string[]).includes(summarizeBy)) { + throw new Error(`${params.reportType} does not support summarizeBy=${summarizeBy}`) + } + const value = QUICKBOOKS_REPORT_SUMMARIZE_VALUES[summarizeBy] + if (!value) throw new Error(`Unsupported QuickBooks report summarization: ${summarizeBy}`) + url.searchParams.set('summarize_column_by', value) + } + + for (const filter of Object.keys(QUICKBOOKS_REPORT_FILTER_PARAMS) as QuickBooksReportFilter[]) { + const value = optionalQuickBooksString(params[filter]) + if (!value) continue + if (!(definition.filters as readonly QuickBooksReportFilter[]).includes(filter)) { + throw new Error(`${params.reportType} does not support ${filter}`) + } + url.searchParams.set(QUICKBOOKS_REPORT_FILTER_PARAMS[filter], value) + } + + const agingMethod = params.agingMethod ?? 'default' + if (agingMethod !== 'default') { + if (!definition.agingMethod) { + throw new Error(`${params.reportType} does not support agingMethod`) + } + const value = QUICKBOOKS_AGING_METHOD_VALUES[agingMethod] + if (!value) throw new Error(`Unsupported QuickBooks aging method: ${agingMethod}`) + url.searchParams.set('aging_method', value) + } + if (params.agingDays !== undefined) { + if (!definition.agingPeriod) throw new Error(`${params.reportType} does not support agingDays`) + if (!Number.isInteger(params.agingDays) || params.agingDays < 1) { + throw new Error('agingDays must be a positive integer') + } + url.searchParams.set('aging_period', String(params.agingDays)) + } + + addQuickBooksTransactionListFilters(url, params) +} diff --git a/apps/sim/tools/quickbooks/run_financial_report.ts b/apps/sim/tools/quickbooks/run_financial_report.ts new file mode 100644 index 00000000000..b7369cdc193 --- /dev/null +++ b/apps/sim/tools/quickbooks/run_financial_report.ts @@ -0,0 +1,205 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import type { + QuickBooksRunFinancialReportParams, + QuickBooksRunFinancialReportResponse, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_REPORT_COLUMNS_PROPERTIES, + QUICKBOOKS_REPORT_HEADER_PROPERTIES, + QUICKBOOKS_REPORT_ROWS_PROPERTIES, +} from '@/tools/quickbooks/types' +import { + buildQuickBooksReportUrl, + getQuickBooksToolHeaders, + transformQuickBooksReportResponse, +} from '@/tools/quickbooks/utils' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksRunFinancialReportTool: ToolConfig< + QuickBooksRunFinancialReportParams, + QuickBooksRunFinancialReportResponse +> = { + id: 'quickbooks_run_financial_report', + name: 'QuickBooks Run Financial Report', + description: 'Run a fixed QuickBooks financial report with verified accountant-focused filters', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + reportType: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Fixed QuickBooks financial report to run', + }, + startDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: + 'Report start date in YYYY-MM-DD format; Intuit recommends periods of six months or less for performance', + }, + endDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Report end or as-of date in YYYY-MM-DD format', + }, + accountingMethod: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Use the QuickBooks default, cash basis, or accrual basis', + }, + summarizeBy: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Time period or business dimension used to summarize report columns', + }, + customerId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Single QuickBooks customer ID filter', + }, + vendorId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Single QuickBooks vendor ID filter', + }, + accountId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Single QuickBooks account ID filter', + }, + itemId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Single QuickBooks item ID filter', + }, + classId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Single QuickBooks class ID filter', + }, + departmentId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Single QuickBooks department ID filter', + }, + agingMethod: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Age open balances from the report date or current date', + }, + agingDays: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: 'Positive number of days in each aging period', + }, + transactionType: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Transaction type filter for Transaction List', + }, + groupBy: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Grouping dimension for Transaction List', + }, + accountsPayablePaid: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Accounts-payable paid status for Transaction List', + }, + accountsReceivablePaid: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Accounts-receivable paid status for Transaction List', + }, + clearedStatus: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Cleared status filter for Transaction List', + }, + documentNumber: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Document number filter for Transaction List', + }, + sourceAccountType: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Source account type filter for Transaction List', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => buildQuickBooksReportUrl(params).toString(), + method: 'GET', + headers: (params) => getQuickBooksToolHeaders(params.accessToken), + retry: { enabled: false }, + }, + transformResponse: async (response, params) => { + if (!params) throw new Error('QuickBooks report parameters are required') + return transformQuickBooksReportResponse(response, params.reportType) + }, + outputs: { + reportType: { + type: 'string', + description: 'Financial report type that was run', + }, + header: { + type: 'json', + description: + 'Native QuickBooks report header with name, periods, basis, currency, summarization, filters, and options', + properties: QUICKBOOKS_REPORT_HEADER_PROPERTIES, + }, + columns: { + type: 'json', + description: 'Native QuickBooks report column definitions', + properties: QUICKBOOKS_REPORT_COLUMNS_PROPERTIES, + }, + rows: { + type: 'json', + description: 'Native hierarchical QuickBooks report rows and section summaries', + properties: QUICKBOOKS_REPORT_ROWS_PROPERTIES, + }, + time: { + type: 'string', + description: 'QuickBooks response timestamp', + optional: true, + nullable: true, + }, + }, +} diff --git a/apps/sim/tools/quickbooks/sales_utils.test.ts b/apps/sim/tools/quickbooks/sales_utils.test.ts new file mode 100644 index 00000000000..cde11da22fb --- /dev/null +++ b/apps/sim/tools/quickbooks/sales_utils.test.ts @@ -0,0 +1,140 @@ +import { afterEach, describe, expect, it, vi } from 'vitest' +import { + buildQuickBooksCreatePaymentBody, + buildQuickBooksUpdatePaymentBody, + parseQuickBooksInvoiceAllocations, + parseQuickBooksSalesLines, +} from '@/tools/quickbooks/sales_utils' +import { quickbooksUpdateCustomerPaymentTool } from '@/tools/quickbooks/update_customer_payment' + +describe('QuickBooks sales monetary validation', () => { + it.each([ + ['boolean', false], + ['over-precision value', 1.001], + ['non-finite value', Number.POSITIVE_INFINITY], + ['unsafe magnitude', Number.MAX_SAFE_INTEGER], + ])('rejects a %s before constructing a customer payment', (_name, totalAmount) => { + expect(() => + buildQuickBooksCreatePaymentBody({ + accessToken: 'token', + realmId: 'realm', + customerId: 'customer-1', + totalAmount: totalAmount as number, + }) + ).toThrow() + }) + + it('preserves valid positive payment amounts and negative sales amounts', () => { + expect( + buildQuickBooksCreatePaymentBody({ + accessToken: 'token', + realmId: 'realm', + customerId: 'customer-1', + totalAmount: 10.25, + invoiceAllocations: [{ invoiceId: 'invoice-1', amount: 10.25 }], + }) + ).toMatchObject({ + TotalAmt: 10.25, + Line: [ + { + Amount: 10.25, + LinkedTxn: [{ TxnId: 'invoice-1', TxnType: 'Invoice' }], + }, + ], + }) + + expect( + parseQuickBooksSalesLines([ + { + lineType: 'item', + amount: -10.25, + itemId: 'item-1', + quantity: 1, + unitPrice: -10.25, + }, + ]) + ).toEqual([ + { + lineType: 'item', + amount: -10.25, + itemId: 'item-1', + description: undefined, + quantity: 1, + unitPrice: -10.25, + serviceDate: undefined, + }, + ]) + }) + + it('accepts trimmed numeric strings without changing their numeric payload values', () => { + expect( + buildQuickBooksCreatePaymentBody({ + accessToken: 'token', + realmId: 'realm', + customerId: 'customer-1', + totalAmount: ' 10.25 ' as unknown as number, + invoiceAllocations: [{ invoiceId: 'invoice-1', amount: ' 10.25 ' as unknown as number }], + }) + ).toMatchObject({ TotalAmt: 10.25, Line: [{ Amount: 10.25 }] }) + }) +}) + +describe('QuickBooks customer payment allocations', () => { + const duplicates = [ + { invoiceId: ' invoice-1 ', amount: 5 }, + { invoiceId: 'invoice-1', amount: 5 }, + ] + + afterEach(() => { + vi.unstubAllGlobals() + }) + + it('rejects duplicate trimmed invoice IDs during parsing', () => { + expect(() => parseQuickBooksInvoiceAllocations(duplicates)).toThrow( + 'invoiceAllocations lists invoice invoice-1 more than once' + ) + }) + + it('rejects duplicate invoice IDs for both create and update bodies', () => { + expect(() => + buildQuickBooksCreatePaymentBody({ + accessToken: 'token', + realmId: 'realm', + customerId: 'customer-1', + totalAmount: 10, + invoiceAllocations: duplicates, + }) + ).toThrow('invoiceAllocations lists invoice invoice-1 more than once') + + expect(() => + buildQuickBooksUpdatePaymentBody({ + accessToken: 'token', + realmId: 'realm', + paymentId: 'payment-1', + syncToken: '0', + totalAmount: 10, + invoiceAllocations: duplicates, + unapplyOmittedInvoices: true, + }) + ).toThrow('invoiceAllocations lists invoice invoice-1 more than once') + }) + + it('rejects duplicate invoice IDs before the Update Payment preservation read', async () => { + const fetchMock = vi.fn() + vi.stubGlobal('fetch', fetchMock) + + await expect( + quickbooksUpdateCustomerPaymentTool.directExecution?.( + { + accessToken: 'token', + realmId: 'realm', + paymentId: 'payment-1', + syncToken: '0', + invoiceAllocations: duplicates, + }, + undefined + ) + ).rejects.toThrow('invoiceAllocations lists invoice invoice-1 more than once') + expect(fetchMock).not.toHaveBeenCalled() + }) +}) diff --git a/apps/sim/tools/quickbooks/sales_utils.ts b/apps/sim/tools/quickbooks/sales_utils.ts new file mode 100644 index 00000000000..7bcc08e09a7 --- /dev/null +++ b/apps/sim/tools/quickbooks/sales_utils.ts @@ -0,0 +1,475 @@ +import { filterUndefined } from '@sim/utils/object' +import Decimal from 'decimal.js' +import type { + QuickBooksCreateCustomerPaymentParams, + QuickBooksCreateSalesDocumentParams, + QuickBooksInvoiceAllocationInput, + QuickBooksSalesLineInput, + QuickBooksSalesTransaction, + QuickBooksTransactionLine, + QuickBooksUpdateCustomerPaymentParams, + QuickBooksUpdateSalesDocumentParams, +} from '@/tools/quickbooks/types' +import { + assertQuickBooksSparseUpdate, + optionalQuickBooksString, + quickBooksReference, + requiredQuickBooksString, + validateQuickBooksDate, +} from '@/tools/quickbooks/values' + +const MAX_SALES_LINES = 100 +const MAX_PAYMENT_ALLOCATIONS = 100 +const ITEM_LINE_KEYS = new Set([ + 'lineType', + 'amount', + 'itemId', + 'description', + 'quantity', + 'unitPrice', + 'serviceDate', +]) +const DESCRIPTION_LINE_KEYS = new Set(['lineType', 'description']) +const PAYMENT_ALLOCATION_KEYS = new Set(['invoiceId', 'amount']) + +function parseJsonArray(value: unknown, fieldName: string): unknown[] | undefined { + if (value == null || value === '') return undefined + let parsed = value + if (typeof value === 'string') { + try { + parsed = JSON.parse(value) + } catch { + throw new Error(`${fieldName} must be valid JSON`) + } + } + if (!Array.isArray(parsed)) throw new Error(`${fieldName} must be a JSON array`) + return parsed +} + +function assertObject(value: unknown, fieldName: string): Record { + if (!value || typeof value !== 'object' || Array.isArray(value)) { + throw new Error(`${fieldName} must be a JSON object`) + } + return value as Record +} + +function assertAllowedKeys( + value: Record, + allowed: Set, + fieldName: string +): void { + const unknownKey = Object.keys(value).find((key) => !allowed.has(key)) + if (unknownKey) throw new Error(`${fieldName} contains unsupported field "${unknownKey}"`) +} + +function quickBooksMoneyDecimal(value: unknown, fieldName: string, requirement: string): Decimal { + if (typeof value !== 'number' && typeof value !== 'string') { + throw new Error(`${fieldName} must be a ${requirement}`) + } + const normalized = typeof value === 'string' ? value.trim() : value + if (normalized === '') throw new Error(`${fieldName} must be a ${requirement}`) + + let decimal: Decimal + try { + decimal = new Decimal(normalized) + } catch { + throw new Error(`${fieldName} must be a ${requirement}`) + } + if (!decimal.isFinite()) throw new Error(`${fieldName} must be a ${requirement}`) + if (decimal.decimalPlaces() > 2) { + throw new Error(`${fieldName} cannot have more than two decimal places`) + } + + const number = decimal.toNumber() + if ( + !Number.isSafeInteger(decimal.times(100).toNumber()) || + !Number.isFinite(number) || + !new Decimal(number).equals(decimal) + ) { + throw new Error(`${fieldName} is outside the safely supported amount range`) + } + return decimal +} + +function requiredPositiveNumber(value: unknown, fieldName: string): number { + const decimal = quickBooksMoneyDecimal(value, fieldName, 'positive finite number') + if (decimal.lte(0)) throw new Error(`${fieldName} must be a positive finite number`) + return decimal.toNumber() +} + +function optionalPositiveNumber(value: unknown, fieldName: string): number | undefined { + if (value == null || value === '') return undefined + if (typeof value !== 'number' && typeof value !== 'string') { + throw new Error(`${fieldName} must be a positive finite number`) + } + const normalized = typeof value === 'string' ? value.trim() : value + if (normalized === '') return undefined + const parsed = typeof normalized === 'number' ? normalized : Number(normalized) + if (!Number.isFinite(parsed) || parsed <= 0) { + throw new Error(`${fieldName} must be a positive finite number`) + } + return parsed +} + +/** + * Sales line monetary fields accept negative values: QuickBooks models + * `Line.Amount` and `SalesItemLineDetail.UnitPrice` as unconstrained decimals, + * and negative amounts are how discounts, returns and credits are expressed on + * a sales form. Only a zero or non-finite value is rejected. + */ +function requiredNonZeroNumber(value: unknown, fieldName: string): number { + const decimal = quickBooksMoneyDecimal(value, fieldName, 'non-zero finite number') + if (decimal.isZero()) throw new Error(`${fieldName} must be a non-zero finite number`) + return decimal.toNumber() +} + +function optionalNonZeroNumber(value: unknown, fieldName: string): number | undefined { + if (value == null || value === '') return undefined + return requiredNonZeroNumber(value, fieldName) +} + +function requiredStringValue(value: unknown, fieldName: string): string { + if (typeof value !== 'string') throw new Error(`${fieldName} must be a string`) + return requiredQuickBooksString(value, fieldName) +} + +function optionalStringValue(value: unknown, fieldName: string): string | undefined { + if (value === undefined) return undefined + if (typeof value !== 'string') throw new Error(`${fieldName} must be a string`) + return optionalQuickBooksString(value) +} + +export function parseQuickBooksSalesLines( + value: unknown, + fieldName = 'lines' +): QuickBooksSalesLineInput[] | undefined { + const parsed = parseJsonArray(value, fieldName) + if (!parsed) return undefined + if (parsed.length === 0) throw new Error(`${fieldName} must contain at least one line`) + if (parsed.length > MAX_SALES_LINES) { + throw new Error(`${fieldName} cannot contain more than ${MAX_SALES_LINES} lines`) + } + + return parsed.map((rawLine, index) => { + const itemName = `${fieldName}[${index}]` + const line = assertObject(rawLine, itemName) + if (line.lineType === 'description') { + assertAllowedKeys(line, DESCRIPTION_LINE_KEYS, itemName) + return { + lineType: 'description', + description: requiredStringValue(line.description, `${itemName}.description`), + } + } + if (line.lineType !== 'item') { + throw new Error(`${itemName}.lineType must be item or description`) + } + assertAllowedKeys(line, ITEM_LINE_KEYS, itemName) + const description = optionalStringValue(line.description, `${itemName}.description`) + const amount = requiredNonZeroNumber(line.amount, `${itemName}.amount`) + const quantity = optionalPositiveNumber(line.quantity, `${itemName}.quantity`) + const unitPrice = optionalNonZeroNumber(line.unitPrice, `${itemName}.unitPrice`) + if ( + quantity !== undefined && + unitPrice !== undefined && + !new Decimal(quantity).times(unitPrice).toDecimalPlaces(2).equals(new Decimal(amount)) + ) { + throw new Error(`${itemName}.amount must equal quantity multiplied by unitPrice`) + } + return { + lineType: 'item', + amount, + itemId: requiredStringValue(line.itemId, `${itemName}.itemId`), + description, + quantity, + unitPrice, + serviceDate: validateQuickBooksDate( + optionalStringValue(line.serviceDate, `${itemName}.serviceDate`), + `${itemName}.serviceDate` + ), + } + }) +} + +export function buildQuickBooksSalesLines(lines: QuickBooksSalesLineInput[]): unknown[] { + const validated = parseQuickBooksSalesLines(lines) + if (!validated) throw new Error('lines are required') + return validated.map((line) => { + if (line.lineType === 'description') { + return { + DetailType: 'DescriptionOnly', + Description: line.description, + DescriptionLineDetail: {}, + } + } + return filterUndefined({ + Amount: line.amount, + Description: line.description, + DetailType: 'SalesItemLineDetail', + SalesItemLineDetail: filterUndefined({ + ItemRef: quickBooksReference(line.itemId!, 'itemId'), + Qty: line.quantity, + UnitPrice: line.unitPrice, + ServiceDate: line.serviceDate, + }), + }) + }) +} + +export function parseQuickBooksInvoiceAllocations( + value: unknown, + fieldName = 'invoiceAllocations' +): QuickBooksInvoiceAllocationInput[] | undefined { + const parsed = parseJsonArray(value, fieldName) + if (!parsed) return undefined + if (parsed.length === 0) throw new Error(`${fieldName} must contain at least one allocation`) + if (parsed.length > MAX_PAYMENT_ALLOCATIONS) { + throw new Error(`${fieldName} cannot contain more than ${MAX_PAYMENT_ALLOCATIONS} allocations`) + } + const invoiceIds = new Set() + return parsed.map((rawAllocation, index) => { + const itemName = `${fieldName}[${index}]` + const allocation = assertObject(rawAllocation, itemName) + assertAllowedKeys(allocation, PAYMENT_ALLOCATION_KEYS, itemName) + const invoiceId = requiredStringValue(allocation.invoiceId, `${itemName}.invoiceId`) + if (invoiceIds.has(invoiceId)) { + throw new Error(`${fieldName} lists invoice ${invoiceId} more than once`) + } + invoiceIds.add(invoiceId) + return { + invoiceId, + amount: requiredPositiveNumber(allocation.amount, `${itemName}.amount`), + } + }) +} + +function buildPaymentLines( + allocations: QuickBooksInvoiceAllocationInput[] | undefined, + totalAmount: number | undefined +): unknown[] | undefined { + if (!allocations) return undefined + if (totalAmount === undefined) { + throw new Error('totalAmount is required when invoice allocations are supplied') + } + const allocationTotal = allocations.reduce( + (sum, allocation) => sum.plus(allocation.amount), + new Decimal(0) + ) + if (allocationTotal.greaterThan(totalAmount)) { + throw new Error('Invoice allocation amounts cannot exceed totalAmount') + } + return allocations.map((allocation) => ({ + Amount: allocation.amount, + LinkedTxn: [{ TxnId: allocation.invoiceId, TxnType: 'Invoice' }], + })) +} + +function getLinkedInvoiceId(line: QuickBooksTransactionLine): string | undefined { + const linked = line.LinkedTxn?.find( + (txn) => txn.TxnType === 'Invoice' && typeof txn.TxnId === 'string' && txn.TxnId.trim() + ) + return linked?.TxnId?.trim() +} + +function sumPaymentLineAmounts(lines: readonly QuickBooksTransactionLine[]): Decimal { + return lines.reduce( + (sum, line) => (typeof line.Amount === 'number' ? sum.plus(line.Amount) : sum), + new Decimal(0) + ) +} + +/** + * Merge caller-supplied invoice allocations into the payment's current lines. + * + * QuickBooks requires an update to carry every `Line` the payment should keep — + * lines are updated all-or-none — so sending only the caller's allocations + * unapplies every other invoice on the payment. This preserves the existing + * lines in their current order (the order QuickBooks preserves), overwrites the + * `Amount` of each line whose linked invoice the caller named, and appends + * allocations for invoices the payment is not applied to yet. + */ +export function mergeQuickBooksPaymentLines( + existingLines: readonly QuickBooksTransactionLine[], + allocations: readonly QuickBooksInvoiceAllocationInput[], + effectiveTotalAmount: number | undefined +): QuickBooksTransactionLine[] { + const requested = new Map() + for (const allocation of allocations) { + if (requested.has(allocation.invoiceId)) { + throw new Error(`invoiceAllocations lists invoice ${allocation.invoiceId} more than once`) + } + requested.set(allocation.invoiceId, allocation.amount) + } + + const applied = new Set() + const merged = existingLines.map((line) => { + const invoiceId = getLinkedInvoiceId(line) + if (!invoiceId || !requested.has(invoiceId)) return line + if (applied.has(invoiceId)) { + throw new Error( + `Payment has multiple lines linked to invoice ${invoiceId}; allocations cannot be merged unambiguously` + ) + } + applied.add(invoiceId) + return { ...line, Amount: requested.get(invoiceId) } + }) + + for (const allocation of allocations) { + if (applied.has(allocation.invoiceId)) continue + merged.push({ + Amount: allocation.amount, + LinkedTxn: [{ TxnId: allocation.invoiceId, TxnType: 'Invoice' }], + }) + } + + if (effectiveTotalAmount === undefined) { + throw new Error('totalAmount is required when invoice allocations are supplied') + } + if (sumPaymentLineAmounts(merged).greaterThan(effectiveTotalAmount)) { + throw new Error('Invoice allocation amounts cannot exceed totalAmount') + } + return merged +} + +export function buildQuickBooksCreateSalesDocumentBody( + params: QuickBooksCreateSalesDocumentParams, + options: { requireDepositAccount?: boolean } = {} +): Record { + if (options.requireDepositAccount && !params.depositAccountId?.trim()) { + throw new Error('depositAccountId is required to create a refund receipt') + } + return filterUndefined({ + CustomerRef: quickBooksReference(params.customerId, 'customerId'), + Line: buildQuickBooksSalesLines(params.lines), + TxnDate: validateQuickBooksDate(params.transactionDate, 'transactionDate'), + DocNumber: optionalQuickBooksString(params.documentNumber), + PrivateNote: optionalQuickBooksString(params.privateNote), + CustomerMemo: optionalQuickBooksString(params.customerMemo) + ? { value: optionalQuickBooksString(params.customerMemo) } + : undefined, + DueDate: validateQuickBooksDate(params.dueDate, 'dueDate'), + ExpirationDate: validateQuickBooksDate(params.expirationDate, 'expirationDate'), + PaymentMethodRef: params.paymentMethodId + ? quickBooksReference(params.paymentMethodId, 'paymentMethodId') + : undefined, + PaymentRefNum: optionalQuickBooksString(params.paymentReferenceNumber), + DepositToAccountRef: params.depositAccountId + ? quickBooksReference(params.depositAccountId, 'depositAccountId') + : undefined, + }) +} + +export function buildQuickBooksUpdateSalesDocumentBody( + params: QuickBooksUpdateSalesDocumentParams +): Record { + const body = filterUndefined({ + Id: requiredQuickBooksString(params.transactionId, 'transactionId'), + SyncToken: requiredQuickBooksString(params.syncToken, 'syncToken'), + sparse: true, + CustomerRef: params.customerId + ? quickBooksReference(params.customerId, 'customerId') + : undefined, + Line: params.lines ? buildQuickBooksSalesLines(params.lines) : undefined, + TxnDate: validateQuickBooksDate(params.transactionDate, 'transactionDate'), + DocNumber: optionalQuickBooksString(params.documentNumber), + PrivateNote: optionalQuickBooksString(params.privateNote), + CustomerMemo: optionalQuickBooksString(params.customerMemo) + ? { value: optionalQuickBooksString(params.customerMemo) } + : undefined, + DueDate: validateQuickBooksDate(params.dueDate, 'dueDate'), + ExpirationDate: validateQuickBooksDate(params.expirationDate, 'expirationDate'), + PaymentMethodRef: params.paymentMethodId + ? quickBooksReference(params.paymentMethodId, 'paymentMethodId') + : undefined, + PaymentRefNum: optionalQuickBooksString(params.paymentReferenceNumber), + DepositToAccountRef: params.depositAccountId + ? quickBooksReference(params.depositAccountId, 'depositAccountId') + : undefined, + }) as Record + assertQuickBooksSparseUpdate(body) + return body +} + +export function buildQuickBooksCreatePaymentBody( + params: QuickBooksCreateCustomerPaymentParams +): Record { + const totalAmount = requiredPositiveNumber(params.totalAmount, 'totalAmount') + const allocations = parseQuickBooksInvoiceAllocations(params.invoiceAllocations) + return filterUndefined({ + CustomerRef: quickBooksReference(params.customerId, 'customerId'), + TotalAmt: totalAmount, + TxnDate: validateQuickBooksDate(params.transactionDate, 'transactionDate'), + PrivateNote: optionalQuickBooksString(params.privateNote), + PaymentRefNum: optionalQuickBooksString(params.paymentReferenceNumber), + PaymentMethodRef: params.paymentMethodId + ? quickBooksReference(params.paymentMethodId, 'paymentMethodId') + : undefined, + DepositToAccountRef: params.depositAccountId + ? quickBooksReference(params.depositAccountId, 'depositAccountId') + : undefined, + Line: buildPaymentLines(allocations, totalAmount), + }) +} + +function buildUpdatePaymentLines( + params: QuickBooksUpdateCustomerPaymentParams, + allocations: QuickBooksInvoiceAllocationInput[] | undefined, + totalAmount: number | undefined, + currentPayment: QuickBooksSalesTransaction | undefined +): unknown[] | undefined { + if (!allocations) return undefined + if (params.unapplyOmittedInvoices) return buildPaymentLines(allocations, totalAmount) + if (!currentPayment) { + throw new Error( + 'The current payment must be read before invoice allocations can be updated. Set unapplyOmittedInvoices to replace every allocation instead.' + ) + } + return mergeQuickBooksPaymentLines( + currentPayment.Line ?? [], + allocations, + totalAmount ?? + (typeof currentPayment.TotalAmt === 'number' ? currentPayment.TotalAmt : undefined) + ) +} + +/** + * Build the sparse Payment update body. + * + * `currentPayment` is the payment as QuickBooks currently holds it and is + * required whenever invoice allocations are supplied: QuickBooks updates + * payment lines all-or-none, so the allocations have to be merged into the + * live line set before they can be sent. `unapplyOmittedInvoices` opts out of + * the merge and replaces the line set outright, unapplying every invoice the + * caller did not list. + */ +export function buildQuickBooksUpdatePaymentBody( + params: QuickBooksUpdateCustomerPaymentParams, + currentPayment?: QuickBooksSalesTransaction +): Record { + const totalAmount = + params.totalAmount === undefined + ? undefined + : requiredPositiveNumber(params.totalAmount, 'totalAmount') + const allocations = parseQuickBooksInvoiceAllocations(params.invoiceAllocations) + const line = buildUpdatePaymentLines(params, allocations, totalAmount, currentPayment) + const body = filterUndefined({ + Id: requiredQuickBooksString(params.paymentId, 'paymentId'), + SyncToken: requiredQuickBooksString(params.syncToken, 'syncToken'), + sparse: true, + CustomerRef: params.customerId + ? quickBooksReference(params.customerId, 'customerId') + : undefined, + TotalAmt: totalAmount, + TxnDate: validateQuickBooksDate(params.transactionDate, 'transactionDate'), + PrivateNote: optionalQuickBooksString(params.privateNote), + PaymentRefNum: optionalQuickBooksString(params.paymentReferenceNumber), + PaymentMethodRef: params.paymentMethodId + ? quickBooksReference(params.paymentMethodId, 'paymentMethodId') + : undefined, + DepositToAccountRef: params.depositAccountId + ? quickBooksReference(params.depositAccountId, 'depositAccountId') + : undefined, + Line: line, + }) as Record + assertQuickBooksSparseUpdate(body) + return body +} diff --git a/apps/sim/tools/quickbooks/types.ts b/apps/sim/tools/quickbooks/types.ts new file mode 100644 index 00000000000..27c828d36cb --- /dev/null +++ b/apps/sim/tools/quickbooks/types.ts @@ -0,0 +1,2017 @@ +import type { RawFileInput } from '@/lib/uploads/utils/file-schemas' +import type { UserFile } from '@/executor/types' +import type { OutputProperty, ToolResponse } from '@/tools/types' + +export interface QuickBooksReference { + value?: string + name?: string +} + +export interface QuickBooksAddress { + Id?: string + Line1?: string + Line2?: string + Line3?: string + Line4?: string + Line5?: string + City?: string + Country?: string + CountrySubDivisionCode?: string + PostalCode?: string + Lat?: string + Long?: string +} + +export interface QuickBooksEmailAddress { + Address?: string +} + +export interface QuickBooksPhoneNumber { + FreeFormNumber?: string +} + +export interface QuickBooksMetaData { + CreateTime?: string + LastUpdatedTime?: string +} + +export interface QuickBooksAccount { + Id: string + SyncToken?: string + Name?: string + SubAccount?: boolean + ParentRef?: QuickBooksReference + FullyQualifiedName?: string + Active?: boolean + Classification?: string + AccountType?: string + AccountSubType?: string + CurrentBalance?: number + CurrentBalanceWithSubAccounts?: number + CurrencyRef?: QuickBooksReference + MetaData?: QuickBooksMetaData + sparse?: boolean + [key: string]: unknown +} + +export interface QuickBooksClass { + Id: string + SyncToken?: string + Name?: string + SubClass?: boolean + ParentRef?: QuickBooksReference + FullyQualifiedName?: string + Active?: boolean + MetaData?: QuickBooksMetaData + domain?: string + sparse?: boolean + [key: string]: unknown +} + +export interface QuickBooksDepartment { + Id: string + SyncToken?: string + Name?: string + SubDepartment?: boolean + ParentRef?: QuickBooksReference + FullyQualifiedName?: string + Active?: boolean + MetaData?: QuickBooksMetaData + domain?: string + sparse?: boolean + [key: string]: unknown +} + +export interface QuickBooksCustomer { + Id: string + SyncToken?: string + DisplayName?: string + CompanyName?: string + GivenName?: string + MiddleName?: string + FamilyName?: string + Suffix?: string + Title?: string + PrintOnCheckName?: string + Active?: boolean + Taxable?: boolean + BillAddr?: QuickBooksAddress + ShipAddr?: QuickBooksAddress + PrimaryPhone?: QuickBooksPhoneNumber + Mobile?: QuickBooksPhoneNumber + Fax?: QuickBooksPhoneNumber + AlternatePhone?: QuickBooksPhoneNumber + PrimaryEmailAddr?: QuickBooksEmailAddress + WebAddr?: { URI?: string } + Balance?: number + BalanceWithJobs?: number + CurrencyRef?: QuickBooksReference + ParentRef?: QuickBooksReference + Job?: boolean + MetaData?: QuickBooksMetaData + sparse?: boolean + [key: string]: unknown +} + +export interface QuickBooksEmployee { + Id: string + SyncToken?: string + DisplayName?: string + GivenName?: string + MiddleName?: string + FamilyName?: string + Suffix?: string + Title?: string + PrintOnCheckName?: string + Active?: boolean + PrimaryPhone?: QuickBooksPhoneNumber + Mobile?: QuickBooksPhoneNumber + PrimaryEmailAddr?: QuickBooksEmailAddress + PrimaryAddr?: QuickBooksAddress + BillableTime?: boolean + MetaData?: QuickBooksMetaData + domain?: string + sparse?: boolean +} + +export interface QuickBooksItem { + Id: string + SyncToken?: string + Name?: string + Description?: string + Active?: boolean + FullyQualifiedName?: string + Taxable?: boolean + UnitPrice?: number + Type?: string + IncomeAccountRef?: QuickBooksReference + PurchaseDesc?: string + PurchaseCost?: number + ExpenseAccountRef?: QuickBooksReference + AssetAccountRef?: QuickBooksReference + TrackQtyOnHand?: boolean + QtyOnHand?: number + InvStartDate?: string + ParentRef?: QuickBooksReference + SubItem?: boolean + Level?: number + MetaData?: QuickBooksMetaData + sparse?: boolean + [key: string]: unknown +} + +export interface QuickBooksCompanyInfo { + Id: string + SyncToken?: string + CompanyName?: string + LegalName?: string + CompanyAddr?: QuickBooksAddress + CustomerCommunicationAddr?: QuickBooksAddress + LegalAddr?: QuickBooksAddress + PrimaryPhone?: QuickBooksPhoneNumber + Email?: QuickBooksEmailAddress + WebAddr?: { URI?: string } + CompanyStartDate?: string + Country?: string + FiscalYearStartMonth?: string + SupportedLanguages?: string + EmployerId?: string + domain?: string + sparse?: boolean + NameValue?: Array<{ Name?: string; Value?: string }> + MetaData?: QuickBooksMetaData + [key: string]: unknown +} + +export interface QuickBooksVendor { + Id: string + SyncToken?: string + DisplayName?: string + CompanyName?: string + GivenName?: string + MiddleName?: string + FamilyName?: string + Suffix?: string + Title?: string + PrintOnCheckName?: string + Active?: boolean + Vendor1099?: boolean + BillAddr?: QuickBooksAddress + PrimaryPhone?: QuickBooksPhoneNumber + Mobile?: QuickBooksPhoneNumber + Fax?: QuickBooksPhoneNumber + AlternatePhone?: QuickBooksPhoneNumber + PrimaryEmailAddr?: QuickBooksEmailAddress + WebAddr?: { URI?: string } + Balance?: number + CurrencyRef?: QuickBooksReference + AcctNum?: string + TermRef?: QuickBooksReference + MetaData?: QuickBooksMetaData + sparse?: boolean + [key: string]: unknown +} + +export interface QuickBooksLinkedTransaction { + TxnId?: string + TxnType?: string + TxnLineId?: string + [key: string]: unknown +} + +export interface QuickBooksTransactionLine { + Id?: string + LineNum?: number + Description?: string + Amount?: number + DetailType?: string + LinkedTxn?: QuickBooksLinkedTransaction[] + AccountBasedExpenseLineDetail?: Record + ItemBasedExpenseLineDetail?: Record + [key: string]: unknown +} + +export interface QuickBooksTransaction { + Id: string + SyncToken?: string + DocNumber?: string + TxnDate?: string + DueDate?: string + ExpirationDate?: string + CustomerRef?: QuickBooksReference + CustomerMemo?: { value?: string } + VendorRef?: QuickBooksReference + APAccountRef?: QuickBooksReference + AccountRef?: QuickBooksReference + FromAccountRef?: QuickBooksReference + ToAccountRef?: QuickBooksReference + EntityRef?: QuickBooksReference & { type?: string } + DepositToAccountRef?: QuickBooksReference + PaymentMethodRef?: QuickBooksReference + PaymentRefNum?: string + PaymentType?: string + PayType?: string + CheckPayment?: { BankAccountRef?: QuickBooksReference; [key: string]: unknown } + CreditCardPayment?: { CCAccountRef?: QuickBooksReference; [key: string]: unknown } + CurrencyRef?: QuickBooksReference + ExchangeRate?: number + Line?: QuickBooksTransactionLine[] + LinkedTxn?: QuickBooksLinkedTransaction[] + Amount?: number + TotalAmt?: number + Balance?: number + UnappliedAmt?: number + PrivateNote?: string + Adjustment?: boolean + TxnStatus?: string + TxnTaxDetail?: Record + MetaData?: QuickBooksMetaData + sparse?: boolean + [key: string]: unknown +} + +export type QuickBooksPurchaseOrder = QuickBooksTransaction +export type QuickBooksBill = QuickBooksTransaction +export type QuickBooksSalesTransaction = QuickBooksTransaction +export type QuickBooksPurchasingTransaction = QuickBooksTransaction +export type QuickBooksAccountingTransaction = QuickBooksTransaction + +export interface QuickBooksAuthParams { + accessToken: string + realmId: string +} + +export type QuickBooksMasterDataRecordType = + | 'account' + | 'class' + | 'customer' + | 'department' + | 'employee' + | 'item' + | 'vendor' + +export type QuickBooksMasterDataReadMode = 'list' | 'by_id' + +export type QuickBooksMasterDataRecord = + | QuickBooksAccount + | QuickBooksClass + | QuickBooksCustomer + | QuickBooksDepartment + | QuickBooksVendor + | QuickBooksItem + | QuickBooksEmployee + +export interface QuickBooksPaginationParams extends QuickBooksAuthParams { + startPosition: number + maxResults: number +} + +export interface QuickBooksReadMasterDataParams extends QuickBooksAuthParams { + recordType: QuickBooksMasterDataRecordType + readMode: QuickBooksMasterDataReadMode + recordId?: string + startPosition?: number + maxResults?: number + activeStatus?: QuickBooksReadActiveStatus +} + +export type QuickBooksSalesTransactionType = + | 'estimate' + | 'invoice' + | 'sales_receipt' + | 'payment' + | 'credit_memo' + | 'refund_receipt' + +export interface QuickBooksReadSalesTransactionsParams extends QuickBooksAuthParams { + transactionType: QuickBooksSalesTransactionType + readMode: QuickBooksMasterDataReadMode + transactionId?: string + startPosition?: number + maxResults?: number + startDate?: string + endDate?: string + customerId?: string +} + +export type QuickBooksPurchasingTransactionType = + | 'purchase_order' + | 'bill' + | 'bill_payment' + | 'vendor_credit' + | 'purchase' + +export interface QuickBooksReadPurchasingTransactionsParams extends QuickBooksAuthParams { + transactionType: QuickBooksPurchasingTransactionType + readMode: QuickBooksMasterDataReadMode + transactionId?: string + startPosition?: number + maxResults?: number + startDate?: string + endDate?: string + vendorId?: string +} + +export type QuickBooksAccountingTransactionType = 'journal_entry' | 'deposit' | 'transfer' + +export interface QuickBooksReadAccountingTransactionsParams extends QuickBooksAuthParams { + transactionType: QuickBooksAccountingTransactionType + readMode: QuickBooksMasterDataReadMode + transactionId?: string + startPosition?: number + maxResults?: number + startDate?: string + endDate?: string +} + +export type QuickBooksReportType = + | 'balance_sheet' + | 'profit_and_loss' + | 'profit_and_loss_detail' + | 'trial_balance' + | 'cash_flow' + | 'ap_aging_summary' + | 'ap_aging_detail' + | 'ar_aging_summary' + | 'ar_aging_detail' + | 'vendor_balance' + | 'customer_balance' + | 'sales_by_customer' + | 'sales_by_item' + | 'expenses_by_vendor' + | 'transaction_list' + +export type QuickBooksAccountingMethod = 'default' | 'cash' | 'accrual' + +export type QuickBooksReportSummarizeBy = + | 'default' + | 'total' + | 'day' + | 'week' + | 'month' + | 'quarter' + | 'year' + | 'customer' + | 'vendor' + | 'item' + | 'class' + | 'department' + +export type QuickBooksAgingMethod = 'default' | 'report_date' | 'current' + +export type QuickBooksTransactionListPaidStatus = 'default' | 'all' | 'paid' | 'unpaid' +export type QuickBooksTransactionListClearedStatus = + | 'default' + | 'cleared' + | 'uncleared' + | 'reconciled' + | 'deposited' +export type QuickBooksTransactionListGroupBy = + | 'default' + | 'account' + | 'customer' + | 'day' + | 'employee' + | 'department' + | 'month' + | 'name' + | 'none' + | 'payment_method' + | 'quarter' + | 'transaction_type' + | 'vendor' + | 'week' + | 'year' + +export type QuickBooksTransactionListTransactionType = + | 'default' + | 'bill' + | 'bill_payment_check' + | 'bill_payment_credit_card' + | 'cash_purchase' + | 'check' + | 'credit_card_charge' + | 'credit_card_credit' + | 'credit_memo' + | 'deposit' + | 'estimate' + | 'invoice' + | 'journal_entry' + | 'payment' + | 'purchase_order' + | 'sales_receipt' + | 'transfer' + | 'vendor_credit' + +export type QuickBooksTransactionListSourceAccountType = + | 'default' + | 'accounts_payable' + | 'accounts_receivable' + | 'bank' + | 'cost_of_goods_sold' + | 'credit_card' + | 'equity' + | 'expense' + | 'fixed_asset' + | 'income' + | 'long_term_liability' + | 'non_posting' + | 'other_asset' + | 'other_current_asset' + | 'other_current_liability' + | 'other_expense' + | 'other_income' + +export interface QuickBooksRunFinancialReportParams extends QuickBooksAuthParams { + reportType: QuickBooksReportType + startDate?: string + endDate?: string + accountingMethod?: QuickBooksAccountingMethod + summarizeBy?: QuickBooksReportSummarizeBy + customerId?: string + vendorId?: string + accountId?: string + itemId?: string + classId?: string + departmentId?: string + agingMethod?: QuickBooksAgingMethod + agingDays?: number + transactionType?: QuickBooksTransactionListTransactionType + groupBy?: QuickBooksTransactionListGroupBy + accountsPayablePaid?: QuickBooksTransactionListPaidStatus + accountsReceivablePaid?: QuickBooksTransactionListPaidStatus + clearedStatus?: QuickBooksTransactionListClearedStatus + documentNumber?: string + sourceAccountType?: QuickBooksTransactionListSourceAccountType +} + +export type QuickBooksDocumentTransactionType = + | 'credit_memo' + | 'estimate' + | 'invoice' + | 'payment' + | 'purchase_order' + | 'refund_receipt' + | 'sales_receipt' + +export type QuickBooksAttachmentTargetType = + | 'bill' + | 'credit_memo' + | 'customer' + | 'estimate' + | 'invoice' + | 'payment' + | 'purchase' + | 'refund_receipt' + | 'sales_receipt' + | 'vendor' + | 'vendor_credit' + +export type QuickBooksAttachmentReadMode = 'list' | 'by_id' +export type QuickBooksAttachmentKind = 'file' | 'note' + +export interface QuickBooksAttachableReference { + EntityRef?: QuickBooksReference & { type?: string } + IncludeOnSend?: boolean + [key: string]: unknown +} + +export interface QuickBooksAttachable { + Id: string + SyncToken?: string + FileName?: string + ContentType?: string + Size?: number + Note?: string + Category?: string + AttachableRef?: QuickBooksAttachableReference[] + MetaData?: QuickBooksMetaData + domain?: string + sparse?: boolean + [key: string]: unknown +} + +export interface QuickBooksEmailTransactionParams extends QuickBooksAuthParams { + transactionType: QuickBooksDocumentTransactionType + transactionId: string + recipient?: string + confirmSend: boolean +} + +export interface QuickBooksDownloadTransactionPdfParams extends QuickBooksAuthParams { + transactionType: QuickBooksDocumentTransactionType + transactionId: string + fileName?: string +} + +export interface QuickBooksReadAttachmentsParams extends QuickBooksAuthParams { + readMode: QuickBooksAttachmentReadMode + targetType?: QuickBooksAttachmentTargetType + targetId?: string + attachmentId?: string + startPosition?: number + maxResults?: number +} + +export interface QuickBooksAddAttachmentParams extends QuickBooksAuthParams { + attachmentKind: QuickBooksAttachmentKind + targetType: QuickBooksAttachmentTargetType + targetId: string + file?: RawFileInput + fileName?: string + contentType?: string + description?: string + note?: string +} + +export interface QuickBooksDownloadAttachmentParams extends QuickBooksAuthParams { + attachmentId: string + fileName?: string +} + +export interface QuickBooksReportOption { + Name?: string + Value?: string + [key: string]: unknown +} + +export interface QuickBooksReportHeader { + Time?: string + ReportName?: string + DateMacro?: string + ReportBasis?: string + StartPeriod?: string + EndPeriod?: string + SummarizeColumnsBy?: string + Currency?: string + Customer?: string + Vendor?: string + Account?: string + Item?: string + Class?: string + Department?: string + Option?: QuickBooksReportOption[] + [key: string]: unknown +} + +export interface QuickBooksReportColumnMetaData { + Name?: string + Value?: string + [key: string]: unknown +} + +export interface QuickBooksReportColumn { + ColTitle?: string + ColType?: string + MetaData?: QuickBooksReportColumnMetaData[] + [key: string]: unknown +} + +export interface QuickBooksReportColumns { + Column?: QuickBooksReportColumn[] + [key: string]: unknown +} + +export interface QuickBooksReportColumnData { + value?: string + id?: string + href?: string + [key: string]: unknown +} + +export interface QuickBooksReportRowSummary { + ColData?: QuickBooksReportColumnData[] + [key: string]: unknown +} + +export interface QuickBooksReportRowHeader { + ColData?: QuickBooksReportColumnData[] + [key: string]: unknown +} + +export interface QuickBooksReportRow { + type?: string + group?: string + Header?: QuickBooksReportRowHeader + ColData?: QuickBooksReportColumnData[] + Rows?: QuickBooksReportRows + Summary?: QuickBooksReportRowSummary + [key: string]: unknown +} + +export interface QuickBooksReportRows { + Row?: QuickBooksReportRow[] + [key: string]: unknown +} + +export type QuickBooksJournalPostingType = 'debit' | 'credit' +export type QuickBooksJournalEntityType = 'customer' | 'vendor' | 'employee' + +export interface QuickBooksJournalLineInput { + postingType: QuickBooksJournalPostingType + amount: number + accountId: string + description?: string + entityType?: QuickBooksJournalEntityType + entityId?: string +} + +export interface QuickBooksDepositLineInput { + amount: number + accountId: string + description?: string +} + +export interface QuickBooksCreateJournalEntryParams extends QuickBooksAuthParams { + lines: QuickBooksJournalLineInput[] + confirmPosting: boolean + transactionDate?: string + documentNumber?: string + privateNote?: string + requestId?: string +} + +export interface QuickBooksUpdateJournalEntryParams extends QuickBooksAuthParams { + journalEntryId: string + syncToken: string + confirmPosting: boolean + transactionDate?: string + documentNumber?: string + privateNote?: string +} + +export interface QuickBooksCreateDepositParams extends QuickBooksAuthParams { + depositAccountId: string + lines: QuickBooksDepositLineInput[] + transactionDate?: string + privateNote?: string + requestId?: string +} + +export interface QuickBooksUpdateDepositParams extends QuickBooksAuthParams { + depositId: string + syncToken: string + depositAccountId: string + transactionDate?: string + privateNote?: string +} + +export type QuickBooksPurchasingLineType = 'account' | 'item' + +export interface QuickBooksPurchasingLineInput { + lineType: QuickBooksPurchasingLineType + amount: number + accountId?: string + itemId?: string + description?: string + quantity?: number + unitPrice?: number +} + +export interface QuickBooksBillLineInput extends QuickBooksPurchasingLineInput { + purchaseOrderId?: string + purchaseOrderLineId?: string +} + +export interface QuickBooksBillLinkInput { + purchaseOrderId: string + purchaseOrderLineId: string +} + +export interface QuickBooksLinkedBillLine extends QuickBooksBillLinkInput { + billLineId?: string +} + +export interface QuickBooksBillAllocationInput { + billId: string + amount: number +} + +export interface QuickBooksCreatePurchaseOrderParams extends QuickBooksAuthParams { + vendorId: string + apAccountId: string + lines: QuickBooksPurchasingLineInput[] + transactionDate?: string + documentNumber?: string + privateNote?: string + requestId?: string +} + +export interface QuickBooksUpdatePurchaseOrderParams extends QuickBooksAuthParams { + purchaseOrderId: string + syncToken: string + vendorId?: string + apAccountId?: string + transactionDate?: string + documentNumber?: string + privateNote?: string +} + +export interface QuickBooksCreateBillParams extends QuickBooksAuthParams { + vendorId: string + lines: QuickBooksBillLineInput[] + apAccountId?: string + transactionDate?: string + dueDate?: string + documentNumber?: string + privateNote?: string + requestId?: string +} + +export interface QuickBooksUpdateBillParams extends QuickBooksAuthParams { + billId: string + syncToken: string + vendorId: string + apAccountId?: string + transactionDate?: string + dueDate?: string + documentNumber?: string + privateNote?: string +} + +export type QuickBooksBillPaymentType = 'check' | 'credit_card' + +export interface QuickBooksCreateBillPaymentParams extends QuickBooksAuthParams { + vendorId: string + totalAmount: number + paymentType: QuickBooksBillPaymentType + paymentAccountId: string + billAllocations?: QuickBooksBillAllocationInput[] + transactionDate?: string + privateNote?: string + requestId?: string +} + +export interface QuickBooksUpdateBillPaymentParams extends QuickBooksAuthParams { + billPaymentId: string + syncToken: string + vendorId: string + transactionDate?: string + privateNote?: string +} + +export interface QuickBooksCreateVendorCreditParams extends QuickBooksAuthParams { + vendorId: string + lines: QuickBooksPurchasingLineInput[] + apAccountId?: string + transactionDate?: string + documentNumber?: string + privateNote?: string + requestId?: string +} + +export interface QuickBooksUpdateVendorCreditParams extends QuickBooksAuthParams { + vendorCreditId: string + syncToken: string + vendorId: string + apAccountId?: string + transactionDate?: string + documentNumber?: string + privateNote?: string +} + +export type QuickBooksPurchasePaymentType = 'cash' | 'check' | 'credit_card' + +export interface QuickBooksCreatePurchaseParams extends QuickBooksAuthParams { + paymentType: QuickBooksPurchasePaymentType + paymentAccountId: string + lines: QuickBooksPurchasingLineInput[] + vendorId?: string + transactionDate?: string + paymentReference?: string + privateNote?: string + requestId?: string +} + +export interface QuickBooksUpdatePurchaseParams extends QuickBooksAuthParams { + purchaseId: string + syncToken: string + vendorId?: string + transactionDate?: string + paymentReference?: string + privateNote?: string +} + +export type QuickBooksSalesLineType = 'item' | 'description' + +export interface QuickBooksSalesLineInput { + lineType: QuickBooksSalesLineType + amount?: number + itemId?: string + description?: string + quantity?: number + unitPrice?: number + serviceDate?: string +} + +export interface QuickBooksCreateSalesDocumentParams extends QuickBooksAuthParams { + customerId: string + lines: QuickBooksSalesLineInput[] + transactionDate?: string + documentNumber?: string + privateNote?: string + customerMemo?: string + dueDate?: string + expirationDate?: string + paymentMethodId?: string + paymentReferenceNumber?: string + depositAccountId?: string + requestId?: string +} + +export interface QuickBooksUpdateSalesDocumentParams + extends Omit { + transactionId: string + syncToken: string + customerId?: string + lines?: QuickBooksSalesLineInput[] +} + +type QuickBooksNonReceiptCreateParams = Omit< + QuickBooksCreateSalesDocumentParams, + 'paymentMethodId' | 'paymentReferenceNumber' | 'depositAccountId' +> +type QuickBooksNonReceiptUpdateParams = Omit< + QuickBooksUpdateSalesDocumentParams, + 'paymentMethodId' | 'paymentReferenceNumber' | 'depositAccountId' +> + +export type QuickBooksCreateEstimateParams = Omit +export type QuickBooksUpdateEstimateParams = Omit +export type QuickBooksCreateInvoiceParams = Omit +export type QuickBooksUpdateInvoiceParams = Omit +export type QuickBooksCreateSalesReceiptParams = Omit< + QuickBooksCreateSalesDocumentParams, + 'dueDate' | 'expirationDate' +> +export type QuickBooksUpdateSalesReceiptParams = Omit< + QuickBooksUpdateSalesDocumentParams, + 'dueDate' | 'expirationDate' +> +export type QuickBooksCreateCreditMemoParams = Omit< + QuickBooksNonReceiptCreateParams, + 'dueDate' | 'expirationDate' +> +export type QuickBooksUpdateCreditMemoParams = Omit< + QuickBooksNonReceiptUpdateParams, + 'dueDate' | 'expirationDate' +> +export type QuickBooksCreateRefundReceiptParams = Omit< + QuickBooksCreateSalesReceiptParams, + 'depositAccountId' +> & { depositAccountId: string } +export type QuickBooksUpdateRefundReceiptParams = QuickBooksUpdateSalesReceiptParams + +export interface QuickBooksInvoiceAllocationInput { + invoiceId: string + amount: number +} + +export interface QuickBooksCreateCustomerPaymentParams extends QuickBooksAuthParams { + customerId: string + totalAmount: number + transactionDate?: string + privateNote?: string + paymentReferenceNumber?: string + paymentMethodId?: string + depositAccountId?: string + invoiceAllocations?: QuickBooksInvoiceAllocationInput[] + requestId?: string +} + +export interface QuickBooksUpdateCustomerPaymentParams + extends Omit { + paymentId: string + syncToken: string + customerId?: string + totalAmount?: number + /** + * Replace the payment's invoice allocations outright instead of merging the + * supplied allocations into the ones already on the payment. Every invoice + * omitted from `invoiceAllocations` is unapplied. + */ + unapplyOmittedInvoices?: boolean +} + +export interface QuickBooksVoidTransactionParams extends QuickBooksAuthParams { + transactionId: string + syncToken: string + confirmVoid: boolean +} + +export type QuickBooksActiveStatus = 'unchanged' | 'active' | 'inactive' +export type QuickBooksReadActiveStatus = 'default' | 'active' | 'inactive' + +export interface QuickBooksCreateCustomerParams extends QuickBooksAuthParams { + displayName: string + requestId?: string + companyName?: string + givenName?: string + familyName?: string + primaryEmail?: string + primaryPhone?: string + billingAddress?: QuickBooksAddress + shippingAddress?: QuickBooksAddress + taxable?: boolean +} + +export interface QuickBooksUpdateCustomerParams + extends Omit { + customerId: string + syncToken: string + displayName?: string + activeStatus?: QuickBooksActiveStatus +} + +export interface QuickBooksCreateEmployeeParams extends QuickBooksAuthParams { + displayName?: string + requestId?: string + givenName?: string + familyName?: string + primaryEmail?: string + primaryPhone?: string + primaryAddress?: QuickBooksAddress + printOnCheckName?: string + billableTime?: boolean +} + +export interface QuickBooksUpdateEmployeeParams + extends Omit { + employeeId: string + syncToken: string + displayName?: string + activeStatus?: QuickBooksActiveStatus +} + +export interface QuickBooksCreateVendorParams extends QuickBooksAuthParams { + displayName: string + requestId?: string + companyName?: string + givenName?: string + familyName?: string + primaryEmail?: string + primaryPhone?: string + billingAddress?: QuickBooksAddress + printOnCheckName?: string + accountNumber?: string + vendor1099?: boolean +} + +export interface QuickBooksUpdateVendorParams + extends Omit { + vendorId: string + syncToken: string + displayName?: string + activeStatus?: QuickBooksActiveStatus +} + +export type QuickBooksWritableItemType = 'service' | 'non_inventory' + +export interface QuickBooksCreateItemParams extends QuickBooksAuthParams { + name: string + itemType: QuickBooksWritableItemType + expenseAccountId: string + incomeAccountId?: string + requestId?: string + description?: string + unitPrice?: number + purchaseDescription?: string + purchaseCost?: number + taxable?: boolean +} + +export interface QuickBooksUpdateItemParams + extends Omit { + itemId: string + syncToken: string + name?: string + expenseAccountId?: string + activeStatus?: QuickBooksActiveStatus +} + +export interface QuickBooksCompanyInfoResponse extends ToolResponse { + output: { + company: QuickBooksCompanyInfo + time: string | null + } +} + +export interface QuickBooksListResponse extends ToolResponse { + output: { + items: T[] + startPosition: number + maxResults: number + nextStartPosition: number + hasMore: boolean + time: string | null + } +} + +export interface QuickBooksReadMasterDataResponse extends ToolResponse { + output: { + recordType: QuickBooksMasterDataRecordType + item?: QuickBooksMasterDataRecord + items?: QuickBooksMasterDataRecord[] + startPosition?: number + maxResults?: number + nextStartPosition?: number + hasMore?: boolean + time: string | null + } +} + +export interface QuickBooksReadSalesTransactionsResponse extends ToolResponse { + output: { + transactionType: QuickBooksSalesTransactionType + item?: QuickBooksSalesTransaction + items?: QuickBooksSalesTransaction[] + startPosition?: number + maxResults?: number + nextStartPosition?: number + hasMore?: boolean + time: string | null + } +} + +export interface QuickBooksReadPurchasingTransactionsResponse extends ToolResponse { + output: { + transactionType: QuickBooksPurchasingTransactionType + item?: QuickBooksPurchasingTransaction + items?: QuickBooksPurchasingTransaction[] + startPosition?: number + maxResults?: number + nextStartPosition?: number + hasMore?: boolean + time: string | null + } +} + +export interface QuickBooksReadAccountingTransactionsResponse extends ToolResponse { + output: { + transactionType: QuickBooksAccountingTransactionType + item?: QuickBooksAccountingTransaction + items?: QuickBooksAccountingTransaction[] + startPosition?: number + maxResults?: number + nextStartPosition?: number + hasMore?: boolean + time: string | null + } +} + +export interface QuickBooksRunFinancialReportResponse extends ToolResponse { + output: { + reportType: QuickBooksReportType + header: QuickBooksReportHeader + columns: QuickBooksReportColumns + rows: QuickBooksReportRows + time: string | null + } +} + +export interface QuickBooksEmailTransactionResponse extends ToolResponse { + output: { + transactionType: QuickBooksDocumentTransactionType + transactionId: string + sent: true + record?: QuickBooksTransaction + time: string | null + } +} + +export interface QuickBooksReadAttachmentsResponse extends ToolResponse { + output: { + item?: QuickBooksAttachable + items?: QuickBooksAttachable[] + startPosition?: number + maxResults?: number + nextStartPosition?: number + hasMore?: boolean + time: string | null + } +} + +export interface QuickBooksAddAttachmentResponse extends ToolResponse { + output: { + attachment: QuickBooksAttachable + attachmentId: string + attachmentKind: QuickBooksAttachmentKind + targetType: QuickBooksAttachmentTargetType + targetId: string + time: string | null + } +} + +export interface QuickBooksFileResponse extends ToolResponse { + output: { + file: UserFile + transactionType?: QuickBooksDocumentTransactionType + transactionId?: string + attachmentId?: string + fileName: string + mimeType: string + size: number + } +} + +export interface QuickBooksMutationResponse + extends ToolResponse { + output: { + record: T + recordId: string + syncToken: string + time: string | null + } +} + +export interface QuickBooksCreateBillResponse + extends QuickBooksMutationResponse { + output: QuickBooksMutationResponse['output'] & { + linkingRequested: boolean + linkingSucceeded: boolean | null + linkedLines: QuickBooksLinkedBillLine[] + missingLinks: QuickBooksBillLinkInput[] + linkingWarning?: string + } +} + +export interface QuickBooksVoidResponse extends ToolResponse { + output: { + record: QuickBooksSalesTransaction + recordId: string + syncToken: string + voided: true + time: string | null + } +} + +export type QuickBooksResponse = + | QuickBooksCompanyInfoResponse + | QuickBooksListResponse + | QuickBooksReadMasterDataResponse + | QuickBooksReadSalesTransactionsResponse + | QuickBooksReadPurchasingTransactionsResponse + | QuickBooksReadAccountingTransactionsResponse + | QuickBooksRunFinancialReportResponse + | QuickBooksEmailTransactionResponse + | QuickBooksReadAttachmentsResponse + | QuickBooksAddAttachmentResponse + | QuickBooksFileResponse + | QuickBooksMutationResponse< + QuickBooksCustomer | QuickBooksEmployee | QuickBooksVendor | QuickBooksItem + > + | QuickBooksMutationResponse + | QuickBooksMutationResponse + | QuickBooksCreateBillResponse + | QuickBooksMutationResponse + | QuickBooksVoidResponse + +export const QUICKBOOKS_REFERENCE_PROPERTIES: Record = { + value: { type: 'string', description: 'QuickBooks entity ID', optional: true }, + name: { type: 'string', description: 'QuickBooks entity display name', optional: true }, +} + +export const QUICKBOOKS_METADATA_PROPERTIES: Record = { + CreateTime: { type: 'string', description: 'Entity creation timestamp', optional: true }, + LastUpdatedTime: { + type: 'string', + description: 'Entity last-updated timestamp', + optional: true, + }, +} + +export const QUICKBOOKS_COMPANY_INFO_PROPERTIES: Record = { + Id: { + type: 'string', + description: 'QuickBooks CompanyInfo entity ID (commonly "1"); this is not the OAuth realmId', + }, + SyncToken: { type: 'string', description: 'CompanyInfo sync token', optional: true }, + CompanyName: { type: 'string', description: 'Company display name', optional: true }, + LegalName: { type: 'string', description: 'Company legal name', optional: true }, + CompanyAddr: { type: 'json', description: 'Company address', optional: true }, + CustomerCommunicationAddr: { + type: 'json', + description: 'Customer communication address', + optional: true, + }, + LegalAddr: { type: 'json', description: 'Company legal address', optional: true }, + PrimaryPhone: { type: 'json', description: 'Primary phone details', optional: true }, + Email: { type: 'json', description: 'Company email details', optional: true }, + WebAddr: { type: 'json', description: 'Company website details', optional: true }, + CompanyStartDate: { + type: 'string', + description: 'Company start date', + optional: true, + }, + Country: { type: 'string', description: 'Company country code', optional: true }, + FiscalYearStartMonth: { + type: 'string', + description: 'Fiscal year starting month', + optional: true, + }, + SupportedLanguages: { + type: 'string', + description: 'Comma-separated list of languages supported by the company', + optional: true, + }, + domain: { type: 'string', description: 'Originating Intuit domain', optional: true }, + sparse: { + type: 'boolean', + description: 'Whether QuickBooks returned a partial representation', + optional: true, + }, + NameValue: { + type: 'array', + description: 'QuickBooks company settings represented as name/value entries', + optional: true, + items: { type: 'json' }, + }, + MetaData: { + type: 'json', + description: 'CompanyInfo creation and update timestamps', + optional: true, + properties: QUICKBOOKS_METADATA_PROPERTIES, + }, +} + +/** + * Pagination outputs shared by QuickBooks read tools. + * + * Every field is optional because tools that expose both a list and a by-ID + * read mode reuse this map for a single declared output shape, and the by-ID + * branch returns only the record and the response timestamp. + */ +export const QUICKBOOKS_LIST_OUTPUTS: Record = { + startPosition: { + type: 'number', + description: 'One-based position of the first item in this response', + optional: true, + }, + maxResults: { + type: 'number', + description: 'Actual number of items reported for this response', + optional: true, + }, + nextStartPosition: { + type: 'number', + description: 'Position to use when explicitly requesting the next page', + optional: true, + }, + hasMore: { + type: 'boolean', + description: 'Conservative indication that another page may exist', + optional: true, + }, + time: { + type: 'string', + description: 'QuickBooks response timestamp', + optional: true, + nullable: true, + }, +} + +export const QUICKBOOKS_ATTACHABLE_PROPERTIES: Record = { + Id: { type: 'string', description: 'QuickBooks attachment ID' }, + SyncToken: { type: 'string', description: 'Attachment sync token', optional: true }, + FileName: { type: 'string', description: 'Attached file name', optional: true }, + ContentType: { type: 'string', description: 'Attached file MIME type', optional: true }, + Size: { type: 'number', description: 'Attached file size in bytes', optional: true }, + Note: { type: 'string', description: 'Attachment note or description', optional: true }, + Category: { + type: 'string', + description: 'Native QuickBooks attachment category', + optional: true, + }, + AttachableRef: { + type: 'array', + description: 'QuickBooks entities referenced by this attachment', + optional: true, + items: { + type: 'json', + properties: { + EntityRef: { + type: 'json', + description: 'Attached entity type and operational ID', + optional: true, + }, + IncludeOnSend: { + type: 'boolean', + description: 'Whether QuickBooks includes the attachment when sending', + optional: true, + }, + }, + }, + }, + MetaData: { + type: 'json', + description: 'Attachment creation and update timestamps', + optional: true, + properties: QUICKBOOKS_METADATA_PROPERTIES, + }, + domain: { type: 'string', description: 'QuickBooks domain', optional: true }, + sparse: { type: 'boolean', description: 'Whether this is a sparse entity', optional: true }, +} + +export const QUICKBOOKS_FILE_OUTPUTS: Record = { + file: { type: 'file', description: 'Downloaded file stored in execution files' }, + fileName: { type: 'string', description: 'Safe downloaded filename' }, + mimeType: { type: 'string', description: 'Downloaded file MIME type' }, + size: { type: 'number', description: 'Downloaded file size in bytes' }, +} + +export const QUICKBOOKS_ENTITY_BASE_PROPERTIES: Record = { + Id: { type: 'string', description: 'QuickBooks entity ID' }, + SyncToken: { type: 'string', description: 'Entity sync token', optional: true }, + Active: { type: 'boolean', description: 'Whether the entity is active', optional: true }, + MetaData: { + type: 'json', + description: 'Entity creation and update timestamps', + optional: true, + properties: QUICKBOOKS_METADATA_PROPERTIES, + }, +} + +export const QUICKBOOKS_ACCOUNT_PROPERTIES: Record = { + ...QUICKBOOKS_ENTITY_BASE_PROPERTIES, + Name: { type: 'string', description: 'Account name', optional: true }, + SubAccount: { type: 'boolean', description: 'Whether this is a subaccount', optional: true }, + ParentRef: { + type: 'json', + description: 'Parent account reference', + optional: true, + properties: QUICKBOOKS_REFERENCE_PROPERTIES, + }, + FullyQualifiedName: { + type: 'string', + description: 'Hierarchical qualified name', + optional: true, + }, + Classification: { + type: 'string', + description: 'Account classification', + optional: true, + }, + AccountType: { type: 'string', description: 'Account type', optional: true }, + AccountSubType: { type: 'string', description: 'Account subtype', optional: true }, + CurrentBalance: { type: 'number', description: 'Account current balance', optional: true }, + CurrencyRef: { + type: 'json', + description: 'Account currency reference', + optional: true, + properties: QUICKBOOKS_REFERENCE_PROPERTIES, + }, +} + +export const QUICKBOOKS_CUSTOMER_PROPERTIES: Record = { + ...QUICKBOOKS_ENTITY_BASE_PROPERTIES, + DisplayName: { + type: 'string', + description: 'Customer display name', + optional: true, + }, + CompanyName: { type: 'string', description: 'Customer company name', optional: true }, + GivenName: { type: 'string', description: 'Given name', optional: true }, + FamilyName: { type: 'string', description: 'Family name', optional: true }, + Taxable: { type: 'boolean', description: 'Whether the customer is taxable', optional: true }, + PrimaryEmailAddr: { + type: 'json', + description: 'Customer primary email address', + optional: true, + }, + PrimaryPhone: { + type: 'json', + description: 'Customer primary phone number', + optional: true, + }, + BillAddr: { type: 'json', description: 'Customer billing address', optional: true }, + ShipAddr: { type: 'json', description: 'Customer shipping address', optional: true }, + Balance: { type: 'number', description: 'Customer balance', optional: true }, + CurrencyRef: { + type: 'json', + description: 'Customer currency reference', + optional: true, + properties: QUICKBOOKS_REFERENCE_PROPERTIES, + }, +} + +export const QUICKBOOKS_VENDOR_PROPERTIES: Record = { + ...QUICKBOOKS_ENTITY_BASE_PROPERTIES, + DisplayName: { type: 'string', description: 'Vendor display name', optional: true }, + CompanyName: { type: 'string', description: 'Vendor company name', optional: true }, + GivenName: { type: 'string', description: 'Given name', optional: true }, + FamilyName: { type: 'string', description: 'Family name', optional: true }, + PrintOnCheckName: { + type: 'string', + description: 'Name printed on checks', + optional: true, + }, + Vendor1099: { + type: 'boolean', + description: 'Whether the vendor is tracked for 1099 reporting', + optional: true, + }, + PrimaryEmailAddr: { + type: 'json', + description: 'Vendor primary email address', + optional: true, + }, + PrimaryPhone: { + type: 'json', + description: 'Vendor primary phone number', + optional: true, + }, + BillAddr: { type: 'json', description: 'Vendor billing address', optional: true }, + AcctNum: { type: 'string', description: 'Vendor account number', optional: true }, + Balance: { type: 'number', description: 'Vendor balance', optional: true }, + CurrencyRef: { + type: 'json', + description: 'Vendor currency reference', + optional: true, + properties: QUICKBOOKS_REFERENCE_PROPERTIES, + }, +} + +export const QUICKBOOKS_ITEM_PROPERTIES: Record = { + ...QUICKBOOKS_ENTITY_BASE_PROPERTIES, + Name: { type: 'string', description: 'Item name', optional: true }, + Description: { type: 'string', description: 'Item sales description', optional: true }, + FullyQualifiedName: { + type: 'string', + description: 'Hierarchical qualified item name', + optional: true, + }, + Taxable: { type: 'boolean', description: 'Whether the item is taxable', optional: true }, + UnitPrice: { type: 'number', description: 'Item sale price', optional: true }, + Type: { type: 'string', description: 'Item type', optional: true }, + IncomeAccountRef: { + type: 'json', + description: 'Item income account reference', + optional: true, + properties: QUICKBOOKS_REFERENCE_PROPERTIES, + }, + ExpenseAccountRef: { + type: 'json', + description: 'Item expense account reference', + optional: true, + properties: QUICKBOOKS_REFERENCE_PROPERTIES, + }, + PurchaseDesc: { type: 'string', description: 'Item purchase description', optional: true }, + PurchaseCost: { type: 'number', description: 'Item purchase cost', optional: true }, + AssetAccountRef: { + type: 'json', + description: 'Inventory asset account reference', + optional: true, + properties: QUICKBOOKS_REFERENCE_PROPERTIES, + }, + TrackQtyOnHand: { + type: 'boolean', + description: 'Whether QuickBooks tracks quantity on hand', + optional: true, + }, + QtyOnHand: { type: 'number', description: 'Current quantity on hand', optional: true }, + InvStartDate: { type: 'string', description: 'Inventory tracking start date', optional: true }, + ParentRef: { + type: 'json', + description: 'Parent item or category reference', + optional: true, + properties: QUICKBOOKS_REFERENCE_PROPERTIES, + }, +} + +export const QUICKBOOKS_EMPLOYEE_PROPERTIES: Record = { + ...QUICKBOOKS_ENTITY_BASE_PROPERTIES, + DisplayName: { type: 'string', description: 'Employee display name', optional: true }, + GivenName: { type: 'string', description: 'Given name', optional: true }, + FamilyName: { type: 'string', description: 'Family name', optional: true }, + PrintOnCheckName: { + type: 'string', + description: 'Employee name printed on checks', + optional: true, + }, + PrimaryEmailAddr: { + type: 'json', + description: 'Employee primary email address', + optional: true, + }, + PrimaryPhone: { + type: 'json', + description: 'Employee primary phone number', + optional: true, + }, + PrimaryAddr: { type: 'json', description: 'Employee primary address', optional: true }, + BillableTime: { + type: 'boolean', + description: 'Whether employee time is billable', + optional: true, + }, + domain: { type: 'string', description: 'QuickBooks domain', optional: true }, + sparse: { type: 'boolean', description: 'Whether this is a sparse entity', optional: true }, +} + +export const QUICKBOOKS_MASTER_DATA_PROPERTIES: Record = { + ...QUICKBOOKS_ACCOUNT_PROPERTIES, + ...QUICKBOOKS_CUSTOMER_PROPERTIES, + ...QUICKBOOKS_VENDOR_PROPERTIES, + ...QUICKBOOKS_ITEM_PROPERTIES, + ...QUICKBOOKS_EMPLOYEE_PROPERTIES, + PrintOnCheckName: { + type: 'string', + description: 'Vendor or employee name printed on checks', + optional: true, + }, + Name: { + type: 'string', + description: 'Account, item, class, or department name', + optional: true, + }, + ParentRef: { + type: 'json', + description: 'Parent account, item, class, or department reference', + optional: true, + properties: QUICKBOOKS_REFERENCE_PROPERTIES, + }, + FullyQualifiedName: { + type: 'string', + description: 'Hierarchical qualified account, item, class, or department name', + optional: true, + }, + CurrencyRef: { + type: 'json', + description: 'Account, customer, or vendor currency reference', + optional: true, + properties: QUICKBOOKS_REFERENCE_PROPERTIES, + }, + DisplayName: { + type: 'string', + description: 'Customer, vendor, or employee display name', + optional: true, + }, + CompanyName: { + type: 'string', + description: 'Customer or vendor company name', + optional: true, + }, + Taxable: { + type: 'boolean', + description: 'Taxable status for the customer or item', + optional: true, + }, + PrimaryEmailAddr: { + type: 'json', + description: 'Customer, vendor, or employee primary email address', + optional: true, + }, + PrimaryPhone: { + type: 'json', + description: 'Customer, vendor, or employee primary phone number', + optional: true, + }, + BillAddr: { + type: 'json', + description: 'Customer or vendor billing address', + optional: true, + }, + Balance: { + type: 'number', + description: 'Customer or vendor balance', + optional: true, + }, + SubClass: { + type: 'boolean', + description: 'Whether the Class is nested under another Class', + optional: true, + }, + SubDepartment: { + type: 'boolean', + description: 'Whether the Department is nested under another Department', + optional: true, + }, +} + +export const QUICKBOOKS_REPORT_HEADER_PROPERTIES: Record = { + Time: { type: 'string', description: 'QuickBooks report generation timestamp', optional: true }, + ReportName: { type: 'string', description: 'Native QuickBooks report name', optional: true }, + DateMacro: { + type: 'string', + description: 'QuickBooks date macro, when returned', + optional: true, + }, + ReportBasis: { type: 'string', description: 'Cash or accrual basis', optional: true }, + StartPeriod: { type: 'string', description: 'Report start date', optional: true }, + EndPeriod: { type: 'string', description: 'Report end or as-of date', optional: true }, + SummarizeColumnsBy: { + type: 'string', + description: 'Dimension or time period used for report columns', + optional: true, + }, + Currency: { type: 'string', description: 'Report currency', optional: true }, + Customer: { type: 'string', description: 'Applied customer filter', optional: true }, + Vendor: { type: 'string', description: 'Applied vendor filter', optional: true }, + Account: { type: 'string', description: 'Applied account filter', optional: true }, + Item: { type: 'string', description: 'Applied item filter', optional: true }, + Class: { type: 'string', description: 'Applied class filter', optional: true }, + Department: { type: 'string', description: 'Applied department filter', optional: true }, + Option: { + type: 'array', + description: 'Native QuickBooks report options, including no-data indicators when present', + optional: true, + items: { type: 'json' }, + }, +} + +export const QUICKBOOKS_REPORT_COLUMNS_PROPERTIES: Record = { + Column: { + type: 'array', + description: 'Native report column definitions with titles, types, and metadata', + optional: true, + items: { + type: 'json', + properties: { + ColTitle: { type: 'string', description: 'Column title', optional: true }, + ColType: { type: 'string', description: 'QuickBooks column data type', optional: true }, + MetaData: { + type: 'array', + description: 'Native column metadata name/value entries', + optional: true, + items: { type: 'json' }, + }, + }, + }, + }, +} + +export const QUICKBOOKS_REPORT_ROWS_PROPERTIES: Record = { + Row: { + type: 'array', + description: + 'Native hierarchical report rows; section rows may contain Header, nested Rows, and Summary, while data rows contain ColData values, IDs, and links', + optional: true, + items: { + type: 'json', + properties: { + type: { type: 'string', description: 'QuickBooks row type', optional: true }, + group: { type: 'string', description: 'QuickBooks section group', optional: true }, + Header: { type: 'json', description: 'Section header column data', optional: true }, + ColData: { + type: 'array', + description: 'Row values with optional operational IDs and links', + optional: true, + items: { type: 'json' }, + }, + Rows: { + type: 'json', + description: 'Nested native QuickBooks report rows', + optional: true, + }, + Summary: { type: 'json', description: 'Section summary column data', optional: true }, + }, + }, + }, +} + +export const QUICKBOOKS_SALES_TRANSACTION_PROPERTIES: Record = { + Id: { type: 'string', description: 'QuickBooks sales transaction ID' }, + SyncToken: { type: 'string', description: 'Current transaction sync token', optional: true }, + DocNumber: { type: 'string', description: 'Transaction document number', optional: true }, + TxnDate: { type: 'string', description: 'Transaction date', optional: true }, + DueDate: { type: 'string', description: 'Invoice due date', optional: true }, + ExpirationDate: { type: 'string', description: 'Estimate expiration date', optional: true }, + CustomerRef: { + type: 'json', + description: 'Customer reference', + optional: true, + properties: QUICKBOOKS_REFERENCE_PROPERTIES, + }, + CustomerMemo: { type: 'json', description: 'Customer-facing memo', optional: true }, + DepositToAccountRef: { + type: 'json', + description: 'Deposit account reference', + optional: true, + properties: QUICKBOOKS_REFERENCE_PROPERTIES, + }, + PaymentMethodRef: { + type: 'json', + description: 'Payment method reference', + optional: true, + properties: QUICKBOOKS_REFERENCE_PROPERTIES, + }, + PaymentRefNum: { + type: 'string', + description: 'Customer payment reference number', + optional: true, + }, + CurrencyRef: { + type: 'json', + description: 'Transaction currency reference', + optional: true, + properties: QUICKBOOKS_REFERENCE_PROPERTIES, + }, + Line: { + type: 'array', + description: 'Native QuickBooks transaction lines', + optional: true, + items: { type: 'json' }, + }, + LinkedTxn: { + type: 'array', + description: 'Transactions linked by QuickBooks', + optional: true, + items: { type: 'json' }, + }, + TotalAmt: { type: 'number', description: 'Transaction total amount', optional: true }, + Balance: { type: 'number', description: 'Remaining transaction balance', optional: true }, + UnappliedAmt: { type: 'number', description: 'Unapplied payment amount', optional: true }, + PrivateNote: { type: 'string', description: 'Internal transaction note', optional: true }, + TxnStatus: { type: 'string', description: 'Transaction status', optional: true }, + TxnTaxDetail: { type: 'json', description: 'Calculated tax details', optional: true }, + MetaData: { + type: 'json', + description: 'Transaction creation and update timestamps', + optional: true, + properties: QUICKBOOKS_METADATA_PROPERTIES, + }, +} + +export const QUICKBOOKS_LINKED_TRANSACTION_PROPERTIES: Record = { + TxnId: { type: 'string', description: 'Linked QuickBooks transaction ID', optional: true }, + TxnType: { type: 'string', description: 'Linked QuickBooks transaction type', optional: true }, + TxnLineId: { + type: 'string', + description: 'Linked QuickBooks transaction line ID', + optional: true, + }, +} + +export const QUICKBOOKS_PURCHASING_LINE_PROPERTIES: Record = { + Id: { type: 'string', description: 'QuickBooks transaction line ID', optional: true }, + LineNum: { type: 'number', description: 'QuickBooks transaction line number', optional: true }, + Description: { type: 'string', description: 'Transaction line description', optional: true }, + Amount: { type: 'number', description: 'Transaction line amount', optional: true }, + DetailType: { type: 'string', description: 'QuickBooks line detail type', optional: true }, + LinkedTxn: { + type: 'array', + description: 'Transactions linked to this QuickBooks line', + optional: true, + items: { type: 'json', properties: QUICKBOOKS_LINKED_TRANSACTION_PROPERTIES }, + }, + AccountBasedExpenseLineDetail: { + type: 'json', + description: 'Native QuickBooks account-based expense details', + optional: true, + }, + ItemBasedExpenseLineDetail: { + type: 'json', + description: 'Native QuickBooks item-based expense details', + optional: true, + }, +} + +export const QUICKBOOKS_PURCHASING_TRANSACTION_PROPERTIES: Record = { + Id: { type: 'string', description: 'QuickBooks purchasing transaction ID' }, + SyncToken: { type: 'string', description: 'Current transaction sync token', optional: true }, + DocNumber: { type: 'string', description: 'Transaction document number', optional: true }, + TxnDate: { type: 'string', description: 'Transaction date', optional: true }, + DueDate: { type: 'string', description: 'Bill due date', optional: true }, + VendorRef: { + type: 'json', + description: 'Vendor reference', + optional: true, + properties: QUICKBOOKS_REFERENCE_PROPERTIES, + }, + APAccountRef: { + type: 'json', + description: 'Accounts-payable account reference', + optional: true, + properties: QUICKBOOKS_REFERENCE_PROPERTIES, + }, + AccountRef: { + type: 'json', + description: 'Payment account reference', + optional: true, + properties: QUICKBOOKS_REFERENCE_PROPERTIES, + }, + EntityRef: { + type: 'json', + description: 'Purchase payee reference', + optional: true, + properties: { + ...QUICKBOOKS_REFERENCE_PROPERTIES, + type: { type: 'string', description: 'Referenced entity type', optional: true }, + }, + }, + PaymentType: { type: 'string', description: 'Purchase payment type', optional: true }, + PayType: { type: 'string', description: 'Bill-payment type', optional: true }, + CheckPayment: { + type: 'json', + description: 'Check payment account details', + optional: true, + }, + CreditCardPayment: { + type: 'json', + description: 'Credit-card payment account details', + optional: true, + }, + PaymentRefNum: { type: 'string', description: 'Payment reference number', optional: true }, + CurrencyRef: { + type: 'json', + description: 'Transaction currency reference', + optional: true, + properties: QUICKBOOKS_REFERENCE_PROPERTIES, + }, + Line: { + type: 'array', + description: 'Native QuickBooks expense or allocation lines', + optional: true, + items: { type: 'json', properties: QUICKBOOKS_PURCHASING_LINE_PROPERTIES }, + }, + LinkedTxn: { + type: 'array', + description: 'Transactions linked by QuickBooks', + optional: true, + items: { type: 'json', properties: QUICKBOOKS_LINKED_TRANSACTION_PROPERTIES }, + }, + TotalAmt: { type: 'number', description: 'Transaction total amount', optional: true }, + Balance: { type: 'number', description: 'Remaining transaction balance', optional: true }, + PrivateNote: { type: 'string', description: 'Internal transaction note', optional: true }, + MetaData: { + type: 'json', + description: 'Transaction creation and update timestamps', + optional: true, + properties: QUICKBOOKS_METADATA_PROPERTIES, + }, +} + +export const QUICKBOOKS_EMAILABLE_TRANSACTION_PROPERTIES: Record = { + ...QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, + ...QUICKBOOKS_PURCHASING_TRANSACTION_PROPERTIES, + Id: { type: 'string', description: 'QuickBooks transaction ID' }, + DueDate: { type: 'string', description: 'Transaction due date', optional: true }, + POStatus: { type: 'string', description: 'Purchase order status', optional: true }, + Line: { + type: 'array', + description: 'Native QuickBooks sales or purchasing transaction lines', + optional: true, + items: { + type: 'json', + properties: { + ...QUICKBOOKS_PURCHASING_LINE_PROPERTIES, + SalesItemLineDetail: { + type: 'json', + description: 'Native QuickBooks sales item line details', + optional: true, + }, + DescriptionLineDetail: { + type: 'json', + description: 'Native QuickBooks description line details', + optional: true, + }, + }, + }, + }, +} + +export const QUICKBOOKS_ACCOUNTING_TRANSACTION_PROPERTIES: Record = { + Id: { type: 'string', description: 'QuickBooks accounting transaction ID' }, + SyncToken: { type: 'string', description: 'Current transaction sync token', optional: true }, + DocNumber: { type: 'string', description: 'Transaction document number', optional: true }, + TxnDate: { type: 'string', description: 'Transaction date', optional: true }, + PrivateNote: { type: 'string', description: 'Internal transaction note', optional: true }, + Adjustment: { + type: 'boolean', + description: 'Whether the journal entry is an adjusting entry', + optional: true, + }, + DepositToAccountRef: { + type: 'json', + description: 'Account receiving a deposit', + optional: true, + properties: QUICKBOOKS_REFERENCE_PROPERTIES, + }, + FromAccountRef: { + type: 'json', + description: 'Transfer source account', + optional: true, + properties: QUICKBOOKS_REFERENCE_PROPERTIES, + }, + ToAccountRef: { + type: 'json', + description: 'Transfer destination account', + optional: true, + properties: QUICKBOOKS_REFERENCE_PROPERTIES, + }, + Line: { + type: 'array', + description: 'Native QuickBooks journal or deposit lines', + optional: true, + items: { type: 'json' }, + }, + Amount: { type: 'number', description: 'Transfer amount', optional: true }, + TotalAmt: { type: 'number', description: 'Transaction total amount', optional: true }, + MetaData: { + type: 'json', + description: 'Transaction creation and update timestamps', + optional: true, + properties: QUICKBOOKS_METADATA_PROPERTIES, + }, +} + +export const QUICKBOOKS_MUTATION_OUTPUTS: Record = { + recordId: { type: 'string', description: 'ID of the created or updated QuickBooks entity' }, + syncToken: { + type: 'string', + description: 'Latest sync token required for a subsequent update', + }, + time: { + type: 'string', + description: 'QuickBooks response timestamp', + optional: true, + nullable: true, + }, +} + +export const QUICKBOOKS_BILL_LINK_INPUT_PROPERTIES: Record = { + purchaseOrderId: { type: 'string', description: 'Requested Purchase Order ID' }, + purchaseOrderLineId: { type: 'string', description: 'Requested Purchase Order line ID' }, +} + +export const QUICKBOOKS_CREATE_BILL_LINK_OUTPUTS: Record = { + linkingRequested: { + type: 'boolean', + description: 'Whether any Purchase Order line links were requested', + }, + linkingSucceeded: { + type: 'boolean', + description: 'Whether QuickBooks returned every requested Purchase Order line link', + nullable: true, + }, + linkedLines: { + type: 'array', + description: 'Requested Purchase Order line links confirmed by QuickBooks', + items: { + type: 'json', + properties: { + ...QUICKBOOKS_BILL_LINK_INPUT_PROPERTIES, + billLineId: { + type: 'string', + description: 'Created Bill line ID carrying the confirmed link', + optional: true, + }, + }, + }, + }, + missingLinks: { + type: 'array', + description: 'Requested Purchase Order line links omitted by QuickBooks', + items: { type: 'json', properties: QUICKBOOKS_BILL_LINK_INPUT_PROPERTIES }, + }, + linkingWarning: { + type: 'string', + description: 'Warning that the Bill was created without every requested Purchase Order link', + optional: true, + }, +} + +export const QUICKBOOKS_VOID_OUTPUTS: Record = { + ...QUICKBOOKS_MUTATION_OUTPUTS, + voided: { type: 'boolean', description: 'Whether QuickBooks voided the transaction' }, +} diff --git a/apps/sim/tools/quickbooks/update_bill.ts b/apps/sim/tools/quickbooks/update_bill.ts new file mode 100644 index 00000000000..f88450519ac --- /dev/null +++ b/apps/sim/tools/quickbooks/update_bill.ts @@ -0,0 +1,123 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import { buildQuickBooksUpdateBillBody } from '@/tools/quickbooks/purchasing_utils' +import type { + QuickBooksMutationResponse, + QuickBooksPurchasingTransaction, + QuickBooksUpdateBillParams, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_MUTATION_OUTPUTS, + QUICKBOOKS_PURCHASING_TRANSACTION_PROPERTIES, +} from '@/tools/quickbooks/types' +import { + buildQuickBooksEntityUrl, + executeQuickBooksFullUpdate, + getQuickBooksToolHeaders, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksUpdateBillTool: ToolConfig< + QuickBooksUpdateBillParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_update_bill', + name: 'QuickBooks Update Bill', + description: 'Read, merge, and full-update bill header fields using its current sync token', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + billId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Bill ID to update', + }, + syncToken: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Current bill sync token', + }, + vendorId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Current or replacement vendor ID required by QuickBooks', + }, + apAccountId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement accounts-payable account ID', + }, + transactionDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement bill date in YYYY-MM-DD format', + }, + dueDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement due date in YYYY-MM-DD format', + }, + documentNumber: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement bill number', + }, + privateNote: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement internal note', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (p) => buildQuickBooksEntityUrl(p.realmId, 'bill').toString(), + method: 'POST', + headers: (p) => getQuickBooksToolHeaders(p.accessToken, 'application/json'), + body: buildQuickBooksUpdateBillBody, + retry: { enabled: false }, + }, + directExecution: (params, signal) => + executeQuickBooksFullUpdate({ + params, + signal, + entity: 'Bill', + resource: 'bill', + recordId: params.billId, + syncToken: params.syncToken, + buildPatch: buildQuickBooksUpdateBillBody, + }), + transformResponse: (r) => + transformQuickBooksMutationResponse(r, 'Bill'), + outputs: { + record: { + type: 'json', + description: 'Updated native QuickBooks Bill', + properties: QUICKBOOKS_PURCHASING_TRANSACTION_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/update_bill_payment.ts b/apps/sim/tools/quickbooks/update_bill_payment.ts new file mode 100644 index 00000000000..9fd18fc75e4 --- /dev/null +++ b/apps/sim/tools/quickbooks/update_bill_payment.ts @@ -0,0 +1,105 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import { buildQuickBooksUpdateBillPaymentBody } from '@/tools/quickbooks/purchasing_utils' +import type { + QuickBooksMutationResponse, + QuickBooksPurchasingTransaction, + QuickBooksUpdateBillPaymentParams, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_MUTATION_OUTPUTS, + QUICKBOOKS_PURCHASING_TRANSACTION_PROPERTIES, +} from '@/tools/quickbooks/types' +import { + buildQuickBooksEntityUrl, + executeQuickBooksFullUpdate, + getQuickBooksToolHeaders, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksUpdateBillPaymentTool: ToolConfig< + QuickBooksUpdateBillPaymentParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_update_bill_payment', + name: 'QuickBooks Update Bill Payment', + description: 'Read, merge, and full-update a BillPayment without changing allocations', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + billPaymentId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'BillPayment ID to update', + }, + syncToken: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Current BillPayment sync token', + }, + vendorId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Current vendor ID required by QuickBooks', + }, + transactionDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement payment date in YYYY-MM-DD format', + }, + privateNote: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement internal note', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (p) => buildQuickBooksEntityUrl(p.realmId, 'billpayment').toString(), + method: 'POST', + headers: (p) => getQuickBooksToolHeaders(p.accessToken, 'application/json'), + body: buildQuickBooksUpdateBillPaymentBody, + retry: { enabled: false }, + }, + directExecution: (params, signal) => + executeQuickBooksFullUpdate({ + params, + signal, + entity: 'BillPayment', + resource: 'billpayment', + recordId: params.billPaymentId, + syncToken: params.syncToken, + buildPatch: buildQuickBooksUpdateBillPaymentBody, + }), + transformResponse: (r) => + transformQuickBooksMutationResponse(r, 'BillPayment'), + outputs: { + record: { + type: 'json', + description: 'Updated native QuickBooks BillPayment', + properties: QUICKBOOKS_PURCHASING_TRANSACTION_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/update_credit_memo.ts b/apps/sim/tools/quickbooks/update_credit_memo.ts new file mode 100644 index 00000000000..12f358c79f1 --- /dev/null +++ b/apps/sim/tools/quickbooks/update_credit_memo.ts @@ -0,0 +1,124 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import { buildQuickBooksUpdateSalesDocumentBody } from '@/tools/quickbooks/sales_utils' +import type { + QuickBooksMutationResponse, + QuickBooksSalesTransaction, + QuickBooksUpdateCreditMemoParams, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_MUTATION_OUTPUTS, + QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, +} from '@/tools/quickbooks/types' +import { + buildQuickBooksEntityUrl, + executeQuickBooksFullUpdate, + getQuickBooksToolHeaders, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksUpdateCreditMemoTool: ToolConfig< + QuickBooksUpdateCreditMemoParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_update_credit_memo', + name: 'QuickBooks Update Credit Memo', + description: 'Read, merge, and full-update a credit memo using its current sync token', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + transactionId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Credit memo ID to update', + }, + syncToken: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Current credit memo sync token', + }, + customerId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement customer ID', + }, + lines: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: + 'Complete replacement set of credit memo lines: any existing line omitted here is deleted from the credit memo', + }, + transactionDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement credit memo date in YYYY-MM-DD format', + }, + documentNumber: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement credit memo number', + }, + privateNote: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement internal note', + }, + customerMemo: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement customer-facing memo', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => buildQuickBooksEntityUrl(params.realmId, 'creditmemo').toString(), + method: 'POST', + headers: (params) => getQuickBooksToolHeaders(params.accessToken, 'application/json'), + body: (params) => buildQuickBooksUpdateSalesDocumentBody(params), + retry: { enabled: false }, + }, + directExecution: (params, signal) => + executeQuickBooksFullUpdate({ + params, + signal, + entity: 'CreditMemo', + resource: 'creditmemo', + recordId: params.transactionId, + syncToken: params.syncToken, + buildPatch: buildQuickBooksUpdateSalesDocumentBody, + }), + transformResponse: (response) => + transformQuickBooksMutationResponse(response, 'CreditMemo'), + outputs: { + record: { + type: 'json', + description: 'Updated native QuickBooks CreditMemo', + properties: QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/update_customer.ts b/apps/sim/tools/quickbooks/update_customer.ts new file mode 100644 index 00000000000..d476958ab2c --- /dev/null +++ b/apps/sim/tools/quickbooks/update_customer.ts @@ -0,0 +1,169 @@ +import { filterUndefined } from '@sim/utils/object' +import { ErrorExtractorId } from '@/tools/error-extractors' +import type { + QuickBooksCustomer, + QuickBooksMutationResponse, + QuickBooksUpdateCustomerParams, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_CUSTOMER_PROPERTIES, + QUICKBOOKS_MUTATION_OUTPUTS, +} from '@/tools/quickbooks/types' +import { + buildQuickBooksEntityUrl, + getQuickBooksToolHeaders, + sanitizeQuickBooksCustomer, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import { + assertQuickBooksSparseUpdate, + optionalQuickBooksString, + parseQuickBooksAddress, + quickBooksActiveValue, + quickBooksEmailAddress, + quickBooksPhoneNumber, + requiredQuickBooksString, +} from '@/tools/quickbooks/values' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksUpdateCustomerTool: ToolConfig< + QuickBooksUpdateCustomerParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_update_customer', + name: 'QuickBooks Update Customer', + description: 'Sparse-update a customer in the connected QuickBooks Online company', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + customerId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'ID of the customer to update', + }, + syncToken: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Current customer sync token', + }, + displayName: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement customer display name', + }, + companyName: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement customer company name', + }, + givenName: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement customer given name', + }, + familyName: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement customer family name', + }, + primaryEmail: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement primary email address', + }, + primaryPhone: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement primary phone number', + }, + billingAddress: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: 'Replacement billing address', + }, + shippingAddress: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: 'Replacement shipping address', + }, + taxable: { + type: 'boolean', + required: false, + visibility: 'user-or-llm', + description: 'Whether sales to this customer are taxable', + }, + activeStatus: { + type: 'string', + required: false, + visibility: 'user-or-llm', + default: 'unchanged', + description: 'Customer status change: unchanged, active, or inactive', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => buildQuickBooksEntityUrl(params.realmId, 'customer').toString(), + method: 'POST', + headers: (params) => getQuickBooksToolHeaders(params.accessToken, 'application/json'), + body: (params) => { + const body = filterUndefined({ + Id: requiredQuickBooksString(params.customerId, 'customerId'), + SyncToken: requiredQuickBooksString(params.syncToken, 'syncToken'), + sparse: true, + DisplayName: optionalQuickBooksString(params.displayName), + CompanyName: optionalQuickBooksString(params.companyName), + GivenName: optionalQuickBooksString(params.givenName), + FamilyName: optionalQuickBooksString(params.familyName), + PrimaryEmailAddr: quickBooksEmailAddress(params.primaryEmail), + PrimaryPhone: quickBooksPhoneNumber(params.primaryPhone), + BillAddr: parseQuickBooksAddress(params.billingAddress, 'billingAddress'), + ShipAddr: parseQuickBooksAddress(params.shippingAddress, 'shippingAddress'), + Taxable: params.taxable, + Active: quickBooksActiveValue(params.activeStatus), + }) as Record + assertQuickBooksSparseUpdate(body) + return body + }, + retry: { enabled: false }, + }, + transformResponse: (response) => + transformQuickBooksMutationResponse( + response, + 'Customer', + sanitizeQuickBooksCustomer + ), + outputs: { + record: { + type: 'json', + description: 'Updated QuickBooks Customer record', + properties: QUICKBOOKS_CUSTOMER_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/update_customer_payment.ts b/apps/sim/tools/quickbooks/update_customer_payment.ts new file mode 100644 index 00000000000..2ed7e153379 --- /dev/null +++ b/apps/sim/tools/quickbooks/update_customer_payment.ts @@ -0,0 +1,188 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import { + buildQuickBooksUpdatePaymentBody, + parseQuickBooksInvoiceAllocations, +} from '@/tools/quickbooks/sales_utils' +import type { + QuickBooksMutationResponse, + QuickBooksSalesTransaction, + QuickBooksUpdateCustomerPaymentParams, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_MUTATION_OUTPUTS, + QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, +} from '@/tools/quickbooks/types' +import { + buildQuickBooksEntityUrl, + getQuickBooksDirectExecutionError, + getQuickBooksToolHeaders, + transformQuickBooksEntityResponse, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksUpdateCustomerPaymentTool: ToolConfig< + QuickBooksUpdateCustomerPaymentParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_update_customer_payment', + name: 'QuickBooks Update Customer Payment', + description: 'Sparse-update a customer payment using its current sync token', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + paymentId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Payment ID to update', + }, + syncToken: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Current payment sync token', + }, + customerId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement customer ID', + }, + totalAmount: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: 'Replacement positive payment total', + }, + transactionDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement payment date in YYYY-MM-DD format', + }, + privateNote: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement internal note', + }, + paymentReferenceNumber: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement payment reference number', + }, + paymentMethodId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement payment method ID', + }, + depositAccountId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement deposit account ID', + }, + invoiceAllocations: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: + 'Bounded invoice allocations to apply. Each entry sets the amount applied to that invoice; invoices already applied on the payment and not listed here keep their current amounts', + }, + unapplyOmittedInvoices: { + type: 'boolean', + required: false, + visibility: 'user-only', + description: + 'Replace the payment allocations outright. Every invoice not listed in invoiceAllocations is UNAPPLIED and returns to open', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => buildQuickBooksEntityUrl(params.realmId, 'payment').toString(), + method: 'POST', + headers: (params) => getQuickBooksToolHeaders(params.accessToken, 'application/json'), + body: (params) => buildQuickBooksUpdatePaymentBody(params), + retry: { enabled: false }, + }, + /** + * QuickBooks updates Payment lines all-or-none: an update that omits a line + * unapplies that invoice. Read the payment first so supplied allocations can + * be merged into the live line set instead of silently replacing it. + */ + directExecution: async (params, signal) => { + const paymentId = params.paymentId?.trim() + if (!paymentId) throw new Error('paymentId is required') + + // Validate bounded allocations before the preservation read so malformed or + // duplicate invoice references never contact QuickBooks. + parseQuickBooksInvoiceAllocations(params.invoiceAllocations) + + let currentPayment: QuickBooksSalesTransaction | undefined + if (params.invoiceAllocations && !params.unapplyOmittedInvoices) { + const readResponse = await fetch( + buildQuickBooksEntityUrl(params.realmId, 'payment', paymentId), + { method: 'GET', headers: getQuickBooksToolHeaders(params.accessToken), signal } + ) + if (!readResponse.ok) + throw await getQuickBooksDirectExecutionError(readResponse, 'Payment', signal) + const { item } = await transformQuickBooksEntityResponse( + readResponse, + 'Payment', + signal + ) + const currentSyncToken = typeof item.SyncToken === 'string' ? item.SyncToken.trim() : '' + if (currentSyncToken !== params.syncToken?.trim()) { + throw new Error( + `QuickBooks payment ${paymentId} changed since sync token ${params.syncToken} was read (current sync token ${currentSyncToken}). Re-read the payment and retry.` + ) + } + currentPayment = item + signal?.throwIfAborted() + } + + const updateResponse = await fetch(buildQuickBooksEntityUrl(params.realmId, 'payment'), { + method: 'POST', + headers: getQuickBooksToolHeaders(params.accessToken, 'application/json'), + body: JSON.stringify(buildQuickBooksUpdatePaymentBody(params, currentPayment)), + signal, + }) + if (!updateResponse.ok) + throw await getQuickBooksDirectExecutionError(updateResponse, 'Payment', signal) + return transformQuickBooksMutationResponse( + updateResponse, + 'Payment', + undefined, + signal + ) + }, + transformResponse: (response) => + transformQuickBooksMutationResponse(response, 'Payment'), + outputs: { + record: { + type: 'json', + description: 'Updated native QuickBooks Payment', + properties: QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/update_deposit.ts b/apps/sim/tools/quickbooks/update_deposit.ts new file mode 100644 index 00000000000..410a8ff488c --- /dev/null +++ b/apps/sim/tools/quickbooks/update_deposit.ts @@ -0,0 +1,95 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import { buildQuickBooksUpdateDepositBody } from '@/tools/quickbooks/accounting_utils' +import type { + QuickBooksAccountingTransaction, + QuickBooksMutationResponse, + QuickBooksUpdateDepositParams, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_ACCOUNTING_TRANSACTION_PROPERTIES, + QUICKBOOKS_MUTATION_OUTPUTS, +} from '@/tools/quickbooks/types' +import { + buildQuickBooksEntityUrl, + getQuickBooksToolHeaders, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksUpdateDepositTool: ToolConfig< + QuickBooksUpdateDepositParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_update_deposit', + name: 'QuickBooks Update Deposit', + description: + 'Sparse-update deposit header fields using the current sync token and destination account', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + depositId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Deposit ID to update', + }, + syncToken: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Current deposit sync token', + }, + depositAccountId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Current QuickBooks account receiving the deposit', + }, + transactionDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement date in YYYY-MM-DD format', + }, + privateNote: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement internal note', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (p) => buildQuickBooksEntityUrl(p.realmId, 'deposit').toString(), + method: 'POST', + headers: (p) => getQuickBooksToolHeaders(p.accessToken, 'application/json'), + body: buildQuickBooksUpdateDepositBody, + retry: { enabled: false }, + }, + transformResponse: (r) => + transformQuickBooksMutationResponse(r, 'Deposit'), + outputs: { + record: { + type: 'json', + description: 'Updated native QuickBooks Deposit', + properties: QUICKBOOKS_ACCOUNTING_TRANSACTION_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/update_employee.ts b/apps/sim/tools/quickbooks/update_employee.ts new file mode 100644 index 00000000000..477f936aede --- /dev/null +++ b/apps/sim/tools/quickbooks/update_employee.ts @@ -0,0 +1,178 @@ +import { filterUndefined } from '@sim/utils/object' +import { ErrorExtractorId } from '@/tools/error-extractors' +import type { + QuickBooksEmployee, + QuickBooksMutationResponse, + QuickBooksUpdateEmployeeParams, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_EMPLOYEE_PROPERTIES, + QUICKBOOKS_MUTATION_OUTPUTS, +} from '@/tools/quickbooks/types' +import { + buildQuickBooksEntityUrl, + executeQuickBooksFullUpdate, + getQuickBooksToolHeaders, + sanitizeQuickBooksEmployee, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import { + assertQuickBooksSparseUpdate, + optionalQuickBooksString, + parseQuickBooksAddress, + quickBooksActiveValue, + quickBooksEmailAddress, + quickBooksPhoneNumber, + requiredQuickBooksString, +} from '@/tools/quickbooks/values' +import type { ToolConfig } from '@/tools/types' + +function buildQuickBooksUpdateEmployeeBody( + params: QuickBooksUpdateEmployeeParams +): Record { + const body = filterUndefined({ + Id: requiredQuickBooksString(params.employeeId, 'employeeId'), + SyncToken: requiredQuickBooksString(params.syncToken, 'syncToken'), + sparse: true, + DisplayName: optionalQuickBooksString(params.displayName), + GivenName: optionalQuickBooksString(params.givenName), + FamilyName: optionalQuickBooksString(params.familyName), + PrimaryEmailAddr: quickBooksEmailAddress(params.primaryEmail), + PrimaryPhone: quickBooksPhoneNumber(params.primaryPhone), + PrimaryAddr: parseQuickBooksAddress(params.primaryAddress, 'primaryAddress'), + PrintOnCheckName: optionalQuickBooksString(params.printOnCheckName), + BillableTime: params.billableTime, + Active: quickBooksActiveValue(params.activeStatus), + }) as Record + assertQuickBooksSparseUpdate(body) + return body +} + +export const quickbooksUpdateEmployeeTool: ToolConfig< + QuickBooksUpdateEmployeeParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_update_employee', + name: 'QuickBooks Update Employee', + description: 'Read, merge, and full-update a non-payroll employee profile', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + employeeId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'ID of the employee to update', + }, + syncToken: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Current employee sync token', + }, + displayName: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement employee display name', + }, + givenName: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement employee given name', + }, + familyName: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement employee family name', + }, + primaryEmail: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement employee primary email address', + }, + primaryPhone: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement employee primary phone number', + }, + primaryAddress: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: 'Replacement employee primary address', + }, + printOnCheckName: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement employee name printed on checks', + }, + billableTime: { + type: 'boolean', + required: false, + visibility: 'user-or-llm', + description: 'Whether employee time is billable', + }, + activeStatus: { + type: 'string', + required: false, + visibility: 'user-or-llm', + default: 'unchanged', + description: 'Employee status change: unchanged, active, or inactive', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => buildQuickBooksEntityUrl(params.realmId, 'employee').toString(), + method: 'POST', + headers: (params) => getQuickBooksToolHeaders(params.accessToken, 'application/json'), + body: buildQuickBooksUpdateEmployeeBody, + retry: { enabled: false }, + }, + directExecution: (params, signal) => + executeQuickBooksFullUpdate({ + params, + signal, + entity: 'Employee', + resource: 'employee', + recordId: params.employeeId, + syncToken: params.syncToken, + buildPatch: buildQuickBooksUpdateEmployeeBody, + sanitize: sanitizeQuickBooksEmployee, + }), + transformResponse: (response) => + transformQuickBooksMutationResponse( + response, + 'Employee', + sanitizeQuickBooksEmployee + ), + outputs: { + record: { + type: 'json', + description: 'Updated QuickBooks Employee record', + properties: QUICKBOOKS_EMPLOYEE_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/update_estimate.ts b/apps/sim/tools/quickbooks/update_estimate.ts new file mode 100644 index 00000000000..bb2e9c87169 --- /dev/null +++ b/apps/sim/tools/quickbooks/update_estimate.ts @@ -0,0 +1,119 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import { buildQuickBooksUpdateSalesDocumentBody } from '@/tools/quickbooks/sales_utils' +import type { + QuickBooksMutationResponse, + QuickBooksSalesTransaction, + QuickBooksUpdateEstimateParams, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_MUTATION_OUTPUTS, + QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, +} from '@/tools/quickbooks/types' +import { + buildQuickBooksEntityUrl, + getQuickBooksToolHeaders, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksUpdateEstimateTool: ToolConfig< + QuickBooksUpdateEstimateParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_update_estimate', + name: 'QuickBooks Update Estimate', + description: 'Sparse-update an estimate using its current sync token', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + transactionId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Estimate ID to update', + }, + syncToken: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Current estimate sync token', + }, + customerId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement customer ID', + }, + lines: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: + 'Complete replacement set of estimate lines: any existing line omitted here is deleted from the estimate', + }, + transactionDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement estimate date in YYYY-MM-DD format', + }, + expirationDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement expiration date in YYYY-MM-DD format', + }, + documentNumber: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement estimate number', + }, + privateNote: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement internal note', + }, + customerMemo: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement customer-facing memo', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => buildQuickBooksEntityUrl(params.realmId, 'estimate').toString(), + method: 'POST', + headers: (params) => getQuickBooksToolHeaders(params.accessToken, 'application/json'), + body: (params) => buildQuickBooksUpdateSalesDocumentBody(params), + retry: { enabled: false }, + }, + transformResponse: (response) => + transformQuickBooksMutationResponse(response, 'Estimate'), + outputs: { + record: { + type: 'json', + description: 'Updated native QuickBooks Estimate', + properties: QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/update_invoice.ts b/apps/sim/tools/quickbooks/update_invoice.ts new file mode 100644 index 00000000000..a57f4c3513c --- /dev/null +++ b/apps/sim/tools/quickbooks/update_invoice.ts @@ -0,0 +1,119 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import { buildQuickBooksUpdateSalesDocumentBody } from '@/tools/quickbooks/sales_utils' +import type { + QuickBooksMutationResponse, + QuickBooksSalesTransaction, + QuickBooksUpdateInvoiceParams, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_MUTATION_OUTPUTS, + QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, +} from '@/tools/quickbooks/types' +import { + buildQuickBooksEntityUrl, + getQuickBooksToolHeaders, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksUpdateInvoiceTool: ToolConfig< + QuickBooksUpdateInvoiceParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_update_invoice', + name: 'QuickBooks Update Invoice', + description: 'Sparse-update an invoice using its current sync token', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + transactionId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Invoice ID to update', + }, + syncToken: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Current invoice sync token', + }, + customerId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement customer ID', + }, + lines: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: + 'Complete replacement set of invoice lines: any existing line omitted here is deleted from the invoice', + }, + transactionDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement invoice date in YYYY-MM-DD format', + }, + dueDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement due date in YYYY-MM-DD format', + }, + documentNumber: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement invoice number', + }, + privateNote: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement internal note', + }, + customerMemo: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement customer-facing memo', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => buildQuickBooksEntityUrl(params.realmId, 'invoice').toString(), + method: 'POST', + headers: (params) => getQuickBooksToolHeaders(params.accessToken, 'application/json'), + body: (params) => buildQuickBooksUpdateSalesDocumentBody(params), + retry: { enabled: false }, + }, + transformResponse: (response) => + transformQuickBooksMutationResponse(response, 'Invoice'), + outputs: { + record: { + type: 'json', + description: 'Updated native QuickBooks Invoice', + properties: QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/update_item.ts b/apps/sim/tools/quickbooks/update_item.ts new file mode 100644 index 00000000000..8514bb8b0a2 --- /dev/null +++ b/apps/sim/tools/quickbooks/update_item.ts @@ -0,0 +1,172 @@ +import { filterUndefined } from '@sim/utils/object' +import { ErrorExtractorId } from '@/tools/error-extractors' +import type { + QuickBooksItem, + QuickBooksMutationResponse, + QuickBooksUpdateItemParams, +} from '@/tools/quickbooks/types' +import { QUICKBOOKS_ITEM_PROPERTIES, QUICKBOOKS_MUTATION_OUTPUTS } from '@/tools/quickbooks/types' +import { + buildQuickBooksEntityUrl, + executeQuickBooksFullUpdate, + getQuickBooksToolHeaders, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import { + assertQuickBooksSparseUpdate, + optionalQuickBooksString, + quickBooksActiveValue, + quickBooksReference, + requiredQuickBooksString, + validateQuickBooksOptionalNumber, +} from '@/tools/quickbooks/values' +import type { ToolConfig } from '@/tools/types' + +function buildQuickBooksUpdateItemBody( + params: QuickBooksUpdateItemParams +): Record { + const body = filterUndefined({ + Id: requiredQuickBooksString(params.itemId, 'itemId'), + SyncToken: requiredQuickBooksString(params.syncToken, 'syncToken'), + sparse: true, + Name: optionalQuickBooksString(params.name), + IncomeAccountRef: params.incomeAccountId + ? quickBooksReference(params.incomeAccountId, 'incomeAccountId') + : undefined, + Description: optionalQuickBooksString(params.description), + UnitPrice: validateQuickBooksOptionalNumber(params.unitPrice, 'unitPrice'), + PurchaseDesc: optionalQuickBooksString(params.purchaseDescription), + PurchaseCost: validateQuickBooksOptionalNumber(params.purchaseCost, 'purchaseCost'), + ExpenseAccountRef: params.expenseAccountId + ? quickBooksReference(params.expenseAccountId, 'expenseAccountId') + : undefined, + Taxable: params.taxable, + Active: quickBooksActiveValue(params.activeStatus), + }) as Record + assertQuickBooksSparseUpdate(body) + return body +} + +export const quickbooksUpdateItemTool: ToolConfig< + QuickBooksUpdateItemParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_update_item', + name: 'QuickBooks Update Item', + description: 'Read, merge, and full-update an item without changing its type', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + itemId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'ID of the item to update', + }, + syncToken: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Current item sync token', + }, + name: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement item name', + }, + incomeAccountId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement income account ID', + }, + description: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement sales description', + }, + unitPrice: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: 'Replacement sales price per unit', + }, + purchaseDescription: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement purchase description', + }, + purchaseCost: { + type: 'number', + required: false, + visibility: 'user-or-llm', + description: 'Replacement purchase cost per unit', + }, + expenseAccountId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement expense account ID', + }, + taxable: { + type: 'boolean', + required: false, + visibility: 'user-or-llm', + description: 'Whether the item is taxable', + }, + activeStatus: { + type: 'string', + required: false, + visibility: 'user-or-llm', + default: 'unchanged', + description: 'Item status change: unchanged, active, or inactive', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => buildQuickBooksEntityUrl(params.realmId, 'item').toString(), + method: 'POST', + headers: (params) => getQuickBooksToolHeaders(params.accessToken, 'application/json'), + body: buildQuickBooksUpdateItemBody, + retry: { enabled: false }, + }, + directExecution: (params, signal) => + executeQuickBooksFullUpdate({ + params, + signal, + entity: 'Item', + resource: 'item', + recordId: params.itemId, + syncToken: params.syncToken, + buildPatch: buildQuickBooksUpdateItemBody, + }), + transformResponse: (response) => + transformQuickBooksMutationResponse(response, 'Item'), + outputs: { + record: { + type: 'json', + description: 'Updated QuickBooks Item record', + properties: QUICKBOOKS_ITEM_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/update_journal_entry.ts b/apps/sim/tools/quickbooks/update_journal_entry.ts new file mode 100644 index 00000000000..f56e91c4cad --- /dev/null +++ b/apps/sim/tools/quickbooks/update_journal_entry.ts @@ -0,0 +1,100 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import { buildQuickBooksUpdateJournalEntryBody } from '@/tools/quickbooks/accounting_utils' +import type { + QuickBooksAccountingTransaction, + QuickBooksMutationResponse, + QuickBooksUpdateJournalEntryParams, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_ACCOUNTING_TRANSACTION_PROPERTIES, + QUICKBOOKS_MUTATION_OUTPUTS, +} from '@/tools/quickbooks/types' +import { + buildQuickBooksEntityUrl, + getQuickBooksToolHeaders, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksUpdateJournalEntryTool: ToolConfig< + QuickBooksUpdateJournalEntryParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_update_journal_entry', + name: 'QuickBooks Update Journal Entry', + description: 'Sparse-update journal-entry header fields after explicit confirmation', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + journalEntryId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Journal Entry ID to update', + }, + syncToken: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Current journal-entry sync token', + }, + confirmPosting: { + type: 'boolean', + required: true, + visibility: 'user-only', + description: 'Explicit confirmation that this journal-entry update should be posted', + }, + transactionDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement date in YYYY-MM-DD format', + }, + documentNumber: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement journal-entry number', + }, + privateNote: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement internal note', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (p) => buildQuickBooksEntityUrl(p.realmId, 'journalentry').toString(), + method: 'POST', + headers: (p) => getQuickBooksToolHeaders(p.accessToken, 'application/json'), + body: buildQuickBooksUpdateJournalEntryBody, + retry: { enabled: false }, + }, + transformResponse: (r) => + transformQuickBooksMutationResponse(r, 'JournalEntry'), + outputs: { + record: { + type: 'json', + description: 'Updated native QuickBooks JournalEntry', + properties: QUICKBOOKS_ACCOUNTING_TRANSACTION_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/update_purchase.ts b/apps/sim/tools/quickbooks/update_purchase.ts new file mode 100644 index 00000000000..13af05c976d --- /dev/null +++ b/apps/sim/tools/quickbooks/update_purchase.ts @@ -0,0 +1,112 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import { buildQuickBooksUpdatePurchaseBody } from '@/tools/quickbooks/purchasing_utils' +import type { + QuickBooksMutationResponse, + QuickBooksPurchasingTransaction, + QuickBooksUpdatePurchaseParams, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_MUTATION_OUTPUTS, + QUICKBOOKS_PURCHASING_TRANSACTION_PROPERTIES, +} from '@/tools/quickbooks/types' +import { + buildQuickBooksEntityUrl, + executeQuickBooksFullUpdate, + getQuickBooksToolHeaders, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksUpdatePurchaseTool: ToolConfig< + QuickBooksUpdatePurchaseParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_update_purchase', + name: 'QuickBooks Update Purchase', + description: 'Read, merge, and full-update purchase header fields without changing lines', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + purchaseId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Purchase ID to update', + }, + syncToken: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Current purchase sync token', + }, + vendorId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement vendor payee ID', + }, + transactionDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement purchase date in YYYY-MM-DD format', + }, + paymentReference: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: + 'Replacement transaction reference number, such as a check number, sent as the purchase DocNumber', + }, + privateNote: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement internal note', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (p) => buildQuickBooksEntityUrl(p.realmId, 'purchase').toString(), + method: 'POST', + headers: (p) => getQuickBooksToolHeaders(p.accessToken, 'application/json'), + body: buildQuickBooksUpdatePurchaseBody, + retry: { enabled: false }, + }, + directExecution: (params, signal) => + executeQuickBooksFullUpdate({ + params, + signal, + entity: 'Purchase', + resource: 'purchase', + recordId: params.purchaseId, + syncToken: params.syncToken, + buildPatch: buildQuickBooksUpdatePurchaseBody, + }), + transformResponse: (r) => + transformQuickBooksMutationResponse(r, 'Purchase'), + outputs: { + record: { + type: 'json', + description: 'Updated native QuickBooks Purchase', + properties: QUICKBOOKS_PURCHASING_TRANSACTION_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/update_purchase_order.ts b/apps/sim/tools/quickbooks/update_purchase_order.ts new file mode 100644 index 00000000000..c46d121c0dd --- /dev/null +++ b/apps/sim/tools/quickbooks/update_purchase_order.ts @@ -0,0 +1,117 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import { buildQuickBooksUpdatePurchaseOrderBody } from '@/tools/quickbooks/purchasing_utils' +import type { + QuickBooksMutationResponse, + QuickBooksPurchasingTransaction, + QuickBooksUpdatePurchaseOrderParams, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_MUTATION_OUTPUTS, + QUICKBOOKS_PURCHASING_TRANSACTION_PROPERTIES, +} from '@/tools/quickbooks/types' +import { + buildQuickBooksEntityUrl, + executeQuickBooksFullUpdate, + getQuickBooksToolHeaders, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksUpdatePurchaseOrderTool: ToolConfig< + QuickBooksUpdatePurchaseOrderParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_update_purchase_order', + name: 'QuickBooks Update Purchase Order', + description: 'Read, merge, and full-update purchase-order header fields', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + purchaseOrderId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Purchase Order ID to update', + }, + syncToken: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Current purchase-order sync token', + }, + vendorId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement vendor ID', + }, + apAccountId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement accounts-payable account ID', + }, + transactionDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement date in YYYY-MM-DD format', + }, + documentNumber: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement purchase-order number', + }, + privateNote: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement internal note', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (p) => buildQuickBooksEntityUrl(p.realmId, 'purchaseorder').toString(), + method: 'POST', + headers: (p) => getQuickBooksToolHeaders(p.accessToken, 'application/json'), + body: buildQuickBooksUpdatePurchaseOrderBody, + retry: { enabled: false }, + }, + directExecution: (params, signal) => + executeQuickBooksFullUpdate({ + params, + signal, + entity: 'PurchaseOrder', + resource: 'purchaseorder', + recordId: params.purchaseOrderId, + syncToken: params.syncToken, + buildPatch: buildQuickBooksUpdatePurchaseOrderBody, + }), + transformResponse: (r) => + transformQuickBooksMutationResponse(r, 'PurchaseOrder'), + outputs: { + record: { + type: 'json', + description: 'Updated native QuickBooks PurchaseOrder', + properties: QUICKBOOKS_PURCHASING_TRANSACTION_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/update_refund_receipt.ts b/apps/sim/tools/quickbooks/update_refund_receipt.ts new file mode 100644 index 00000000000..0f981613f80 --- /dev/null +++ b/apps/sim/tools/quickbooks/update_refund_receipt.ts @@ -0,0 +1,131 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import { buildQuickBooksUpdateSalesDocumentBody } from '@/tools/quickbooks/sales_utils' +import type { + QuickBooksMutationResponse, + QuickBooksSalesTransaction, + QuickBooksUpdateRefundReceiptParams, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_MUTATION_OUTPUTS, + QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, +} from '@/tools/quickbooks/types' +import { + buildQuickBooksEntityUrl, + getQuickBooksToolHeaders, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksUpdateRefundReceiptTool: ToolConfig< + QuickBooksUpdateRefundReceiptParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_update_refund_receipt', + name: 'QuickBooks Update Refund Receipt', + description: 'Sparse-update a refund receipt using its current sync token', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + transactionId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Refund receipt ID to update', + }, + syncToken: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Current refund receipt sync token', + }, + customerId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement customer ID', + }, + lines: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: + 'Complete replacement set of refund receipt lines: any existing line omitted here is deleted from the refund receipt', + }, + transactionDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement refund date in YYYY-MM-DD format', + }, + documentNumber: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement refund receipt number', + }, + privateNote: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement internal note', + }, + customerMemo: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement customer-facing memo', + }, + paymentMethodId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement payment method ID', + }, + paymentReferenceNumber: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement payment reference number', + }, + depositAccountId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement deposit account ID', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => buildQuickBooksEntityUrl(params.realmId, 'refundreceipt').toString(), + method: 'POST', + headers: (params) => getQuickBooksToolHeaders(params.accessToken, 'application/json'), + body: (params) => buildQuickBooksUpdateSalesDocumentBody(params), + retry: { enabled: false }, + }, + transformResponse: (response) => + transformQuickBooksMutationResponse(response, 'RefundReceipt'), + outputs: { + record: { + type: 'json', + description: 'Updated native QuickBooks RefundReceipt', + properties: QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/update_sales_receipt.ts b/apps/sim/tools/quickbooks/update_sales_receipt.ts new file mode 100644 index 00000000000..d95a1856d71 --- /dev/null +++ b/apps/sim/tools/quickbooks/update_sales_receipt.ts @@ -0,0 +1,131 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import { buildQuickBooksUpdateSalesDocumentBody } from '@/tools/quickbooks/sales_utils' +import type { + QuickBooksMutationResponse, + QuickBooksSalesTransaction, + QuickBooksUpdateSalesReceiptParams, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_MUTATION_OUTPUTS, + QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, +} from '@/tools/quickbooks/types' +import { + buildQuickBooksEntityUrl, + getQuickBooksToolHeaders, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksUpdateSalesReceiptTool: ToolConfig< + QuickBooksUpdateSalesReceiptParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_update_sales_receipt', + name: 'QuickBooks Update Sales Receipt', + description: 'Sparse-update a sales receipt using its current sync token', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + transactionId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Sales receipt ID to update', + }, + syncToken: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Current sales receipt sync token', + }, + customerId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement customer ID', + }, + lines: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: + 'Complete replacement set of sales receipt lines: any existing line omitted here is deleted from the sales receipt', + }, + transactionDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement receipt date in YYYY-MM-DD format', + }, + documentNumber: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement sales receipt number', + }, + privateNote: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement internal note', + }, + customerMemo: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement customer-facing memo', + }, + paymentMethodId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement payment method ID', + }, + paymentReferenceNumber: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement payment reference number', + }, + depositAccountId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement deposit account ID', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => buildQuickBooksEntityUrl(params.realmId, 'salesreceipt').toString(), + method: 'POST', + headers: (params) => getQuickBooksToolHeaders(params.accessToken, 'application/json'), + body: (params) => buildQuickBooksUpdateSalesDocumentBody(params), + retry: { enabled: false }, + }, + transformResponse: (response) => + transformQuickBooksMutationResponse(response, 'SalesReceipt'), + outputs: { + record: { + type: 'json', + description: 'Updated native QuickBooks SalesReceipt', + properties: QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/update_vendor.ts b/apps/sim/tools/quickbooks/update_vendor.ts new file mode 100644 index 00000000000..e092d4b6c18 --- /dev/null +++ b/apps/sim/tools/quickbooks/update_vendor.ts @@ -0,0 +1,189 @@ +import { filterUndefined } from '@sim/utils/object' +import { ErrorExtractorId } from '@/tools/error-extractors' +import type { + QuickBooksMutationResponse, + QuickBooksUpdateVendorParams, + QuickBooksVendor, +} from '@/tools/quickbooks/types' +import { QUICKBOOKS_MUTATION_OUTPUTS, QUICKBOOKS_VENDOR_PROPERTIES } from '@/tools/quickbooks/types' +import { + buildQuickBooksEntityUrl, + executeQuickBooksFullUpdate, + getQuickBooksToolHeaders, + sanitizeQuickBooksVendor, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import { + assertQuickBooksSparseUpdate, + optionalQuickBooksString, + parseQuickBooksAddress, + quickBooksActiveValue, + quickBooksEmailAddress, + quickBooksPhoneNumber, + requiredQuickBooksString, +} from '@/tools/quickbooks/values' +import type { ToolConfig } from '@/tools/types' + +function buildQuickBooksUpdateVendorBody( + params: QuickBooksUpdateVendorParams +): Record { + const body = filterUndefined({ + Id: requiredQuickBooksString(params.vendorId, 'vendorId'), + SyncToken: requiredQuickBooksString(params.syncToken, 'syncToken'), + sparse: true, + DisplayName: optionalQuickBooksString(params.displayName), + CompanyName: optionalQuickBooksString(params.companyName), + GivenName: optionalQuickBooksString(params.givenName), + FamilyName: optionalQuickBooksString(params.familyName), + PrimaryEmailAddr: quickBooksEmailAddress(params.primaryEmail), + PrimaryPhone: quickBooksPhoneNumber(params.primaryPhone), + BillAddr: parseQuickBooksAddress(params.billingAddress, 'billingAddress'), + PrintOnCheckName: optionalQuickBooksString(params.printOnCheckName), + AcctNum: optionalQuickBooksString(params.accountNumber), + Vendor1099: params.vendor1099, + Active: quickBooksActiveValue(params.activeStatus), + }) as Record + assertQuickBooksSparseUpdate(body) + return body +} + +export const quickbooksUpdateVendorTool: ToolConfig< + QuickBooksUpdateVendorParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_update_vendor', + name: 'QuickBooks Update Vendor', + description: 'Read, merge, and full-update a vendor in QuickBooks Online', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + vendorId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'ID of the vendor to update', + }, + syncToken: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Current vendor sync token', + }, + displayName: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement vendor display name', + }, + companyName: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement vendor company name', + }, + givenName: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement vendor given name', + }, + familyName: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement vendor family name', + }, + primaryEmail: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement primary email address', + }, + primaryPhone: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement primary phone number', + }, + billingAddress: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: 'Replacement billing address', + }, + printOnCheckName: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement name to print on checks', + }, + accountNumber: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement vendor account number', + }, + vendor1099: { + type: 'boolean', + required: false, + visibility: 'user-or-llm', + description: 'Whether the vendor is tracked for 1099 reporting', + }, + activeStatus: { + type: 'string', + required: false, + visibility: 'user-or-llm', + default: 'unchanged', + description: 'Vendor status change: unchanged, active, or inactive', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => buildQuickBooksEntityUrl(params.realmId, 'vendor').toString(), + method: 'POST', + headers: (params) => getQuickBooksToolHeaders(params.accessToken, 'application/json'), + body: buildQuickBooksUpdateVendorBody, + retry: { enabled: false }, + }, + directExecution: (params, signal) => + executeQuickBooksFullUpdate({ + params, + signal, + entity: 'Vendor', + resource: 'vendor', + recordId: params.vendorId, + syncToken: params.syncToken, + buildPatch: buildQuickBooksUpdateVendorBody, + sanitize: sanitizeQuickBooksVendor, + }), + transformResponse: (response) => + transformQuickBooksMutationResponse( + response, + 'Vendor', + sanitizeQuickBooksVendor + ), + outputs: { + record: { + type: 'json', + description: 'Updated QuickBooks Vendor record', + properties: QUICKBOOKS_VENDOR_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/update_vendor_credit.ts b/apps/sim/tools/quickbooks/update_vendor_credit.ts new file mode 100644 index 00000000000..978e5eb9964 --- /dev/null +++ b/apps/sim/tools/quickbooks/update_vendor_credit.ts @@ -0,0 +1,117 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import { buildQuickBooksUpdateVendorCreditBody } from '@/tools/quickbooks/purchasing_utils' +import type { + QuickBooksMutationResponse, + QuickBooksPurchasingTransaction, + QuickBooksUpdateVendorCreditParams, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_MUTATION_OUTPUTS, + QUICKBOOKS_PURCHASING_TRANSACTION_PROPERTIES, +} from '@/tools/quickbooks/types' +import { + buildQuickBooksEntityUrl, + executeQuickBooksFullUpdate, + getQuickBooksToolHeaders, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksUpdateVendorCreditTool: ToolConfig< + QuickBooksUpdateVendorCreditParams, + QuickBooksMutationResponse +> = { + id: 'quickbooks_update_vendor_credit', + name: 'QuickBooks Update Vendor Credit', + description: 'Read, merge, and full-update vendor-credit header fields', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + vendorCreditId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'VendorCredit ID to update', + }, + syncToken: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Current vendor-credit sync token', + }, + vendorId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Current or replacement vendor ID required by QuickBooks', + }, + apAccountId: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement accounts-payable account ID', + }, + transactionDate: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement date in YYYY-MM-DD format', + }, + documentNumber: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement vendor-credit number', + }, + privateNote: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Replacement internal note', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (p) => buildQuickBooksEntityUrl(p.realmId, 'vendorcredit').toString(), + method: 'POST', + headers: (p) => getQuickBooksToolHeaders(p.accessToken, 'application/json'), + body: buildQuickBooksUpdateVendorCreditBody, + retry: { enabled: false }, + }, + directExecution: (params, signal) => + executeQuickBooksFullUpdate({ + params, + signal, + entity: 'VendorCredit', + resource: 'vendorcredit', + recordId: params.vendorCreditId, + syncToken: params.syncToken, + buildPatch: buildQuickBooksUpdateVendorCreditBody, + }), + transformResponse: (r) => + transformQuickBooksMutationResponse(r, 'VendorCredit'), + outputs: { + record: { + type: 'json', + description: 'Updated native QuickBooks VendorCredit', + properties: QUICKBOOKS_PURCHASING_TRANSACTION_PROPERTIES, + }, + ...QUICKBOOKS_MUTATION_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/utils.ts b/apps/sim/tools/quickbooks/utils.ts new file mode 100644 index 00000000000..9677890fc97 --- /dev/null +++ b/apps/sim/tools/quickbooks/utils.ts @@ -0,0 +1,706 @@ +import { omit } from '@sim/utils/object' +import { readResponseJsonWithLimit } from '@/lib/core/utils/stream-limits' +import { ErrorExtractorId, extractErrorMessage } from '@/tools/error-extractors' +import { + buildQuickBooksCompanyUrl, + buildQuickBooksHeaders, + QUICKBOOKS_MAX_RESPONSE_BYTES, +} from '@/tools/quickbooks/client' +import type { SanitizedQuickBooksFault } from '@/tools/quickbooks/fault' +import { sanitizeQuickBooksFaultData } from '@/tools/quickbooks/fault' +import { + applyQuickBooksReportParams, + resolveQuickBooksReportEndpoint, +} from '@/tools/quickbooks/reports' +import type { + QuickBooksAccountingTransactionType, + QuickBooksAddress, + QuickBooksCustomer, + QuickBooksEmployee, + QuickBooksListResponse, + QuickBooksMasterDataRecordType, + QuickBooksMutationResponse, + QuickBooksPaginationParams, + QuickBooksPurchasingTransactionType, + QuickBooksReadAccountingTransactionsParams, + QuickBooksReadMasterDataParams, + QuickBooksReadPurchasingTransactionsParams, + QuickBooksReadSalesTransactionsParams, + QuickBooksReportColumns, + QuickBooksReportHeader, + QuickBooksReportRows, + QuickBooksReportType, + QuickBooksRunFinancialReportParams, + QuickBooksRunFinancialReportResponse, + QuickBooksSalesTransactionType, + QuickBooksVendor, +} from '@/tools/quickbooks/types' +import { + optionalQuickBooksString, + requiredQuickBooksString, + validateQuickBooksDate, + validateQuickBooksPagination, +} from '@/tools/quickbooks/values' + +export type QuickBooksQueryEntity = + | 'Account' + | 'Bill' + | 'BillPayment' + | 'Class' + | 'CreditMemo' + | 'Customer' + | 'Deposit' + | 'Department' + | 'Employee' + | 'Estimate' + | 'Invoice' + | 'Item' + | 'JournalEntry' + | 'Payment' + | 'PurchaseOrder' + | 'Purchase' + | 'RefundReceipt' + | 'SalesReceipt' + | 'Transfer' + | 'Vendor' + | 'VendorCredit' + +interface QuickBooksQueryResponse { + QueryResponse?: Partial> & { + startPosition?: number + maxResults?: number + } + time?: string +} + +function assertQuickBooksEntity(candidate: unknown, entity: QuickBooksQueryEntity): T { + if (!candidate || typeof candidate !== 'object' || Array.isArray(candidate)) { + throw new Error(`QuickBooks ${entity} response contains a malformed ${entity} record`) + } + const recordId = (candidate as { Id?: unknown }).Id + if (typeof recordId !== 'string' || !recordId.trim()) { + throw new Error(`QuickBooks ${entity} response contains a record without an Id`) + } + return candidate as T +} + +export const QUICKBOOKS_MASTER_DATA_ENTITIES = { + account: { entity: 'Account', resource: 'account' }, + class: { entity: 'Class', resource: 'class' }, + customer: { entity: 'Customer', resource: 'customer' }, + department: { entity: 'Department', resource: 'department' }, + employee: { entity: 'Employee', resource: 'employee' }, + item: { entity: 'Item', resource: 'item' }, + vendor: { entity: 'Vendor', resource: 'vendor' }, +} as const satisfies Record< + QuickBooksMasterDataRecordType, + { entity: QuickBooksQueryEntity; resource: string } +> + +export function buildQuickBooksReportUrl(params: QuickBooksRunFinancialReportParams): URL { + const { endpoint, dateParams } = resolveQuickBooksReportEndpoint(params) + const url = buildQuickBooksCompanyUrl(params.realmId, `reports/${endpoint}`) + for (const [key, value] of dateParams) url.searchParams.set(key, value) + applyQuickBooksReportParams(url, params) + return url +} + +interface QuickBooksReportEnvelope { + Header?: QuickBooksReportHeader + Columns?: QuickBooksReportColumns + Rows?: QuickBooksReportRows +} + +function assertQuickBooksReportSection(value: unknown, section: string): T { + if (!value || typeof value !== 'object' || Array.isArray(value)) { + throw new Error(`QuickBooks report response is missing or has malformed ${section}`) + } + return value as T +} + +export async function transformQuickBooksReportResponse( + response: Response, + reportType: QuickBooksReportType +): Promise { + const data = await parseQuickBooksJson( + response, + `QuickBooks ${reportType} report response` + ) + const header = assertQuickBooksReportSection(data.Header, 'Header') + return { + success: true, + output: { + reportType, + header, + columns: assertQuickBooksReportSection(data.Columns, 'Columns'), + rows: assertQuickBooksReportSection(data.Rows, 'Rows'), + time: typeof header.Time === 'string' ? header.Time : null, + }, + } +} + +export const QUICKBOOKS_SALES_ENTITIES = { + credit_memo: { entity: 'CreditMemo', resource: 'creditmemo' }, + estimate: { entity: 'Estimate', resource: 'estimate' }, + invoice: { entity: 'Invoice', resource: 'invoice' }, + payment: { entity: 'Payment', resource: 'payment' }, + refund_receipt: { entity: 'RefundReceipt', resource: 'refundreceipt' }, + sales_receipt: { entity: 'SalesReceipt', resource: 'salesreceipt' }, +} as const satisfies Record< + QuickBooksSalesTransactionType, + { entity: QuickBooksQueryEntity; resource: string } +> + +export const QUICKBOOKS_PURCHASING_ENTITIES = { + bill: { entity: 'Bill', resource: 'bill' }, + bill_payment: { entity: 'BillPayment', resource: 'billpayment' }, + purchase: { entity: 'Purchase', resource: 'purchase' }, + purchase_order: { entity: 'PurchaseOrder', resource: 'purchaseorder' }, + vendor_credit: { entity: 'VendorCredit', resource: 'vendorcredit' }, +} as const satisfies Record< + QuickBooksPurchasingTransactionType, + { entity: QuickBooksQueryEntity; resource: string } +> + +export function buildQuickBooksQueryUrl( + realmId: string, + entity: QuickBooksQueryEntity, + startPosition: number, + maxResults: number, + filters: readonly QuickBooksQueryFilter[] = [] +): URL { + const pagination = validateQuickBooksPagination(startPosition, maxResults) + const url = buildQuickBooksCompanyUrl(realmId, 'query') + const where = + filters.length > 0 + ? ` WHERE ${filters.map((filter) => buildQuickBooksQueryFilter(filter)).join(' AND ')}` + : '' + url.searchParams.set( + 'query', + `SELECT * FROM ${entity}${where} STARTPOSITION ${pagination.startPosition} MAXRESULTS ${pagination.maxResults}` + ) + return url +} + +type QuickBooksQueryField = 'Active' | 'CustomerRef' | 'EntityRef' | 'TxnDate' | 'VendorRef' +type QuickBooksQueryOperator = '=' | '>=' | '<=' + +interface QuickBooksQueryFilter { + field: QuickBooksQueryField + operator: QuickBooksQueryOperator + value: string | boolean +} + +function buildQuickBooksQueryFilter(filter: QuickBooksQueryFilter): string { + if (typeof filter.value === 'boolean') { + return `${filter.field} ${filter.operator} ${String(filter.value)}` + } + const value = requiredQuickBooksString(filter.value, filter.field) + .replace(/\\/g, '\\\\') + .replace(/'/g, "\\'") + return `${filter.field} ${filter.operator} '${value}'` +} + +function getQuickBooksDateRangeFilters( + startDate: string | undefined, + endDate: string | undefined +): QuickBooksQueryFilter[] { + const start = validateQuickBooksDate(startDate, 'startDate') + const end = validateQuickBooksDate(endDate, 'endDate') + if (start && end && start > end) throw new Error('startDate cannot be after endDate') + return [ + ...(start ? [{ field: 'TxnDate', operator: '>=', value: start } as const] : []), + ...(end ? [{ field: 'TxnDate', operator: '<=', value: end } as const] : []), + ] +} + +export function buildQuickBooksMasterDataQueryUrl(params: QuickBooksReadMasterDataParams): URL { + const config = getQuickBooksMasterDataEntity(params.recordType) + const activeStatus = params.activeStatus ?? 'default' + if (!['default', 'active', 'inactive'].includes(activeStatus)) { + throw new Error(`Unsupported QuickBooks active status filter: ${String(activeStatus)}`) + } + const filters: QuickBooksQueryFilter[] = + activeStatus === 'default' + ? [] + : [{ field: 'Active', operator: '=', value: activeStatus === 'active' }] + return buildQuickBooksQueryUrl( + params.realmId, + config.entity, + params.startPosition ?? 1, + params.maxResults ?? 25, + filters + ) +} + +export function buildQuickBooksSalesQueryUrl(params: QuickBooksReadSalesTransactionsParams): URL { + const config = getQuickBooksSalesEntity(params.transactionType) + const filters = getQuickBooksDateRangeFilters(params.startDate, params.endDate) + const customerId = optionalQuickBooksString(params.customerId) + if (customerId) filters.push({ field: 'CustomerRef', operator: '=', value: customerId }) + return buildQuickBooksQueryUrl( + params.realmId, + config.entity, + params.startPosition ?? 1, + params.maxResults ?? 25, + filters + ) +} + +const QUICKBOOKS_PURCHASING_VENDOR_FILTER_TYPES = new Set([ + 'bill', + 'bill_payment', + 'purchase_order', + 'vendor_credit', +]) + +export function buildQuickBooksPurchasingQueryUrl( + params: QuickBooksReadPurchasingTransactionsParams +): URL { + const config = getQuickBooksPurchasingEntity(params.transactionType) + const filters = getQuickBooksDateRangeFilters(params.startDate, params.endDate) + const vendorId = optionalQuickBooksString(params.vendorId) + if (vendorId) { + if (!QUICKBOOKS_PURCHASING_VENDOR_FILTER_TYPES.has(params.transactionType)) { + throw new Error(`${params.transactionType} does not support vendorId filtering`) + } + filters.push({ field: 'VendorRef', operator: '=', value: vendorId }) + } + return buildQuickBooksQueryUrl( + params.realmId, + config.entity, + params.startPosition ?? 1, + params.maxResults ?? 25, + filters + ) +} + +export function buildQuickBooksAccountingQueryUrl( + params: QuickBooksReadAccountingTransactionsParams +): URL { + const config = getQuickBooksAccountingEntity(params.transactionType) + return buildQuickBooksQueryUrl( + params.realmId, + config.entity, + params.startPosition ?? 1, + params.maxResults ?? 25, + getQuickBooksDateRangeFilters(params.startDate, params.endDate) + ) +} + +export const QUICKBOOKS_ACCOUNTING_ENTITIES = { + deposit: { entity: 'Deposit', resource: 'deposit' }, + journal_entry: { entity: 'JournalEntry', resource: 'journalentry' }, + transfer: { entity: 'Transfer', resource: 'transfer' }, +} as const satisfies Record< + QuickBooksAccountingTransactionType, + { entity: QuickBooksQueryEntity; resource: string } +> + +export function getQuickBooksMasterDataEntity(recordType: QuickBooksMasterDataRecordType) { + const config = QUICKBOOKS_MASTER_DATA_ENTITIES[recordType] + if (!config) { + throw new Error(`Unsupported QuickBooks master data record type: ${String(recordType)}`) + } + return config +} + +export function getQuickBooksSalesEntity(transactionType: QuickBooksSalesTransactionType) { + const config = QUICKBOOKS_SALES_ENTITIES[transactionType] + if (!config) { + throw new Error(`Unsupported QuickBooks sales transaction type: ${String(transactionType)}`) + } + return config +} + +export function getQuickBooksPurchasingEntity( + transactionType: QuickBooksPurchasingTransactionType +) { + const config = QUICKBOOKS_PURCHASING_ENTITIES[transactionType] + if (!config) { + throw new Error( + `Unsupported QuickBooks purchasing transaction type: ${String(transactionType)}` + ) + } + return config +} + +export function getQuickBooksAccountingEntity( + transactionType: QuickBooksAccountingTransactionType +) { + const config = QUICKBOOKS_ACCOUNTING_ENTITIES[transactionType] + if (!config) { + throw new Error( + `Unsupported QuickBooks accounting transaction type: ${String(transactionType)}` + ) + } + return config +} + +export function buildQuickBooksEntityUrl( + realmId: string, + resource: string, + recordId?: string +): URL { + const normalizedResource = resource.trim() + if (!normalizedResource) throw new Error('QuickBooks resource is required') + const normalizedRecordId = recordId?.trim() + if (recordId !== undefined && !normalizedRecordId) { + throw new Error('QuickBooks record ID is required') + } + return buildQuickBooksCompanyUrl( + realmId, + normalizedRecordId + ? `${encodeURIComponent(normalizedResource)}/${encodeURIComponent(normalizedRecordId)}` + : encodeURIComponent(normalizedResource) + ) +} + +export function addQuickBooksRequestId(url: URL, requestId?: string): URL { + const normalized = optionalQuickBooksString(requestId) + if (!normalized) return url + if (normalized.length > 50) throw new Error('requestId cannot exceed 50 characters') + url.searchParams.set('requestid', normalized) + return url +} + +/** + * Locates a fault anywhere Intuit is documented to place one. + * + * A transport-level fault sits at the top level of `IntuitResponse`, but a + * rejected *query* nests its fault inside `QueryResponse`: "If the query + * contains an error, the `` element will contain ``." + * Only checking the top level lets a rejected query fall through to an absent + * entity array and be reported as an empty, successful result set. + */ +function findQuickBooksFault(data: unknown): SanitizedQuickBooksFault | null { + const topLevel = sanitizeQuickBooksFaultData(data) + if (topLevel) return topLevel + if (!data || typeof data !== 'object' || Array.isArray(data)) return null + return sanitizeQuickBooksFaultData((data as Record).QueryResponse) +} + +/** + * Builds the error a `directExecution` tool throws for a failed QuickBooks + * response. + * + * `parseQuickBooksJson` cannot be reused here: it rejects on a non-OK status + * before it ever reads the body, so the Intuit fault describing *why* the call + * failed would be discarded. `entity` names the QuickBooks entity the call + * targeted and only shapes the read label used for diagnostics. + */ +export async function getQuickBooksDirectExecutionError( + response: Response, + entity: QuickBooksQueryEntity, + signal?: AbortSignal +): Promise { + let data: unknown = null + try { + data = await readResponseJsonWithLimit(response, { + maxBytes: QUICKBOOKS_MAX_RESPONSE_BYTES, + label: `QuickBooks ${entity} error response`, + signal, + }) + } catch { + signal?.throwIfAborted() + } + + const errorInfo = { + status: response.status, + statusText: response.statusText, + data: sanitizeQuickBooksFaultData(data), + headers: response.headers, + } + return Object.assign( + new Error(extractErrorMessage(errorInfo, ErrorExtractorId.QUICKBOOKS_FAULT)), + errorInfo + ) +} + +interface QuickBooksFullUpdateOptions< + P extends { accessToken: string; realmId: string }, + T extends { Id: string; SyncToken?: string }, +> { + params: P + signal?: AbortSignal + entity: QuickBooksQueryEntity + resource: string + recordId: string + syncToken: string + buildPatch: (params: P) => Record + sanitize?: (record: T) => T +} + +/** + * Implements Intuit's documented full-update sequence: read the complete live + * entity, reject stale caller state, apply only the requested patch, and post + * the resulting entity back without the sparse marker or response metadata. + */ +export async function executeQuickBooksFullUpdate< + P extends { accessToken: string; realmId: string }, + T extends { Id: string; SyncToken?: string }, +>(options: QuickBooksFullUpdateOptions): Promise> { + const recordId = requiredQuickBooksString(options.recordId, 'recordId') + const syncToken = requiredQuickBooksString(options.syncToken, 'syncToken') + const patch = options.buildPatch(options.params) + const readResponse = await fetch( + buildQuickBooksEntityUrl(options.params.realmId, options.resource, recordId), + { + method: 'GET', + headers: getQuickBooksToolHeaders(options.params.accessToken), + signal: options.signal, + } + ) + if (!readResponse.ok) { + throw await getQuickBooksDirectExecutionError(readResponse, options.entity, options.signal) + } + const { item } = await transformQuickBooksEntityResponse( + readResponse, + options.entity, + options.signal + ) + const current = item as T & Record + const currentId = typeof current.Id === 'string' ? current.Id.trim() : '' + const currentSyncToken = typeof current.SyncToken === 'string' ? current.SyncToken.trim() : '' + if (currentId !== recordId) { + throw new Error(`QuickBooks ${options.entity} read returned an unexpected record ID`) + } + if (currentSyncToken !== syncToken) { + throw new Error( + `QuickBooks ${options.entity} ${recordId} changed since sync token ${syncToken} was read (current sync token ${currentSyncToken}). Re-read the record and retry.` + ) + } + options.signal?.throwIfAborted() + + const currentFields = omit(current, [ + 'HeaderFull', + 'HeaderLite', + 'MetaData', + 'NameAndId', + 'Overview', + 'domain', + 'sparse', + 'status', + ]) + const patchFields = omit(patch, ['sparse']) + const fullBody = { + ...currentFields, + ...patchFields, + Id: recordId, + SyncToken: syncToken, + } + const updateResponse = await fetch( + buildQuickBooksEntityUrl(options.params.realmId, options.resource), + { + method: 'POST', + headers: getQuickBooksToolHeaders(options.params.accessToken, 'application/json'), + body: JSON.stringify(fullBody), + signal: options.signal, + } + ) + if (!updateResponse.ok) { + throw await getQuickBooksDirectExecutionError(updateResponse, options.entity, options.signal) + } + return transformQuickBooksMutationResponse( + updateResponse, + options.entity, + options.sanitize, + options.signal + ) +} + +export async function parseQuickBooksJson( + response: Response, + label: string, + signal?: AbortSignal +): Promise { + if (!response.ok) { + throw new Error(`QuickBooks request failed with HTTP ${response.status}`) + } + const data = await readResponseJsonWithLimit(response, { + maxBytes: QUICKBOOKS_MAX_RESPONSE_BYTES, + label, + signal, + }) + const faultData = findQuickBooksFault(data) + if (faultData) { + const errorInfo = { + status: response.status, + statusText: response.statusText, + data: faultData, + headers: response.headers, + } + throw Object.assign( + new Error(extractErrorMessage(errorInfo, ErrorExtractorId.QUICKBOOKS_FAULT)), + errorInfo + ) + } + return data +} + +export async function transformQuickBooksListResponse( + response: Response, + params: QuickBooksPaginationParams, + entity: QuickBooksQueryEntity +): Promise> { + const data = await parseQuickBooksJson>( + response, + `QuickBooks ${entity} query response` + ) + const queryResponse = data.QueryResponse + if (!queryResponse || typeof queryResponse !== 'object' || Array.isArray(queryResponse)) { + throw new Error(`QuickBooks ${entity} response is missing QueryResponse`) + } + + const candidate = queryResponse[entity] + if (candidate !== undefined && !Array.isArray(candidate)) { + throw new Error(`QuickBooks ${entity} response contains a malformed entity list`) + } + + const items = (candidate ?? []).map((item) => assertQuickBooksEntity(item, entity)) + const startPosition = Number.isInteger(queryResponse.startPosition) + ? (queryResponse.startPosition as number) + : params.startPosition + const maxResults = Number.isInteger(queryResponse.maxResults) + ? (queryResponse.maxResults as number) + : items.length + + return { + success: true, + output: { + items, + startPosition, + maxResults, + nextStartPosition: startPosition + items.length, + hasMore: items.length === params.maxResults, + time: typeof data.time === 'string' ? data.time : null, + }, + } +} + +export async function transformQuickBooksEntityResponse< + T extends { Id: string; SyncToken?: string }, +>( + response: Response, + entity: QuickBooksQueryEntity, + signal?: AbortSignal +): Promise<{ item: T; time: string | null }> { + const data = await parseQuickBooksJson & { time?: string }>( + response, + `QuickBooks ${entity} response`, + signal + ) + const candidate = data[entity] + if (!candidate) { + throw new Error(`QuickBooks ${entity} response is missing ${entity}`) + } + return { + item: assertQuickBooksEntity(candidate, entity), + time: typeof data.time === 'string' ? data.time : null, + } +} + +export async function transformQuickBooksMutationResponse< + T extends { Id: string; SyncToken?: string }, +>( + response: Response, + entity: QuickBooksQueryEntity, + sanitize: (item: T) => T = (item) => item, + signal?: AbortSignal +): Promise> { + const parsed = await transformQuickBooksEntityResponse(response, entity, signal) + const item = sanitize(parsed.item) + const recordId = typeof item.Id === 'string' ? item.Id.trim() : '' + const syncToken = typeof item.SyncToken === 'string' ? item.SyncToken.trim() : '' + if (!recordId || !syncToken) { + throw new Error(`QuickBooks ${entity} response is missing Id or SyncToken`) + } + return { + success: true, + output: { record: item, recordId, syncToken, time: parsed.time }, + } +} + +export function sanitizeQuickBooksVendor(vendor: QuickBooksVendor): QuickBooksVendor { + return omit(vendor, ['TaxIdentifier']) as QuickBooksVendor +} + +export function sanitizeQuickBooksCustomer(customer: QuickBooksCustomer): QuickBooksCustomer { + return omit(customer, ['TaxIdentifier']) as QuickBooksCustomer +} + +export function sanitizeQuickBooksEmployee(employee: QuickBooksEmployee): QuickBooksEmployee { + const id = typeof employee.Id === 'string' ? employee.Id.trim() : '' + if (!id) throw new Error('QuickBooks Employee response is missing Id') + + const sanitized: QuickBooksEmployee = { Id: id } + for (const key of [ + 'SyncToken', + 'DisplayName', + 'GivenName', + 'MiddleName', + 'FamilyName', + 'Suffix', + 'Title', + 'PrintOnCheckName', + ] as const) { + const value = employee[key] + if (typeof value === 'string') sanitized[key] = value + } + if (typeof employee.domain === 'string') sanitized.domain = employee.domain + for (const key of ['Active', 'BillableTime', 'sparse'] as const) { + const value = employee[key] + if (typeof value === 'boolean') sanitized[key] = value + } + for (const key of ['PrimaryPhone', 'Mobile'] as const) { + const value = employee[key] + if (value && typeof value.FreeFormNumber === 'string') { + sanitized[key] = { FreeFormNumber: value.FreeFormNumber } + } + } + if (employee.PrimaryEmailAddr && typeof employee.PrimaryEmailAddr.Address === 'string') { + sanitized.PrimaryEmailAddr = { Address: employee.PrimaryEmailAddr.Address } + } + if (employee.PrimaryAddr && typeof employee.PrimaryAddr === 'object') { + const address: QuickBooksAddress = {} + for (const key of [ + 'Id', + 'Line1', + 'Line2', + 'Line3', + 'Line4', + 'Line5', + 'City', + 'Country', + 'CountrySubDivisionCode', + 'PostalCode', + 'Lat', + 'Long', + ] as const) { + const value = employee.PrimaryAddr[key] + if (typeof value === 'string') address[key] = value + } + if (Object.keys(address).length > 0) sanitized.PrimaryAddr = address + } + if (employee.MetaData && typeof employee.MetaData === 'object') { + sanitized.MetaData = { + ...(typeof employee.MetaData.CreateTime === 'string' + ? { CreateTime: employee.MetaData.CreateTime } + : {}), + ...(typeof employee.MetaData.LastUpdatedTime === 'string' + ? { LastUpdatedTime: employee.MetaData.LastUpdatedTime } + : {}), + } + } + return sanitized +} + +export function getQuickBooksToolHeaders( + accessToken: string, + contentType?: 'application/json' +): Record { + return { + ...buildQuickBooksHeaders(accessToken), + ...(contentType ? { 'Content-Type': contentType } : {}), + } +} diff --git a/apps/sim/tools/quickbooks/values.ts b/apps/sim/tools/quickbooks/values.ts new file mode 100644 index 00000000000..ce1598a4770 --- /dev/null +++ b/apps/sim/tools/quickbooks/values.ts @@ -0,0 +1,185 @@ +import type { + QuickBooksActiveStatus, + QuickBooksAddress, + QuickBooksReference, + QuickBooksWritableItemType, +} from '@/tools/quickbooks/types' + +/** + * Pure QuickBooks value normalizers and validators. + * + * This module has no runtime dependencies — no `fetch`, no environment + * access, no response parsing — so it stays safe to import from the block + * definition, which is client-bundled. Anything that needs the API client or + * a `Response` belongs in `@/tools/quickbooks/utils` instead. + */ + +export function requiredQuickBooksString(value: string, fieldName: string): string { + const normalized = value.trim() + if (!normalized) throw new Error(`${fieldName} is required`) + return normalized +} + +export function optionalQuickBooksString(value?: string): string | undefined { + if (value === undefined) return undefined + const normalized = value.trim() + return normalized || undefined +} + +export function quickBooksReference(value: string, fieldName: string): QuickBooksReference { + return { value: requiredQuickBooksString(value, fieldName) } +} + +const QUICKBOOKS_DATE_PATTERN = /^\d{4}-\d{2}-\d{2}$/ + +export function validateQuickBooksDate( + value: string | undefined, + fieldName: string +): string | undefined { + const normalized = optionalQuickBooksString(value) + if (!normalized) return undefined + if (!QUICKBOOKS_DATE_PATTERN.test(normalized)) { + throw new Error(`${fieldName} must use YYYY-MM-DD`) + } + const date = new Date(`${normalized}T00:00:00Z`) + if (Number.isNaN(date.getTime()) || date.toISOString().slice(0, 10) !== normalized) { + throw new Error(`${fieldName} must be a valid date`) + } + return normalized +} + +export function quickBooksEmailAddress(value?: string): { Address: string } | undefined { + const normalized = optionalQuickBooksString(value) + return normalized ? { Address: normalized } : undefined +} + +export function quickBooksPhoneNumber(value?: string): { FreeFormNumber: string } | undefined { + const normalized = optionalQuickBooksString(value) + return normalized ? { FreeFormNumber: normalized } : undefined +} + +export function validateQuickBooksOptionalNumber( + value: number | undefined, + fieldName: string +): number | undefined { + if (value === undefined) return undefined + if (!Number.isFinite(value)) throw new Error(`${fieldName} must be a finite number`) + return value +} + +export function validateQuickBooksPagination( + startPosition: number, + maxResults: number +): { startPosition: number; maxResults: number } { + if (!Number.isInteger(startPosition) || startPosition < 1) { + throw new Error('startPosition must be a positive integer') + } + if (!Number.isInteger(maxResults) || maxResults < 1 || maxResults > 100) { + throw new Error('maxResults must be an integer from 1 through 100') + } + return { startPosition, maxResults } +} + +export function assertQuickBooksListOnlyFilters( + readMode: 'list' | 'by_id', + filters: Record +): void { + if (readMode !== 'by_id') return + const provided = Object.entries(filters).find(([, value]) => { + if (value === undefined || value === null || value === '') return false + return value !== 'default' + }) + if (provided) throw new Error(`${provided[0]} is supported only for List mode`) +} + +export function quickBooksWritableItemType(itemType: QuickBooksWritableItemType): string { + const types: Record = { + service: 'Service', + non_inventory: 'NonInventory', + } + const type = types[itemType] + if (!type) throw new Error(`Unsupported writable QuickBooks item type: ${String(itemType)}`) + return type +} + +const QUICKBOOKS_ADDRESS_FIELDS = { + line1: 'Line1', + Line1: 'Line1', + line2: 'Line2', + Line2: 'Line2', + city: 'City', + City: 'City', + countrySubDivisionCode: 'CountrySubDivisionCode', + CountrySubDivisionCode: 'CountrySubDivisionCode', + postalCode: 'PostalCode', + PostalCode: 'PostalCode', + country: 'Country', + Country: 'Country', +} as const + +export function parseQuickBooksAddress( + value: unknown, + fieldName: string +): QuickBooksAddress | undefined { + if (value == null || value === '') return undefined + let parsed: unknown = value + if (typeof value === 'string') { + try { + parsed = JSON.parse(value) + } catch { + throw new Error(`${fieldName} must be valid JSON`) + } + } + if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) { + throw new Error(`${fieldName} must be a JSON object`) + } + + const result: QuickBooksAddress = {} + for (const [key, fieldValue] of Object.entries(parsed)) { + const quickBooksKey = QUICKBOOKS_ADDRESS_FIELDS[key as keyof typeof QUICKBOOKS_ADDRESS_FIELDS] + if (!quickBooksKey) { + throw new Error(`${fieldName} contains unsupported field "${key}"`) + } + if (typeof fieldValue !== 'string') { + throw new Error(`${fieldName}.${key} must be a string`) + } + result[quickBooksKey] = fieldValue + } + if (Object.keys(result).length === 0) { + throw new Error(`${fieldName} must contain at least one supported address field`) + } + return result +} + +export function quickBooksActiveValue( + activeStatus: QuickBooksActiveStatus | undefined +): boolean | undefined { + if (activeStatus === undefined || activeStatus === 'unchanged') return undefined + if (activeStatus === 'active') return true + if (activeStatus === 'inactive') return false + throw new Error(`Unsupported QuickBooks active status: ${String(activeStatus)}`) +} + +/** + * Guards a QuickBooks sparse-update body. + * + * Enforces both halves of the contract: + * 1. `sparse` is literally `true`. Intuit treats an update without it as a + * *full* replacement, silently clearing every field the body omits, and + * documents `sparse` as required to void an object. A builder that drops it + * would otherwise fail only against the live API. + * 2. The body carries at least one field beyond the required identifiers + * (`Id`, `SyncToken`, `sparse` by default), so an update that would change + * nothing never reaches the API. + */ +export function assertQuickBooksSparseUpdate( + body: Record, + requiredFieldCount = 3 +): void { + if (body.sparse !== true) { + throw new Error('QuickBooks sparse update body must set sparse to true') + } + if (Object.keys(body).length <= requiredFieldCount) { + throw new Error('Provide at least one field to update') + } +} diff --git a/apps/sim/tools/quickbooks/void_customer_payment.ts b/apps/sim/tools/quickbooks/void_customer_payment.ts new file mode 100644 index 00000000000..54271d60863 --- /dev/null +++ b/apps/sim/tools/quickbooks/void_customer_payment.ts @@ -0,0 +1,101 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import type { + QuickBooksSalesTransaction, + QuickBooksVoidResponse, + QuickBooksVoidTransactionParams, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, + QUICKBOOKS_VOID_OUTPUTS, +} from '@/tools/quickbooks/types' +import { + buildQuickBooksEntityUrl, + getQuickBooksToolHeaders, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import { assertQuickBooksSparseUpdate, requiredQuickBooksString } from '@/tools/quickbooks/values' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksVoidCustomerPaymentTool: ToolConfig< + QuickBooksVoidTransactionParams, + QuickBooksVoidResponse +> = { + id: 'quickbooks_void_customer_payment', + name: 'QuickBooks Void Customer Payment', + description: 'Void a customer payment after explicit confirmation', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + transactionId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Payment ID to void', + }, + syncToken: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Current payment sync token', + }, + confirmVoid: { + type: 'boolean', + required: true, + visibility: 'user-only', + description: 'Explicit confirmation that the payment should be voided', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => { + const url = buildQuickBooksEntityUrl(params.realmId, 'payment') + url.searchParams.set('operation', 'update') + url.searchParams.set('include', 'void') + return url.toString() + }, + method: 'POST', + headers: (params) => getQuickBooksToolHeaders(params.accessToken, 'application/json'), + body: (params) => { + if (params.confirmVoid !== true) throw new Error('Confirm void before voiding the payment') + const body = { + Id: requiredQuickBooksString(params.transactionId, 'transactionId'), + SyncToken: requiredQuickBooksString(params.syncToken, 'syncToken'), + sparse: true, + } + assertQuickBooksSparseUpdate(body, 2) + return body + }, + retry: { enabled: false }, + }, + transformResponse: async (response) => { + const result = await transformQuickBooksMutationResponse( + response, + 'Payment' + ) + return { success: true, output: { ...result.output, voided: true } } + }, + outputs: { + record: { + type: 'json', + description: 'Voided native QuickBooks Payment', + properties: QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, + }, + ...QUICKBOOKS_VOID_OUTPUTS, + }, +} diff --git a/apps/sim/tools/quickbooks/void_invoice.ts b/apps/sim/tools/quickbooks/void_invoice.ts new file mode 100644 index 00000000000..c7c539eb295 --- /dev/null +++ b/apps/sim/tools/quickbooks/void_invoice.ts @@ -0,0 +1,97 @@ +import { ErrorExtractorId } from '@/tools/error-extractors' +import type { + QuickBooksSalesTransaction, + QuickBooksVoidResponse, + QuickBooksVoidTransactionParams, +} from '@/tools/quickbooks/types' +import { + QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, + QUICKBOOKS_VOID_OUTPUTS, +} from '@/tools/quickbooks/types' +import { + buildQuickBooksEntityUrl, + getQuickBooksToolHeaders, + transformQuickBooksMutationResponse, +} from '@/tools/quickbooks/utils' +import { requiredQuickBooksString } from '@/tools/quickbooks/values' +import type { ToolConfig } from '@/tools/types' + +export const quickbooksVoidInvoiceTool: ToolConfig< + QuickBooksVoidTransactionParams, + QuickBooksVoidResponse +> = { + id: 'quickbooks_void_invoice', + name: 'QuickBooks Void Invoice', + description: 'Void an invoice after explicit confirmation', + version: '1.0.0', + params: { + accessToken: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks OAuth access token', + }, + realmId: { + type: 'string', + required: true, + visibility: 'hidden', + description: 'QuickBooks company ID derived from the connected credential', + }, + transactionId: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Invoice ID to void', + }, + syncToken: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Current invoice sync token', + }, + confirmVoid: { + type: 'boolean', + required: true, + visibility: 'user-only', + description: 'Explicit confirmation that the invoice should be voided', + }, + }, + oauth: { + required: true, + provider: 'quickbooks', + requiredScopes: ['com.intuit.quickbooks.accounting'], + }, + errorExtractor: ErrorExtractorId.QUICKBOOKS_FAULT, + request: { + url: (params) => { + const url = buildQuickBooksEntityUrl(params.realmId, 'invoice') + url.searchParams.set('operation', 'void') + return url.toString() + }, + method: 'POST', + headers: (params) => getQuickBooksToolHeaders(params.accessToken, 'application/json'), + body: (params) => { + if (params.confirmVoid !== true) throw new Error('Confirm void before voiding the invoice') + return { + Id: requiredQuickBooksString(params.transactionId, 'transactionId'), + SyncToken: requiredQuickBooksString(params.syncToken, 'syncToken'), + } + }, + retry: { enabled: false }, + }, + transformResponse: async (response) => { + const result = await transformQuickBooksMutationResponse( + response, + 'Invoice' + ) + return { success: true, output: { ...result.output, voided: true } } + }, + outputs: { + record: { + type: 'json', + description: 'Voided native QuickBooks Invoice', + properties: QUICKBOOKS_SALES_TRANSACTION_PROPERTIES, + }, + ...QUICKBOOKS_VOID_OUTPUTS, + }, +} diff --git a/apps/sim/tools/registry.ts b/apps/sim/tools/registry.ts index cca3a0cf396..83aa5fa056f 100644 --- a/apps/sim/tools/registry.ts +++ b/apps/sim/tools/registry.ts @@ -3669,6 +3669,55 @@ import { quartrListSlideDecksTool, quartrListTranscriptsTool, } from '@/tools/quartr' +import { + quickbooksAddAttachmentTool, + quickbooksCreateBillPaymentTool, + quickbooksCreateBillTool, + quickbooksCreateCreditMemoTool, + quickbooksCreateCustomerPaymentTool, + quickbooksCreateCustomerTool, + quickbooksCreateDepositTool, + quickbooksCreateEmployeeTool, + quickbooksCreateEstimateTool, + quickbooksCreateInvoiceTool, + quickbooksCreateItemTool, + quickbooksCreateJournalEntryTool, + quickbooksCreatePurchaseOrderTool, + quickbooksCreatePurchaseTool, + quickbooksCreateRefundReceiptTool, + quickbooksCreateSalesReceiptTool, + quickbooksCreateVendorCreditTool, + quickbooksCreateVendorTool, + quickbooksDownloadAttachmentTool, + quickbooksDownloadTransactionPdfTool, + quickbooksEmailTransactionTool, + quickbooksGetCompanyInfoTool, + quickbooksReadAccountingTransactionsTool, + quickbooksReadAttachmentsTool, + quickbooksReadMasterDataTool, + quickbooksReadPurchasingTransactionsTool, + quickbooksReadSalesTransactionsTool, + quickbooksRunFinancialReportTool, + quickbooksUpdateBillPaymentTool, + quickbooksUpdateBillTool, + quickbooksUpdateCreditMemoTool, + quickbooksUpdateCustomerPaymentTool, + quickbooksUpdateCustomerTool, + quickbooksUpdateDepositTool, + quickbooksUpdateEmployeeTool, + quickbooksUpdateEstimateTool, + quickbooksUpdateInvoiceTool, + quickbooksUpdateItemTool, + quickbooksUpdateJournalEntryTool, + quickbooksUpdatePurchaseOrderTool, + quickbooksUpdatePurchaseTool, + quickbooksUpdateRefundReceiptTool, + quickbooksUpdateSalesReceiptTool, + quickbooksUpdateVendorCreditTool, + quickbooksUpdateVendorTool, + quickbooksVoidCustomerPaymentTool, + quickbooksVoidInvoiceTool, +} from '@/tools/quickbooks' import { quiverImageToSvgTool, quiverListModelsTool, quiverTextToSvgTool } from '@/tools/quiver' import { rabbitmqCreateBindingTool, @@ -7479,6 +7528,53 @@ export const tools: Record = { postgresql_delete: postgresDeleteTool, postgresql_execute: postgresExecuteTool, postgresql_introspect: postgresIntrospectTool, + quickbooks_add_attachment: quickbooksAddAttachmentTool, + quickbooks_create_bill: quickbooksCreateBillTool, + quickbooks_create_bill_payment: quickbooksCreateBillPaymentTool, + quickbooks_create_credit_memo: quickbooksCreateCreditMemoTool, + quickbooks_create_customer: quickbooksCreateCustomerTool, + quickbooks_create_customer_payment: quickbooksCreateCustomerPaymentTool, + quickbooks_create_deposit: quickbooksCreateDepositTool, + quickbooks_create_employee: quickbooksCreateEmployeeTool, + quickbooks_create_estimate: quickbooksCreateEstimateTool, + quickbooks_create_invoice: quickbooksCreateInvoiceTool, + quickbooks_create_item: quickbooksCreateItemTool, + quickbooks_create_journal_entry: quickbooksCreateJournalEntryTool, + quickbooks_create_purchase: quickbooksCreatePurchaseTool, + quickbooks_create_purchase_order: quickbooksCreatePurchaseOrderTool, + quickbooks_create_refund_receipt: quickbooksCreateRefundReceiptTool, + quickbooks_create_sales_receipt: quickbooksCreateSalesReceiptTool, + quickbooks_create_vendor: quickbooksCreateVendorTool, + quickbooks_create_vendor_credit: quickbooksCreateVendorCreditTool, + quickbooks_download_attachment: quickbooksDownloadAttachmentTool, + quickbooks_download_transaction_pdf: quickbooksDownloadTransactionPdfTool, + quickbooks_email_transaction: quickbooksEmailTransactionTool, + quickbooks_get_company_info: quickbooksGetCompanyInfoTool, + quickbooks_read_accounting_transactions: quickbooksReadAccountingTransactionsTool, + quickbooks_read_attachments: quickbooksReadAttachmentsTool, + quickbooks_read_master_data: quickbooksReadMasterDataTool, + quickbooks_read_purchasing_transactions: quickbooksReadPurchasingTransactionsTool, + quickbooks_read_sales_transactions: quickbooksReadSalesTransactionsTool, + quickbooks_run_financial_report: quickbooksRunFinancialReportTool, + quickbooks_update_bill: quickbooksUpdateBillTool, + quickbooks_update_bill_payment: quickbooksUpdateBillPaymentTool, + quickbooks_update_credit_memo: quickbooksUpdateCreditMemoTool, + quickbooks_update_customer: quickbooksUpdateCustomerTool, + quickbooks_update_customer_payment: quickbooksUpdateCustomerPaymentTool, + quickbooks_update_deposit: quickbooksUpdateDepositTool, + quickbooks_update_employee: quickbooksUpdateEmployeeTool, + quickbooks_update_estimate: quickbooksUpdateEstimateTool, + quickbooks_update_invoice: quickbooksUpdateInvoiceTool, + quickbooks_update_item: quickbooksUpdateItemTool, + quickbooks_update_journal_entry: quickbooksUpdateJournalEntryTool, + quickbooks_update_purchase: quickbooksUpdatePurchaseTool, + quickbooks_update_purchase_order: quickbooksUpdatePurchaseOrderTool, + quickbooks_update_refund_receipt: quickbooksUpdateRefundReceiptTool, + quickbooks_update_sales_receipt: quickbooksUpdateSalesReceiptTool, + quickbooks_update_vendor: quickbooksUpdateVendorTool, + quickbooks_update_vendor_credit: quickbooksUpdateVendorCreditTool, + quickbooks_void_customer_payment: quickbooksVoidCustomerPaymentTool, + quickbooks_void_invoice: quickbooksVoidInvoiceTool, rds_query: rdsQueryTool, rds_insert: rdsInsertTool, rds_update: rdsUpdateTool, diff --git a/packages/deployment-config/src/env-capabilities.ts b/packages/deployment-config/src/env-capabilities.ts index 3d7573956de..d4c2824f40d 100644 --- a/packages/deployment-config/src/env-capabilities.ts +++ b/packages/deployment-config/src/env-capabilities.ts @@ -1277,6 +1277,7 @@ export const OAUTH_CLIENT_CAPABILITIES = { dropbox: ['DROPBOX_CLIENT_ID', 'DROPBOX_CLIENT_SECRET'], slack: ['SLACK_CLIENT_ID', 'SLACK_CLIENT_SECRET'], reddit: ['REDDIT_CLIENT_ID', 'REDDIT_CLIENT_SECRET'], + quickbooks: ['QUICKBOOKS_CLIENT_ID', 'QUICKBOOKS_CLIENT_SECRET', 'QUICKBOOKS_ENV'], wealthbox: ['WEALTHBOX_CLIENT_ID', 'WEALTHBOX_CLIENT_SECRET'], webflow: ['WEBFLOW_CLIENT_ID', 'WEBFLOW_CLIENT_SECRET'], asana: ['ASANA_CLIENT_ID', 'ASANA_CLIENT_SECRET'], diff --git a/packages/deployment-config/src/integrations.json b/packages/deployment-config/src/integrations.json index bf9e33f7429..5862a76367f 100644 --- a/packages/deployment-config/src/integrations.json +++ b/packages/deployment-config/src/integrations.json @@ -17526,6 +17526,214 @@ "integrationType": "analytics", "tags": ["data-analytics", "enrichment", "document-processing"] }, + { + "type": "quickbooks", + "slug": "quickbooks", + "name": "QuickBooks", + "description": "Manage QuickBooks Online company, transactions, reports, emails, PDFs, and attachments", + "longDescription": "Connect one QuickBooks Online company to manage bounded master-data, sales, purchasing, receivables, payables, accounting, reports, transaction delivery, and document workflows.", + "bgColor": "#2CA01C", + "iconName": "QuickBooksIcon", + "docsUrl": "https://docs.sim.ai/integrations/quickbooks", + "operations": [ + { + "name": "Get Company Info", + "description": "Get information about the connected QuickBooks Online company" + }, + { + "name": "Read Master Data", + "description": "List or read one account, class, customer, department, employee, item, or vendor" + }, + { + "name": "Create Customer", + "description": "Create a customer in the connected QuickBooks Online company" + }, + { + "name": "Update Customer", + "description": "Sparse-update a customer in the connected QuickBooks Online company" + }, + { + "name": "Create Employee", + "description": "Create a non-payroll employee profile in the connected QuickBooks Online company" + }, + { + "name": "Update Employee", + "description": "Read, merge, and full-update a non-payroll employee profile" + }, + { + "name": "Create Vendor", + "description": "Create a vendor in the connected QuickBooks Online company" + }, + { + "name": "Update Vendor", + "description": "Read, merge, and full-update a vendor in QuickBooks Online" + }, + { + "name": "Create Item", + "description": "Create a Service or Non-inventory item in QuickBooks Online" + }, + { + "name": "Update Item", + "description": "Read, merge, and full-update an item without changing its type" + }, + { + "name": "Read Sales Transactions", + "description": "List or read one estimate, invoice, sales receipt, payment, credit memo, or refund receipt" + }, + { + "name": "Create Estimate", + "description": "Create an estimate with bounded item and description lines" + }, + { + "name": "Update Estimate", + "description": "Sparse-update an estimate using its current sync token" + }, + { + "name": "Create Invoice", + "description": "Create an invoice without emailing or collecting payment" + }, + { + "name": "Update Invoice", + "description": "Sparse-update an invoice using its current sync token" + }, + { + "name": "Void Invoice", + "description": "Void an invoice after explicit confirmation" + }, + { + "name": "Create Sales Receipt", + "description": "Create a sales receipt for a completed customer sale" + }, + { + "name": "Update Sales Receipt", + "description": "Sparse-update a sales receipt using its current sync token" + }, + { + "name": "Create Customer Payment", + "description": "Record a customer payment with optional bounded invoice allocations" + }, + { + "name": "Update Customer Payment", + "description": "Sparse-update a customer payment using its current sync token" + }, + { + "name": "Void Customer Payment", + "description": "Void a customer payment after explicit confirmation" + }, + { + "name": "Create Credit Memo", + "description": "Create a customer credit memo with bounded sales lines" + }, + { + "name": "Update Credit Memo", + "description": "Read, merge, and full-update a credit memo using its current sync token" + }, + { + "name": "Create Refund Receipt", + "description": "Create a customer refund receipt against a required deposit account" + }, + { + "name": "Update Refund Receipt", + "description": "Sparse-update a refund receipt using its current sync token" + }, + { + "name": "Read Purchasing Transactions", + "description": "List or read one purchase order, bill, bill payment, vendor credit, or purchase" + }, + { + "name": "Create Purchase Order", + "description": "Create a purchase order with bounded expense lines" + }, + { + "name": "Update Purchase Order", + "description": "Read, merge, and full-update purchase-order header fields" + }, + { + "name": "Create Bill", + "description": "Create a vendor bill with optional Purchase Order line links without paying it" + }, + { + "name": "Update Bill", + "description": "Read, merge, and full-update bill header fields using its current sync token" + }, + { + "name": "Create Bill Payment", + "description": "Record a check or credit-card payment allocated to one or more bills" + }, + { + "name": "Update Bill Payment", + "description": "Read, merge, and full-update a BillPayment without changing allocations" + }, + { + "name": "Create Vendor Credit", + "description": "Create a vendor credit without applying it to a bill" + }, + { + "name": "Update Vendor Credit", + "description": "Read, merge, and full-update vendor-credit header fields" + }, + { + "name": "Create Purchase or Expense", + "description": "Record a cash, check, or credit-card purchase with bounded expense lines" + }, + { + "name": "Update Purchase or Expense", + "description": "Read, merge, and full-update purchase header fields without changing lines" + }, + { + "name": "Read Accounting Transactions", + "description": "List or read one journal entry, deposit, or transfer" + }, + { + "name": "Create Journal Entry", + "description": "Post a balanced journal entry after explicit confirmation" + }, + { + "name": "Update Journal Entry", + "description": "Sparse-update journal-entry header fields after explicit confirmation" + }, + { + "name": "Create Deposit", + "description": "Create a deposit with bounded account lines" + }, + { + "name": "Update Deposit", + "description": "Sparse-update deposit header fields using the current sync token and destination account" + }, + { + "name": "Run Financial Report", + "description": "Run a fixed QuickBooks financial report with verified accountant-focused filters" + }, + { + "name": "Email Transaction", + "description": "Send a supported QuickBooks transaction by email. This causes an external email and Intuit limits sandbox email delivery." + }, + { + "name": "Download Transaction PDF", + "description": "Download a supported QuickBooks transaction as a bounded PDF file" + }, + { + "name": "Read Attachments", + "description": "List attachment metadata for a fixed QuickBooks entity or read one attachment by ID" + }, + { + "name": "Add Attachment", + "description": "Attach one supported file or one note to a fixed QuickBooks entity" + }, + { + "name": "Download Attachment", + "description": "Download a QuickBooks file attachment as a stored Sim file" + } + ], + "operationCount": 47, + "triggers": [], + "triggerCount": 0, + "authType": "oauth", + "oauthServiceId": "quickbooks", + "category": "tools", + "integrationType": "commerce", + "tags": ["payments", "automation", "data-analytics"] + }, { "type": "quiver", "slug": "quiver", diff --git a/packages/sim-setup/src/capability-config.test.ts b/packages/sim-setup/src/capability-config.test.ts index eaf2d4920b4..41da28d96d2 100644 --- a/packages/sim-setup/src/capability-config.test.ts +++ b/packages/sim-setup/src/capability-config.test.ts @@ -92,4 +92,17 @@ describe('capability setup configuration', () => { ) } }) + + it('configures the QuickBooks API environment with its OAuth credentials', () => { + expect(OAUTH_CLIENT_CAPABILITIES.quickbooks).toEqual([ + 'QUICKBOOKS_CLIENT_ID', + 'QUICKBOOKS_CLIENT_SECRET', + 'QUICKBOOKS_ENV', + ]) + expect(getOAuthClientSetupFields('quickbooks')).toEqual([ + { key: 'QUICKBOOKS_CLIENT_ID', input: 'text' }, + { key: 'QUICKBOOKS_CLIENT_SECRET', input: 'secret' }, + { key: 'QUICKBOOKS_ENV', input: 'text' }, + ]) + }) }) diff --git a/packages/sim-setup/src/capability-config.ts b/packages/sim-setup/src/capability-config.ts index 4848d90607c..9eb5b0f77c7 100644 --- a/packages/sim-setup/src/capability-config.ts +++ b/packages/sim-setup/src/capability-config.ts @@ -969,6 +969,11 @@ export const OAUTH_CLIENT_SETUP_FIELDS = { INSTAGRAM_CLIENT_ID: { input: 'text' }, INSTAGRAM_CLIENT_SECRET: { input: 'secret' }, }, + quickbooks: { + QUICKBOOKS_CLIENT_ID: { input: 'text' }, + QUICKBOOKS_CLIENT_SECRET: { input: 'secret' }, + QUICKBOOKS_ENV: { input: 'text' }, + }, salesforce: { SALESFORCE_CLIENT_ID: { input: 'text' }, SALESFORCE_CLIENT_SECRET: { input: 'secret' }, From 15a31a273de16a8b4e7639b6a90299b4319cd9f4 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Thu, 27 Aug 2026 20:57:52 -0700 Subject: [PATCH 2/6] fix(integrations): harden QuickBooks contract accuracy --- .../docs/en/integrations/quickbooks.mdx | 12 +- apps/sim/blocks/blocks/quickbooks.ts | 202 +++++++++++++++++- .../sim/lib/api/contracts/tools/quickbooks.ts | 17 +- .../internal/quickbooks/operations.test.ts | 30 ++- .../sim/lib/internal/quickbooks/operations.ts | 67 ++++-- .../sim/tools/quickbooks/api_accuracy.test.ts | 129 ++++++++++- apps/sim/tools/quickbooks/block.test.ts | 46 ++++ apps/sim/tools/quickbooks/create_customer.ts | 25 ++- apps/sim/tools/quickbooks/create_vendor.ts | 25 ++- apps/sim/tools/quickbooks/documents_utils.ts | 53 ++++- .../tools/quickbooks/purchasing_utils.test.ts | 50 +++++ apps/sim/tools/quickbooks/purchasing_utils.ts | 10 +- apps/sim/tools/quickbooks/sales_utils.test.ts | 60 ++++++ apps/sim/tools/quickbooks/sales_utils.ts | 2 +- apps/sim/tools/quickbooks/types.ts | 17 +- apps/sim/tools/quickbooks/update_bill.ts | 4 +- .../tools/quickbooks/update_bill_payment.ts | 4 +- .../quickbooks/update_customer_payment.ts | 62 ++++-- .../tools/quickbooks/update_vendor_credit.ts | 4 +- apps/sim/tools/quickbooks/utils.ts | 43 ++-- .../deployment-config/src/integrations.json | 2 +- 21 files changed, 729 insertions(+), 135 deletions(-) create mode 100644 apps/sim/tools/quickbooks/block.test.ts diff --git a/apps/docs/content/docs/en/integrations/quickbooks.mdx b/apps/docs/content/docs/en/integrations/quickbooks.mdx index 0c29cb1e55a..c8c0ee56362 100644 --- a/apps/docs/content/docs/en/integrations/quickbooks.mdx +++ b/apps/docs/content/docs/en/integrations/quickbooks.mdx @@ -215,7 +215,7 @@ Create a customer in the connected QuickBooks Online company | Parameter | Type | Required | Description | | --------- | ---- | -------- | ----------- | -| `displayName` | string | Yes | Unique customer display name | +| `displayName` | string | No | Unique customer display name. Required unless givenName or familyName is supplied | | `companyName` | string | No | Customer company name | | `givenName` | string | No | Customer given name | | `familyName` | string | No | Customer family name | @@ -399,7 +399,7 @@ Create a vendor in the connected QuickBooks Online company | Parameter | Type | Required | Description | | --------- | ---- | -------- | ----------- | -| `displayName` | string | Yes | Unique vendor display name | +| `displayName` | string | No | Unique vendor display name. Required unless givenName or familyName is supplied | | `companyName` | string | No | Vendor company name | | `givenName` | string | No | Vendor given name | | `familyName` | string | No | Vendor family name | @@ -1160,7 +1160,7 @@ Record a customer payment with optional bounded invoice allocations ### QuickBooks Update Customer Payment -Sparse-update a customer payment using its current sync token +Read, merge, and full-update a customer payment using its current sync token #### Input @@ -1869,7 +1869,7 @@ Read, merge, and full-update bill header fields using its current sync token | --------- | ---- | -------- | ----------- | | `billId` | string | Yes | Bill ID to update | | `syncToken` | string | Yes | Current bill sync token | -| `vendorId` | string | Yes | Current or replacement vendor ID required by QuickBooks | +| `vendorId` | string | No | Replacement vendor ID; omit to preserve the current vendor | | `apAccountId` | string | No | Replacement accounts-payable account ID | | `transactionDate` | string | No | Replacement bill date in YYYY-MM-DD format | | `dueDate` | string | No | Replacement due date in YYYY-MM-DD format | @@ -2017,7 +2017,7 @@ Read, merge, and full-update a BillPayment without changing allocations | --------- | ---- | -------- | ----------- | | `billPaymentId` | string | Yes | BillPayment ID to update | | `syncToken` | string | Yes | Current BillPayment sync token | -| `vendorId` | string | Yes | Current vendor ID required by QuickBooks | +| `vendorId` | string | No | Replacement vendor ID; omit to preserve the current vendor | | `transactionDate` | string | No | Replacement payment date in YYYY-MM-DD format | | `privateNote` | string | No | Replacement internal note | @@ -2161,7 +2161,7 @@ Read, merge, and full-update vendor-credit header fields | --------- | ---- | -------- | ----------- | | `vendorCreditId` | string | Yes | VendorCredit ID to update | | `syncToken` | string | Yes | Current vendor-credit sync token | -| `vendorId` | string | Yes | Current or replacement vendor ID required by QuickBooks | +| `vendorId` | string | No | Replacement vendor ID; omit to preserve the current vendor | | `apAccountId` | string | No | Replacement accounts-payable account ID | | `transactionDate` | string | No | Replacement date in YYYY-MM-DD format | | `documentNumber` | string | No | Replacement vendor-credit number | diff --git a/apps/sim/blocks/blocks/quickbooks.ts b/apps/sim/blocks/blocks/quickbooks.ts index ab04505f654..368a8a23aac 100644 --- a/apps/sim/blocks/blocks/quickbooks.ts +++ b/apps/sim/blocks/blocks/quickbooks.ts @@ -289,6 +289,21 @@ function optionalValue(value: unknown): unknown { return typeof value === 'string' && value.trim() === '' ? undefined : value } +function requiredWhenNameAlternativesAreEmpty( + values: Record | undefined, + operations: readonly string[], + alternativeFields: readonly string[] +) { + const operation = typeof values?.operation === 'string' ? values.operation : '' + const alternativesAreEmpty = alternativeFields.every( + (field) => optionalValue(values?.[field]) === undefined + ) + return { + field: 'operation', + value: operations.includes(operation) && alternativesAreEmpty ? operation : [], + } +} + function paginationCondition(values?: Record) { if (!values) { return { field: 'operation', value: [...PAGINATED_OPERATIONS] } @@ -386,6 +401,157 @@ export const QuickBooksBlock: BlockConfig = { integrationType: IntegrationType.Commerce, bgColor: '#2CA01C', icon: QuickBooksIcon, + canvasPresentation: { + defaultTitle: 'QuickBooks', + sentences: { + byOperation: { + quickbooks_get_company_info: ['Read the connected QuickBooks company'], + quickbooks_read_master_data: [ + 'Read', + { field: 'recordType', core: true }, + { text: 'using', field: 'readMode' }, + ], + quickbooks_create_customer: [ + { + text: 'Create customer', + field: ['displayName', 'givenName', 'familyName'], + core: true, + }, + ], + quickbooks_update_customer: [{ text: 'Update customer', field: 'customerId', core: true }], + quickbooks_create_employee: [ + { + text: 'Create employee', + field: ['displayName', 'givenName', 'familyName'], + core: true, + }, + ], + quickbooks_update_employee: [{ text: 'Update employee', field: 'employeeId', core: true }], + quickbooks_create_vendor: [ + { + text: 'Create vendor', + field: ['displayName', 'givenName', 'familyName'], + core: true, + }, + ], + quickbooks_update_vendor: [{ text: 'Update vendor', field: 'vendorId', core: true }], + quickbooks_create_item: [{ text: 'Create item', field: 'name', core: true }], + quickbooks_update_item: [{ text: 'Update item', field: 'itemId', core: true }], + quickbooks_read_sales_transactions: [ + 'Read sales transactions', + { text: 'of type', field: 'transactionType', core: true }, + { text: 'using', field: 'readMode' }, + ], + quickbooks_create_estimate: [ + { text: 'Create an estimate for customer', field: 'customerId', core: true }, + ], + quickbooks_update_estimate: [ + { text: 'Update estimate', field: 'transactionId', core: true }, + ], + quickbooks_create_invoice: [ + { text: 'Create an invoice for customer', field: 'customerId', core: true }, + ], + quickbooks_update_invoice: [{ text: 'Update invoice', field: 'transactionId', core: true }], + quickbooks_void_invoice: [{ text: 'Void invoice', field: 'transactionId', core: true }], + quickbooks_create_sales_receipt: [ + { text: 'Create a sales receipt for customer', field: 'customerId', core: true }, + ], + quickbooks_update_sales_receipt: [ + { text: 'Update sales receipt', field: 'transactionId', core: true }, + ], + quickbooks_create_customer_payment: [ + { text: 'Record payment from customer', field: 'customerId', core: true }, + { text: 'for', field: 'totalAmount' }, + ], + quickbooks_update_customer_payment: [ + { text: 'Update customer payment', field: 'transactionId', core: true }, + ], + quickbooks_void_customer_payment: [ + { text: 'Void customer payment', field: 'transactionId', core: true }, + ], + quickbooks_create_credit_memo: [ + { text: 'Create a credit memo for customer', field: 'customerId', core: true }, + ], + quickbooks_update_credit_memo: [ + { text: 'Update credit memo', field: 'transactionId', core: true }, + ], + quickbooks_create_refund_receipt: [ + { text: 'Create a refund receipt for customer', field: 'customerId', core: true }, + ], + quickbooks_update_refund_receipt: [ + { text: 'Update refund receipt', field: 'transactionId', core: true }, + ], + quickbooks_read_purchasing_transactions: [ + 'Read purchasing transactions', + { text: 'of type', field: 'purchasingTransactionType', core: true }, + { text: 'using', field: 'readMode' }, + ], + quickbooks_create_purchase_order: [ + { text: 'Create a purchase order for vendor', field: 'vendorId', core: true }, + ], + quickbooks_update_purchase_order: [ + { text: 'Update purchase order', field: 'transactionId', core: true }, + ], + quickbooks_create_bill: [ + { text: 'Create a bill for vendor', field: 'vendorId', core: true }, + ], + quickbooks_update_bill: [{ text: 'Update bill', field: 'transactionId', core: true }], + quickbooks_create_bill_payment: [ + { text: 'Record bill payment for vendor', field: 'vendorId', core: true }, + { text: 'for', field: 'totalAmount' }, + ], + quickbooks_update_bill_payment: [ + { text: 'Update bill payment', field: 'transactionId', core: true }, + ], + quickbooks_create_vendor_credit: [ + { text: 'Create a credit for vendor', field: 'vendorId', core: true }, + ], + quickbooks_update_vendor_credit: [ + { text: 'Update vendor credit', field: 'transactionId', core: true }, + ], + quickbooks_create_purchase: [ + { text: 'Record a purchase for vendor', field: 'vendorId', core: true }, + ], + quickbooks_update_purchase: [ + { text: 'Update purchase', field: 'transactionId', core: true }, + ], + quickbooks_read_accounting_transactions: [ + 'Read accounting transactions', + { text: 'of type', field: 'accountingTransactionType', core: true }, + { text: 'using', field: 'readMode' }, + ], + quickbooks_create_journal_entry: ['Create a journal entry'], + quickbooks_update_journal_entry: [ + { text: 'Update journal entry', field: 'transactionId', core: true }, + ], + quickbooks_create_deposit: [ + { text: 'Create a deposit into account', field: 'depositAccountId', core: true }, + ], + quickbooks_update_deposit: [{ text: 'Update deposit', field: 'transactionId', core: true }], + quickbooks_run_financial_report: [{ text: 'Run report', field: 'reportType', core: true }], + quickbooks_email_transaction: [ + { text: 'Email', field: 'documentTransactionType', core: true }, + { text: 'with ID', field: 'documentTransactionId' }, + ], + quickbooks_download_transaction_pdf: [ + { text: 'Download PDF for', field: 'documentTransactionType', core: true }, + { text: 'with ID', field: 'documentTransactionId' }, + ], + quickbooks_read_attachments: [ + 'Read QuickBooks attachments', + { text: 'for', field: 'attachmentTargetType' }, + { text: 'with ID', field: 'attachmentTargetId' }, + ], + quickbooks_add_attachment: [ + { text: 'Add attachment to', field: 'attachmentTargetType', core: true }, + { text: 'with ID', field: 'attachmentTargetId' }, + ], + quickbooks_download_attachment: [ + { text: 'Download attachment', field: 'attachmentId', core: true }, + ], + }, + }, + }, subBlocks: [ { id: 'operation', @@ -545,15 +711,18 @@ export const QuickBooksBlock: BlockConfig = { type: 'dropdown', options: [ { label: 'Bill', id: 'bill' }, + { label: 'Bill Payment', id: 'bill_payment' }, { label: 'Credit Memo', id: 'credit_memo' }, - { label: 'Customer', id: 'customer' }, + { label: 'Deposit', id: 'deposit' }, { label: 'Estimate', id: 'estimate' }, { label: 'Invoice', id: 'invoice' }, + { label: 'Item', id: 'item' }, + { label: 'Journal Entry', id: 'journal_entry' }, { label: 'Customer Payment', id: 'payment' }, { label: 'Purchase or Expense', id: 'purchase' }, + { label: 'Purchase Order', id: 'purchase_order' }, { label: 'Refund Receipt', id: 'refund_receipt' }, { label: 'Sales Receipt', id: 'sales_receipt' }, - { label: 'Vendor', id: 'vendor' }, { label: 'Vendor Credit', id: 'vendor_credit' }, ], condition: attachmentTargetCondition, @@ -1274,11 +1443,8 @@ export const QuickBooksBlock: BlockConfig = { 'quickbooks_update_vendor', 'quickbooks_create_purchase_order', 'quickbooks_create_bill', - 'quickbooks_update_bill', 'quickbooks_create_bill_payment', - 'quickbooks_update_bill_payment', 'quickbooks_create_vendor_credit', - 'quickbooks_update_vendor_credit', ], }, }, @@ -1315,10 +1481,12 @@ export const QuickBooksBlock: BlockConfig = { field: 'operation', value: [...CUSTOMER_OPERATIONS, ...EMPLOYEE_OPERATIONS, ...VENDOR_OPERATIONS], }, - required: { - field: 'operation', - value: ['quickbooks_create_customer', 'quickbooks_create_vendor'], - }, + required: (values) => + requiredWhenNameAlternativesAreEmpty( + values, + ['quickbooks_create_customer', 'quickbooks_create_vendor'], + ['givenName', 'familyName'] + ), }, { id: 'companyName', @@ -1339,6 +1507,14 @@ export const QuickBooksBlock: BlockConfig = { field: 'operation', value: [...CUSTOMER_OPERATIONS, ...EMPLOYEE_OPERATIONS, ...VENDOR_OPERATIONS], }, + required: (values) => + requiredWhenNameAlternativesAreEmpty( + values, + ['quickbooks_create_customer', 'quickbooks_create_employee', 'quickbooks_create_vendor'], + values?.operation === 'quickbooks_create_employee' + ? ['familyName'] + : ['displayName', 'familyName'] + ), }, { id: 'familyName', @@ -1349,6 +1525,14 @@ export const QuickBooksBlock: BlockConfig = { field: 'operation', value: [...CUSTOMER_OPERATIONS, ...EMPLOYEE_OPERATIONS, ...VENDOR_OPERATIONS], }, + required: (values) => + requiredWhenNameAlternativesAreEmpty( + values, + ['quickbooks_create_customer', 'quickbooks_create_employee', 'quickbooks_create_vendor'], + values?.operation === 'quickbooks_create_employee' + ? ['givenName'] + : ['displayName', 'givenName'] + ), }, { id: 'primaryEmail', diff --git a/apps/sim/lib/api/contracts/tools/quickbooks.ts b/apps/sim/lib/api/contracts/tools/quickbooks.ts index df864e4369f..67195ef3d93 100644 --- a/apps/sim/lib/api/contracts/tools/quickbooks.ts +++ b/apps/sim/lib/api/contracts/tools/quickbooks.ts @@ -29,32 +29,35 @@ const documentTransactionTypeSchema = z.enum([ const attachmentTargetTypeSchema = z.enum([ 'bill', + 'bill_payment', 'credit_memo', - 'customer', + 'deposit', 'estimate', 'invoice', + 'item', + 'journal_entry', 'payment', 'purchase', + 'purchase_order', 'refund_receipt', 'sales_receipt', - 'vendor', 'vendor_credit', ]) -const optionalFileName = z.string().trim().max(180, 'Filename is too long').optional().nullable() +const optionalFileName = z.string().trim().max(1000, 'Filename is too long').optional().nullable() const optionalContentType = z .string() .trim() - .max(255, 'Content type is too long') + .max(100, 'Content type is too long') .optional() .nullable() const optionalDescription = z .string() .trim() - .max(1000, 'Description is too long') + .max(2000, 'Description is too long') .optional() .nullable() -const optionalNote = z.string().trim().max(4000, 'Note is too long').optional().nullable() +const optionalNote = z.string().trim().max(2000, 'Note is too long').optional().nullable() const boundedId = z.string().trim().min(1, 'ID is required').max(256, 'ID is too long') const routeErrorSchema = z.object({ success: z.literal(false), error: z.string().min(1) }) const attachableSchema = z @@ -139,7 +142,7 @@ export type QuickBooksAddAttachmentBody = z.output ({ uploadCopilotFile: vi.fn(), uploadExecutionFile: vi.fn(), + guardedFetch: vi.fn(), + closeDispatcher: vi.fn(), })) vi.mock('@/lib/uploads/contexts/copilot', () => ({ @@ -14,6 +16,12 @@ vi.mock('@/lib/uploads/contexts/copilot', () => ({ vi.mock('@/lib/uploads/contexts/execution', () => ({ uploadExecutionFile: mocks.uploadExecutionFile, })) +vi.mock('@/lib/core/security/input-validation.server', () => ({ + createSsrfGuardedFetchWithDispatcher: () => ({ + fetch: mocks.guardedFetch, + dispatcher: { close: mocks.closeDispatcher }, + }), +})) vi.mock('@/tools/quickbooks/client', () => ({ QUICKBOOKS_MAX_RESPONSE_BYTES: 8 * 1024 * 1024, buildQuickBooksCompanyUrl: (realmId: string, resource: string) => { @@ -53,12 +61,18 @@ describe('QuickBooks internal operations', () => { beforeEach(() => { vi.clearAllMocks() vi.stubGlobal('fetch', vi.fn()) + mocks.closeDispatcher.mockResolvedValue(undefined) mocks.uploadCopilotFile.mockResolvedValue(COPILOT_FILE) mocks.uploadExecutionFile.mockResolvedValue({ ...COPILOT_FILE, context: 'execution' }) }) - it('downloads attachment bytes directly from the authenticated Intuit endpoint', async () => { + it('resolves Intuit temporary URLs and downloads attachment bytes without forwarding OAuth', async () => { vi.mocked(fetch).mockResolvedValue( + new Response('"https://attachments.example/receipt.png?signature=secret"', { + headers: { 'content-type': 'text/plain' }, + }) + ) + mocks.guardedFetch.mockResolvedValue( new Response(new Uint8Array([1, 2, 3, 4]), { headers: { 'content-disposition': 'attachment; filename="receipt.png"', @@ -88,6 +102,14 @@ describe('QuickBooks internal operations', () => { headers: expect.objectContaining({ Authorization: 'Bearer secret-token' }), }) ) + expect(mocks.guardedFetch).toHaveBeenCalledWith( + 'https://attachments.example/receipt.png?signature=secret', + expect.objectContaining({ + method: 'GET', + headers: { Accept: '*/*' }, + }) + ) + expect(mocks.closeDispatcher).toHaveBeenCalledOnce() expect(mocks.uploadCopilotFile).toHaveBeenCalledWith({ buffer: Buffer.from([1, 2, 3, 4]), fileName: 'receipt.png', @@ -99,6 +121,11 @@ describe('QuickBooks internal operations', () => { it('rejects an oversized attachment from Content-Length before buffering it', async () => { vi.mocked(fetch).mockResolvedValue( + new Response('https://attachments.example/oversized.bin', { + headers: { 'content-type': 'text/plain' }, + }) + ) + mocks.guardedFetch.mockResolvedValue( new Response(new Uint8Array([1]), { headers: { 'content-length': String(QUICKBOOKS_MAX_ATTACHMENT_BYTES + 1) }, }) @@ -115,6 +142,7 @@ describe('QuickBooks internal operations', () => { context() ) ).rejects.toThrow('exceeds maximum size') + expect(mocks.closeDispatcher).toHaveBeenCalledOnce() expect(mocks.uploadCopilotFile).not.toHaveBeenCalled() }) diff --git a/apps/sim/lib/internal/quickbooks/operations.ts b/apps/sim/lib/internal/quickbooks/operations.ts index 8ebd6c65803..5e8dde4b394 100644 --- a/apps/sim/lib/internal/quickbooks/operations.ts +++ b/apps/sim/lib/internal/quickbooks/operations.ts @@ -4,9 +4,11 @@ import type { QuickBooksAddAttachmentBody, QuickBooksDownloadDocumentBody, } from '@/lib/api/contracts/tools/quickbooks' +import { createSsrfGuardedFetchWithDispatcher } from '@/lib/core/security/input-validation.server' import { assertContentLengthWithinLimit, assertKnownSizeWithinLimit, + readResponseTextWithLimit, readResponseToBufferWithLimit, } from '@/lib/core/utils/stream-limits' import { uploadCopilotFile } from '@/lib/uploads/contexts/copilot' @@ -26,6 +28,7 @@ import { QUICKBOOKS_DOCUMENT_METADATA_TIMEOUT_MS, QUICKBOOKS_DOCUMENT_TRANSFER_TIMEOUT_MS, QUICKBOOKS_MAX_ATTACHMENT_BYTES, + QUICKBOOKS_TEMP_URL_MAX_BYTES, quickBooksDocumentSignal, sanitizeQuickBooksFileName, validateQuickBooksAttachmentFileType, @@ -88,26 +91,62 @@ async function downloadQuickBooksAttachment( body.realmId, `download/${encodeURIComponent(body.attachmentId)}` ) - const transferSignal = quickBooksDocumentSignal(signal, QUICKBOOKS_DOCUMENT_TRANSFER_TIMEOUT_MS) - const downloadResponse = await fetch(downloadUrl, { + const metadataSignal = quickBooksDocumentSignal(signal, QUICKBOOKS_DOCUMENT_METADATA_TIMEOUT_MS) + const downloadUrlResponse = await fetch(downloadUrl, { method: 'GET', headers: { ...buildQuickBooksHeaders(body.accessToken), Accept: '*/*' }, - signal: transferSignal, + signal: metadataSignal, }) - if (downloadResponse.status === 404) { + if (downloadUrlResponse.status === 404) { throw new Error('This QuickBooks attachment has no downloadable file') } - if (!downloadResponse.ok) throw await getQuickBooksDocumentError(downloadResponse, signal) - assertContentLengthWithinLimit( - downloadResponse.headers, - QUICKBOOKS_MAX_ATTACHMENT_BYTES, - 'QuickBooks attachment file' - ) - const buffer = await readResponseToBufferWithLimit(downloadResponse, { - maxBytes: QUICKBOOKS_MAX_ATTACHMENT_BYTES, - label: 'QuickBooks attachment file', - signal: transferSignal, + if (!downloadUrlResponse.ok) { + throw await getQuickBooksDocumentError(downloadUrlResponse, metadataSignal) + } + const temporaryUrlText = await readResponseTextWithLimit(downloadUrlResponse, { + maxBytes: QUICKBOOKS_TEMP_URL_MAX_BYTES, + label: 'QuickBooks attachment temporary URL response', + signal: metadataSignal, }) + let temporaryUrl = temporaryUrlText.trim() + if (temporaryUrl.startsWith('"')) { + try { + const parsed = JSON.parse(temporaryUrl) + temporaryUrl = typeof parsed === 'string' ? parsed.trim() : '' + } catch { + throw new Error('QuickBooks returned a malformed attachment download URL') + } + } + if (!temporaryUrl) throw new Error('QuickBooks returned an empty attachment download URL') + + const guarded = createSsrfGuardedFetchWithDispatcher({ + maxResponseSize: QUICKBOOKS_MAX_ATTACHMENT_BYTES, + }) + const transferSignal = quickBooksDocumentSignal(signal, QUICKBOOKS_DOCUMENT_TRANSFER_TIMEOUT_MS) + let downloadResponse: Response + let buffer: Buffer + try { + downloadResponse = await guarded.fetch(temporaryUrl, { + method: 'GET', + headers: { Accept: '*/*' }, + signal: transferSignal, + }) + if (!downloadResponse.ok) { + throw await getQuickBooksDocumentError(downloadResponse, transferSignal) + } + assertContentLengthWithinLimit( + downloadResponse.headers, + QUICKBOOKS_MAX_ATTACHMENT_BYTES, + 'QuickBooks attachment file' + ) + buffer = await readResponseToBufferWithLimit(downloadResponse, { + maxBytes: QUICKBOOKS_MAX_ATTACHMENT_BYTES, + label: 'QuickBooks attachment file', + signal: transferSignal, + }) + } finally { + await guarded.dispatcher.close() + } if (buffer.length === 0) throw new Error('QuickBooks attachment file is empty') const fallbackName = `quickbooks-attachment-${body.attachmentId}` diff --git a/apps/sim/tools/quickbooks/api_accuracy.test.ts b/apps/sim/tools/quickbooks/api_accuracy.test.ts index c1a357b90c1..dd5367894b1 100644 --- a/apps/sim/tools/quickbooks/api_accuracy.test.ts +++ b/apps/sim/tools/quickbooks/api_accuracy.test.ts @@ -2,6 +2,9 @@ * @vitest-environment node */ import { describe, expect, it } from 'vitest' +import { quickBooksAddAttachmentBodySchema } from '@/lib/api/contracts/tools/quickbooks' +import { quickbooksCreateCustomerTool } from '@/tools/quickbooks/create_customer' +import { quickbooksCreateVendorTool } from '@/tools/quickbooks/create_vendor' import { assertQuickBooksAttachmentExtension, getQuickBooksAttachmentTarget, @@ -54,18 +57,96 @@ describe('QuickBooks documented document operations', () => { }) describe('QuickBooks attachment contract', () => { - it('supports customer and vendor profiles and excludes list items', () => { - expect(getQuickBooksAttachmentTarget('customer')).toEqual({ entityType: 'Customer' }) - expect(getQuickBooksAttachmentTarget('vendor')).toEqual({ entityType: 'Vendor' }) - expect(() => getQuickBooksAttachmentTarget('item' as QuickBooksAttachmentTargetType)).toThrow( - 'Unsupported QuickBooks attachment target type' - ) + it.each([ + ['bill', 'Bill'], + ['bill_payment', 'BillPayment'], + ['credit_memo', 'CreditMemo'], + ['deposit', 'Deposit'], + ['estimate', 'Estimate'], + ['invoice', 'Invoice'], + ['item', 'Item'], + ['journal_entry', 'JournalEntry'], + ['payment', 'Payment'], + ['purchase', 'Purchase'], + ['purchase_order', 'PurchaseOrder'], + ['refund_receipt', 'RefundReceipt'], + ['sales_receipt', 'SalesReceipt'], + ['vendor_credit', 'VendorCredit'], + ] as const)('maps the documented %s attachment target', (type, entityType) => { + expect(getQuickBooksAttachmentTarget(type)).toEqual({ entityType }) + }) + + it('rejects unsupported non-transaction targets', () => { + expect(() => + getQuickBooksAttachmentTarget('customer' as QuickBooksAttachmentTargetType) + ).toThrow('Unsupported QuickBooks attachment target type') + }) + + it('enforces Intuit attachment metadata limits', () => { + const base = { + accessToken: 'token', + realmId: '123', + attachmentKind: 'note' as const, + targetType: 'item' as const, + targetId: 'item-1', + } + expect( + quickBooksAddAttachmentBodySchema.safeParse({ ...base, note: 'n'.repeat(2000) }).success + ).toBe(true) + expect( + quickBooksAddAttachmentBodySchema.safeParse({ ...base, note: 'n'.repeat(2001) }).success + ).toBe(false) + + const fileBase = { + ...base, + attachmentKind: 'file' as const, + file: { key: 'uploads/file.txt', name: 'file.txt', size: 4, type: 'text/plain' }, + note: undefined, + } + expect( + quickBooksAddAttachmentBodySchema.safeParse({ + ...fileBase, + fileName: `${'f'.repeat(996)}.txt`, + contentType: 'c'.repeat(100), + description: 'd'.repeat(2000), + }).success + ).toBe(true) + expect( + quickBooksAddAttachmentBodySchema.safeParse({ + ...fileBase, + contentType: 'c'.repeat(101), + }).success + ).toBe(false) + expect( + quickBooksAddAttachmentBodySchema.safeParse({ + ...fileBase, + description: 'd'.repeat(2001), + }).success + ).toBe(false) + }) + + it.each([ + ['design.ai', 'application/postscript', 'application/postscript'], + [ + 'contract.docx', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + ], + [ + 'sheet.ods', + 'application/vnd.oasis.opendocument.spreadsheet', + 'application/vnd.oasis.opendocument.spreadsheet', + ], + ['scan.tiff', 'image/tiff', 'image/tiff'], + ['notes.txt', 'text/plain', 'text/plain'], + ['legacy.xls', 'application/vnd.ms-excel', 'application/vnd.ms-excel'], + ])('accepts the documented %s attachment type', (fileName, mimeType, canonical) => { + expect(validateQuickBooksAttachmentFileType(fileName, mimeType)).toBe(canonical) }) - it('accepts documented TIFF files and rejects undocumented DOCX files', () => { - expect(validateQuickBooksAttachmentFileType('scan.tiff', 'image/tiff')).toBe('image/tiff') - expect(() => assertQuickBooksAttachmentExtension('contract.docx')).toThrow( - 'does not support the docx file type' + it('rejects file extensions outside the documented upload table', () => { + expect(() => assertQuickBooksAttachmentExtension('archive.zip')).toThrow( + 'does not support the zip file type' ) }) }) @@ -87,3 +168,31 @@ describe('QuickBooks sensitive output handling', () => { expect(result?.output.company).not.toHaveProperty('EmployerId') }) }) + +describe('QuickBooks documented create-name alternatives', () => { + it('creates customers and vendors from supported name components without a display name', () => { + expect( + quickbooksCreateCustomerTool.request.body?.({ + accessToken: 'token', + realmId: '123', + givenName: 'Ada', + }) + ).toMatchObject({ GivenName: 'Ada' }) + expect( + quickbooksCreateVendorTool.request.body?.({ + accessToken: 'token', + realmId: '123', + familyName: 'Lovelace', + }) + ).toMatchObject({ FamilyName: 'Lovelace' }) + }) + + it('rejects customer and vendor creates with no supported name field', () => { + expect(() => + quickbooksCreateCustomerTool.request.body?.({ accessToken: 'token', realmId: '123' }) + ).toThrow('At least one of displayName, givenName, or familyName must be supplied') + expect(() => + quickbooksCreateVendorTool.request.body?.({ accessToken: 'token', realmId: '123' }) + ).toThrow('At least one of displayName, givenName, or familyName must be supplied') + }) +}) diff --git a/apps/sim/tools/quickbooks/block.test.ts b/apps/sim/tools/quickbooks/block.test.ts new file mode 100644 index 00000000000..a36d6eacfa1 --- /dev/null +++ b/apps/sim/tools/quickbooks/block.test.ts @@ -0,0 +1,46 @@ +import { describe, expect, it } from 'vitest' +import { QuickBooksBlock } from '@/blocks/blocks/quickbooks' + +function requiredCondition(fieldId: string, values: Record) { + const field = QuickBooksBlock.subBlocks.find((subBlock) => subBlock.id === fieldId) + if (!field || typeof field.required !== 'function') { + throw new Error(`${fieldId} does not define a dynamic required condition`) + } + return field.required(values) +} + +describe('QuickBooks block conditional name requirements', () => { + it('requires one supported customer or vendor name field', () => { + expect(requiredCondition('displayName', { operation: 'quickbooks_create_customer' })).toEqual({ + field: 'operation', + value: 'quickbooks_create_customer', + }) + expect( + requiredCondition('displayName', { + operation: 'quickbooks_create_customer', + givenName: 'Ada', + }) + ).toEqual({ field: 'operation', value: [] }) + expect( + requiredCondition('givenName', { + operation: 'quickbooks_create_vendor', + familyName: 'Lovelace', + }) + ).toEqual({ field: 'operation', value: [] }) + }) + + it('requires an employee given or family name even when displayName is supplied', () => { + expect( + requiredCondition('givenName', { + operation: 'quickbooks_create_employee', + displayName: 'Ada Lovelace', + }) + ).toEqual({ field: 'operation', value: 'quickbooks_create_employee' }) + expect( + requiredCondition('givenName', { + operation: 'quickbooks_create_employee', + familyName: 'Lovelace', + }) + ).toEqual({ field: 'operation', value: [] }) + }) +}) diff --git a/apps/sim/tools/quickbooks/create_customer.ts b/apps/sim/tools/quickbooks/create_customer.ts index dcc874d3c4c..abea65ccac5 100644 --- a/apps/sim/tools/quickbooks/create_customer.ts +++ b/apps/sim/tools/quickbooks/create_customer.ts @@ -21,7 +21,6 @@ import { parseQuickBooksAddress, quickBooksEmailAddress, quickBooksPhoneNumber, - requiredQuickBooksString, } from '@/tools/quickbooks/values' import type { ToolConfig } from '@/tools/types' @@ -48,9 +47,10 @@ export const quickbooksCreateCustomerTool: ToolConfig< }, displayName: { type: 'string', - required: true, + required: false, visibility: 'user-or-llm', - description: 'Unique customer display name', + description: + 'Unique customer display name. Required unless givenName or familyName is supplied', }, companyName: { type: 'string', @@ -121,18 +121,25 @@ export const quickbooksCreateCustomerTool: ToolConfig< ).toString(), method: 'POST', headers: (params) => getQuickBooksToolHeaders(params.accessToken, 'application/json'), - body: (params) => - filterUndefined({ - DisplayName: requiredQuickBooksString(params.displayName, 'displayName'), + body: (params) => { + const displayName = optionalQuickBooksString(params.displayName) + const givenName = optionalQuickBooksString(params.givenName) + const familyName = optionalQuickBooksString(params.familyName) + if (displayName === undefined && givenName === undefined && familyName === undefined) { + throw new Error('At least one of displayName, givenName, or familyName must be supplied') + } + return filterUndefined({ + DisplayName: displayName, CompanyName: optionalQuickBooksString(params.companyName), - GivenName: optionalQuickBooksString(params.givenName), - FamilyName: optionalQuickBooksString(params.familyName), + GivenName: givenName, + FamilyName: familyName, PrimaryEmailAddr: quickBooksEmailAddress(params.primaryEmail), PrimaryPhone: quickBooksPhoneNumber(params.primaryPhone), BillAddr: parseQuickBooksAddress(params.billingAddress, 'billingAddress'), ShipAddr: parseQuickBooksAddress(params.shippingAddress, 'shippingAddress'), Taxable: params.taxable, - }), + }) + }, retry: { enabled: false }, }, transformResponse: (response) => diff --git a/apps/sim/tools/quickbooks/create_vendor.ts b/apps/sim/tools/quickbooks/create_vendor.ts index 5d5668cc0a9..6fd6cdc2837 100644 --- a/apps/sim/tools/quickbooks/create_vendor.ts +++ b/apps/sim/tools/quickbooks/create_vendor.ts @@ -18,7 +18,6 @@ import { parseQuickBooksAddress, quickBooksEmailAddress, quickBooksPhoneNumber, - requiredQuickBooksString, } from '@/tools/quickbooks/values' import type { ToolConfig } from '@/tools/types' @@ -45,9 +44,10 @@ export const quickbooksCreateVendorTool: ToolConfig< }, displayName: { type: 'string', - required: true, + required: false, visibility: 'user-or-llm', - description: 'Unique vendor display name', + description: + 'Unique vendor display name. Required unless givenName or familyName is supplied', }, companyName: { type: 'string', @@ -124,19 +124,26 @@ export const quickbooksCreateVendorTool: ToolConfig< ).toString(), method: 'POST', headers: (params) => getQuickBooksToolHeaders(params.accessToken, 'application/json'), - body: (params) => - filterUndefined({ - DisplayName: requiredQuickBooksString(params.displayName, 'displayName'), + body: (params) => { + const displayName = optionalQuickBooksString(params.displayName) + const givenName = optionalQuickBooksString(params.givenName) + const familyName = optionalQuickBooksString(params.familyName) + if (displayName === undefined && givenName === undefined && familyName === undefined) { + throw new Error('At least one of displayName, givenName, or familyName must be supplied') + } + return filterUndefined({ + DisplayName: displayName, CompanyName: optionalQuickBooksString(params.companyName), - GivenName: optionalQuickBooksString(params.givenName), - FamilyName: optionalQuickBooksString(params.familyName), + GivenName: givenName, + FamilyName: familyName, PrimaryEmailAddr: quickBooksEmailAddress(params.primaryEmail), PrimaryPhone: quickBooksPhoneNumber(params.primaryPhone), BillAddr: parseQuickBooksAddress(params.billingAddress, 'billingAddress'), PrintOnCheckName: optionalQuickBooksString(params.printOnCheckName), AcctNum: optionalQuickBooksString(params.accountNumber), Vendor1099: params.vendor1099, - }), + }) + }, retry: { enabled: false }, }, transformResponse: (response) => diff --git a/apps/sim/tools/quickbooks/documents_utils.ts b/apps/sim/tools/quickbooks/documents_utils.ts index 7c9d2616a5a..a9e37942a62 100644 --- a/apps/sim/tools/quickbooks/documents_utils.ts +++ b/apps/sim/tools/quickbooks/documents_utils.ts @@ -22,22 +22,25 @@ export const QUICKBOOKS_DOCUMENT_TRANSACTIONS = { export const QUICKBOOKS_ATTACHMENT_TARGETS = { bill: { entityType: 'Bill' }, + bill_payment: { entityType: 'BillPayment' }, credit_memo: { entityType: 'CreditMemo' }, - customer: { entityType: 'Customer' }, + deposit: { entityType: 'Deposit' }, estimate: { entityType: 'Estimate' }, invoice: { entityType: 'Invoice' }, + item: { entityType: 'Item' }, + journal_entry: { entityType: 'JournalEntry' }, payment: { entityType: 'Payment' }, purchase: { entityType: 'Purchase' }, + purchase_order: { entityType: 'PurchaseOrder' }, refund_receipt: { entityType: 'RefundReceipt' }, sales_receipt: { entityType: 'SalesReceipt' }, - vendor: { entityType: 'Vendor' }, vendor_credit: { entityType: 'VendorCredit' }, } as const satisfies Record /** - * Sim caps a single QuickBooks attachment at the 20 MB limit Intuit documents - * for files entering QuickBooks document workflows. - * @see https://quickbooks.intuit.com/learn-support/en-us/help-article/accounts-payable/email-receipts-bills-quickbooks-online/L7r2LAQ7C_US_en_US + * Sim intentionally caps each attachment at 20 MB to bound memory use. This is + * below Intuit's documented 100 MB overall multipart request ceiling. + * @see https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/attachable */ export const QUICKBOOKS_MAX_ATTACHMENT_BYTES = 20 * 1024 * 1024 @@ -65,12 +68,15 @@ interface QuickBooksFileType { } /** - * Extension allowlist for QuickBooks attachments. Intuit publishes accepted - * extensions but not MIME types, so each entry tolerates the common aliases a - * browser or operating system may report and normalizes them to one canonical - * content type before upload. + * Extension allowlist for QuickBooks attachments. Each entry follows Intuit's + * published extension/content-type table, tolerates common browser and OS MIME + * aliases, and normalizes them to one canonical content type before upload. */ const QUICKBOOKS_FILE_TYPES: Record = { + ai: { + canonical: 'application/postscript', + accepted: ['application/postscript', QUICKBOOKS_OCTET_STREAM], + }, csv: { canonical: 'text/csv', accepted: [ @@ -85,14 +91,33 @@ const QUICKBOOKS_FILE_TYPES: Record = { canonical: 'application/msword', accepted: ['application/msword', 'application/vnd.ms-word', QUICKBOOKS_OCTET_STREAM], }, + docx: { + canonical: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + accepted: [ + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + QUICKBOOKS_OCTET_STREAM, + ], + }, + eps: { + canonical: 'application/postscript', + accepted: ['application/postscript', QUICKBOOKS_OCTET_STREAM], + }, gif: { canonical: 'image/gif', accepted: ['image/gif'] }, jpeg: { canonical: 'image/jpeg', accepted: ['image/jpeg', 'image/jpg', 'image/pjpeg'] }, jpg: { canonical: 'image/jpeg', accepted: ['image/jpeg', 'image/jpg', 'image/pjpeg'] }, + ods: { + canonical: 'application/vnd.oasis.opendocument.spreadsheet', + accepted: ['application/vnd.oasis.opendocument.spreadsheet', QUICKBOOKS_OCTET_STREAM], + }, pdf: { canonical: 'application/pdf', accepted: ['application/pdf', 'application/x-pdf', QUICKBOOKS_OCTET_STREAM], }, png: { canonical: 'image/png', accepted: ['image/png', 'image/x-png'] }, + rtf: { + canonical: 'text/rtf', + accepted: ['text/rtf', 'application/rtf', QUICKBOOKS_OCTET_STREAM], + }, tif: { canonical: 'image/tiff', accepted: ['image/tiff', 'image/tif', 'image/x-tiff', QUICKBOOKS_OCTET_STREAM], @@ -101,6 +126,14 @@ const QUICKBOOKS_FILE_TYPES: Record = { canonical: 'image/tiff', accepted: ['image/tiff', 'image/tif', 'image/x-tiff', QUICKBOOKS_OCTET_STREAM], }, + txt: { + canonical: 'text/plain', + accepted: ['text/plain', QUICKBOOKS_OCTET_STREAM], + }, + xls: { + canonical: 'application/vnd.ms-excel', + accepted: ['application/vnd.ms-excel', 'application/vnd/ms-excel', QUICKBOOKS_OCTET_STREAM], + }, xlsx: { canonical: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', accepted: [ @@ -137,7 +170,7 @@ export function validateQuickBooksRecipient(recipient?: string): string | undefi return normalized } -const QUICKBOOKS_MAX_FILE_NAME_LENGTH = 180 +const QUICKBOOKS_MAX_FILE_NAME_LENGTH = 1000 /** * Bounds a filename without destroying its extension. Truncating the whole diff --git a/apps/sim/tools/quickbooks/purchasing_utils.test.ts b/apps/sim/tools/quickbooks/purchasing_utils.test.ts index a6f61abe84d..2d1715cc4f0 100644 --- a/apps/sim/tools/quickbooks/purchasing_utils.test.ts +++ b/apps/sim/tools/quickbooks/purchasing_utils.test.ts @@ -2,7 +2,10 @@ import { describe, expect, it } from 'vitest' import { buildQuickBooksCreateBillBody, buildQuickBooksCreateBillPaymentBody, + buildQuickBooksUpdateBillBody, + buildQuickBooksUpdateBillPaymentBody, buildQuickBooksUpdatePurchaseBody, + buildQuickBooksUpdateVendorCreditBody, verifyQuickBooksBillLinks, } from '@/tools/quickbooks/purchasing_utils' import type { QuickBooksCreateBillParams } from '@/tools/quickbooks/types' @@ -173,3 +176,50 @@ describe('QuickBooks Purchase full-update patch', () => { }) }) }) + +describe('QuickBooks payable full-update patches', () => { + it('preserves the current vendor when no replacement vendor is supplied', () => { + expect( + buildQuickBooksUpdateBillBody({ + accessToken: 'token', + realmId: '123', + billId: 'bill-1', + syncToken: '2', + privateNote: 'Updated bill', + }) + ).toEqual({ + Id: 'bill-1', + SyncToken: '2', + sparse: true, + PrivateNote: 'Updated bill', + }) + expect( + buildQuickBooksUpdateBillPaymentBody({ + accessToken: 'token', + realmId: '123', + billPaymentId: 'payment-1', + syncToken: '2', + privateNote: 'Updated payment', + }) + ).toEqual({ + Id: 'payment-1', + SyncToken: '2', + sparse: true, + PrivateNote: 'Updated payment', + }) + expect( + buildQuickBooksUpdateVendorCreditBody({ + accessToken: 'token', + realmId: '123', + vendorCreditId: 'credit-1', + syncToken: '2', + privateNote: 'Updated credit', + }) + ).toEqual({ + Id: 'credit-1', + SyncToken: '2', + sparse: true, + PrivateNote: 'Updated credit', + }) + }) +}) diff --git a/apps/sim/tools/quickbooks/purchasing_utils.ts b/apps/sim/tools/quickbooks/purchasing_utils.ts index 5ca1db67240..139d045d127 100644 --- a/apps/sim/tools/quickbooks/purchasing_utils.ts +++ b/apps/sim/tools/quickbooks/purchasing_utils.ts @@ -489,9 +489,8 @@ export function buildQuickBooksUpdateBillBody( SyncToken: requiredQuickBooksString(params.syncToken, 'syncToken'), sparse: true, ...purchasingHeader(params), - VendorRef: quickBooksReference(params.vendorId, 'vendorId'), } - assertQuickBooksSparseUpdate(body, 4) + assertQuickBooksSparseUpdate(body) return body } @@ -533,11 +532,11 @@ export function buildQuickBooksUpdateBillPaymentBody( Id: requiredQuickBooksString(params.billPaymentId, 'billPaymentId'), SyncToken: requiredQuickBooksString(params.syncToken, 'syncToken'), sparse: true, - VendorRef: quickBooksReference(params.vendorId, 'vendorId'), + VendorRef: params.vendorId ? quickBooksReference(params.vendorId, 'vendorId') : undefined, TxnDate: validateQuickBooksDate(params.transactionDate, 'transactionDate'), PrivateNote: optionalQuickBooksString(params.privateNote), }) as Record - assertQuickBooksSparseUpdate(body, 4) + assertQuickBooksSparseUpdate(body) return body } @@ -559,9 +558,8 @@ export function buildQuickBooksUpdateVendorCreditBody( SyncToken: requiredQuickBooksString(params.syncToken, 'syncToken'), sparse: true, ...purchasingHeader(params), - VendorRef: quickBooksReference(params.vendorId, 'vendorId'), } - assertQuickBooksSparseUpdate(body, 4) + assertQuickBooksSparseUpdate(body) return body } diff --git a/apps/sim/tools/quickbooks/sales_utils.test.ts b/apps/sim/tools/quickbooks/sales_utils.test.ts index cde11da22fb..1fe20725405 100644 --- a/apps/sim/tools/quickbooks/sales_utils.test.ts +++ b/apps/sim/tools/quickbooks/sales_utils.test.ts @@ -1,4 +1,9 @@ import { afterEach, describe, expect, it, vi } from 'vitest' + +vi.mock('@/lib/core/config/env', () => ({ + env: { QUICKBOOKS_ENV: 'production' }, +})) + import { buildQuickBooksCreatePaymentBody, buildQuickBooksUpdatePaymentBody, @@ -137,4 +142,59 @@ describe('QuickBooks customer payment allocations', () => { ).rejects.toThrow('invoiceAllocations lists invoice invoice-1 more than once') expect(fetchMock).not.toHaveBeenCalled() }) + + it('reads and preserves the complete Payment for every documented full update', async () => { + const fetchMock = vi + .fn() + .mockResolvedValueOnce( + Response.json({ + Payment: { + Id: 'payment-1', + SyncToken: '2', + CustomerRef: { value: 'customer-1' }, + TotalAmt: 25, + Line: [ + { + Amount: 25, + LinkedTxn: [{ TxnId: 'invoice-1', TxnType: 'Invoice' }], + }, + ], + PrivateNote: 'Old note', + MetaData: { CreateTime: '2026-08-01T00:00:00Z' }, + domain: 'QBO', + sparse: false, + }, + }) + ) + .mockResolvedValueOnce( + Response.json({ Payment: { Id: 'payment-1', SyncToken: '3', TotalAmt: 25 } }) + ) + vi.stubGlobal('fetch', fetchMock) + + await quickbooksUpdateCustomerPaymentTool.directExecution?.( + { + accessToken: 'token', + realmId: '123', + paymentId: 'payment-1', + syncToken: '2', + privateNote: 'New note', + }, + undefined + ) + + expect(fetchMock).toHaveBeenCalledTimes(2) + expect(JSON.parse(String(fetchMock.mock.calls[1]?.[1]?.body))).toEqual({ + Id: 'payment-1', + SyncToken: '2', + CustomerRef: { value: 'customer-1' }, + TotalAmt: 25, + Line: [ + { + Amount: 25, + LinkedTxn: [{ TxnId: 'invoice-1', TxnType: 'Invoice' }], + }, + ], + PrivateNote: 'New note', + }) + }) }) diff --git a/apps/sim/tools/quickbooks/sales_utils.ts b/apps/sim/tools/quickbooks/sales_utils.ts index 7bcc08e09a7..8b847e64820 100644 --- a/apps/sim/tools/quickbooks/sales_utils.ts +++ b/apps/sim/tools/quickbooks/sales_utils.ts @@ -432,7 +432,7 @@ function buildUpdatePaymentLines( } /** - * Build the sparse Payment update body. + * Build the Payment patch merged into the documented full-update request. * * `currentPayment` is the payment as QuickBooks currently holds it and is * required whenever invoice allocations are supplied: QuickBooks updates diff --git a/apps/sim/tools/quickbooks/types.ts b/apps/sim/tools/quickbooks/types.ts index 27c828d36cb..c92c479203c 100644 --- a/apps/sim/tools/quickbooks/types.ts +++ b/apps/sim/tools/quickbooks/types.ts @@ -496,15 +496,18 @@ export type QuickBooksDocumentTransactionType = export type QuickBooksAttachmentTargetType = | 'bill' + | 'bill_payment' | 'credit_memo' - | 'customer' + | 'deposit' | 'estimate' | 'invoice' + | 'item' + | 'journal_entry' | 'payment' | 'purchase' + | 'purchase_order' | 'refund_receipt' | 'sales_receipt' - | 'vendor' | 'vendor_credit' export type QuickBooksAttachmentReadMode = 'list' | 'by_id' @@ -761,7 +764,7 @@ export interface QuickBooksCreateBillParams extends QuickBooksAuthParams { export interface QuickBooksUpdateBillParams extends QuickBooksAuthParams { billId: string syncToken: string - vendorId: string + vendorId?: string apAccountId?: string transactionDate?: string dueDate?: string @@ -785,7 +788,7 @@ export interface QuickBooksCreateBillPaymentParams extends QuickBooksAuthParams export interface QuickBooksUpdateBillPaymentParams extends QuickBooksAuthParams { billPaymentId: string syncToken: string - vendorId: string + vendorId?: string transactionDate?: string privateNote?: string } @@ -803,7 +806,7 @@ export interface QuickBooksCreateVendorCreditParams extends QuickBooksAuthParams export interface QuickBooksUpdateVendorCreditParams extends QuickBooksAuthParams { vendorCreditId: string syncToken: string - vendorId: string + vendorId?: string apAccountId?: string transactionDate?: string documentNumber?: string @@ -943,7 +946,7 @@ export type QuickBooksActiveStatus = 'unchanged' | 'active' | 'inactive' export type QuickBooksReadActiveStatus = 'default' | 'active' | 'inactive' export interface QuickBooksCreateCustomerParams extends QuickBooksAuthParams { - displayName: string + displayName?: string requestId?: string companyName?: string givenName?: string @@ -984,7 +987,7 @@ export interface QuickBooksUpdateEmployeeParams } export interface QuickBooksCreateVendorParams extends QuickBooksAuthParams { - displayName: string + displayName?: string requestId?: string companyName?: string givenName?: string diff --git a/apps/sim/tools/quickbooks/update_bill.ts b/apps/sim/tools/quickbooks/update_bill.ts index f88450519ac..8f4820300ab 100644 --- a/apps/sim/tools/quickbooks/update_bill.ts +++ b/apps/sim/tools/quickbooks/update_bill.ts @@ -52,9 +52,9 @@ export const quickbooksUpdateBillTool: ToolConfig< }, vendorId: { type: 'string', - required: true, + required: false, visibility: 'user-or-llm', - description: 'Current or replacement vendor ID required by QuickBooks', + description: 'Replacement vendor ID; omit to preserve the current vendor', }, apAccountId: { type: 'string', diff --git a/apps/sim/tools/quickbooks/update_bill_payment.ts b/apps/sim/tools/quickbooks/update_bill_payment.ts index 9fd18fc75e4..6f88595560e 100644 --- a/apps/sim/tools/quickbooks/update_bill_payment.ts +++ b/apps/sim/tools/quickbooks/update_bill_payment.ts @@ -52,9 +52,9 @@ export const quickbooksUpdateBillPaymentTool: ToolConfig< }, vendorId: { type: 'string', - required: true, + required: false, visibility: 'user-or-llm', - description: 'Current vendor ID required by QuickBooks', + description: 'Replacement vendor ID; omit to preserve the current vendor', }, transactionDate: { type: 'string', diff --git a/apps/sim/tools/quickbooks/update_customer_payment.ts b/apps/sim/tools/quickbooks/update_customer_payment.ts index 2ed7e153379..c91633870c8 100644 --- a/apps/sim/tools/quickbooks/update_customer_payment.ts +++ b/apps/sim/tools/quickbooks/update_customer_payment.ts @@ -14,6 +14,7 @@ import { } from '@/tools/quickbooks/types' import { buildQuickBooksEntityUrl, + buildQuickBooksFullUpdateBody, getQuickBooksDirectExecutionError, getQuickBooksToolHeaders, transformQuickBooksEntityResponse, @@ -27,7 +28,7 @@ export const quickbooksUpdateCustomerPaymentTool: ToolConfig< > = { id: 'quickbooks_update_customer_payment', name: 'QuickBooks Update Customer Payment', - description: 'Sparse-update a customer payment using its current sync token', + description: 'Read, merge, and full-update a customer payment using its current sync token', version: '1.0.0', params: { accessToken: { @@ -125,9 +126,9 @@ export const quickbooksUpdateCustomerPaymentTool: ToolConfig< retry: { enabled: false }, }, /** - * QuickBooks updates Payment lines all-or-none: an update that omits a line - * unapplies that invoice. Read the payment first so supplied allocations can - * be merged into the live line set instead of silently replacing it. + * QuickBooks only documents full Payment updates and treats Payment lines as + * all-or-none. Read the complete payment first, preserve its writable fields, + * and merge supplied allocations unless the caller explicitly replaces them. */ directExecution: async (params, signal) => { const paymentId = params.paymentId?.trim() @@ -137,33 +138,50 @@ export const quickbooksUpdateCustomerPaymentTool: ToolConfig< // duplicate invoice references never contact QuickBooks. parseQuickBooksInvoiceAllocations(params.invoiceAllocations) - let currentPayment: QuickBooksSalesTransaction | undefined - if (params.invoiceAllocations && !params.unapplyOmittedInvoices) { - const readResponse = await fetch( - buildQuickBooksEntityUrl(params.realmId, 'payment', paymentId), - { method: 'GET', headers: getQuickBooksToolHeaders(params.accessToken), signal } - ) - if (!readResponse.ok) - throw await getQuickBooksDirectExecutionError(readResponse, 'Payment', signal) - const { item } = await transformQuickBooksEntityResponse( + const syncToken = params.syncToken?.trim() + if (!syncToken) throw new Error('syncToken is required') + const readResponse = await fetch( + buildQuickBooksEntityUrl(params.realmId, 'payment', paymentId), + { + method: 'GET', + headers: getQuickBooksToolHeaders(params.accessToken), + signal, + } + ) + if (!readResponse.ok) { + throw await getQuickBooksDirectExecutionError(readResponse, 'Payment', signal) + } + const { item: currentPayment } = + await transformQuickBooksEntityResponse( readResponse, 'Payment', signal ) - const currentSyncToken = typeof item.SyncToken === 'string' ? item.SyncToken.trim() : '' - if (currentSyncToken !== params.syncToken?.trim()) { - throw new Error( - `QuickBooks payment ${paymentId} changed since sync token ${params.syncToken} was read (current sync token ${currentSyncToken}). Re-read the payment and retry.` - ) - } - currentPayment = item - signal?.throwIfAborted() + const currentId = typeof currentPayment.Id === 'string' ? currentPayment.Id.trim() : '' + const currentSyncToken = + typeof currentPayment.SyncToken === 'string' ? currentPayment.SyncToken.trim() : '' + if (currentId !== paymentId) { + throw new Error('QuickBooks Payment read returned an unexpected record ID') } + if (currentSyncToken !== syncToken) { + throw new Error( + `QuickBooks payment ${paymentId} changed since sync token ${syncToken} was read (current sync token ${currentSyncToken}). Re-read the payment and retry.` + ) + } + signal?.throwIfAborted() + + const patch = buildQuickBooksUpdatePaymentBody(params, currentPayment) + const fullBody = buildQuickBooksFullUpdateBody( + currentPayment as QuickBooksSalesTransaction & Record, + patch, + paymentId, + syncToken + ) const updateResponse = await fetch(buildQuickBooksEntityUrl(params.realmId, 'payment'), { method: 'POST', headers: getQuickBooksToolHeaders(params.accessToken, 'application/json'), - body: JSON.stringify(buildQuickBooksUpdatePaymentBody(params, currentPayment)), + body: JSON.stringify(fullBody), signal, }) if (!updateResponse.ok) diff --git a/apps/sim/tools/quickbooks/update_vendor_credit.ts b/apps/sim/tools/quickbooks/update_vendor_credit.ts index 978e5eb9964..37dabd122d3 100644 --- a/apps/sim/tools/quickbooks/update_vendor_credit.ts +++ b/apps/sim/tools/quickbooks/update_vendor_credit.ts @@ -52,9 +52,9 @@ export const quickbooksUpdateVendorCreditTool: ToolConfig< }, vendorId: { type: 'string', - required: true, + required: false, visibility: 'user-or-llm', - description: 'Current or replacement vendor ID required by QuickBooks', + description: 'Replacement vendor ID; omit to preserve the current vendor', }, apAccountId: { type: 'string', diff --git a/apps/sim/tools/quickbooks/utils.ts b/apps/sim/tools/quickbooks/utils.ts index 9677890fc97..0393017f04e 100644 --- a/apps/sim/tools/quickbooks/utils.ts +++ b/apps/sim/tools/quickbooks/utils.ts @@ -431,6 +431,31 @@ interface QuickBooksFullUpdateOptions< sanitize?: (record: T) => T } +export function buildQuickBooksFullUpdateBody( + current: Record, + patch: Record, + recordId: string, + syncToken: string +): Record { + const currentFields = omit(current, [ + 'HeaderFull', + 'HeaderLite', + 'MetaData', + 'NameAndId', + 'Overview', + 'domain', + 'sparse', + 'status', + ]) + const patchFields = omit(patch, ['sparse']) + return { + ...currentFields, + ...patchFields, + Id: recordId, + SyncToken: syncToken, + } +} + /** * Implements Intuit's documented full-update sequence: read the complete live * entity, reject stale caller state, apply only the requested patch, and post @@ -472,23 +497,7 @@ export async function executeQuickBooksFullUpdate< } options.signal?.throwIfAborted() - const currentFields = omit(current, [ - 'HeaderFull', - 'HeaderLite', - 'MetaData', - 'NameAndId', - 'Overview', - 'domain', - 'sparse', - 'status', - ]) - const patchFields = omit(patch, ['sparse']) - const fullBody = { - ...currentFields, - ...patchFields, - Id: recordId, - SyncToken: syncToken, - } + const fullBody = buildQuickBooksFullUpdateBody(current, patch, recordId, syncToken) const updateResponse = await fetch( buildQuickBooksEntityUrl(options.params.realmId, options.resource), { diff --git a/packages/deployment-config/src/integrations.json b/packages/deployment-config/src/integrations.json index 5862a76367f..07a3ef06400 100644 --- a/packages/deployment-config/src/integrations.json +++ b/packages/deployment-config/src/integrations.json @@ -17614,7 +17614,7 @@ }, { "name": "Update Customer Payment", - "description": "Sparse-update a customer payment using its current sync token" + "description": "Read, merge, and full-update a customer payment using its current sync token" }, { "name": "Void Customer Payment", From bb1634d9b75d8b71956ca1380376df501bd0707e Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Thu, 27 Aug 2026 21:01:22 -0700 Subject: [PATCH 3/6] chore(docs): sync QuickBooks manifest --- apps/sim/lib/copilot/generated/docs-manifest.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/sim/lib/copilot/generated/docs-manifest.ts b/apps/sim/lib/copilot/generated/docs-manifest.ts index ebb373f85dd..721f411268f 100644 --- a/apps/sim/lib/copilot/generated/docs-manifest.ts +++ b/apps/sim/lib/copilot/generated/docs-manifest.ts @@ -260,6 +260,7 @@ export const DOCS_MANIFEST: readonly string[] = [ 'integrations/pulse.mdx', 'integrations/qdrant.mdx', 'integrations/quartr.mdx', + 'integrations/quickbooks.mdx', 'integrations/quiver.mdx', 'integrations/rabbitmq.mdx', 'integrations/railway.mdx', From 551532b61748332cfd3473065dfe16720ce15df2 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Thu, 27 Aug 2026 21:50:04 -0700 Subject: [PATCH 4/6] fix(integrations): isolate QuickBooks record versions --- .../docs/en/integrations/quickbooks.mdx | 112 ++++++++++++------ apps/sim/blocks/blocks/quickbooks.ts | 43 ++++--- apps/sim/lib/core/security/redaction.test.ts | 41 ------- apps/sim/lib/core/security/redaction.ts | 2 +- .../sim/tools/quickbooks/api_accuracy.test.ts | 62 ++++++++++ apps/sim/tools/quickbooks/full_update.test.ts | 6 +- .../read_accounting_transactions.ts | 13 +- apps/sim/tools/quickbooks/read_master_data.ts | 7 ++ .../read_purchasing_transactions.ts | 13 +- .../quickbooks/read_sales_transactions.ts | 13 +- apps/sim/tools/quickbooks/types.ts | 12 +- apps/sim/tools/quickbooks/utils.ts | 9 +- 12 files changed, 234 insertions(+), 99 deletions(-) diff --git a/apps/docs/content/docs/en/integrations/quickbooks.mdx b/apps/docs/content/docs/en/integrations/quickbooks.mdx index c8c0ee56362..0d6cbe9480b 100644 --- a/apps/docs/content/docs/en/integrations/quickbooks.mdx +++ b/apps/docs/content/docs/en/integrations/quickbooks.mdx @@ -201,6 +201,7 @@ List or read one account, class, customer, department, employee, item, or vendor | ↳ `sparse` | boolean | Whether this is a sparse entity | | ↳ `SubClass` | boolean | Whether the Class is nested under another Class | | ↳ `SubDepartment` | boolean | Whether the Department is nested under another Department | +| `recordVersion` | string | Display-safe alias for the native SyncToken on a by-ID record | | `startPosition` | number | One-based position of the first record in this page | | `maxResults` | number | Actual number of records returned in this page | | `nextStartPosition` | number | Position to use when explicitly requesting the next page | @@ -231,7 +232,8 @@ Create a customer in the connected QuickBooks Online company | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Created QuickBooks Customer record | | ↳ `Id` | string | QuickBooks entity ID | @@ -280,7 +282,8 @@ Sparse-update a customer in the connected QuickBooks Online company | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Updated QuickBooks Customer record | | ↳ `Id` | string | QuickBooks entity ID | @@ -326,7 +329,8 @@ Create a non-payroll employee profile in the connected QuickBooks Online company | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Created QuickBooks Employee record | | ↳ `Id` | string | QuickBooks entity ID | @@ -371,7 +375,8 @@ Read, merge, and full-update a non-payroll employee profile | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Updated QuickBooks Employee record | | ↳ `Id` | string | QuickBooks entity ID | @@ -416,7 +421,8 @@ Create a vendor in the connected QuickBooks Online company | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Created QuickBooks Vendor record | | ↳ `Id` | string | QuickBooks entity ID | @@ -467,7 +473,8 @@ Read, merge, and full-update a vendor in QuickBooks Online | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Updated QuickBooks Vendor record | | ↳ `Id` | string | QuickBooks entity ID | @@ -515,7 +522,8 @@ Create a Service or Non-inventory item in QuickBooks Online | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Created QuickBooks Item record | | ↳ `Id` | string | QuickBooks entity ID | @@ -573,7 +581,8 @@ Read, merge, and full-update an item without changing its type | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Updated QuickBooks Item record | | ↳ `Id` | string | QuickBooks entity ID | @@ -692,6 +701,7 @@ List or read one estimate, invoice, sales receipt, payment, credit memo, or refu | ↳ `MetaData` | json | Transaction creation and update timestamps | | ↳ `CreateTime` | string | Entity creation timestamp | | ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | +| `recordVersion` | string | Display-safe alias for the native SyncToken on a by-ID transaction | | `startPosition` | number | One-based position of the first item in this response | | `maxResults` | number | Actual number of items reported for this response | | `nextStartPosition` | number | Position to use when explicitly requesting the next page | @@ -720,7 +730,8 @@ Create an estimate with bounded item and description lines | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Created native QuickBooks Estimate | | ↳ `Id` | string | QuickBooks sales transaction ID | @@ -778,7 +789,8 @@ Sparse-update an estimate using its current sync token | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Updated native QuickBooks Estimate | | ↳ `Id` | string | QuickBooks sales transaction ID | @@ -835,7 +847,8 @@ Create an invoice without emailing or collecting payment | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Created native QuickBooks Invoice | | ↳ `Id` | string | QuickBooks sales transaction ID | @@ -893,7 +906,8 @@ Sparse-update an invoice using its current sync token | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Updated native QuickBooks Invoice | | ↳ `Id` | string | QuickBooks sales transaction ID | @@ -945,7 +959,8 @@ Void an invoice after explicit confirmation | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `voided` | boolean | Whether QuickBooks voided the transaction | | `record` | json | Voided native QuickBooks Invoice | @@ -1005,7 +1020,8 @@ Create a sales receipt for a completed customer sale | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Created native QuickBooks SalesReceipt | | ↳ `Id` | string | QuickBooks sales transaction ID | @@ -1065,7 +1081,8 @@ Sparse-update a sales receipt using its current sync token | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Updated native QuickBooks SalesReceipt | | ↳ `Id` | string | QuickBooks sales transaction ID | @@ -1123,7 +1140,8 @@ Record a customer payment with optional bounded invoice allocations | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Created native QuickBooks Payment | | ↳ `Id` | string | QuickBooks sales transaction ID | @@ -1183,7 +1201,8 @@ Read, merge, and full-update a customer payment using its current sync token | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Updated native QuickBooks Payment | | ↳ `Id` | string | QuickBooks sales transaction ID | @@ -1235,7 +1254,8 @@ Void a customer payment after explicit confirmation | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `voided` | boolean | Whether QuickBooks voided the transaction | | `record` | json | Voided native QuickBooks Payment | @@ -1292,7 +1312,8 @@ Create a customer credit memo with bounded sales lines | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Created native QuickBooks CreditMemo | | ↳ `Id` | string | QuickBooks sales transaction ID | @@ -1349,7 +1370,8 @@ Read, merge, and full-update a credit memo using its current sync token | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Updated native QuickBooks CreditMemo | | ↳ `Id` | string | QuickBooks sales transaction ID | @@ -1408,7 +1430,8 @@ Create a customer refund receipt against a required deposit account | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Created native QuickBooks RefundReceipt | | ↳ `Id` | string | QuickBooks sales transaction ID | @@ -1468,7 +1491,8 @@ Sparse-update a refund receipt using its current sync token | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Updated native QuickBooks RefundReceipt | | ↳ `Id` | string | QuickBooks sales transaction ID | @@ -1623,6 +1647,7 @@ List or read one purchase order, bill, bill payment, vendor credit, or purchase | ↳ `MetaData` | json | Transaction creation and update timestamps | | ↳ `CreateTime` | string | Entity creation timestamp | | ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | +| `recordVersion` | string | Display-safe alias for the native SyncToken on a by-ID transaction | | `startPosition` | number | One-based position of the first item in this response | | `maxResults` | number | Actual number of items reported for this response | | `nextStartPosition` | number | Position to use when explicitly requesting the next page | @@ -1650,7 +1675,8 @@ Create a purchase order with bounded expense lines | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Created native QuickBooks PurchaseOrder | | ↳ `Id` | string | QuickBooks purchasing transaction ID | @@ -1723,7 +1749,8 @@ Read, merge, and full-update purchase-order header fields | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Updated native QuickBooks PurchaseOrder | | ↳ `Id` | string | QuickBooks purchasing transaction ID | @@ -1797,7 +1824,8 @@ Create a vendor bill with optional Purchase Order line links without paying it | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `linkingRequested` | boolean | Whether any Purchase Order line links were requested | | `linkingSucceeded` | boolean | Whether QuickBooks returned every requested Purchase Order line link | @@ -1881,7 +1909,8 @@ Read, merge, and full-update bill header fields using its current sync token | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Updated native QuickBooks Bill | | ↳ `Id` | string | QuickBooks purchasing transaction ID | @@ -1955,7 +1984,8 @@ Record a check or credit-card payment allocated to one or more bills | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Created native QuickBooks BillPayment | | ↳ `Id` | string | QuickBooks purchasing transaction ID | @@ -2026,7 +2056,8 @@ Read, merge, and full-update a BillPayment without changing allocations | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Updated native QuickBooks BillPayment | | ↳ `Id` | string | QuickBooks purchasing transaction ID | @@ -2099,7 +2130,8 @@ Create a vendor credit without applying it to a bill | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Created native QuickBooks VendorCredit | | ↳ `Id` | string | QuickBooks purchasing transaction ID | @@ -2172,7 +2204,8 @@ Read, merge, and full-update vendor-credit header fields | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Updated native QuickBooks VendorCredit | | ↳ `Id` | string | QuickBooks purchasing transaction ID | @@ -2246,7 +2279,8 @@ Record a cash, check, or credit-card purchase with bounded expense lines | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Created native QuickBooks Purchase | | ↳ `Id` | string | QuickBooks purchasing transaction ID | @@ -2318,7 +2352,8 @@ Read, merge, and full-update purchase header fields without changing lines | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Updated native QuickBooks Purchase | | ↳ `Id` | string | QuickBooks purchasing transaction ID | @@ -2435,6 +2470,7 @@ List or read one journal entry, deposit, or transfer | ↳ `MetaData` | json | Transaction creation and update timestamps | | ↳ `CreateTime` | string | Entity creation timestamp | | ↳ `LastUpdatedTime` | string | Entity last-updated timestamp | +| `recordVersion` | string | Display-safe alias for the native SyncToken on a by-ID transaction | | `startPosition` | number | One-based position of the first item in this response | | `maxResults` | number | Actual number of items reported for this response | | `nextStartPosition` | number | Position to use when explicitly requesting the next page | @@ -2461,7 +2497,8 @@ Post a balanced journal entry after explicit confirmation | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Created native QuickBooks JournalEntry | | ↳ `Id` | string | QuickBooks accounting transaction ID | @@ -2506,7 +2543,8 @@ Sparse-update journal-entry header fields after explicit confirmation | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Updated native QuickBooks JournalEntry | | ↳ `Id` | string | QuickBooks accounting transaction ID | @@ -2550,7 +2588,8 @@ Create a deposit with bounded account lines | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Created native QuickBooks Deposit | | ↳ `Id` | string | QuickBooks accounting transaction ID | @@ -2594,7 +2633,8 @@ Sparse-update deposit header fields using the current sync token and destination | Parameter | Type | Description | | --------- | ---- | ----------- | | `recordId` | string | ID of the created or updated QuickBooks entity | -| `syncToken` | string | Latest sync token required for a subsequent update | +| `syncToken` | string | Native QuickBooks SyncToken returned by the mutation | +| `recordVersion` | string | Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name | | `time` | string | QuickBooks response timestamp | | `record` | json | Updated native QuickBooks Deposit | | ↳ `Id` | string | QuickBooks accounting transaction ID | diff --git a/apps/sim/blocks/blocks/quickbooks.ts b/apps/sim/blocks/blocks/quickbooks.ts index 368a8a23aac..8afe4a32c6e 100644 --- a/apps/sim/blocks/blocks/quickbooks.ts +++ b/apps/sim/blocks/blocks/quickbooks.ts @@ -2944,9 +2944,24 @@ export const QuickBooksBlock: BlockConfig = { }, syncToken: { type: 'string', - description: 'Latest QuickBooks sync token for a subsequent update', + description: 'Native QuickBooks SyncToken returned by the mutation', condition: { field: 'operation', value: [...MUTATION_OPERATIONS] }, }, + recordVersion: { + type: 'string', + description: + 'QuickBooks record version returned by a mutation or by-ID read; connect this value to the Sync Token input', + condition: { + field: 'operation', + value: [ + ...MUTATION_OPERATIONS, + MASTER_DATA_OPERATION, + SALES_READ_OPERATION, + PURCHASING_READ_OPERATION, + ACCOUNTING_READ_OPERATION, + ], + }, + }, voided: { type: 'boolean', description: 'True when QuickBooks successfully voided the transaction', @@ -3065,7 +3080,7 @@ export const QuickBooksBlockMeta = { icon: QuickBooksIcon, title: 'QuickBooks customer onboarding', prompt: - 'Build a workflow that receives an approved customer profile, creates the QuickBooks customer, and stores its ID and sync token in a Sim table.', + 'Build a workflow that receives an approved customer profile, creates the QuickBooks customer, and stores its ID and record version in a Sim table.', modules: ['tables', 'agent', 'workflows'], category: 'operations', tags: ['finance', 'customers', 'onboarding'], @@ -3074,7 +3089,7 @@ export const QuickBooksBlockMeta = { icon: QuickBooksIcon, title: 'QuickBooks vendor onboarding', prompt: - 'Create a workflow that receives approved vendor identity, contact, address, and 1099 details, creates the QuickBooks vendor, and stores the returned ID and sync token.', + 'Create a workflow that receives approved vendor identity, contact, address, and 1099 details, creates the QuickBooks vendor, and stores the returned ID and record version.', modules: ['tables', 'agent', 'workflows'], category: 'operations', tags: ['finance', 'vendors', 'procurement'], @@ -3083,7 +3098,7 @@ export const QuickBooksBlockMeta = { icon: QuickBooksIcon, title: 'QuickBooks catalogue maintenance', prompt: - 'Build a workflow that reads filtered QuickBooks master data, creates approved non-payroll employees or Service and Non-inventory items, and safely updates exposed fields while retaining returned IDs and sync tokens.', + 'Build a workflow that reads filtered QuickBooks master data, creates approved non-payroll employees or Service and Non-inventory items, and safely updates exposed fields while retaining returned IDs and record versions.', modules: ['tables', 'agent', 'workflows'], category: 'operations', tags: ['finance', 'catalogue', 'operations'], @@ -3101,7 +3116,7 @@ export const QuickBooksBlockMeta = { icon: QuickBooksIcon, title: 'QuickBooks estimate preparation', prompt: - 'Build a workflow that receives an approved customer quote and line items, creates a QuickBooks estimate, and stores its ID and sync token for controlled revisions.', + 'Build a workflow that receives an approved customer quote and line items, creates a QuickBooks estimate, and stores its ID and record version for controlled revisions.', modules: ['tables', 'agent', 'workflows'], category: 'operations', tags: ['finance', 'estimates', 'sales'], @@ -3110,7 +3125,7 @@ export const QuickBooksBlockMeta = { icon: QuickBooksIcon, title: 'QuickBooks invoice creation and delivery', prompt: - 'Create a workflow that validates approved customer and item IDs, creates a QuickBooks invoice, stores its ID and sync token, then—after explicit approval—emails it or downloads its PDF for controlled delivery and archiving.', + 'Create a workflow that validates approved customer and item IDs, creates a QuickBooks invoice, stores its ID and record version, then—after explicit approval—emails it or downloads its PDF for controlled delivery and archiving.', modules: ['tables', 'agent', 'workflows'], category: 'operations', tags: ['finance', 'invoices', 'receivables'], @@ -3164,47 +3179,47 @@ export const QuickBooksBlockMeta = { skills: [ { name: 'onboard-quickbooks-customers', - description: 'Create approved QuickBooks customers and retain their IDs and sync tokens.', + description: 'Create approved QuickBooks customers and retain their IDs and record versions.', content: - '# Onboard QuickBooks Customers\n\n## Steps\n1. Validate the approved customer identity and contact details.\n2. Use Create Customer with a unique display name.\n3. Store the returned `recordId` and `syncToken` for later updates.\n\n## Output\nReturn the created customer, ID, and sync token. Report duplicate-name faults for human review.', + '# Onboard QuickBooks Customers\n\n## Steps\n1. Validate the approved customer identity and contact details.\n2. Use Create Customer with a unique display name.\n3. Store the returned `recordId` and `recordVersion`; connect `recordVersion` to the Sync Token input for later updates.\n\n## Output\nReturn the created customer, ID, and record version. Report duplicate-name faults for human review.', }, { name: 'onboard-quickbooks-vendors', description: 'Create approved QuickBooks vendors with bounded contact and 1099 fields.', content: - '# Onboard QuickBooks Vendors\n\n## Steps\n1. Validate the approved vendor identity, contact, address, and optional 1099 status.\n2. Use Create Vendor.\n3. Store the returned `recordId` and `syncToken`.\n\n## Output\nReturn the created vendor and identifiers. Do not claim to merge vendors or administer tax identifiers.', + '# Onboard QuickBooks Vendors\n\n## Steps\n1. Validate the approved vendor identity, contact, address, and optional 1099 status.\n2. Use Create Vendor.\n3. Store the returned `recordId` and `recordVersion`; connect `recordVersion` to the Sync Token input for later updates.\n\n## Output\nReturn the created vendor and identifiers. Do not claim to merge vendors or administer tax identifiers.', }, { name: 'maintain-products-and-services', description: 'Create supported items or update exposed item fields without changing types.', content: - '# Maintain QuickBooks Products and Services\n\n## Steps\n1. Read Account master data to obtain approved account IDs.\n2. Create a Service or Non-inventory Item, or update exposed basic fields without changing the existing item Type.\n3. Store the latest item ID and sync token.\n\n## Output\nReturn the native Item record. Do not claim to create Inventory, Category, or Group items or manage their specialized fields.', + '# Maintain QuickBooks Products and Services\n\n## Steps\n1. Read Account master data to obtain approved account IDs.\n2. Create a Service or Non-inventory Item, or update exposed basic fields without changing the existing item Type.\n3. Store the latest item ID and record version; connect the record version to the Sync Token input for updates.\n\n## Output\nReturn the native Item record and record version. Do not claim to create Inventory, Category, or Group items or manage their specialized fields.', }, { name: 'record-quickbooks-accounting-adjustments', description: 'Post approved balanced journal entries, record deposits, and review transfers.', content: - '# Record QuickBooks Accounting Adjustments\n\n## Steps\n1. Read the approved account IDs from Master Data.\n2. For a journal entry, verify that positive debit and credit lines balance and require explicit posting confirmation; for a deposit, verify the destination and source account IDs.\n3. Store the returned `recordId` and `syncToken`; use Read Accounting Transactions to review journal entries, deposits, or read-only transfers.\n4. Run an approved Trial Balance or financial statement on cash or accrual basis when an accountant requests post-adjustment review.\n\n## Output\nReturn the native accounting transaction and identifiers plus the native report hierarchy when requested. Do not claim to create transfers, replace transaction lines, or administer currencies.', + '# Record QuickBooks Accounting Adjustments\n\n## Steps\n1. Read the approved account IDs from Master Data.\n2. For a journal entry, verify that positive debit and credit lines balance and require explicit posting confirmation; for a deposit, verify the destination and source account IDs.\n3. Store the returned `recordId` and `recordVersion`; connect `recordVersion` to the Sync Token input for later updates, and use Read Accounting Transactions to review journal entries, deposits, or read-only transfers.\n4. Run an approved Trial Balance or financial statement on cash or accrual basis when an accountant requests post-adjustment review.\n\n## Output\nReturn the native accounting transaction and identifiers plus the native report hierarchy when requested. Do not claim to create transfers, replace transaction lines, or administer currencies.', }, { name: 'prepare-quickbooks-estimates', description: 'Create and revise bounded QuickBooks estimates from approved quote details.', content: - '# Prepare QuickBooks Estimates\n\n## Steps\n1. Validate the customer, item IDs, amounts, and dates.\n2. Use Create Estimate with bounded item or description lines.\n3. For a revision, use the estimate ID and latest `syncToken` with Update Estimate.\n\n## Output\nReturn the native Estimate, ID, and latest sync token. Do not claim to email or accept the estimate.', + '# Prepare QuickBooks Estimates\n\n## Steps\n1. Validate the customer, item IDs, amounts, and dates.\n2. Use Create Estimate with bounded item or description lines.\n3. For a revision, use the estimate ID and latest `recordVersion` as the Update Estimate Sync Token input.\n\n## Output\nReturn the native Estimate, ID, and latest record version. Do not claim to email or accept the estimate.', }, { name: 'create-quickbooks-invoices', description: 'Create approved QuickBooks invoices and explicitly deliver or archive their documents.', content: - '# Create and Deliver QuickBooks Invoices\n\n## Steps\n1. Validate the approved customer, item IDs, positive amounts, and optional dates.\n2. Use Create Invoice with at least one bounded line.\n3. Store the returned `recordId` and `syncToken`.\n4. Only after explicit approval, use Email Transaction for one recipient or Download Transaction PDF for controlled archiving.\n5. Use Add Attachment for one approved receipt or audit note when needed, and Read Attachments to verify the metadata.\n\n## Output\nReturn the native Invoice and identifiers plus any sent status, downloaded file, or attachment ID. Do not claim bulk email, automatic resend, attachment deletion, or automatic payment collection.', + '# Create and Deliver QuickBooks Invoices\n\n## Steps\n1. Validate the approved customer, item IDs, positive amounts, and optional dates.\n2. Use Create Invoice with at least one bounded line.\n3. Store the returned `recordId` and `recordVersion`; connect `recordVersion` to the Sync Token input for later updates.\n4. Only after explicit approval, use Email Transaction for one recipient or Download Transaction PDF for controlled archiving.\n5. Use Add Attachment for one approved receipt or audit note when needed, and Read Attachments to verify the metadata.\n\n## Output\nReturn the native Invoice and identifiers plus any sent status, downloaded file, or attachment ID. Do not claim bulk email, automatic resend, attachment deletion, or automatic payment collection.', }, { name: 'record-quickbooks-payables', description: 'Create standalone or PO-linked bills and record bounded payments to approved Bill IDs.', content: - '# Record QuickBooks Payables\n\n## Steps\n1. Validate the vendor, expense lines, and optional A/P account.\n2. For PO-linked billing, use Read Purchasing Transactions by ID and copy each approved Purchase Order `Line[].Id` into the matching Create Bill line with its PO ID.\n3. Use Create Bill, store its ID and sync token, and inspect `linkingSucceeded` and `missingLinks`; QuickBooks may create the Bill while omitting an invalid or unavailable link.\n4. When payment is separately approved, use Create Bill Payment with bounded Bill allocations whose amounts equal the payment total.\n5. Run A/P Aging Summary or Detail with supported vendor, department, date, and aging controls for accountant review.\n\n## Output\nAlways return the created Bill ID and linkage result. Preserve the native aging report when requested. Never imply that a missing link prevented Bill creation, and never create a payment implicitly.', + '# Record QuickBooks Payables\n\n## Steps\n1. Validate the vendor, expense lines, and optional A/P account.\n2. For PO-linked billing, use Read Purchasing Transactions by ID and copy each approved Purchase Order `Line[].Id` into the matching Create Bill line with its PO ID.\n3. Use Create Bill, store its ID and record version, and inspect `linkingSucceeded` and `missingLinks`; QuickBooks may create the Bill while omitting an invalid or unavailable link.\n4. When payment is separately approved, use Create Bill Payment with bounded Bill allocations whose amounts equal the payment total.\n5. Run A/P Aging Summary or Detail with supported vendor, department, date, and aging controls for accountant review.\n\n## Output\nAlways return the created Bill ID, record version, and linkage result. Preserve the native aging report when requested. Never imply that a missing link prevented Bill creation, and never create a payment implicitly.', }, { name: 'analyze-quickbooks-financial-reports', diff --git a/apps/sim/lib/core/security/redaction.test.ts b/apps/sim/lib/core/security/redaction.test.ts index cb4ef360965..ac493b709ad 100644 --- a/apps/sim/lib/core/security/redaction.test.ts +++ b/apps/sim/lib/core/security/redaction.test.ts @@ -54,10 +54,6 @@ describe('isSensitiveKey', () => { expect(isSensitiveKey('refresh_token')).toBe(true) expect(isSensitiveKey('auth_token')).toBe(true) expect(isSensitiveKey('accessToken')).toBe(true) - expect(isSensitiveKey('sessionToken')).toBe(true) - expect(isSensitiveKey('webIdentityToken')).toBe(true) - expect(isSensitiveKey('verificationToken')).toBe(true) - expect(isSensitiveKey('githubToken')).toBe(true) }) it.concurrent('should match secret variations', () => { @@ -112,28 +108,9 @@ describe('isSensitiveKey', () => { it.concurrent('should match ssh passphrases', () => { expect(isSensitiveKey('passphrase')).toBe(true) }) - - it.concurrent('should not allow arbitrary keys ending in workflow token names', () => { - expect(isSensitiveKey('asyncToken')).toBe(true) - expect(isSensitiveKey('homepageToken')).toBe(true) - }) }) describe('non-sensitive keys (no false positives)', () => { - it.concurrent('should bypass the exact allowlisted non-secret token fields', () => { - expect(isSensitiveKey('nextPageToken')).toBe(false) - expect(isSensitiveKey('syncToken')).toBe(false) - expect(isSensitiveKey('SyncToken')).toBe(false) - expect(isSensitiveKey('subjectFromWebIdentityToken')).toBe(false) - }) - - it.concurrent('should keep the allowlist exact rather than suffix-based', () => { - expect(isSensitiveKey('nextSyncToken')).toBe(true) - expect(isSensitiveKey('pageToken')).toBe(true) - expect(isSensitiveKey('nextToken')).toBe(true) - expect(isSensitiveKey('webIdentityToken')).toBe(true) - }) - it.concurrent('should not match keys with sensitive words as prefix only', () => { expect(isSensitiveKey('tokenCount')).toBe(false) expect(isSensitiveKey('tokenizer')).toBe(false) @@ -546,24 +523,6 @@ describe('redactApiKeys', () => { expect(result.config.normalField).toBe('normal-value') }) - it.concurrent('should preserve allowlisted token fields while redacting credentials', () => { - const result = redactApiKeys({ - nextPageToken: 'page-2', - subjectFromWebIdentityToken: 'arn-subject', - record: { Id: '42', SyncToken: '3' }, - accessToken: 'access-secret', - sessionToken: 'session-secret', - }) - - expect(result).toEqual({ - nextPageToken: 'page-2', - subjectFromWebIdentityToken: 'arn-subject', - record: { Id: '42', SyncToken: '3' }, - accessToken: REDACTED_MARKER, - sessionToken: REDACTED_MARKER, - }) - }) - it.concurrent('should redact sensitive keys in arrays', () => { const arr = [{ apiKey: 'secret-key-1' }, { apiKey: 'secret-key-2' }] diff --git a/apps/sim/lib/core/security/redaction.ts b/apps/sim/lib/core/security/redaction.ts index 3b8260b5f50..af6ea2c5487 100644 --- a/apps/sim/lib/core/security/redaction.ts +++ b/apps/sim/lib/core/security/redaction.ts @@ -7,7 +7,7 @@ import { filterUserFileForDisplay, isUserFile } from '@/lib/core/utils/user-file export const REDACTED_MARKER = '[REDACTED]' export const TRUNCATED_MARKER = '[TRUNCATED]' -const BYPASS_REDACTION_KEYS = new Set(['nextpagetoken', 'synctoken', 'subjectfromwebidentitytoken']) +const BYPASS_REDACTION_KEYS = new Set(['nextpagetoken']) /** Keys that contain large binary/encoded data that should be truncated in logs */ const LARGE_DATA_KEYS = new Set(['base64']) diff --git a/apps/sim/tools/quickbooks/api_accuracy.test.ts b/apps/sim/tools/quickbooks/api_accuracy.test.ts index dd5367894b1..f932fd1972b 100644 --- a/apps/sim/tools/quickbooks/api_accuracy.test.ts +++ b/apps/sim/tools/quickbooks/api_accuracy.test.ts @@ -3,6 +3,7 @@ */ import { describe, expect, it } from 'vitest' import { quickBooksAddAttachmentBodySchema } from '@/lib/api/contracts/tools/quickbooks' +import { isSensitiveKey, redactApiKeys } from '@/lib/core/security/redaction' import { quickbooksCreateCustomerTool } from '@/tools/quickbooks/create_customer' import { quickbooksCreateVendorTool } from '@/tools/quickbooks/create_vendor' import { @@ -13,6 +14,10 @@ import { } from '@/tools/quickbooks/documents_utils' import { quickbooksEmailTransactionTool } from '@/tools/quickbooks/email_transaction' import { quickbooksGetCompanyInfoTool } from '@/tools/quickbooks/get_company_info' +import { quickbooksReadAccountingTransactionsTool } from '@/tools/quickbooks/read_accounting_transactions' +import { quickbooksReadMasterDataTool } from '@/tools/quickbooks/read_master_data' +import { quickbooksReadPurchasingTransactionsTool } from '@/tools/quickbooks/read_purchasing_transactions' +import { quickbooksReadSalesTransactionsTool } from '@/tools/quickbooks/read_sales_transactions' import type { QuickBooksAttachmentTargetType } from '@/tools/quickbooks/types' describe('QuickBooks documented document operations', () => { @@ -152,6 +157,63 @@ describe('QuickBooks attachment contract', () => { }) describe('QuickBooks sensitive output handling', () => { + it('keeps generic sync-token redaction intact while exposing the safe version alias', () => { + expect(isSensitiveKey('syncToken')).toBe(true) + expect(isSensitiveKey('recordVersion')).toBe(false) + expect(redactApiKeys({ syncToken: '7', recordVersion: '7' })).toEqual({ + syncToken: '[REDACTED]', + recordVersion: '7', + }) + }) + + it('exposes a display-safe record version on every by-ID read family', async () => { + const masterData = await quickbooksReadMasterDataTool.transformResponse?.( + Response.json({ Customer: { Id: 'customer-1', SyncToken: '1' } }), + { + accessToken: 'token', + realmId: '123', + recordType: 'customer', + readMode: 'by_id', + recordId: 'customer-1', + } + ) + const sales = await quickbooksReadSalesTransactionsTool.transformResponse?.( + Response.json({ Invoice: { Id: 'invoice-1', SyncToken: '2' } }), + { + accessToken: 'token', + realmId: '123', + transactionType: 'invoice', + readMode: 'by_id', + transactionId: 'invoice-1', + } + ) + const purchasing = await quickbooksReadPurchasingTransactionsTool.transformResponse?.( + Response.json({ Bill: { Id: 'bill-1', SyncToken: '3' } }), + { + accessToken: 'token', + realmId: '123', + transactionType: 'bill', + readMode: 'by_id', + transactionId: 'bill-1', + } + ) + const accounting = await quickbooksReadAccountingTransactionsTool.transformResponse?.( + Response.json({ Deposit: { Id: 'deposit-1', SyncToken: '4' } }), + { + accessToken: 'token', + realmId: '123', + transactionType: 'deposit', + readMode: 'by_id', + transactionId: 'deposit-1', + } + ) + + expect(masterData?.output.recordVersion).toBe('1') + expect(sales?.output.recordVersion).toBe('2') + expect(purchasing?.output.recordVersion).toBe('3') + expect(accounting?.output.recordVersion).toBe('4') + }) + it('removes the company employer identifier from tool output', async () => { const result = await quickbooksGetCompanyInfoTool.transformResponse?.( Response.json({ diff --git a/apps/sim/tools/quickbooks/full_update.test.ts b/apps/sim/tools/quickbooks/full_update.test.ts index 051d8d09c77..8469a49455a 100644 --- a/apps/sim/tools/quickbooks/full_update.test.ts +++ b/apps/sim/tools/quickbooks/full_update.test.ts @@ -66,7 +66,11 @@ describe('QuickBooks documented full updates', () => { Line: [{ Id: 'line-1', Amount: 25 }], PrivateNote: 'new note', }) - expect(result.output).toMatchObject({ recordId: 'bill-1', syncToken: '3' }) + expect(result.output).toMatchObject({ + recordId: 'bill-1', + syncToken: '3', + recordVersion: '3', + }) }) it('rejects a stale sync token without posting an update', async () => { diff --git a/apps/sim/tools/quickbooks/read_accounting_transactions.ts b/apps/sim/tools/quickbooks/read_accounting_transactions.ts index 926e5607866..51056a03c7d 100644 --- a/apps/sim/tools/quickbooks/read_accounting_transactions.ts +++ b/apps/sim/tools/quickbooks/read_accounting_transactions.ts @@ -9,6 +9,7 @@ import { buildQuickBooksAccountingQueryUrl, buildQuickBooksEntityUrl, getQuickBooksAccountingEntity, + getQuickBooksRecordVersion, getQuickBooksToolHeaders, transformQuickBooksEntityResponse, transformQuickBooksListResponse, @@ -139,7 +140,12 @@ export const quickbooksReadAccountingTransactionsTool: ToolConfig< ) return { success: true, - output: { transactionType: params.transactionType, item: result.item, time: result.time }, + output: { + transactionType: params.transactionType, + item: result.item, + recordVersion: getQuickBooksRecordVersion(result.item), + time: result.time, + }, } } throw new Error(`Unsupported QuickBooks accounting read mode: ${String(params.readMode)}`) @@ -158,6 +164,11 @@ export const quickbooksReadAccountingTransactionsTool: ToolConfig< optional: true, items: { type: 'json', properties: QUICKBOOKS_ACCOUNTING_TRANSACTION_PROPERTIES }, }, + recordVersion: { + type: 'string', + description: 'Display-safe alias for the native SyncToken on a by-ID transaction', + optional: true, + }, startPosition: { type: 'number', description: 'One-based position of the first item in this response', diff --git a/apps/sim/tools/quickbooks/read_master_data.ts b/apps/sim/tools/quickbooks/read_master_data.ts index 3032bee00b9..6b0765fa5e7 100644 --- a/apps/sim/tools/quickbooks/read_master_data.ts +++ b/apps/sim/tools/quickbooks/read_master_data.ts @@ -12,6 +12,7 @@ import { buildQuickBooksEntityUrl, buildQuickBooksMasterDataQueryUrl, getQuickBooksMasterDataEntity, + getQuickBooksRecordVersion, getQuickBooksToolHeaders, sanitizeQuickBooksCustomer, sanitizeQuickBooksEmployee, @@ -155,6 +156,7 @@ export const quickbooksReadMasterDataTool: ToolConfig< output: { recordType: params.recordType, item: sanitizeMasterDataRecord(params.recordType, result.item), + recordVersion: getQuickBooksRecordVersion(result.item), time: result.time, }, } @@ -181,6 +183,11 @@ export const quickbooksReadMasterDataTool: ToolConfig< properties: QUICKBOOKS_MASTER_DATA_PROPERTIES, }, }, + recordVersion: { + type: 'string', + description: 'Display-safe alias for the native SyncToken on a by-ID record', + optional: true, + }, startPosition: { type: 'number', description: 'One-based position of the first record in this page', diff --git a/apps/sim/tools/quickbooks/read_purchasing_transactions.ts b/apps/sim/tools/quickbooks/read_purchasing_transactions.ts index 40a33e32f4c..9cf63ce0dc7 100644 --- a/apps/sim/tools/quickbooks/read_purchasing_transactions.ts +++ b/apps/sim/tools/quickbooks/read_purchasing_transactions.ts @@ -9,6 +9,7 @@ import { buildQuickBooksEntityUrl, buildQuickBooksPurchasingQueryUrl, getQuickBooksPurchasingEntity, + getQuickBooksRecordVersion, getQuickBooksToolHeaders, transformQuickBooksEntityResponse, transformQuickBooksListResponse, @@ -145,7 +146,12 @@ export const quickbooksReadPurchasingTransactionsTool: ToolConfig< ) return { success: true, - output: { transactionType: params.transactionType, item: result.item, time: result.time }, + output: { + transactionType: params.transactionType, + item: result.item, + recordVersion: getQuickBooksRecordVersion(result.item), + time: result.time, + }, } } throw new Error(`Unsupported QuickBooks purchasing read mode: ${String(params.readMode)}`) @@ -164,6 +170,11 @@ export const quickbooksReadPurchasingTransactionsTool: ToolConfig< optional: true, items: { type: 'json', properties: QUICKBOOKS_PURCHASING_TRANSACTION_PROPERTIES }, }, + recordVersion: { + type: 'string', + description: 'Display-safe alias for the native SyncToken on a by-ID transaction', + optional: true, + }, startPosition: { type: 'number', description: 'One-based position of the first item in this response', diff --git a/apps/sim/tools/quickbooks/read_sales_transactions.ts b/apps/sim/tools/quickbooks/read_sales_transactions.ts index 5c1c393a5fe..f2d4014ece1 100644 --- a/apps/sim/tools/quickbooks/read_sales_transactions.ts +++ b/apps/sim/tools/quickbooks/read_sales_transactions.ts @@ -8,6 +8,7 @@ import { QUICKBOOKS_SALES_TRANSACTION_PROPERTIES } from '@/tools/quickbooks/type import { buildQuickBooksEntityUrl, buildQuickBooksSalesQueryUrl, + getQuickBooksRecordVersion, getQuickBooksSalesEntity, getQuickBooksToolHeaders, transformQuickBooksEntityResponse, @@ -147,7 +148,12 @@ export const quickbooksReadSalesTransactionsTool: ToolConfig< ) return { success: true, - output: { transactionType: params.transactionType, item: result.item, time: result.time }, + output: { + transactionType: params.transactionType, + item: result.item, + recordVersion: getQuickBooksRecordVersion(result.item), + time: result.time, + }, } } throw new Error(`Unsupported QuickBooks sales read mode: ${String(params.readMode)}`) @@ -166,6 +172,11 @@ export const quickbooksReadSalesTransactionsTool: ToolConfig< optional: true, items: { type: 'json', properties: QUICKBOOKS_SALES_TRANSACTION_PROPERTIES }, }, + recordVersion: { + type: 'string', + description: 'Display-safe alias for the native SyncToken on a by-ID transaction', + optional: true, + }, startPosition: { type: 'number', description: 'One-based position of the first item in this response', diff --git a/apps/sim/tools/quickbooks/types.ts b/apps/sim/tools/quickbooks/types.ts index c92c479203c..00ddb32e2bf 100644 --- a/apps/sim/tools/quickbooks/types.ts +++ b/apps/sim/tools/quickbooks/types.ts @@ -1054,6 +1054,7 @@ export interface QuickBooksReadMasterDataResponse extends ToolResponse { output: { recordType: QuickBooksMasterDataRecordType item?: QuickBooksMasterDataRecord + recordVersion?: string items?: QuickBooksMasterDataRecord[] startPosition?: number maxResults?: number @@ -1067,6 +1068,7 @@ export interface QuickBooksReadSalesTransactionsResponse extends ToolResponse { output: { transactionType: QuickBooksSalesTransactionType item?: QuickBooksSalesTransaction + recordVersion?: string items?: QuickBooksSalesTransaction[] startPosition?: number maxResults?: number @@ -1080,6 +1082,7 @@ export interface QuickBooksReadPurchasingTransactionsResponse extends ToolRespon output: { transactionType: QuickBooksPurchasingTransactionType item?: QuickBooksPurchasingTransaction + recordVersion?: string items?: QuickBooksPurchasingTransaction[] startPosition?: number maxResults?: number @@ -1093,6 +1096,7 @@ export interface QuickBooksReadAccountingTransactionsResponse extends ToolRespon output: { transactionType: QuickBooksAccountingTransactionType item?: QuickBooksAccountingTransaction + recordVersion?: string items?: QuickBooksAccountingTransaction[] startPosition?: number maxResults?: number @@ -1163,6 +1167,7 @@ export interface QuickBooksMutationResponse = { recordId: { type: 'string', description: 'ID of the created or updated QuickBooks entity' }, syncToken: { type: 'string', - description: 'Latest sync token required for a subsequent update', + description: 'Native QuickBooks SyncToken returned by the mutation', + }, + recordVersion: { + type: 'string', + description: + 'Latest QuickBooks record version required for a subsequent update; this is the native SyncToken under a display-safe name', }, time: { type: 'string', diff --git a/apps/sim/tools/quickbooks/utils.ts b/apps/sim/tools/quickbooks/utils.ts index 0393017f04e..4447dda7c9d 100644 --- a/apps/sim/tools/quickbooks/utils.ts +++ b/apps/sim/tools/quickbooks/utils.ts @@ -609,6 +609,11 @@ export async function transformQuickBooksEntityResponse< } } +export function getQuickBooksRecordVersion(record: { SyncToken?: string }): string | undefined { + const recordVersion = typeof record.SyncToken === 'string' ? record.SyncToken.trim() : '' + return recordVersion || undefined +} + export async function transformQuickBooksMutationResponse< T extends { Id: string; SyncToken?: string }, >( @@ -620,13 +625,13 @@ export async function transformQuickBooksMutationResponse< const parsed = await transformQuickBooksEntityResponse(response, entity, signal) const item = sanitize(parsed.item) const recordId = typeof item.Id === 'string' ? item.Id.trim() : '' - const syncToken = typeof item.SyncToken === 'string' ? item.SyncToken.trim() : '' + const syncToken = getQuickBooksRecordVersion(item) ?? '' if (!recordId || !syncToken) { throw new Error(`QuickBooks ${entity} response is missing Id or SyncToken`) } return { success: true, - output: { record: item, recordId, syncToken, time: parsed.time }, + output: { record: item, recordId, syncToken, recordVersion: syncToken, time: parsed.time }, } } From 5b4a0eb4cf88622eafcc2d4538c0e521242d2ac6 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Fri, 28 Aug 2026 10:45:17 -0700 Subject: [PATCH 5/6] chore(tools): regenerate QuickBooks metadata --- apps/sim/tools/generated/tool-ids.ts | 2 +- apps/sim/tools/generated/tool-metadata.ts | 2 +- apps/sim/tools/generated/tool-outputs.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/sim/tools/generated/tool-ids.ts b/apps/sim/tools/generated/tool-ids.ts index eb371835666..d92e85fe6aa 100644 --- a/apps/sim/tools/generated/tool-ids.ts +++ b/apps/sim/tools/generated/tool-ids.ts @@ -3,7 +3,7 @@ /** Every registered tool id, including versioned variants. */ const toolIds: string[] = JSON.parse( - '["a2a_cancel_task","a2a_get_agent_card","a2a_get_task","a2a_send_message","affinity_batch_update_entity_fields","affinity_batch_update_list_entry_fields","affinity_create_list","affinity_create_list_field_dropdown_option","affinity_create_merge","affinity_create_note","affinity_create_reminder","affinity_delete_list_field_dropdown_option","affinity_delete_note","affinity_get_company","affinity_get_current_user","affinity_get_entity_field_value","affinity_get_list","affinity_get_list_entry","affinity_get_list_entry_field","affinity_get_list_field_dropdown_option","affinity_get_merge","affinity_get_merge_task","affinity_get_note","affinity_get_opportunity","affinity_get_person","affinity_get_saved_view","affinity_get_transcript","affinity_get_user","affinity_list_calls","affinity_list_chat_messages","affinity_list_companies","affinity_list_coworker_connections","affinity_list_emails","affinity_list_entity_field_values","affinity_list_entity_list_entries","affinity_list_entity_lists","affinity_list_entity_notes","affinity_list_entity_relationships","affinity_list_field_dropdown_options","affinity_list_field_metadata","affinity_list_field_value_changes","affinity_list_investor_executive_connections","affinity_list_list_entries","affinity_list_list_entry_field_value_changes","affinity_list_list_entry_fields","affinity_list_list_field_dropdown_options","affinity_list_list_fields","affinity_list_lists","affinity_list_meetings","affinity_list_merge_tasks","affinity_list_merges","affinity_list_note_attached_companies","affinity_list_note_attached_opportunities","affinity_list_note_attached_persons","affinity_list_note_replies","affinity_list_notes","affinity_list_opportunities","affinity_list_persons","affinity_list_reminders","affinity_list_saved_view_entries","affinity_list_saved_views","affinity_list_transcript_fragments","affinity_list_transcripts","affinity_list_users","affinity_search_companies","affinity_search_files","affinity_search_list_entries","affinity_search_notes","affinity_search_persons","affinity_semantic_search","affinity_update_entity_field_value","affinity_update_list_entry_field","affinity_update_list_field_dropdown_option","affinity_update_note","agentmail_create_draft","agentmail_create_inbox","agentmail_delete_draft","agentmail_delete_inbox","agentmail_delete_thread","agentmail_forward_message","agentmail_get_draft","agentmail_get_inbox","agentmail_get_message","agentmail_get_thread","agentmail_list_drafts","agentmail_list_inboxes","agentmail_list_messages","agentmail_list_threads","agentmail_reply_message","agentmail_send_draft","agentmail_send_message","agentmail_update_draft","agentmail_update_inbox","agentmail_update_message","agentmail_update_thread","agentphone_create_call","agentphone_create_contact","agentphone_create_number","agentphone_delete_contact","agentphone_get_call","agentphone_get_call_transcript","agentphone_get_contact","agentphone_get_conversation","agentphone_get_conversation_messages","agentphone_get_number_messages","agentphone_get_usage","agentphone_get_usage_daily","agentphone_get_usage_monthly","agentphone_list_calls","agentphone_list_contacts","agentphone_list_conversations","agentphone_list_numbers","agentphone_react_to_message","agentphone_release_number","agentphone_send_message","agentphone_update_contact","agentphone_update_conversation","agiloft_async_status","agiloft_attach_file","agiloft_attachment_info","agiloft_create_record","agiloft_delete_record","agiloft_get_choice_line_id","agiloft_list_tables","agiloft_lock_record","agiloft_nlp_search","agiloft_read_record","agiloft_remove_attachment","agiloft_retrieve_attachment","agiloft_run_action_button","agiloft_saved_search","agiloft_search_records","agiloft_select_records","agiloft_update_record","agiloft_upsert_record","ahrefs_anchors","ahrefs_backlinks","ahrefs_backlinks_stats","ahrefs_batch_analysis","ahrefs_broken_backlinks","ahrefs_domain_rating","ahrefs_domain_rating_history","ahrefs_keyword_overview","ahrefs_keywords_history","ahrefs_metrics","ahrefs_metrics_history","ahrefs_organic_competitors","ahrefs_organic_keywords","ahrefs_paid_pages","ahrefs_rank_tracker_competitors_overview","ahrefs_rank_tracker_competitors_stats","ahrefs_rank_tracker_overview","ahrefs_rank_tracker_serp_overview","ahrefs_refdomains_history","ahrefs_referring_domains","ahrefs_related_terms","ahrefs_site_audit_page_explorer","ahrefs_top_pages","airtable_create_records","airtable_delete_records","airtable_get_base_schema","airtable_get_record","airtable_list_bases","airtable_list_records","airtable_list_tables","airtable_update_multiple_records","airtable_update_record","airtable_upsert_records","airweave_search","algolia_add_record","algolia_batch_operations","algolia_browse_records","algolia_clear_records","algolia_copy_move_index","algolia_delete_by_filter","algolia_delete_index","algolia_delete_record","algolia_get_record","algolia_get_records","algolia_get_settings","algolia_get_task_status","algolia_list_indices","algolia_partial_update_record","algolia_search","algolia_update_settings","amplitude_event_segmentation","amplitude_funnels","amplitude_get_active_users","amplitude_get_revenue","amplitude_group_identify","amplitude_identify_user","amplitude_list_events","amplitude_realtime_active_users","amplitude_retention","amplitude_send_event","amplitude_user_activity","amplitude_user_profile","amplitude_user_search","apify_get_dataset_items","apify_get_run","apify_run_actor_async","apify_run_actor_sync","apify_run_task","apollo_account_bulk_create","apollo_account_bulk_update","apollo_account_create","apollo_account_search","apollo_account_update","apollo_contact_bulk_create","apollo_contact_bulk_update","apollo_contact_create","apollo_contact_search","apollo_contact_update","apollo_email_accounts","apollo_opportunity_create","apollo_opportunity_get","apollo_opportunity_search","apollo_opportunity_update","apollo_organization_bulk_enrich","apollo_organization_enrich","apollo_organization_search","apollo_people_bulk_enrich","apollo_people_enrich","apollo_people_search","apollo_sequence_add_contacts","apollo_sequence_search","apollo_task_create","apollo_task_search","appconfig_create_application","appconfig_create_configuration_profile","appconfig_create_environment","appconfig_create_hosted_configuration_version","appconfig_delete_application","appconfig_delete_configuration_profile","appconfig_delete_environment","appconfig_delete_hosted_configuration_version","appconfig_get_application","appconfig_get_configuration","appconfig_get_configuration_profile","appconfig_get_deployment","appconfig_get_environment","appconfig_get_hosted_configuration_version","appconfig_list_applications","appconfig_list_configuration_profiles","appconfig_list_deployment_strategies","appconfig_list_deployments","appconfig_list_environments","appconfig_list_hosted_configuration_versions","appconfig_start_deployment","appconfig_stop_deployment","appconfig_update_application","appconfig_update_configuration_profile","appconfig_update_environment","arxiv_get_author_papers","arxiv_get_paper","arxiv_search","asana_add_comment","asana_add_followers","asana_create_project","asana_create_section","asana_create_subtask","asana_create_task","asana_delete_task","asana_get_project","asana_get_projects","asana_get_task","asana_list_sections","asana_list_workspaces","asana_search_tasks","asana_update_task","ashby_add_candidate_tag","ashby_anonymize_candidate","ashby_change_application_source","ashby_change_application_stage","ashby_create_application","ashby_create_candidate","ashby_create_note","ashby_delete_application","ashby_get_application","ashby_get_candidate","ashby_get_job","ashby_get_job_posting","ashby_get_offer","ashby_list_applications","ashby_list_archive_reasons","ashby_list_candidate_tags","ashby_list_candidates","ashby_list_custom_fields","ashby_list_departments","ashby_list_interviews","ashby_list_job_postings","ashby_list_jobs","ashby_list_locations","ashby_list_notes","ashby_list_offers","ashby_list_openings","ashby_list_sources","ashby_list_users","ashby_remove_candidate_tag","ashby_search_candidates","ashby_set_custom_field_value","ashby_set_custom_field_values","ashby_update_candidate","athena_batch_get_query_execution","athena_create_named_query","athena_delete_named_query","athena_get_named_query","athena_get_query_execution","athena_get_query_results","athena_list_databases","athena_list_named_queries","athena_list_query_executions","athena_list_table_metadata","athena_start_query","athena_stop_query","attio_assert_record","attio_create_attribute","attio_create_comment","attio_create_list","attio_create_list_entry","attio_create_note","attio_create_object","attio_create_record","attio_create_task","attio_create_webhook","attio_delete_comment","attio_delete_list_entry","attio_delete_note","attio_delete_record","attio_delete_task","attio_delete_webhook","attio_get_attribute","attio_get_comment","attio_get_list","attio_get_list_entry","attio_get_member","attio_get_note","attio_get_object","attio_get_record","attio_get_task","attio_get_thread","attio_get_webhook","attio_list_attributes","attio_list_lists","attio_list_members","attio_list_notes","attio_list_objects","attio_list_records","attio_list_tasks","attio_list_threads","attio_list_webhooks","attio_query_list_entries","attio_search_records","attio_update_attribute","attio_update_list","attio_update_list_entry","attio_update_object","attio_update_record","attio_update_task","attio_update_webhook","azure_data_explorer_create_table","azure_data_explorer_drop_table","azure_data_explorer_ingest_from_query","azure_data_explorer_ingest_inline","azure_data_explorer_list_databases","azure_data_explorer_list_functions","azure_data_explorer_list_tables","azure_data_explorer_management","azure_data_explorer_query","azure_data_explorer_show_database_schema","azure_data_explorer_show_ingestion_failures","azure_data_explorer_show_operations","azure_data_explorer_show_table_details","azure_data_explorer_show_table_schema","azure_devops_add_comment","azure_devops_create_work_item","azure_devops_get_build_log","azure_devops_get_build_timeline","azure_devops_get_comments","azure_devops_get_pipeline","azure_devops_get_pipeline_run","azure_devops_get_work_item","azure_devops_get_work_items_batch","azure_devops_get_work_items_between_builds","azure_devops_list_build_logs","azure_devops_list_builds","azure_devops_list_pipeline_runs","azure_devops_list_pipelines","azure_devops_query_work_items","azure_devops_update_work_item","bitbucket_approve_pull_request","bitbucket_create_branch","bitbucket_create_pull_request","bitbucket_create_pull_request_comment","bitbucket_decline_pull_request","bitbucket_delete_branch","bitbucket_get_commit","bitbucket_get_file","bitbucket_get_file_metadata","bitbucket_get_pipeline","bitbucket_get_pipeline_step_log","bitbucket_get_pull_request","bitbucket_get_pull_request_diff","bitbucket_get_pull_request_diffstat","bitbucket_get_pull_request_merge_task_status","bitbucket_get_repository","bitbucket_list_branches","bitbucket_list_commits","bitbucket_list_directory","bitbucket_list_pipeline_steps","bitbucket_list_pipelines","bitbucket_list_pull_request_comments","bitbucket_list_pull_request_commit_statuses","bitbucket_list_pull_requests","bitbucket_list_repositories","bitbucket_list_workspaces","bitbucket_merge_pull_request","bitbucket_request_pull_request_changes","bitbucket_stop_pipeline","bitbucket_trigger_pipeline","box_copy_file","box_create_folder","box_delete_file","box_delete_folder","box_download_file","box_get_file_info","box_list_folder_items","box_search","box_sign_cancel_request","box_sign_create_request","box_sign_get_request","box_sign_list_requests","box_sign_resend_request","box_update_file","box_upload_file","brandfetch_get_brand","brandfetch_search","brex_archive_budget","brex_create_budget","brex_create_spend_limit","brex_create_transfer","brex_create_vendor","brex_get_budget","brex_get_cash_account","brex_get_company","brex_get_current_user","brex_get_expense","brex_get_spend_limit","brex_get_transfer","brex_get_user","brex_get_vendor","brex_list_budgets","brex_list_card_accounts","brex_list_card_statements","brex_list_card_transactions","brex_list_cards","brex_list_cash_accounts","brex_list_cash_statements","brex_list_cash_transactions","brex_list_departments","brex_list_expenses","brex_list_locations","brex_list_spend_limits","brex_list_titles","brex_list_transfers","brex_list_users","brex_list_vendors","brex_match_receipt","brex_update_expense","brex_update_vendor","brex_upload_receipt","brightdata_cancel_snapshot","brightdata_discover","brightdata_download_snapshot","brightdata_scrape_dataset","brightdata_scrape_url","brightdata_serp_search","brightdata_snapshot_status","brightdata_sync_scrape","browser_use_run_task","buffer_create_idea","buffer_create_post","buffer_delete_post","buffer_edit_post","buffer_get_account","buffer_get_channels","buffer_get_idea_groups","buffer_get_ideas","buffer_get_post","buffer_get_posts","calcom_cancel_booking","calcom_confirm_booking","calcom_create_booking","calcom_create_event_type","calcom_create_schedule","calcom_decline_booking","calcom_delete_event_type","calcom_delete_schedule","calcom_get_booking","calcom_get_default_schedule","calcom_get_event_type","calcom_get_schedule","calcom_get_slots","calcom_list_bookings","calcom_list_event_types","calcom_list_schedules","calcom_reschedule_booking","calcom_update_event_type","calcom_update_schedule","calendly_cancel_event","calendly_create_event_invitee","calendly_create_invitee_no_show","calendly_create_scheduling_link","calendly_create_webhook","calendly_delete_invitee_no_show","calendly_delete_webhook","calendly_get_current_user","calendly_get_event_invitee","calendly_get_event_type","calendly_get_scheduled_event","calendly_get_user","calendly_list_event_invitees","calendly_list_event_type_available_times","calendly_list_event_types","calendly_list_organization_memberships","calendly_list_routing_form_submissions","calendly_list_routing_forms","calendly_list_scheduled_events","calendly_list_user_availability_schedules","calendly_list_user_busy_times","calendly_list_webhooks","cbinsights_chat","cbinsights_get_commercial_maturity_history","cbinsights_get_exit_probability_history","cbinsights_get_mosaic_history","cbinsights_get_org_business_relationships","cbinsights_get_org_funding_window","cbinsights_get_org_fundings","cbinsights_get_org_investments","cbinsights_get_org_management_and_board","cbinsights_get_org_outlook","cbinsights_get_org_portfolio_exits","cbinsights_get_org_revenue","cbinsights_get_scouting_report","cbinsights_get_strategy_map","cbinsights_list_business_relationships","cbinsights_list_funding_window","cbinsights_list_fundings","cbinsights_list_investments","cbinsights_list_management_and_board","cbinsights_list_outlook","cbinsights_list_portfolio_exits","cbinsights_list_revenue","cbinsights_lookup_organizations","cbinsights_rag","cbinsights_search_firmographics","clay_populate","clerk_add_organization_member","clerk_ban_user","clerk_create_actor_token","clerk_create_allowlist_identifier","clerk_create_blocklist_identifier","clerk_create_organization","clerk_create_organization_invitation","clerk_create_user","clerk_delete_allowlist_identifier","clerk_delete_blocklist_identifier","clerk_delete_organization","clerk_delete_user","clerk_get_jwt_template","clerk_get_organization","clerk_get_session","clerk_get_user","clerk_get_user_oauth_token","clerk_list_allowlist_identifiers","clerk_list_blocklist_identifiers","clerk_list_jwt_templates","clerk_list_organization_invitations","clerk_list_organization_memberships","clerk_list_organizations","clerk_list_sessions","clerk_list_users","clerk_lock_user","clerk_remove_organization_member","clerk_revoke_actor_token","clerk_revoke_session","clerk_unban_user","clerk_unlock_user","clerk_update_organization","clerk_update_organization_membership","clerk_update_user","clickhouse_count_rows","clickhouse_create_database","clickhouse_create_table","clickhouse_delete","clickhouse_describe_table","clickhouse_drop_database","clickhouse_drop_partition","clickhouse_drop_table","clickhouse_execute","clickhouse_insert","clickhouse_insert_rows","clickhouse_introspect","clickhouse_kill_query","clickhouse_list_clusters","clickhouse_list_databases","clickhouse_list_mutations","clickhouse_list_partitions","clickhouse_list_running_queries","clickhouse_list_tables","clickhouse_optimize_table","clickhouse_query","clickhouse_rename_table","clickhouse_show_create_table","clickhouse_table_stats","clickhouse_truncate_table","clickhouse_update","clickup_add_tag_to_task","clickup_create_checklist","clickup_create_checklist_item","clickup_create_comment","clickup_create_folder","clickup_create_list","clickup_create_task","clickup_create_time_entry","clickup_delete_checklist","clickup_delete_checklist_item","clickup_delete_comment","clickup_delete_task","clickup_delete_time_entry","clickup_get_comments","clickup_get_custom_fields","clickup_get_folders","clickup_get_list_members","clickup_get_lists","clickup_get_running_timer","clickup_get_space_tags","clickup_get_spaces","clickup_get_task","clickup_get_task_members","clickup_get_tasks","clickup_get_time_entries","clickup_get_workspaces","clickup_remove_custom_field_value","clickup_remove_tag_from_task","clickup_search_tasks","clickup_set_custom_field_value","clickup_start_timer","clickup_stop_timer","clickup_update_checklist","clickup_update_checklist_item","clickup_update_comment","clickup_update_task","clickup_update_time_entry","clickup_upload_attachment","cloudflare_create_access_application","cloudflare_create_access_policy","cloudflare_create_access_service_token","cloudflare_create_dns_record","cloudflare_create_r2_bucket","cloudflare_create_rate_limit_rule","cloudflare_create_ruleset","cloudflare_create_ruleset_rule","cloudflare_create_zone","cloudflare_delete_access_application","cloudflare_delete_access_policy","cloudflare_delete_dns_record","cloudflare_delete_r2_bucket","cloudflare_delete_ruleset_rule","cloudflare_delete_zone","cloudflare_dns_analytics","cloudflare_get_access_application","cloudflare_get_r2_bucket","cloudflare_get_ruleset","cloudflare_get_ruleset_entrypoint","cloudflare_get_tunnel","cloudflare_get_tunnel_configuration","cloudflare_get_worker_script_settings","cloudflare_get_zone","cloudflare_get_zone_settings","cloudflare_list_access_applications","cloudflare_list_access_groups","cloudflare_list_access_identity_providers","cloudflare_list_access_policies","cloudflare_list_access_service_tokens","cloudflare_list_certificates","cloudflare_list_dns_records","cloudflare_list_managed_ruleset_overrides","cloudflare_list_r2_buckets","cloudflare_list_rate_limit_rules","cloudflare_list_rulesets","cloudflare_list_tunnels","cloudflare_list_worker_routes","cloudflare_list_worker_scripts","cloudflare_list_zones","cloudflare_purge_cache","cloudflare_revoke_access_service_token","cloudflare_update_access_application","cloudflare_update_access_policy","cloudflare_update_dns_record","cloudflare_update_rate_limit_rule","cloudflare_update_ruleset_rule","cloudflare_update_zone_setting","cloudformation_cancel_update_stack","cloudformation_create_change_set","cloudformation_create_stack","cloudformation_delete_stack","cloudformation_describe_change_set","cloudformation_describe_stack_drift_detection_status","cloudformation_describe_stack_events","cloudformation_describe_stacks","cloudformation_detect_stack_drift","cloudformation_execute_change_set","cloudformation_get_template","cloudformation_get_template_summary","cloudformation_list_stack_resources","cloudformation_update_stack","cloudformation_validate_template","cloudwatch_describe_alarm_history","cloudwatch_describe_alarms","cloudwatch_describe_log_groups","cloudwatch_describe_log_streams","cloudwatch_filter_log_events","cloudwatch_get_log_events","cloudwatch_get_metric_statistics","cloudwatch_list_metrics","cloudwatch_mute_alarm","cloudwatch_put_log_group_retention","cloudwatch_put_metric_data","cloudwatch_query_logs","cloudwatch_unmute_alarm","codepipeline_disable_stage_transition","codepipeline_enable_stage_transition","codepipeline_get_pipeline","codepipeline_get_pipeline_execution","codepipeline_get_pipeline_state","codepipeline_list_action_executions","codepipeline_list_pipeline_executions","codepipeline_list_pipelines","codepipeline_put_approval_result","codepipeline_retry_stage_execution","codepipeline_start_execution","codepipeline_stop_execution","confluence_add_label","confluence_create_blogpost","confluence_create_comment","confluence_create_page","confluence_create_page_property","confluence_create_space","confluence_create_space_property","confluence_delete_attachment","confluence_delete_blogpost","confluence_delete_comment","confluence_delete_label","confluence_delete_page","confluence_delete_page_property","confluence_delete_space","confluence_delete_space_property","confluence_get_blogpost","confluence_get_page_ancestors","confluence_get_page_children","confluence_get_page_descendants","confluence_get_page_version","confluence_get_pages_by_label","confluence_get_space","confluence_get_task","confluence_get_user","confluence_list_attachments","confluence_list_blogposts","confluence_list_blogposts_in_space","confluence_list_comments","confluence_list_labels","confluence_list_page_properties","confluence_list_page_versions","confluence_list_pages_in_space","confluence_list_space_labels","confluence_list_space_permissions","confluence_list_space_properties","confluence_list_spaces","confluence_list_tasks","confluence_retrieve","confluence_search","confluence_search_in_space","confluence_update","confluence_update_blogpost","confluence_update_comment","confluence_update_space","confluence_update_task","confluence_upload_attachment","context_dev_classify_naics","context_dev_classify_sic","context_dev_crawl","context_dev_extract","context_dev_extract_product","context_dev_extract_products","context_dev_get_brand","context_dev_get_brand_by_email","context_dev_get_brand_by_name","context_dev_get_brand_by_ticker","context_dev_identify_transaction","context_dev_map","context_dev_scrape_fonts","context_dev_scrape_html","context_dev_scrape_images","context_dev_scrape_markdown","context_dev_scrape_styleguide","context_dev_screenshot","context_dev_search","convex_action","convex_document_deltas","convex_list_documents","convex_list_tables","convex_mutation","convex_query","convex_run_function","crowdstrike_create_indicators","crowdstrike_delete_indicators","crowdstrike_delete_rtr_session","crowdstrike_execute_rtr_command","crowdstrike_get_alert_details","crowdstrike_get_case_details","crowdstrike_get_host_group_details","crowdstrike_get_indicator_details","crowdstrike_get_rtr_command_status","crowdstrike_get_sensor_aggregates","crowdstrike_get_sensor_details","crowdstrike_get_vulnerability_details","crowdstrike_init_rtr_session","crowdstrike_perform_host_action","crowdstrike_perform_host_group_action","crowdstrike_query_alerts","crowdstrike_query_cases","crowdstrike_query_host_groups","crowdstrike_query_indicators","crowdstrike_query_sensors","crowdstrike_query_vulnerabilities","crowdstrike_update_alerts","crowdstrike_update_indicators","crunchbase_autocomplete","crunchbase_get_acquisition","crunchbase_get_entity","crunchbase_get_entity_card","crunchbase_get_fields_metadata","crunchbase_get_funding_round","crunchbase_get_organization","crunchbase_get_person","crunchbase_list_deleted_entities","crunchbase_search_acquisitions","crunchbase_search_entities","crunchbase_search_funding_rounds","crunchbase_search_organizations","crunchbase_search_people","cursor_add_followup","cursor_add_followup_v2","cursor_delete_agent","cursor_delete_agent_v2","cursor_download_artifact","cursor_download_artifact_v2","cursor_get_agent","cursor_get_agent_v2","cursor_get_api_key_info","cursor_get_api_key_info_v2","cursor_get_conversation","cursor_get_conversation_v2","cursor_launch_agent","cursor_launch_agent_v2","cursor_list_agents","cursor_list_agents_v2","cursor_list_artifacts","cursor_list_artifacts_v2","cursor_list_models","cursor_list_models_v2","cursor_list_repositories","cursor_list_repositories_v2","cursor_stop_agent","cursor_stop_agent_v2","dagster_delete_run","dagster_get_asset","dagster_get_run","dagster_get_run_logs","dagster_launch_run","dagster_list_assets","dagster_list_jobs","dagster_list_runs","dagster_list_schedules","dagster_list_sensors","dagster_materialize_assets","dagster_reexecute_run","dagster_report_asset_materialization","dagster_start_schedule","dagster_start_sensor","dagster_stop_schedule","dagster_stop_sensor","dagster_terminate_run","dagster_wipe_asset","databricks_cancel_run","databricks_execute_sql","databricks_get_cluster","databricks_get_job","databricks_get_run","databricks_get_run_output","databricks_get_statement","databricks_list_clusters","databricks_list_jobs","databricks_list_runs","databricks_list_warehouses","databricks_run_job","datadog_add_incident_todo","datadog_cancel_downtime","datadog_create_dashboard","datadog_create_downtime","datadog_create_event","datadog_create_incident","datadog_create_monitor","datadog_create_slo","datadog_delete_dashboard","datadog_delete_slo","datadog_get_browser_synthetics_results","datadog_get_dashboard","datadog_get_incident","datadog_get_monitor","datadog_get_security_signal","datadog_get_slo","datadog_get_slo_history","datadog_get_synthetics_results","datadog_get_synthetics_test","datadog_list_dashboards","datadog_list_downtimes","datadog_list_incidents","datadog_list_monitors","datadog_list_security_rules","datadog_list_security_signals","datadog_list_services","datadog_list_slos","datadog_list_synthetics_tests","datadog_mute_monitor","datadog_query_logs","datadog_query_timeseries","datadog_search_spans","datadog_send_logs","datadog_submit_metrics","datadog_trigger_synthetics_tests","datadog_unmute_monitor","datadog_update_incident","datadog_update_security_signal_assignee","datadog_update_security_signal_state","datadog_update_slo","datadog_update_synthetics_status","datagma_enrich_company","datagma_enrich_person","datagma_find_email","datagma_find_phone","datagma_get_credits","daytona_create_sandbox","daytona_delete_sandbox","daytona_download_file","daytona_execute_command","daytona_get_sandbox","daytona_git_clone","daytona_list_files","daytona_list_sandboxes","daytona_run_code","daytona_start_sandbox","daytona_stop_sandbox","daytona_upload_file","deployed_block_executor","deployments_deploy","deployments_get_version","deployments_list_versions","deployments_promote","deployments_undeploy","devin_append_session_tags","devin_archive_session","devin_create_session","devin_get_session","devin_get_session_tags","devin_list_session_attachments","devin_list_session_messages","devin_list_sessions","devin_replace_session_tags","devin_send_message","devin_terminate_session","discord_add_reaction","discord_archive_thread","discord_assign_role","discord_ban_member","discord_bulk_delete_messages","discord_create_channel","discord_create_invite","discord_create_role","discord_create_thread","discord_create_webhook","discord_delete_channel","discord_delete_invite","discord_delete_message","discord_delete_role","discord_delete_webhook","discord_edit_message","discord_execute_webhook","discord_get_channel","discord_get_invite","discord_get_member","discord_get_messages","discord_get_pinned_messages","discord_get_server","discord_get_user","discord_get_webhook","discord_join_thread","discord_kick_member","discord_leave_thread","discord_list_channels","discord_list_roles","discord_pin_message","discord_remove_reaction","discord_remove_role","discord_send_message","discord_unban_member","discord_unpin_message","discord_update_channel","discord_update_member","discord_update_role","docusign_create_from_template","docusign_download_document","docusign_get_envelope","docusign_list_envelopes","docusign_list_recipients","docusign_list_templates","docusign_send_envelope","docusign_void_envelope","downdetector_get_company","downdetector_get_company_attribution","downdetector_get_company_baseline","downdetector_get_company_events","downdetector_get_company_incidents","downdetector_get_company_indicators","downdetector_get_company_last_15","downdetector_get_company_status","downdetector_get_provider","downdetector_get_reports","downdetector_get_site_companies","downdetector_list_categories","downdetector_list_incidents","downdetector_list_sites","downdetector_search_companies","dropbox_copy","dropbox_create_folder","dropbox_create_shared_link","dropbox_delete","dropbox_download","dropbox_get_metadata","dropbox_list_folder","dropbox_list_revisions","dropbox_list_shared_links","dropbox_move","dropbox_restore","dropbox_search","dropbox_upload","dropcontact_enrich_contact","dspy_chain_of_thought","dspy_predict","dspy_react","dub_bulk_create_links","dub_bulk_delete_links","dub_bulk_update_links","dub_create_link","dub_create_tag","dub_delete_link","dub_get_analytics","dub_get_events","dub_get_link","dub_get_links_count","dub_get_qr_code","dub_list_domains","dub_list_folders","dub_list_links","dub_list_tags","dub_update_link","dub_upsert_link","duckduckgo_search","dynamodb_delete","dynamodb_get","dynamodb_introspect","dynamodb_put","dynamodb_query","dynamodb_scan","dynamodb_update","dynatrace_add_problem_comment","dynatrace_add_tags","dynatrace_close_problem","dynatrace_create_settings_object","dynatrace_create_slo","dynatrace_delete_problem_comment","dynatrace_delete_settings_object","dynatrace_delete_slo","dynatrace_delete_tag","dynatrace_execute_synthetic_monitors","dynatrace_get_attack","dynatrace_get_audit_logs","dynatrace_get_entity","dynatrace_get_event","dynatrace_get_metric","dynatrace_get_problem","dynatrace_get_problem_comment","dynatrace_get_security_problem","dynatrace_get_settings_object","dynatrace_get_slo","dynatrace_get_synthetic_batch","dynatrace_ingest_event","dynatrace_ingest_logs","dynatrace_ingest_metrics","dynatrace_list_attacks","dynatrace_list_entities","dynatrace_list_entity_types","dynatrace_list_events","dynatrace_list_metrics","dynatrace_list_problem_comments","dynatrace_list_problems","dynatrace_list_remediation_items","dynatrace_list_security_problems","dynatrace_list_settings_objects","dynatrace_list_settings_schemas","dynatrace_list_slos","dynatrace_list_synthetic_monitors","dynatrace_list_tags","dynatrace_mute_security_problem","dynatrace_mute_security_problems","dynatrace_query_metrics","dynatrace_search_logs","dynatrace_unmute_security_problem","dynatrace_unmute_security_problems","dynatrace_update_problem_comment","dynatrace_update_settings_object","dynatrace_update_slo","elasticsearch_bulk","elasticsearch_cluster_health","elasticsearch_cluster_stats","elasticsearch_count","elasticsearch_create_index","elasticsearch_delete_document","elasticsearch_delete_index","elasticsearch_get_document","elasticsearch_get_index","elasticsearch_index_document","elasticsearch_list_indices","elasticsearch_search","elasticsearch_update_document","elevenlabs_audio_isolation","elevenlabs_edit_voice_settings","elevenlabs_get_user","elevenlabs_get_voice","elevenlabs_get_voice_settings","elevenlabs_list_models","elevenlabs_list_voices","elevenlabs_sound_effects","elevenlabs_speech_to_speech","elevenlabs_tts","emailbison_attach_leads_to_campaign","emailbison_attach_tags_to_leads","emailbison_create_campaign","emailbison_create_lead","emailbison_create_tag","emailbison_get_lead","emailbison_list_campaigns","emailbison_list_leads","emailbison_list_replies","emailbison_list_tags","emailbison_update_campaign","emailbison_update_campaign_status","emailbison_update_lead","embeddings_cohere","embeddings_gemini","embeddings_mistral","embeddings_openai","embeddings_openrouter","enrich_check_credits","enrich_company_funding","enrich_company_lookup","enrich_company_revenue","enrich_disposable_email_check","enrich_email_to_ip","enrich_email_to_person_lite","enrich_email_to_phone","enrich_email_to_profile","enrich_find_email","enrich_get_post_details","enrich_ip_to_company","enrich_linkedin_profile","enrich_linkedin_to_personal_email","enrich_linkedin_to_work_email","enrich_phone_finder","enrich_reverse_hash_lookup","enrich_sales_pointer_people","enrich_search_company","enrich_search_company_activities","enrich_search_company_employees","enrich_search_jobs","enrich_search_logo","enrich_search_people","enrich_search_people_activities","enrich_search_post_comments","enrich_search_post_comments_by_url","enrich_search_post_reactions","enrich_search_post_reactions_by_url","enrich_search_posts","enrich_search_similar_companies","enrich_verify_email","enrichment_run","enrow_find_email","enrow_verify_email","exa_agent","exa_answer","exa_find_similar_links","exa_get_contents","exa_search","extend_parser","extend_parser_v2","fathom_get_summary","fathom_get_transcript","fathom_list_meeting_types","fathom_list_meetings","fathom_list_team_members","fathom_list_teams","file_append","file_compress","file_decompress","file_fetch","file_get","file_get_content","file_manage_sharing","file_parser","file_parser_v2","file_parser_v3","file_read","file_write","findymail_find_email_from_linkedin","findymail_find_email_from_name","findymail_find_emails_by_domain","findymail_find_employees","findymail_find_phone","findymail_get_company","findymail_get_credits","findymail_lookup_technologies","findymail_reverse_email_lookup","findymail_search_technologies","findymail_verify_email","firecrawl_agent","firecrawl_batch_scrape","firecrawl_batch_scrape_status","firecrawl_cancel_crawl","firecrawl_crawl","firecrawl_crawl_status","firecrawl_credit_usage","firecrawl_extract","firecrawl_extract_status","firecrawl_map","firecrawl_parse","firecrawl_scrape","firecrawl_search","fireflies_add_to_live_meeting","fireflies_create_bite","fireflies_delete_transcript","fireflies_get_transcript","fireflies_get_user","fireflies_list_bites","fireflies_list_contacts","fireflies_list_transcripts","fireflies_list_users","fireflies_upload_audio","flint_create_task","flint_generate_pages","flint_get_task","function_execute","gamma_check_status","gamma_generate","gamma_generate_from_template","gamma_list_folders","gamma_list_themes","github_add_assignees","github_add_assignees_v2","github_add_labels","github_add_labels_v2","github_cancel_workflow_run","github_cancel_workflow_run_v2","github_check_star","github_check_star_v2","github_close_issue","github_close_issue_v2","github_close_pr","github_close_pr_v2","github_comment","github_comment_v2","github_compare_commits","github_compare_commits_v2","github_create_branch","github_create_branch_v2","github_create_comment_reaction","github_create_comment_reaction_v2","github_create_file","github_create_file_v2","github_create_gist","github_create_gist_v2","github_create_issue","github_create_issue_reaction","github_create_issue_reaction_v2","github_create_issue_v2","github_create_milestone","github_create_milestone_v2","github_create_pr","github_create_pr_review","github_create_pr_review_v2","github_create_pr_v2","github_create_project","github_create_project_v2","github_create_release","github_create_release_v2","github_delete_branch","github_delete_branch_v2","github_delete_comment","github_delete_comment_reaction","github_delete_comment_reaction_v2","github_delete_comment_v2","github_delete_file","github_delete_file_v2","github_delete_gist","github_delete_gist_v2","github_delete_issue_reaction","github_delete_issue_reaction_v2","github_delete_milestone","github_delete_milestone_v2","github_delete_project","github_delete_project_v2","github_delete_release","github_delete_release_v2","github_fork_gist","github_fork_gist_v2","github_fork_repo","github_fork_repo_v2","github_get_branch","github_get_branch_protection","github_get_branch_protection_v2","github_get_branch_v2","github_get_commit","github_get_commit_v2","github_get_file_content","github_get_file_content_v2","github_get_gist","github_get_gist_v2","github_get_issue","github_get_issue_v2","github_get_latest_release","github_get_latest_release_v2","github_get_milestone","github_get_milestone_v2","github_get_pr_files","github_get_pr_files_v2","github_get_project","github_get_project_v2","github_get_readme","github_get_readme_v2","github_get_release","github_get_release_v2","github_get_tree","github_get_tree_v2","github_get_workflow","github_get_workflow_run","github_get_workflow_run_v2","github_get_workflow_v2","github_issue_comment","github_issue_comment_v2","github_job_logs","github_latest_commit","github_latest_commit_v2","github_list_branches","github_list_branches_v2","github_list_commits","github_list_commits_v2","github_list_forks","github_list_forks_v2","github_list_gists","github_list_gists_v2","github_list_issue_comments","github_list_issue_comments_v2","github_list_issues","github_list_issues_v2","github_list_milestones","github_list_milestones_v2","github_list_pr_comments","github_list_pr_comments_v2","github_list_projects","github_list_projects_v2","github_list_prs","github_list_prs_v2","github_list_releases","github_list_releases_v2","github_list_review_threads","github_list_stargazers","github_list_stargazers_v2","github_list_tags","github_list_tags_v2","github_list_workflow_runs","github_list_workflow_runs_v2","github_list_workflows","github_list_workflows_v2","github_merge_pr","github_merge_pr_v2","github_pr","github_pr_v2","github_remove_label","github_remove_label_v2","github_reply_review_thread","github_repo_info","github_repo_info_v2","github_request_reviewers","github_request_reviewers_v2","github_rerun_workflow","github_rerun_workflow_v2","github_resolve_review_thread","github_search_code","github_search_code_v2","github_search_commits","github_search_commits_v2","github_search_issues","github_search_issues_v2","github_search_repos","github_search_repos_v2","github_search_users","github_search_users_v2","github_star_gist","github_star_gist_v2","github_star_repo","github_star_repo_v2","github_status_check_rollup","github_trigger_workflow","github_trigger_workflow_v2","github_unstar_gist","github_unstar_gist_v2","github_unstar_repo","github_unstar_repo_v2","github_update_branch_protection","github_update_branch_protection_v2","github_update_comment","github_update_comment_v2","github_update_file","github_update_file_v2","github_update_gist","github_update_gist_v2","github_update_issue","github_update_issue_v2","github_update_milestone","github_update_milestone_v2","github_update_pr","github_update_pr_v2","github_update_project","github_update_project_v2","github_update_release","github_update_release_v2","gitlab_activate_user","gitlab_add_member","gitlab_add_saml_group_link","gitlab_approve_access_request","gitlab_approve_merge_request","gitlab_approve_user","gitlab_ban_user","gitlab_block_user","gitlab_cancel_pipeline","gitlab_compare_branches","gitlab_create_branch","gitlab_create_file","gitlab_create_issue","gitlab_create_issue_note","gitlab_create_merge_request","gitlab_create_merge_request_note","gitlab_create_pipeline","gitlab_create_release","gitlab_create_user","gitlab_deactivate_user","gitlab_delete_branch","gitlab_delete_issue","gitlab_delete_saml_group_link","gitlab_delete_user","gitlab_delete_user_identity","gitlab_deny_access_request","gitlab_get_file","gitlab_get_group","gitlab_get_issue","gitlab_get_job_log","gitlab_get_merge_request","gitlab_get_merge_request_changes","gitlab_get_pipeline","gitlab_get_project","gitlab_invite_member","gitlab_list_access_requests","gitlab_list_branches","gitlab_list_commits","gitlab_list_groups","gitlab_list_invitations","gitlab_list_issues","gitlab_list_members","gitlab_list_merge_requests","gitlab_list_pipeline_jobs","gitlab_list_pipelines","gitlab_list_projects","gitlab_list_releases","gitlab_list_repository_tree","gitlab_list_saml_group_links","gitlab_list_user_memberships","gitlab_merge_merge_request","gitlab_play_job","gitlab_reject_user","gitlab_remove_member","gitlab_retry_pipeline","gitlab_revoke_invitation","gitlab_search_users","gitlab_unban_user","gitlab_unblock_user","gitlab_update_file","gitlab_update_invitation","gitlab_update_issue","gitlab_update_member","gitlab_update_merge_request","gitlab_update_user","gmail_add_label","gmail_add_label_v2","gmail_archive","gmail_archive_v2","gmail_create_label_v2","gmail_delete","gmail_delete_draft_v2","gmail_delete_label_v2","gmail_delete_v2","gmail_draft","gmail_draft_v2","gmail_edit_draft_v2","gmail_get_draft_v2","gmail_get_thread_v2","gmail_list_drafts_v2","gmail_list_labels_v2","gmail_list_threads_v2","gmail_mark_read","gmail_mark_read_v2","gmail_mark_unread","gmail_mark_unread_v2","gmail_move","gmail_move_v2","gmail_read","gmail_read_v2","gmail_remove_label","gmail_remove_label_v2","gmail_search","gmail_search_v2","gmail_send","gmail_send_v2","gmail_trash_thread_v2","gmail_unarchive","gmail_unarchive_v2","gmail_untrash_thread_v2","gmail_update_label_v2","gong_aggregate_activity","gong_aggregate_by_period","gong_answered_scorecards","gong_ask_anything","gong_assign_flow_prospects","gong_create_call","gong_day_by_day_activity","gong_get_brief","gong_get_call","gong_get_call_transcript","gong_get_coaching","gong_get_extensive_calls","gong_get_folder_content","gong_get_logs","gong_get_prospect_flows","gong_get_user","gong_interaction_stats","gong_list_calls","gong_list_flows","gong_list_library_folders","gong_list_scorecards","gong_list_trackers","gong_list_users","gong_list_workspaces","gong_lookup_email","gong_lookup_phone","gong_purge_email_address","gong_purge_phone_number","gong_unassign_flow_prospects","google_ads_ad_performance","google_ads_campaign_performance","google_ads_list_ad_groups","google_ads_list_campaigns","google_ads_list_customers","google_ads_search","google_appsheet_add_rows","google_appsheet_delete_rows","google_appsheet_edit_rows","google_appsheet_find_rows","google_bigquery_create_dataset","google_bigquery_create_table","google_bigquery_delete_dataset","google_bigquery_delete_table","google_bigquery_get_query_results","google_bigquery_get_table","google_bigquery_insert_rows","google_bigquery_list_datasets","google_bigquery_list_table_data","google_bigquery_list_tables","google_bigquery_query","google_books_volume_details","google_books_volume_search","google_calendar_create","google_calendar_create_calendar","google_calendar_create_calendar_v2","google_calendar_create_v2","google_calendar_delete","google_calendar_delete_calendar","google_calendar_delete_calendar_v2","google_calendar_delete_v2","google_calendar_freebusy","google_calendar_freebusy_v2","google_calendar_get","google_calendar_get_v2","google_calendar_instances","google_calendar_instances_v2","google_calendar_invite","google_calendar_invite_v2","google_calendar_list","google_calendar_list_acl","google_calendar_list_acl_v2","google_calendar_list_calendars","google_calendar_list_calendars_v2","google_calendar_list_v2","google_calendar_move","google_calendar_move_v2","google_calendar_quick_add","google_calendar_quick_add_v2","google_calendar_share_calendar","google_calendar_share_calendar_v2","google_calendar_unshare_calendar","google_calendar_unshare_calendar_v2","google_calendar_update","google_calendar_update_acl","google_calendar_update_acl_v2","google_calendar_update_calendar","google_calendar_update_calendar_v2","google_calendar_update_v2","google_contacts_create","google_contacts_delete","google_contacts_get","google_contacts_list","google_contacts_search","google_contacts_update","google_docs_create","google_docs_create_named_range","google_docs_create_paragraph_bullets","google_docs_delete_content_range","google_docs_delete_named_range","google_docs_delete_paragraph_bullets","google_docs_insert_image","google_docs_insert_page_break","google_docs_insert_table","google_docs_insert_text","google_docs_read","google_docs_replace_text","google_docs_update_paragraph_style","google_docs_update_text_style","google_docs_write","google_drive_copy","google_drive_create_comment","google_drive_create_folder","google_drive_delete","google_drive_delete_comment","google_drive_download","google_drive_export","google_drive_get_about","google_drive_get_content","google_drive_get_file","google_drive_get_revision","google_drive_list","google_drive_list_comments","google_drive_list_permissions","google_drive_list_revisions","google_drive_move","google_drive_search","google_drive_share","google_drive_trash","google_drive_unshare","google_drive_untrash","google_drive_update","google_drive_upload","google_forms_batch_update","google_forms_create_form","google_forms_create_watch","google_forms_delete_watch","google_forms_get_form","google_forms_get_responses","google_forms_list_watches","google_forms_renew_watch","google_forms_set_publish_settings","google_groups_add_alias","google_groups_add_member","google_groups_create_group","google_groups_delete_group","google_groups_get_group","google_groups_get_member","google_groups_get_settings","google_groups_has_member","google_groups_list_aliases","google_groups_list_groups","google_groups_list_members","google_groups_remove_alias","google_groups_remove_member","google_groups_update_group","google_groups_update_member","google_groups_update_settings","google_maps_air_quality","google_maps_directions","google_maps_distance_matrix","google_maps_elevation","google_maps_geocode","google_maps_geolocate","google_maps_place_details","google_maps_places_nearby","google_maps_places_search","google_maps_pollen","google_maps_reverse_geocode","google_maps_snap_to_roads","google_maps_solar","google_maps_speed_limits","google_maps_timezone","google_maps_validate_address","google_meet_create_space","google_meet_end_conference","google_meet_get_conference_record","google_meet_get_space","google_meet_list_conference_records","google_meet_list_participants","google_pagespeed_analyze","google_search","google_sheets_append","google_sheets_append_v2","google_sheets_batch_clear_v2","google_sheets_batch_get_v2","google_sheets_batch_update_v2","google_sheets_clear_v2","google_sheets_copy_sheet_v2","google_sheets_create_spreadsheet_v2","google_sheets_delete_rows_v2","google_sheets_delete_sheet_v2","google_sheets_delete_spreadsheet_v2","google_sheets_get_spreadsheet_v2","google_sheets_read","google_sheets_read_v2","google_sheets_update","google_sheets_update_v2","google_sheets_write","google_sheets_write_v2","google_slides_add_image","google_slides_add_slide","google_slides_batch_update","google_slides_copy_presentation","google_slides_create","google_slides_create_line","google_slides_create_paragraph_bullets","google_slides_create_shape","google_slides_create_sheets_chart","google_slides_create_table","google_slides_create_video","google_slides_delete_object","google_slides_delete_paragraph_bullets","google_slides_delete_table_column","google_slides_delete_table_row","google_slides_delete_text","google_slides_duplicate_object","google_slides_export_presentation","google_slides_get_page","google_slides_get_thumbnail","google_slides_group_objects","google_slides_insert_table_columns","google_slides_insert_table_rows","google_slides_insert_text","google_slides_merge_table_cells","google_slides_read","google_slides_refresh_sheets_chart","google_slides_replace_all_shapes_with_image","google_slides_replace_all_shapes_with_sheets_chart","google_slides_replace_all_text","google_slides_replace_image","google_slides_reroute_line","google_slides_ungroup_objects","google_slides_unmerge_table_cells","google_slides_update_image_properties","google_slides_update_line_category","google_slides_update_line_properties","google_slides_update_page_element_alt_text","google_slides_update_page_element_transform","google_slides_update_page_elements_z_order","google_slides_update_page_properties","google_slides_update_paragraph_style","google_slides_update_shape_properties","google_slides_update_slide_properties","google_slides_update_slides_position","google_slides_update_table_border_properties","google_slides_update_table_cell_properties","google_slides_update_table_column_properties","google_slides_update_table_row_properties","google_slides_update_text_style","google_slides_update_video_properties","google_slides_write","google_tasks_create","google_tasks_delete","google_tasks_get","google_tasks_list","google_tasks_list_task_lists","google_tasks_update","google_translate_detect","google_translate_text","google_vault_add_held_accounts","google_vault_add_matters_permissions","google_vault_close_matters","google_vault_create_matters","google_vault_create_matters_export","google_vault_create_matters_holds","google_vault_create_saved_query","google_vault_delete_matters","google_vault_delete_matters_export","google_vault_delete_matters_holds","google_vault_delete_saved_query","google_vault_download_export_file","google_vault_list_matters","google_vault_list_matters_export","google_vault_list_matters_holds","google_vault_list_saved_queries","google_vault_remove_held_accounts","google_vault_remove_matters_permissions","google_vault_reopen_matters","google_vault_undelete_matters","google_vault_update_matters","google_vault_update_matters_holds","grafana_check_data_source_health","grafana_create_alert_rule","grafana_create_annotation","grafana_create_contact_point","grafana_create_dashboard","grafana_create_folder","grafana_delete_alert_rule","grafana_delete_annotation","grafana_delete_contact_point","grafana_delete_dashboard","grafana_delete_folder","grafana_get_alert_rule","grafana_get_alert_rule_group","grafana_get_dashboard","grafana_get_data_source","grafana_get_folder","grafana_get_health","grafana_list_alert_rules","grafana_list_annotations","grafana_list_contact_points","grafana_list_dashboards","grafana_list_data_sources","grafana_list_folders","grafana_move_folder","grafana_query_data_source","grafana_update_alert_rule","grafana_update_annotation","grafana_update_contact_point","grafana_update_dashboard","grafana_update_folder","grain_create_hook","grain_create_hook_v2","grain_delete_hook","grain_delete_hook_v2","grain_get_recording","grain_get_transcript","grain_list_hooks","grain_list_hooks_v2","grain_list_meeting_types","grain_list_recordings","grain_list_teams","grain_list_views","granola_create_webhook_endpoint","granola_delete_webhook_endpoint","granola_get_note","granola_get_transcript","granola_list_audit_events","granola_list_folders","granola_list_notes","granola_list_webhook_endpoints","granola_update_webhook_endpoint","greenhouse_get_application","greenhouse_get_candidate","greenhouse_get_job","greenhouse_get_user","greenhouse_list_applications","greenhouse_list_candidates","greenhouse_list_departments","greenhouse_list_job_stages","greenhouse_list_jobs","greenhouse_list_offices","greenhouse_list_users","greptile_index_repo","greptile_query","greptile_search","greptile_status","guardrails_validate","harmonic_batch_get_people","harmonic_clear_people_saved_search_net_new_results","harmonic_enrich_person","harmonic_get_company_employees","harmonic_get_email_enrichment_job","harmonic_get_email_enrichment_usage","harmonic_get_enrichment_status","harmonic_get_people_saved_search_net_new_results","harmonic_get_people_saved_search_results","harmonic_get_person","harmonic_list_people_saved_searches","harmonic_search_people_scout","harmonic_submit_email_enrichment_job","hex_cancel_run","hex_create_collection","hex_create_group","hex_deactivate_user","hex_delete_group","hex_get_collection","hex_get_data_connection","hex_get_group","hex_get_project","hex_get_project_runs","hex_get_queried_tables","hex_get_run_status","hex_list_collections","hex_list_data_connections","hex_list_groups","hex_list_projects","hex_list_users","hex_run_project","hex_update_collection","hex_update_group","hex_update_project","http_request","hubspot_add_list_memberships","hubspot_create_appointment","hubspot_create_association","hubspot_create_company","hubspot_create_contact","hubspot_create_deal","hubspot_create_email","hubspot_create_line_item","hubspot_create_list","hubspot_create_note","hubspot_create_ticket","hubspot_delete_association","hubspot_delete_company","hubspot_delete_contact","hubspot_delete_deal","hubspot_delete_line_item","hubspot_delete_ticket","hubspot_get_appointment","hubspot_get_association_labels","hubspot_get_cart","hubspot_get_company","hubspot_get_contact","hubspot_get_deal","hubspot_get_email","hubspot_get_line_item","hubspot_get_list","hubspot_get_list_memberships","hubspot_get_marketing_event","hubspot_get_note","hubspot_get_properties","hubspot_get_quote","hubspot_get_ticket","hubspot_get_users","hubspot_list_appointments","hubspot_list_associations","hubspot_list_carts","hubspot_list_companies","hubspot_list_contacts","hubspot_list_deals","hubspot_list_emails","hubspot_list_line_items","hubspot_list_lists","hubspot_list_marketing_events","hubspot_list_notes","hubspot_list_owners","hubspot_list_quotes","hubspot_list_tickets","hubspot_remove_list_memberships","hubspot_search_companies","hubspot_search_contacts","hubspot_search_deals","hubspot_search_emails","hubspot_search_line_items","hubspot_search_notes","hubspot_search_quotes","hubspot_search_tickets","hubspot_update_appointment","hubspot_update_company","hubspot_update_contact","hubspot_update_deal","hubspot_update_line_item","hubspot_update_ticket","huggingface_chat","hunter_companies_find","hunter_discover","hunter_domain_search","hunter_email_count","hunter_email_finder","hunter_email_verifier","iam_add_user_to_group","iam_attach_role_policy","iam_attach_user_policy","iam_create_access_key","iam_create_role","iam_create_user","iam_delete_access_key","iam_delete_role","iam_delete_user","iam_detach_role_policy","iam_detach_user_policy","iam_get_role","iam_get_user","iam_list_attached_role_policies","iam_list_attached_user_policies","iam_list_groups","iam_list_policies","iam_list_roles","iam_list_users","iam_remove_user_from_group","iam_simulate_principal_policy","icypeas_find_email","icypeas_verify_email","identity_center_check_assignment_deletion_status","identity_center_check_assignment_status","identity_center_create_account_assignment","identity_center_delete_account_assignment","identity_center_describe_account","identity_center_get_group","identity_center_get_user","identity_center_list_account_assignments","identity_center_list_accounts","identity_center_list_groups","identity_center_list_instances","identity_center_list_permission_sets","image_generate","incidentio_actions_create","incidentio_actions_list","incidentio_actions_show","incidentio_actions_update","incidentio_alert_events_create","incidentio_alerts_list","incidentio_alerts_resolve","incidentio_alerts_show","incidentio_catalog_entries_list","incidentio_catalog_types_list","incidentio_custom_fields_create","incidentio_custom_fields_delete","incidentio_custom_fields_list","incidentio_custom_fields_show","incidentio_custom_fields_update","incidentio_escalation_paths_create","incidentio_escalation_paths_delete","incidentio_escalation_paths_list","incidentio_escalation_paths_show","incidentio_escalation_paths_update","incidentio_escalations_cancel","incidentio_escalations_create","incidentio_escalations_list","incidentio_escalations_show","incidentio_follow_ups_create","incidentio_follow_ups_list","incidentio_follow_ups_show","incidentio_follow_ups_update","incidentio_incident_alerts_list","incidentio_incident_memberships_create","incidentio_incident_memberships_revoke","incidentio_incident_participants_list","incidentio_incident_roles_create","incidentio_incident_roles_delete","incidentio_incident_roles_list","incidentio_incident_roles_show","incidentio_incident_roles_update","incidentio_incident_statuses_list","incidentio_incident_timestamps_list","incidentio_incident_timestamps_show","incidentio_incident_types_list","incidentio_incident_updates_list","incidentio_incidents_create","incidentio_incidents_list","incidentio_incidents_show","incidentio_incidents_update","incidentio_on_call_now","incidentio_schedule_entries_list","incidentio_schedule_overrides_create","incidentio_schedule_overrides_list","incidentio_schedules_create","incidentio_schedules_delete","incidentio_schedules_list","incidentio_schedules_show","incidentio_schedules_update","incidentio_severities_list","incidentio_teams_list","incidentio_teams_show","incidentio_users_list","incidentio_users_show","incidentio_workflows_create","incidentio_workflows_delete","incidentio_workflows_list","incidentio_workflows_show","incidentio_workflows_update","infisical_create_secret","infisical_delete_secret","infisical_get_secret","infisical_list_secrets","infisical_update_secret","instagram_delete_comment","instagram_download_media","instagram_get_account_insights","instagram_get_container_status","instagram_get_conversation_messages","instagram_get_media","instagram_get_media_insights","instagram_get_message","instagram_get_profile","instagram_get_publishing_limit","instagram_hide_comment","instagram_list_comments","instagram_list_conversations","instagram_list_media","instagram_list_stories","instagram_private_reply","instagram_publish_carousel","instagram_publish_image","instagram_publish_reel","instagram_publish_story","instagram_publish_video","instagram_reply_to_comment","instagram_send_text_message","instagram_set_comments_enabled","instantly_activate_campaign","instantly_create_campaign","instantly_create_lead","instantly_create_lead_list","instantly_delete_campaign","instantly_delete_leads","instantly_get_lead","instantly_list_campaigns","instantly_list_emails","instantly_list_lead_lists","instantly_list_leads","instantly_patch_campaign","instantly_patch_lead","instantly_pause_campaign","instantly_reply_to_email","instantly_update_lead_interest_status","intercom_assign_conversation_v2","intercom_attach_contact_to_company_v2","intercom_close_conversation_v2","intercom_create_company","intercom_create_company_v2","intercom_create_contact","intercom_create_contact_v2","intercom_create_event_v2","intercom_create_message","intercom_create_message_v2","intercom_create_note_v2","intercom_create_tag_v2","intercom_create_ticket","intercom_create_ticket_v2","intercom_delete_contact","intercom_delete_contact_v2","intercom_detach_contact_from_company_v2","intercom_get_company","intercom_get_company_v2","intercom_get_contact","intercom_get_contact_v2","intercom_get_conversation","intercom_get_conversation_v2","intercom_get_ticket","intercom_get_ticket_v2","intercom_list_admins_v2","intercom_list_companies","intercom_list_companies_v2","intercom_list_contacts","intercom_list_contacts_v2","intercom_list_conversations","intercom_list_conversations_v2","intercom_list_tags_v2","intercom_open_conversation_v2","intercom_reply_conversation","intercom_reply_conversation_v2","intercom_search_contacts","intercom_search_contacts_v2","intercom_search_conversations","intercom_search_conversations_v2","intercom_snooze_conversation_v2","intercom_tag_contact_v2","intercom_tag_conversation_v2","intercom_untag_contact_v2","intercom_update_contact","intercom_update_contact_v2","intercom_update_ticket_v2","jina_read_url","jina_search","jira_add_attachment","jira_add_comment","jira_add_watcher","jira_add_worklog","jira_assign_issue","jira_bulk_read","jira_create_issue_link","jira_delete_attachment","jira_delete_comment","jira_delete_issue","jira_delete_issue_link","jira_delete_worklog","jira_get_attachments","jira_get_comments","jira_get_fields","jira_get_project","jira_get_transitions","jira_get_users","jira_get_worklogs","jira_list_issue_types","jira_list_projects","jira_remove_watcher","jira_retrieve","jira_search_issues","jira_search_users","jira_transition_issue","jira_update","jira_update_comment","jira_update_worklog","jira_write","jotform_add_label_resources","jotform_clone_form","jotform_create_form","jotform_create_label","jotform_create_question","jotform_create_questions","jotform_create_report","jotform_create_submission","jotform_create_submissions","jotform_create_webhook","jotform_delete_form","jotform_delete_label","jotform_delete_question","jotform_delete_report","jotform_delete_submission","jotform_delete_webhook","jotform_get_form","jotform_get_form_properties","jotform_get_history","jotform_get_label","jotform_get_question","jotform_get_report","jotform_get_settings","jotform_get_submission","jotform_get_usage","jotform_get_user","jotform_list_form_files","jotform_list_form_reports","jotform_list_form_submissions","jotform_list_forms","jotform_list_label_resources","jotform_list_labels","jotform_list_questions","jotform_list_reports","jotform_list_submissions","jotform_list_subusers","jotform_list_webhooks","jotform_remove_label_resources","jotform_update_form_properties","jotform_update_label","jotform_update_question","jotform_update_settings","jotform_update_submission","jsm_add_comment","jsm_add_customer","jsm_add_organization","jsm_add_participants","jsm_answer_approval","jsm_attach_form","jsm_copy_forms","jsm_create_object","jsm_create_organization","jsm_create_request","jsm_delete_form","jsm_delete_object","jsm_externalise_form","jsm_get_approvals","jsm_get_comments","jsm_get_customers","jsm_get_form","jsm_get_form_answers","jsm_get_form_structure","jsm_get_form_templates","jsm_get_issue_forms","jsm_get_object","jsm_get_object_schema","jsm_get_object_type_attributes","jsm_get_organizations","jsm_get_participants","jsm_get_queues","jsm_get_request","jsm_get_request_type_fields","jsm_get_request_types","jsm_get_requests","jsm_get_service_desks","jsm_get_sla","jsm_get_transitions","jsm_internalise_form","jsm_list_object_schemas","jsm_list_object_types","jsm_reopen_form","jsm_save_form_answers","jsm_search_objects_aql","jsm_submit_form","jsm_transition_request","jsm_update_object","jupyter_copy_content","jupyter_create_file","jupyter_create_session","jupyter_delete_content","jupyter_delete_session","jupyter_get_content","jupyter_interrupt_kernel","jupyter_list_contents","jupyter_list_kernels","jupyter_list_kernelspecs","jupyter_list_sessions","jupyter_rename_content","jupyter_restart_kernel","jupyter_start_kernel","jupyter_stop_kernel","jupyter_upload_file","kalshi_amend_order","kalshi_amend_order_v2","kalshi_cancel_order","kalshi_cancel_order_v2","kalshi_create_order","kalshi_create_order_v2","kalshi_get_balance","kalshi_get_balance_v2","kalshi_get_candlesticks","kalshi_get_candlesticks_v2","kalshi_get_event","kalshi_get_event_candlesticks","kalshi_get_event_candlesticks_v2","kalshi_get_event_v2","kalshi_get_events","kalshi_get_events_v2","kalshi_get_exchange_announcements","kalshi_get_exchange_announcements_v2","kalshi_get_exchange_schedule","kalshi_get_exchange_schedule_v2","kalshi_get_exchange_status","kalshi_get_exchange_status_v2","kalshi_get_fills","kalshi_get_fills_v2","kalshi_get_market","kalshi_get_market_v2","kalshi_get_markets","kalshi_get_markets_v2","kalshi_get_order","kalshi_get_order_v2","kalshi_get_orderbook","kalshi_get_orderbook_v2","kalshi_get_orders","kalshi_get_orders_v2","kalshi_get_positions","kalshi_get_positions_v2","kalshi_get_series_by_ticker","kalshi_get_series_by_ticker_v2","kalshi_get_series_list","kalshi_get_series_list_v2","kalshi_get_settlements","kalshi_get_settlements_v2","kalshi_get_trades","kalshi_get_trades_v2","ketch_get_consent","ketch_get_subscriptions","ketch_invoke_right","ketch_set_consent","ketch_set_subscriptions","knowledge_create_document","knowledge_delete_chunk","knowledge_delete_document","knowledge_get_connector","knowledge_get_document","knowledge_list_chunks","knowledge_list_connectors","knowledge_list_documents","knowledge_list_tags","knowledge_search","knowledge_trigger_sync","knowledge_update_chunk","knowledge_upload_chunk","knowledge_upsert_document","lambda_add_permission","lambda_create_alias","lambda_create_event_source_mapping","lambda_create_function","lambda_create_function_url_config","lambda_delete_alias","lambda_delete_event_source_mapping","lambda_delete_function","lambda_delete_function_concurrency","lambda_delete_function_event_invoke_config","lambda_delete_function_url_config","lambda_delete_provisioned_concurrency_config","lambda_get_account_settings","lambda_get_alias","lambda_get_event_source_mapping","lambda_get_function","lambda_get_function_concurrency","lambda_get_function_configuration","lambda_get_function_event_invoke_config","lambda_get_function_recursion_config","lambda_get_function_url_config","lambda_get_layer_version","lambda_get_policy","lambda_get_provisioned_concurrency_config","lambda_get_runtime_management_config","lambda_invoke","lambda_list_aliases","lambda_list_event_source_mappings","lambda_list_function_event_invoke_configs","lambda_list_function_url_configs","lambda_list_functions","lambda_list_layer_versions","lambda_list_layers","lambda_list_provisioned_concurrency_configs","lambda_list_tags","lambda_list_versions_by_function","lambda_publish_version","lambda_put_function_concurrency","lambda_put_function_event_invoke_config","lambda_put_function_recursion_config","lambda_put_provisioned_concurrency_config","lambda_put_runtime_management_config","lambda_remove_permission","lambda_tag_resource","lambda_untag_resource","lambda_update_alias","lambda_update_event_source_mapping","lambda_update_function_code","lambda_update_function_configuration","lambda_update_function_url_config","langsmith_create_feedback","langsmith_create_run","langsmith_create_runs_batch","langsmith_get_run","langsmith_update_run","latex_compile","latex_get_package","latex_list_fonts","latex_search_packages","launchdarkly_create_flag","launchdarkly_delete_flag","launchdarkly_get_audit_log","launchdarkly_get_flag","launchdarkly_get_flag_status","launchdarkly_list_environments","launchdarkly_list_flags","launchdarkly_list_members","launchdarkly_list_projects","launchdarkly_list_segments","launchdarkly_toggle_flag","launchdarkly_update_flag","leadmagic_company_search","leadmagic_email_to_profile","leadmagic_find_email","leadmagic_find_mobile","leadmagic_get_credits","leadmagic_profile_search","leadmagic_profile_to_email","leadmagic_role_finder","leadmagic_validate_email","lemlist_get_activities","lemlist_get_lead","lemlist_send_email","linear_add_label_to_issue","linear_add_label_to_project","linear_archive_issue","linear_archive_label","linear_archive_project","linear_create_attachment","linear_create_comment","linear_create_customer","linear_create_customer_request","linear_create_customer_status","linear_create_customer_tier","linear_create_cycle","linear_create_favorite","linear_create_issue","linear_create_issue_relation","linear_create_label","linear_create_project","linear_create_project_label","linear_create_project_milestone","linear_create_project_status","linear_create_project_update","linear_create_workflow_state","linear_delete_attachment","linear_delete_comment","linear_delete_customer","linear_delete_customer_status","linear_delete_customer_tier","linear_delete_issue","linear_delete_issue_relation","linear_delete_project","linear_delete_project_label","linear_delete_project_milestone","linear_delete_project_status","linear_get_active_cycle","linear_get_customer","linear_get_cycle","linear_get_issue","linear_get_project","linear_get_viewer","linear_list_attachments","linear_list_comments","linear_list_customer_requests","linear_list_customer_statuses","linear_list_customer_tiers","linear_list_customers","linear_list_cycles","linear_list_favorites","linear_list_issue_relations","linear_list_labels","linear_list_notifications","linear_list_project_labels","linear_list_project_milestones","linear_list_project_statuses","linear_list_project_updates","linear_list_projects","linear_list_teams","linear_list_users","linear_list_workflow_states","linear_merge_customers","linear_read_issues","linear_remove_label_from_issue","linear_remove_label_from_project","linear_search_issues","linear_unarchive_issue","linear_update_attachment","linear_update_comment","linear_update_customer","linear_update_customer_request","linear_update_customer_status","linear_update_customer_tier","linear_update_issue","linear_update_label","linear_update_notification","linear_update_project","linear_update_project_label","linear_update_project_milestone","linear_update_project_status","linear_update_workflow_state","linkedin_get_profile","linkedin_share_post","linkup_search","linq_add_participant","linq_check_imessage","linq_check_rcs","linq_create_attachment","linq_create_chat","linq_create_contact_card","linq_create_webhook_subscription","linq_delete_attachment","linq_delete_message","linq_delete_webhook_subscription","linq_edit_message","linq_get_attachment","linq_get_chat","linq_get_contact_card","linq_get_message","linq_get_webhook_subscription","linq_leave_chat","linq_list_chats","linq_list_messages","linq_list_phone_numbers","linq_list_thread","linq_list_webhook_events","linq_list_webhook_subscriptions","linq_mark_chat_read","linq_react_to_message","linq_remove_participant","linq_send_message","linq_send_voice_memo","linq_share_contact_card","linq_start_typing","linq_stop_typing","linq_update_chat","linq_update_contact_card","linq_update_webhook_subscription","llm_chat","logfire_get_token_info","logfire_get_trace","logfire_query","logfire_search_records","logrocket_create_release","logrocket_get_audit_logs","logrocket_get_highlights","logrocket_identify_user","logrocket_list_exported_sessions","logrocket_request_highlights","logs_get","logs_get_execution","logs_get_run_details","logs_query","logs_query_runs","loops_check_contact_suppression","loops_create_contact","loops_create_contact_property","loops_delete_contact","loops_find_contact","loops_get_transactional_email","loops_list_contact_properties","loops_list_mailing_lists","loops_list_transactional_emails","loops_remove_contact_suppression","loops_send_event","loops_send_transactional_email","loops_update_contact","luma_add_guests","luma_cancel_event","luma_create_event","luma_get_event","luma_get_guest","luma_get_guests","luma_list_events","luma_lookup_event","luma_send_invites","luma_update_event","luma_update_guest_status","mailchimp_add_member","mailchimp_add_member_tags","mailchimp_add_or_update_member","mailchimp_add_segment_member","mailchimp_add_subscriber_to_automation","mailchimp_archive_member","mailchimp_create_audience","mailchimp_create_batch_operation","mailchimp_create_campaign","mailchimp_create_interest","mailchimp_create_interest_category","mailchimp_create_landing_page","mailchimp_create_merge_field","mailchimp_create_segment","mailchimp_create_template","mailchimp_delete_audience","mailchimp_delete_batch_operation","mailchimp_delete_campaign","mailchimp_delete_interest","mailchimp_delete_interest_category","mailchimp_delete_landing_page","mailchimp_delete_member","mailchimp_delete_merge_field","mailchimp_delete_segment","mailchimp_delete_template","mailchimp_get_audience","mailchimp_get_audiences","mailchimp_get_automation","mailchimp_get_automations","mailchimp_get_batch_operation","mailchimp_get_batch_operations","mailchimp_get_campaign","mailchimp_get_campaign_content","mailchimp_get_campaign_report","mailchimp_get_campaign_reports","mailchimp_get_campaigns","mailchimp_get_interest","mailchimp_get_interest_categories","mailchimp_get_interest_category","mailchimp_get_interests","mailchimp_get_landing_page","mailchimp_get_landing_pages","mailchimp_get_member","mailchimp_get_member_tags","mailchimp_get_members","mailchimp_get_merge_field","mailchimp_get_merge_fields","mailchimp_get_segment","mailchimp_get_segment_members","mailchimp_get_segments","mailchimp_get_template","mailchimp_get_templates","mailchimp_pause_automation","mailchimp_publish_landing_page","mailchimp_remove_member_tags","mailchimp_remove_segment_member","mailchimp_replicate_campaign","mailchimp_schedule_campaign","mailchimp_send_campaign","mailchimp_set_campaign_content","mailchimp_start_automation","mailchimp_unarchive_member","mailchimp_unpublish_landing_page","mailchimp_unschedule_campaign","mailchimp_update_audience","mailchimp_update_campaign","mailchimp_update_interest","mailchimp_update_interest_category","mailchimp_update_landing_page","mailchimp_update_member","mailchimp_update_merge_field","mailchimp_update_segment","mailchimp_update_template","mailgun_add_list_member","mailgun_create_mailing_list","mailgun_get_domain","mailgun_get_mailing_list","mailgun_get_message","mailgun_list_domains","mailgun_list_messages","mailgun_send_message","managed_agent_archive_session","managed_agent_create_session","managed_agent_delete_session","managed_agent_get_session","managed_agent_interrupt_session","managed_agent_list_events","managed_agent_respond_custom_tool","managed_agent_respond_tool_confirmation","managed_agent_run_session","managed_agent_send_message","managed_agent_update_session","mem0_add_memories","mem0_get_memories","mem0_search_memories","memory_add","memory_delete","memory_get","memory_get_all","microsoft_ad_add_directory_role_member","microsoft_ad_add_group_member","microsoft_ad_add_user_app_role_assignment","microsoft_ad_assign_license","microsoft_ad_create_group","microsoft_ad_create_user","microsoft_ad_delete_group","microsoft_ad_delete_user","microsoft_ad_get_conditional_access_policy","microsoft_ad_get_device","microsoft_ad_get_group","microsoft_ad_get_user","microsoft_ad_list_authentication_methods","microsoft_ad_list_conditional_access_policies","microsoft_ad_list_devices","microsoft_ad_list_directory_audits","microsoft_ad_list_directory_role_members","microsoft_ad_list_directory_roles","microsoft_ad_list_group_members","microsoft_ad_list_groups","microsoft_ad_list_service_principal_app_role_assignments","microsoft_ad_list_service_principals","microsoft_ad_list_sign_ins","microsoft_ad_list_subscribed_skus","microsoft_ad_list_user_app_role_assignments","microsoft_ad_list_user_devices","microsoft_ad_list_user_licenses","microsoft_ad_list_users","microsoft_ad_remove_directory_role_member","microsoft_ad_remove_group_member","microsoft_ad_remove_user_app_role_assignment","microsoft_ad_reset_password","microsoft_ad_revoke_sign_in_sessions","microsoft_ad_set_password","microsoft_ad_update_group","microsoft_ad_update_user","microsoft_dataverse_associate","microsoft_dataverse_create_multiple","microsoft_dataverse_create_record","microsoft_dataverse_delete_record","microsoft_dataverse_disassociate","microsoft_dataverse_download_file","microsoft_dataverse_execute_action","microsoft_dataverse_execute_function","microsoft_dataverse_fetchxml_query","microsoft_dataverse_get_entity_metadata","microsoft_dataverse_get_record","microsoft_dataverse_list_records","microsoft_dataverse_search","microsoft_dataverse_update_multiple","microsoft_dataverse_update_record","microsoft_dataverse_upload_file","microsoft_dataverse_upsert_record","microsoft_dataverse_whoami","microsoft_excel_clear_range","microsoft_excel_create_table","microsoft_excel_delete_worksheet","microsoft_excel_format_range","microsoft_excel_read","microsoft_excel_read_v2","microsoft_excel_sort_range","microsoft_excel_table_add","microsoft_excel_worksheet_add","microsoft_excel_write","microsoft_excel_write_v2","microsoft_planner_create_bucket","microsoft_planner_create_plan","microsoft_planner_create_task","microsoft_planner_delete_bucket","microsoft_planner_delete_plan","microsoft_planner_delete_task","microsoft_planner_get_plan_details","microsoft_planner_get_task_details","microsoft_planner_list_buckets","microsoft_planner_list_plans","microsoft_planner_read_bucket","microsoft_planner_read_plan","microsoft_planner_read_task","microsoft_planner_update_bucket","microsoft_planner_update_plan","microsoft_planner_update_plan_details","microsoft_planner_update_task","microsoft_planner_update_task_details","microsoft_teams_delete_channel_message","microsoft_teams_delete_chat_message","microsoft_teams_get_message","microsoft_teams_list_channel_members","microsoft_teams_list_channels","microsoft_teams_list_chat_members","microsoft_teams_list_chats","microsoft_teams_list_team_members","microsoft_teams_list_teams","microsoft_teams_read_channel","microsoft_teams_read_chat","microsoft_teams_reply_to_message","microsoft_teams_set_reaction","microsoft_teams_unset_reaction","microsoft_teams_update_channel_message","microsoft_teams_update_chat_message","microsoft_teams_write_channel","microsoft_teams_write_chat","microsoft_word_append","microsoft_word_create","microsoft_word_create_from_template","microsoft_word_export_pdf","microsoft_word_list","microsoft_word_read","microsoft_word_replace_text","microsoft_word_update","millionverifier_get_credits","millionverifier_verify_email","mintlify_create_agent_job","mintlify_create_assistant_message","mintlify_detect_ai_prose","mintlify_get_agent_job","mintlify_get_assistant_caller_stats","mintlify_get_assistant_conversations","mintlify_get_feedback","mintlify_get_feedback_by_page","mintlify_get_page_content","mintlify_get_searches","mintlify_get_update_status","mintlify_get_views","mintlify_get_visitors","mintlify_search","mintlify_send_agent_message","mintlify_trigger_automation","mintlify_trigger_preview","mintlify_trigger_update","mistral_parser","mistral_parser_v2","mistral_parser_v3","modal_call_function","modal_chat_completion","modal_list_models","monday_archive_item","monday_change_column_value","monday_create_board","monday_create_column","monday_create_group","monday_create_item","monday_create_subitem","monday_create_update","monday_delete_item","monday_duplicate_item","monday_get_board","monday_get_groups","monday_get_item","monday_get_items","monday_list_boards","monday_move_item_to_group","monday_search_items","monday_update_item","mongodb_delete","mongodb_execute","mongodb_insert","mongodb_introspect","mongodb_query","mongodb_update","mssql_delete","mssql_execute","mssql_insert","mssql_introspect","mssql_query","mssql_update","mysql_delete","mysql_execute","mysql_insert","mysql_introspect","mysql_query","mysql_update","neo4j_create","neo4j_delete","neo4j_execute","neo4j_introspect","neo4j_merge","neo4j_query","neo4j_update","netsuite_attach_record","netsuite_batch_create_records","netsuite_batch_delete_records","netsuite_batch_get_records","netsuite_batch_update_records","netsuite_batch_upsert_records","netsuite_create_record","netsuite_delete_record","netsuite_detach_record","netsuite_execute_action","netsuite_execute_dataset","netsuite_execute_suiteql","netsuite_get_async_result","netsuite_get_async_status","netsuite_get_governance_limits","netsuite_get_record","netsuite_get_record_form","netsuite_get_record_metadata","netsuite_get_select_options","netsuite_get_server_time","netsuite_get_subresource","netsuite_list_datasets","netsuite_list_record_types","netsuite_list_records","netsuite_transform_record","netsuite_update_record","netsuite_upsert_record","neverbounce_get_credits","neverbounce_verify_email","new_relic_create_deployment_event","new_relic_get_entity","new_relic_nrql_query","new_relic_search_entities","notion_add_database_row","notion_add_database_row_v2","notion_append_blocks","notion_append_blocks_v2","notion_create_comment","notion_create_comment_v2","notion_create_database","notion_create_database_v2","notion_create_page","notion_create_page_v2","notion_delete_block","notion_delete_block_v2","notion_list_comments","notion_list_comments_v2","notion_list_users","notion_list_users_v2","notion_query_database","notion_query_database_v2","notion_read","notion_read_database","notion_read_database_v2","notion_read_v2","notion_retrieve_block","notion_retrieve_block_children","notion_retrieve_block_children_v2","notion_retrieve_block_v2","notion_retrieve_user","notion_retrieve_user_v2","notion_search","notion_search_v2","notion_update_block","notion_update_block_v2","notion_update_page","notion_update_page_v2","notion_write","notion_write_v2","obsidian_append_active","obsidian_append_note","obsidian_append_periodic_note","obsidian_create_note","obsidian_delete_note","obsidian_execute_command","obsidian_get_active","obsidian_get_note","obsidian_get_periodic_note","obsidian_list_commands","obsidian_list_files","obsidian_open_file","obsidian_patch_active","obsidian_patch_note","obsidian_search","okta_activate_group_rule","okta_activate_user","okta_add_user_to_group","okta_assign_group_to_app","okta_assign_user_role","okta_assign_user_to_app","okta_clear_user_sessions","okta_create_group","okta_create_group_rule","okta_create_user","okta_deactivate_group_rule","okta_deactivate_user","okta_delete_group","okta_delete_group_rule","okta_delete_user","okta_enroll_factor","okta_get_app","okta_get_factor","okta_get_group","okta_get_group_rule","okta_get_logs","okta_get_session","okta_get_user","okta_list_app_groups","okta_list_app_users","okta_list_apps","okta_list_factors","okta_list_group_members","okta_list_group_rules","okta_list_groups","okta_list_user_roles","okta_list_users","okta_remove_group_from_app","okta_remove_user_from_app","okta_remove_user_from_group","okta_remove_user_role","okta_reset_all_factors","okta_reset_factor","okta_reset_password","okta_revoke_session","okta_suspend_user","okta_unsuspend_user","okta_update_group","okta_update_user","onedrive_copy","onedrive_create_folder","onedrive_create_share_link","onedrive_delete","onedrive_download","onedrive_get_drive_info","onedrive_get_item","onedrive_list","onedrive_move","onedrive_search","onedrive_upload","onepassword_create_item","onepassword_delete_item","onepassword_get_item","onepassword_get_item_file","onepassword_get_vault","onepassword_list_items","onepassword_list_vaults","onepassword_replace_item","onepassword_resolve_secret","onepassword_update_item","openai_embeddings","openai_image","outlook_calendar_create_event","outlook_calendar_delete_event","outlook_calendar_get_event","outlook_calendar_list_events","outlook_calendar_respond","outlook_calendar_update_event","outlook_copy","outlook_create_folder","outlook_delete","outlook_draft","outlook_forward","outlook_get_attachment","outlook_list_attachments","outlook_list_folders","outlook_mark_read","outlook_mark_unread","outlook_move","outlook_read","outlook_reply","outlook_reply_all","outlook_search","outlook_send","outlook_update_message","pagerduty_add_note","pagerduty_create_incident","pagerduty_get_incident","pagerduty_get_service","pagerduty_list_escalation_policies","pagerduty_list_incident_alerts","pagerduty_list_incidents","pagerduty_list_oncalls","pagerduty_list_schedules","pagerduty_list_services","pagerduty_list_users","pagerduty_merge_incidents","pagerduty_send_event","pagerduty_snooze_incident","pagerduty_update_incident","parallel_deep_research","parallel_extract","parallel_search","pdl_autocomplete","pdl_bulk_company_enrich","pdl_bulk_person_enrich","pdl_clean_company","pdl_clean_location","pdl_clean_school","pdl_company_enrich","pdl_company_search","pdl_person_enrich","pdl_person_identify","pdl_person_search","perplexity_chat","perplexity_search","persona_approve_inquiry","persona_create_account","persona_create_inquiry","persona_create_report","persona_decline_inquiry","persona_expire_inquiry","persona_generate_inquiry_link","persona_get_account","persona_get_case","persona_get_document","persona_get_inquiry","persona_get_report","persona_get_verification","persona_import_accounts","persona_list_accounts","persona_list_cases","persona_list_inquiries","persona_list_inquiry_templates","persona_list_reports","persona_mark_inquiry_for_review","persona_print_inquiry_pdf","persona_redact_account","persona_redact_inquiry","persona_resume_inquiry","persona_update_account","persona_update_inquiry","pinecone_delete_vectors","pinecone_describe_index","pinecone_describe_index_stats","pinecone_fetch","pinecone_generate_embeddings","pinecone_list_indexes","pinecone_list_vector_ids","pinecone_search_text","pinecone_search_vector","pinecone_update_vector","pinecone_upsert_text","pipedrive_create_activity","pipedrive_create_deal","pipedrive_create_lead","pipedrive_create_project","pipedrive_delete_lead","pipedrive_get_activities","pipedrive_get_all_deals","pipedrive_get_deal","pipedrive_get_files","pipedrive_get_leads","pipedrive_get_mail_messages","pipedrive_get_mail_thread","pipedrive_get_pipeline_deals","pipedrive_get_pipelines","pipedrive_get_projects","pipedrive_update_activity","pipedrive_update_deal","pipedrive_update_lead","pitchbook_company_active_investors","pitchbook_company_bio","pitchbook_company_deal_service_providers","pitchbook_company_deals","pitchbook_company_financials","pitchbook_company_general_service_providers","pitchbook_company_industries","pitchbook_company_investors","pitchbook_company_most_recent_debt_financing","pitchbook_company_most_recent_financials","pitchbook_company_most_recent_financing","pitchbook_company_search","pitchbook_company_similar_companies","pitchbook_company_social_analytics","pitchbook_company_updates","pitchbook_company_vc_exit_predictions","pitchbook_contracts_history","pitchbook_cost_of_calls","pitchbook_credit_history","pitchbook_credit_news","pitchbook_credit_news_bulk","pitchbook_credit_news_most_recent","pitchbook_credit_news_search","pitchbook_deal_bio","pitchbook_deal_cap_table_history","pitchbook_deal_debt_lenders","pitchbook_deal_detailed","pitchbook_deal_investors","pitchbook_deal_multiples","pitchbook_deal_search","pitchbook_deal_service_providers","pitchbook_deal_stock_info","pitchbook_deal_tranche_info","pitchbook_deal_updates","pitchbook_deal_valuation","pitchbook_entity_affiliates","pitchbook_entity_locations","pitchbook_entity_news","pitchbook_entity_people","pitchbook_entity_updates","pitchbook_fund_active_investments","pitchbook_fund_benchmark","pitchbook_fund_bio","pitchbook_fund_cash_flows","pitchbook_fund_commitments","pitchbook_fund_investment_preferences","pitchbook_fund_investments","pitchbook_fund_performance","pitchbook_fund_search","pitchbook_fund_team","pitchbook_fund_updates","pitchbook_investor_active_investments","pitchbook_investor_bio","pitchbook_investor_board_seats","pitchbook_investor_deal_service_providers","pitchbook_investor_funds","pitchbook_investor_general_service_providers","pitchbook_investor_investments","pitchbook_investor_last_closed_fund","pitchbook_investor_preferences","pitchbook_investor_search","pitchbook_investor_updates","pitchbook_limited_partner_actual_allocations","pitchbook_limited_partner_bio","pitchbook_limited_partner_commitment_aggregates","pitchbook_limited_partner_commitment_preferences","pitchbook_limited_partner_commitments_detailed","pitchbook_limited_partner_search","pitchbook_limited_partner_service_providers","pitchbook_limited_partner_target_allocations","pitchbook_limited_partner_updates","pitchbook_lookup_table_structure","pitchbook_lookup_tables","pitchbook_patent_detailed","pitchbook_patent_search","pitchbook_people_search","pitchbook_person_bio","pitchbook_person_contact","pitchbook_person_education_work","pitchbook_sandbox_entities","pitchbook_search","pitchbook_service_provider_bio","pitchbook_service_provider_search","pitchbook_service_provider_updates","pitchbook_serviced_companies","pitchbook_serviced_deals","pitchbook_serviced_funds","pitchbook_serviced_investors","pitchbook_serviced_limited_partners","pitchbook_shared_search","pitchbook_usage_report","polymarket_get_activity","polymarket_get_event","polymarket_get_events","polymarket_get_holders","polymarket_get_last_trade_price","polymarket_get_leaderboard","polymarket_get_market","polymarket_get_markets","polymarket_get_midpoint","polymarket_get_orderbook","polymarket_get_positions","polymarket_get_price","polymarket_get_price_history","polymarket_get_series","polymarket_get_series_by_id","polymarket_get_spread","polymarket_get_tags","polymarket_get_tick_size","polymarket_get_trades","polymarket_search","postgresql_delete","postgresql_execute","postgresql_insert","postgresql_introspect","postgresql_query","postgresql_update","posthog_batch_events","posthog_capture_event","posthog_create_annotation","posthog_create_cohort","posthog_create_dashboard","posthog_create_experiment","posthog_create_feature_flag","posthog_create_insight","posthog_create_survey","posthog_delete_feature_flag","posthog_delete_person","posthog_delete_survey","posthog_evaluate_flags","posthog_get_cohort","posthog_get_dashboard","posthog_get_event_definition","posthog_get_experiment","posthog_get_feature_flag","posthog_get_insight","posthog_get_organization","posthog_get_person","posthog_get_project","posthog_get_property_definition","posthog_get_session_recording","posthog_get_survey","posthog_list_actions","posthog_list_annotations","posthog_list_cohorts","posthog_list_dashboards","posthog_list_event_definitions","posthog_list_experiments","posthog_list_feature_flags","posthog_list_insights","posthog_list_organizations","posthog_list_persons","posthog_list_projects","posthog_list_property_definitions","posthog_list_recording_playlists","posthog_list_session_recordings","posthog_list_surveys","posthog_query","posthog_update_cohort","posthog_update_event_definition","posthog_update_experiment","posthog_update_feature_flag","posthog_update_insight","posthog_update_property_definition","posthog_update_survey","profound_bot_logs","profound_bots_report","profound_category_assets","profound_category_personas","profound_category_prompts","profound_category_tags","profound_category_topics","profound_citation_prompts","profound_citations_report","profound_list_assets","profound_list_categories","profound_list_domains","profound_list_models","profound_list_optimizations","profound_list_personas","profound_list_regions","profound_optimization_analysis","profound_prompt_answers","profound_prompt_volume","profound_query_fanouts","profound_raw_logs","profound_referrals_report","profound_sentiment_report","profound_visibility_report","prospeo_account_information","prospeo_bulk_enrich_company","prospeo_bulk_enrich_person","prospeo_enrich_company","prospeo_enrich_person","prospeo_search_company","prospeo_search_person","prospeo_search_suggestions","pulse_parser","pulse_parser_v2","qdrant_fetch_points","qdrant_search_vector","qdrant_upsert_points","quartr_get_audio","quartr_get_company","quartr_get_event","quartr_get_event_summary","quartr_get_report","quartr_get_slide_deck","quartr_get_transcript","quartr_list_audio","quartr_list_companies","quartr_list_document_types","quartr_list_documents","quartr_list_event_types","quartr_list_events","quartr_list_live_events","quartr_list_reports","quartr_list_slide_decks","quartr_list_transcripts","quiver_image_to_svg","quiver_list_models","quiver_text_to_svg","rabbitmq_create_binding","rabbitmq_create_exchange","rabbitmq_create_policy","rabbitmq_create_queue","rabbitmq_delete_binding","rabbitmq_delete_exchange","rabbitmq_delete_policy","rabbitmq_delete_queue","rabbitmq_get_exchange","rabbitmq_get_messages","rabbitmq_get_overview","rabbitmq_get_queue","rabbitmq_health_check","rabbitmq_list_bindings","rabbitmq_list_channels","rabbitmq_list_connections","rabbitmq_list_consumers","rabbitmq_list_exchange_bindings","rabbitmq_list_exchanges","rabbitmq_list_nodes","rabbitmq_list_policies","rabbitmq_list_queues","rabbitmq_list_vhosts","rabbitmq_publish_message","rabbitmq_purge_queue","railway_create_environment","railway_create_project","railway_create_service","railway_delete_environment","railway_delete_project","railway_delete_service","railway_delete_variable","railway_deploy_service","railway_get_deployment","railway_get_deployment_logs","railway_get_project","railway_list_deployments","railway_list_project_members","railway_list_projects","railway_list_variables","railway_restart_deployment","railway_rollback_deployment","railway_transfer_project","railway_update_project","railway_upsert_variable","rb2b_credit_check","rb2b_email_to_activity","rb2b_hem_to_best_linkedin","rb2b_hem_to_business_profile","rb2b_hem_to_linkedin","rb2b_hem_to_maid","rb2b_ip_to_company","rb2b_ip_to_hem","rb2b_ip_to_maid","rb2b_linkedin_slug_search","rb2b_linkedin_to_best_personal_email","rb2b_linkedin_to_business_profile","rb2b_linkedin_to_hashed_emails","rb2b_linkedin_to_mobile_phone","rb2b_linkedin_to_personal_email","rds_delete","rds_execute","rds_insert","rds_introspect","rds_query","rds_update","reddit_delete","reddit_edit","reddit_get_comments","reddit_get_controversial","reddit_get_info","reddit_get_me","reddit_get_messages","reddit_get_posts","reddit_get_saved","reddit_get_subreddit_info","reddit_get_subreddit_rules","reddit_get_user","reddit_get_user_comments","reddit_get_user_posts","reddit_hide","reddit_hot_posts","reddit_list_my_subreddits","reddit_lock","reddit_mark_all_read","reddit_mark_read","reddit_marknsfw","reddit_mod_approve","reddit_mod_distinguish","reddit_mod_remove","reddit_mod_sticky","reddit_reply","reddit_report","reddit_save","reddit_search","reddit_search_subreddits","reddit_send_message","reddit_submit_post","reddit_subscribe","reddit_unhide","reddit_unlock","reddit_unmarknsfw","reddit_unsave","reddit_vote","redis_command","redis_delete","redis_exists","redis_expire","redis_get","redis_hdel","redis_hget","redis_hgetall","redis_hset","redis_incr","redis_incrby","redis_keys","redis_llen","redis_lpop","redis_lpush","redis_lrange","redis_persist","redis_rpop","redis_rpush","redis_set","redis_setnx","redis_ttl","reducto_parser","reducto_parser_v2","resend_cancel_email","resend_create_audience","resend_create_broadcast","resend_create_contact","resend_delete_audience","resend_delete_contact","resend_get_audience","resend_get_broadcast","resend_get_contact","resend_get_email","resend_list_audiences","resend_list_contacts","resend_list_domains","resend_send","resend_send_broadcast","resend_update_contact","revenuecat_create_purchase","revenuecat_defer_google_subscription","revenuecat_delete_customer","revenuecat_get_customer","revenuecat_grant_entitlement","revenuecat_list_offerings","revenuecat_refund_google_subscription","revenuecat_revoke_entitlement","revenuecat_revoke_google_subscription","revenuecat_update_subscriber_attributes","rippling_bulk_create_custom_object_records","rippling_bulk_delete_custom_object_records","rippling_bulk_update_custom_object_records","rippling_create_business_partner","rippling_create_business_partner_group","rippling_create_custom_app","rippling_create_custom_object","rippling_create_custom_object_field","rippling_create_custom_object_record","rippling_create_custom_page","rippling_create_custom_setting","rippling_create_department","rippling_create_draft_hires","rippling_create_object_category","rippling_create_title","rippling_create_work_location","rippling_delete_business_partner","rippling_delete_business_partner_group","rippling_delete_custom_app","rippling_delete_custom_object","rippling_delete_custom_object_field","rippling_delete_custom_object_record","rippling_delete_custom_page","rippling_delete_custom_setting","rippling_delete_object_category","rippling_delete_title","rippling_delete_work_location","rippling_get_business_partner","rippling_get_business_partner_group","rippling_get_current_user","rippling_get_custom_app","rippling_get_custom_object","rippling_get_custom_object_field","rippling_get_custom_object_record","rippling_get_custom_object_record_by_external_id","rippling_get_custom_page","rippling_get_custom_setting","rippling_get_department","rippling_get_employment_type","rippling_get_job_function","rippling_get_object_category","rippling_get_report_run","rippling_get_supergroup","rippling_get_team","rippling_get_title","rippling_get_user","rippling_get_work_location","rippling_get_worker","rippling_list_business_partner_groups","rippling_list_business_partners","rippling_list_companies","rippling_list_custom_apps","rippling_list_custom_fields","rippling_list_custom_object_fields","rippling_list_custom_object_records","rippling_list_custom_objects","rippling_list_custom_pages","rippling_list_custom_settings","rippling_list_departments","rippling_list_employment_types","rippling_list_entitlements","rippling_list_job_functions","rippling_list_object_categories","rippling_list_supergroup_exclusion_members","rippling_list_supergroup_inclusion_members","rippling_list_supergroup_members","rippling_list_supergroups","rippling_list_teams","rippling_list_titles","rippling_list_users","rippling_list_work_locations","rippling_list_workers","rippling_query_custom_object_records","rippling_trigger_report_run","rippling_update_custom_app","rippling_update_custom_object","rippling_update_custom_object_field","rippling_update_custom_object_record","rippling_update_custom_page","rippling_update_custom_setting","rippling_update_department","rippling_update_object_category","rippling_update_supergroup_exclusion_members","rippling_update_supergroup_inclusion_members","rippling_update_title","rippling_update_work_location","rocketlane_add_field_option","rocketlane_add_project_members","rocketlane_add_task_assignees","rocketlane_add_task_dependencies","rocketlane_add_task_followers","rocketlane_archive_project","rocketlane_assign_placeholders","rocketlane_create_field","rocketlane_create_phase","rocketlane_create_project","rocketlane_create_space","rocketlane_create_space_document","rocketlane_create_task","rocketlane_create_time_entry","rocketlane_create_time_off","rocketlane_delete_field","rocketlane_delete_phase","rocketlane_delete_project","rocketlane_delete_space","rocketlane_delete_space_document","rocketlane_delete_task","rocketlane_delete_time_entry","rocketlane_delete_time_off","rocketlane_get_field","rocketlane_get_invoice","rocketlane_get_invoice_line_items","rocketlane_get_invoice_payments","rocketlane_get_phase","rocketlane_get_project","rocketlane_get_space","rocketlane_get_space_document","rocketlane_get_task","rocketlane_get_time_entry","rocketlane_get_time_off","rocketlane_get_user","rocketlane_import_template","rocketlane_list_fields","rocketlane_list_invoices","rocketlane_list_phases","rocketlane_list_placeholders","rocketlane_list_projects","rocketlane_list_resource_allocations","rocketlane_list_space_documents","rocketlane_list_spaces","rocketlane_list_tasks","rocketlane_list_time_entries","rocketlane_list_time_entry_categories","rocketlane_list_time_offs","rocketlane_list_users","rocketlane_move_task_to_phase","rocketlane_remove_project_members","rocketlane_remove_task_assignees","rocketlane_remove_task_dependencies","rocketlane_remove_task_followers","rocketlane_search_time_entries","rocketlane_unassign_placeholders","rocketlane_update_field","rocketlane_update_field_option","rocketlane_update_phase","rocketlane_update_project","rocketlane_update_space","rocketlane_update_space_document","rocketlane_update_task","rocketlane_update_time_entry","rootly_acknowledge_alert","rootly_add_incident_event","rootly_add_subscribers","rootly_assign_incident_role","rootly_create_action_item","rootly_create_alert","rootly_create_incident","rootly_create_status_page_event","rootly_delete_action_item","rootly_delete_incident","rootly_escalate_alert","rootly_get_alert","rootly_get_incident","rootly_list_action_items","rootly_list_alerts","rootly_list_causes","rootly_list_environments","rootly_list_escalation_policies","rootly_list_functionalities","rootly_list_incident_events","rootly_list_incident_roles","rootly_list_incident_types","rootly_list_incidents","rootly_list_on_calls","rootly_list_playbooks","rootly_list_retrospectives","rootly_list_schedules","rootly_list_services","rootly_list_severities","rootly_list_teams","rootly_list_users","rootly_mitigate_incident","rootly_remove_subscribers","rootly_resolve_alert","rootly_resolve_incident","rootly_run_workflow","rootly_snooze_alert","rootly_unassign_incident_role","rootly_update_action_item","rootly_update_alert","rootly_update_incident","s3_copy_object","s3_create_bucket","s3_delete_bucket","s3_delete_object","s3_delete_objects","s3_get_object","s3_head_object","s3_list_buckets","s3_list_objects","s3_presigned_url","s3_put_object","salesforce_create_account","salesforce_create_case","salesforce_create_contact","salesforce_create_custom_field","salesforce_create_custom_object","salesforce_create_lead","salesforce_create_opportunity","salesforce_create_task","salesforce_delete_account","salesforce_delete_case","salesforce_delete_contact","salesforce_delete_custom_field","salesforce_delete_lead","salesforce_delete_opportunity","salesforce_delete_task","salesforce_describe_object","salesforce_get_accounts","salesforce_get_cases","salesforce_get_contacts","salesforce_get_dashboard","salesforce_get_leads","salesforce_get_opportunities","salesforce_get_report","salesforce_get_tasks","salesforce_list_dashboards","salesforce_list_objects","salesforce_list_report_types","salesforce_list_reports","salesforce_query","salesforce_query_more","salesforce_refresh_dashboard","salesforce_run_report","salesforce_tooling_query","salesforce_update_account","salesforce_update_case","salesforce_update_contact","salesforce_update_custom_field","salesforce_update_lead","salesforce_update_opportunity","salesforce_update_task","sap_concur_approve_expense_report","sap_concur_associate_attendees","sap_concur_create_cash_advance","sap_concur_create_expected_expense","sap_concur_create_expense_report","sap_concur_create_list_item","sap_concur_create_purchase_request","sap_concur_create_quick_expense","sap_concur_create_quick_expense_with_image","sap_concur_create_report_comment","sap_concur_create_travel_request","sap_concur_create_user","sap_concur_delete_expected_expense","sap_concur_delete_expense","sap_concur_delete_expense_report","sap_concur_delete_list_item","sap_concur_delete_travel_request","sap_concur_delete_user","sap_concur_get_allocation","sap_concur_get_budget","sap_concur_get_cash_advance","sap_concur_get_expected_expense","sap_concur_get_expense","sap_concur_get_expense_report","sap_concur_get_itemizations","sap_concur_get_itinerary","sap_concur_get_list","sap_concur_get_list_item","sap_concur_get_purchase_request","sap_concur_get_receipt","sap_concur_get_receipt_status","sap_concur_get_request_cash_advance","sap_concur_get_travel_profile","sap_concur_get_travel_request","sap_concur_get_user","sap_concur_issue_cash_advance","sap_concur_list_allocations","sap_concur_list_attendee_associations","sap_concur_list_budget_categories","sap_concur_list_budgets","sap_concur_list_exceptions","sap_concur_list_expected_expenses","sap_concur_list_expense_reports","sap_concur_list_expenses","sap_concur_list_itineraries","sap_concur_list_list_items","sap_concur_list_lists","sap_concur_list_receipts","sap_concur_list_report_comments","sap_concur_list_reports_to_approve","sap_concur_list_travel_profiles_summary","sap_concur_list_travel_request_comments","sap_concur_list_travel_requests","sap_concur_list_users","sap_concur_move_travel_request","sap_concur_recall_expense_report","sap_concur_remove_all_attendees","sap_concur_search_locations","sap_concur_search_users","sap_concur_send_back_expense_report","sap_concur_submit_expense_report","sap_concur_update_allocation","sap_concur_update_expected_expense","sap_concur_update_expense","sap_concur_update_expense_report","sap_concur_update_list_item","sap_concur_update_travel_request","sap_concur_update_user","sap_concur_upload_exchange_rates","sap_concur_upload_receipt_image","sap_s4hana_create_business_partner","sap_s4hana_create_purchase_order","sap_s4hana_create_purchase_requisition","sap_s4hana_create_sales_order","sap_s4hana_delete_sales_order","sap_s4hana_get_billing_document","sap_s4hana_get_business_partner","sap_s4hana_get_customer","sap_s4hana_get_inbound_delivery","sap_s4hana_get_material_document","sap_s4hana_get_outbound_delivery","sap_s4hana_get_product","sap_s4hana_get_purchase_order","sap_s4hana_get_purchase_requisition","sap_s4hana_get_sales_order","sap_s4hana_get_supplier","sap_s4hana_get_supplier_invoice","sap_s4hana_list_billing_documents","sap_s4hana_list_business_partners","sap_s4hana_list_customers","sap_s4hana_list_inbound_deliveries","sap_s4hana_list_material_documents","sap_s4hana_list_material_stock","sap_s4hana_list_outbound_deliveries","sap_s4hana_list_products","sap_s4hana_list_purchase_orders","sap_s4hana_list_purchase_requisitions","sap_s4hana_list_sales_orders","sap_s4hana_list_supplier_invoices","sap_s4hana_list_suppliers","sap_s4hana_odata_query","sap_s4hana_update_business_partner","sap_s4hana_update_customer","sap_s4hana_update_product","sap_s4hana_update_purchase_order","sap_s4hana_update_purchase_requisition","sap_s4hana_update_sales_order","sap_s4hana_update_supplier","search_tool","secrets_manager_create_secret","secrets_manager_delete_secret","secrets_manager_describe_secret","secrets_manager_get_secret","secrets_manager_list_secrets","secrets_manager_restore_secret","secrets_manager_rotate_secret","secrets_manager_tag_resource","secrets_manager_untag_resource","secrets_manager_update_secret","semrush_backlinks","semrush_backlinks_anchors","semrush_backlinks_competitors","semrush_backlinks_geo_distribution","semrush_backlinks_indexed_pages","semrush_backlinks_overview","semrush_backlinks_tld_distribution","semrush_batch_keyword_overview","semrush_broad_match_keywords","semrush_domain_ad_copies","semrush_domain_ad_history","semrush_domain_organic_competitors","semrush_domain_organic_keywords","semrush_domain_overview","semrush_domain_overview_all","semrush_domain_overview_history","semrush_domain_paid_competitors","semrush_domain_paid_keywords","semrush_domain_pla_copies","semrush_domain_pla_keywords","semrush_domain_vs_domain","semrush_keyword_ad_history","semrush_keyword_difficulty","semrush_keyword_overview","semrush_keyword_overview_all","semrush_keyword_questions","semrush_organic_results","semrush_paid_results","semrush_referring_domains","semrush_referring_ips","semrush_related_keywords","semrush_subdomain_ad_copies","semrush_subdomain_organic_keywords","semrush_subdomain_overview","semrush_subdomain_overview_all","semrush_subdomain_overview_history","semrush_subdomain_paid_keywords","semrush_top_domains","semrush_url_organic_keywords","semrush_url_overview","semrush_url_overview_all","semrush_url_overview_history","semrush_url_paid_keywords","semrush_winners_and_losers","sendblue_evaluate_service","sendblue_get_message","sendblue_send_group_message","sendblue_send_message","sendblue_send_typing_indicator","sendgrid_add_contact","sendgrid_add_contacts_to_list","sendgrid_create_list","sendgrid_create_template","sendgrid_create_template_version","sendgrid_delete_contacts","sendgrid_delete_list","sendgrid_delete_template","sendgrid_get_contact","sendgrid_get_list","sendgrid_get_template","sendgrid_list_all_lists","sendgrid_list_templates","sendgrid_remove_contacts_from_list","sendgrid_search_contacts","sendgrid_send_mail","sentry_events_get","sentry_events_list","sentry_issues_get","sentry_issues_list","sentry_issues_update","sentry_projects_create","sentry_projects_get","sentry_projects_list","sentry_projects_update","sentry_releases_create","sentry_releases_deploy","sentry_releases_list","sentry_teams_list","serper_search","servicenow_add_incident_comment","servicenow_aggregate","servicenow_close_incident","servicenow_create_change_request","servicenow_create_incident","servicenow_create_record","servicenow_delete_record","servicenow_download_attachment","servicenow_find_user","servicenow_get_change_next_states","servicenow_get_change_request","servicenow_get_ci","servicenow_get_incident","servicenow_get_knowledge_article","servicenow_get_requested_item","servicenow_list_approvals","servicenow_list_attachments","servicenow_list_catalog_items","servicenow_list_change_requests","servicenow_list_change_tasks","servicenow_list_ci_relationships","servicenow_list_group_members","servicenow_list_incidents","servicenow_list_requested_items","servicenow_order_catalog_item","servicenow_read_record","servicenow_resolve_incident","servicenow_search_cis","servicenow_search_knowledge","servicenow_update_approval","servicenow_update_change_request","servicenow_update_change_state","servicenow_update_incident","servicenow_update_record","servicenow_upload_attachment","ses_create_configuration_set","ses_create_email_identity","ses_create_template","ses_delete_email_identity","ses_delete_suppressed_destination","ses_delete_template","ses_get_account","ses_get_email_identity","ses_get_suppressed_destination","ses_get_template","ses_list_identities","ses_list_suppressed_destinations","ses_list_templates","ses_put_suppressed_destination","ses_send_bulk_email","ses_send_custom_verification_email","ses_send_email","ses_send_templated_email","ses_update_template","sftp_delete","sftp_download","sftp_list","sftp_mkdir","sftp_upload","sharepoint_add_list_items","sharepoint_create_list","sharepoint_create_page","sharepoint_delete_file","sharepoint_delete_list_item","sharepoint_delete_page","sharepoint_download_file","sharepoint_get_drive_item","sharepoint_get_list","sharepoint_get_list_item","sharepoint_list_sites","sharepoint_publish_page","sharepoint_read_page","sharepoint_update_list","sharepoint_update_page","sharepoint_upload_file","shopify_adjust_inventory","shopify_cancel_order","shopify_create_customer","shopify_create_fulfillment","shopify_create_product","shopify_delete_customer","shopify_delete_product","shopify_get_collection","shopify_get_customer","shopify_get_inventory_level","shopify_get_order","shopify_get_product","shopify_list_collections","shopify_list_customers","shopify_list_inventory_items","shopify_list_locations","shopify_list_orders","shopify_list_products","shopify_update_customer","shopify_update_order","shopify_update_product","similarweb_bounce_rate","similarweb_page_views","similarweb_pages_per_visit","similarweb_traffic_visits","similarweb_visit_duration","similarweb_website_overview","sixtyfour_enrich_company","sixtyfour_enrich_lead","sixtyfour_find_email","sixtyfour_find_phone","slack_add_reaction","slack_archive_conversation","slack_canvas","slack_create_channel_canvas","slack_create_conversation","slack_delete_canvas","slack_delete_message","slack_delete_scheduled_message","slack_download","slack_edit_canvas","slack_ephemeral_message","slack_get_canvas","slack_get_channel_history","slack_get_channel_info","slack_get_message","slack_get_permalink","slack_get_thread","slack_get_thread_replies","slack_get_user","slack_get_user_presence","slack_invite_to_conversation","slack_list_canvases","slack_list_channels","slack_list_members","slack_list_scheduled_messages","slack_list_users","slack_lookup_canvas_sections","slack_message","slack_message_reader","slack_open_view","slack_publish_view","slack_push_view","slack_remove_reaction","slack_rename_conversation","slack_schedule_message","slack_set_conversation_purpose","slack_set_conversation_topic","slack_set_status","slack_set_suggested_prompts","slack_set_title","slack_update_message","slack_update_view","smartlead_add_email_accounts_to_campaign","smartlead_add_leads_to_campaign","smartlead_create_campaign","smartlead_create_lead_list","smartlead_delete_campaign","smartlead_delete_campaign_webhook","smartlead_delete_lead_from_campaign","smartlead_delete_lead_list","smartlead_duplicate_campaign","smartlead_export_campaign_leads","smartlead_get_campaign","smartlead_get_campaign_analytics","smartlead_get_campaign_analytics_by_date","smartlead_get_campaign_lead_statistics","smartlead_get_campaign_mailbox_statistics","smartlead_get_campaign_sequences","smartlead_get_campaign_statistics","smartlead_get_campaign_top_level_analytics_by_date","smartlead_get_campaign_webhook_summary","smartlead_get_lead_by_email","smartlead_get_lead_by_id","smartlead_get_lead_list","smartlead_get_lead_message_history","smartlead_list_campaign_email_accounts","smartlead_list_campaign_leads","smartlead_list_campaign_webhooks","smartlead_list_campaigns","smartlead_list_clients","smartlead_list_email_accounts","smartlead_list_inbox_replies","smartlead_list_lead_activities","smartlead_list_lead_categories","smartlead_list_lead_lists","smartlead_mark_lead_complete","smartlead_pause_lead","smartlead_remove_email_accounts_from_campaign","smartlead_resume_lead","smartlead_save_campaign_sequences","smartlead_unsubscribe_lead_from_campaign","smartlead_unsubscribe_lead_globally","smartlead_update_campaign_schedule","smartlead_update_campaign_settings","smartlead_update_campaign_status","smartlead_update_lead","smartlead_update_lead_category","smartlead_update_lead_list","smartlead_upsert_campaign_webhook","sms_send","smtp_send_mail","snowflake_alter_warehouse","snowflake_call_procedure","snowflake_cancel_statement","snowflake_cancel_task_run","snowflake_delete_rows","snowflake_execute_sql","snowflake_get_statement","snowflake_get_task","snowflake_get_task_run","snowflake_get_task_run_output","snowflake_get_warehouse","snowflake_insert_rows","snowflake_introspect_schema","snowflake_list_copy_history","snowflake_list_databases","snowflake_list_query_history","snowflake_list_schemas","snowflake_list_tables","snowflake_list_task_runs","snowflake_list_tasks","snowflake_list_warehouses","snowflake_load_data","snowflake_resume_task","snowflake_resume_warehouse","snowflake_run_task","snowflake_suspend_task","snowflake_suspend_warehouse","snowflake_unload_data","snowflake_update_rows","snowflake_upsert_rows","splunk_cancel_search_job","splunk_create_search_job","splunk_dispatch_saved_search","splunk_get_fired_alerts","splunk_get_saved_search","splunk_get_search_job","splunk_get_search_results","splunk_list_apps","splunk_list_fired_alerts","splunk_list_indexes","splunk_list_saved_searches","splunk_run_search","sportmonks_core_get_cities","sportmonks_core_get_city","sportmonks_core_get_continent","sportmonks_core_get_continents","sportmonks_core_get_countries","sportmonks_core_get_country","sportmonks_core_get_entity_filters","sportmonks_core_get_my_usage","sportmonks_core_get_region","sportmonks_core_get_regions","sportmonks_core_get_timezones","sportmonks_core_get_type","sportmonks_core_get_type_by_entity","sportmonks_core_get_types","sportmonks_core_search_cities","sportmonks_core_search_countries","sportmonks_core_search_regions","sportmonks_football_expected_by_player","sportmonks_football_expected_by_team","sportmonks_football_get_all_commentaries","sportmonks_football_get_all_fixtures","sportmonks_football_get_all_players","sportmonks_football_get_all_rivals","sportmonks_football_get_all_teams","sportmonks_football_get_all_transfer_rumours","sportmonks_football_get_all_transfers","sportmonks_football_get_brackets_by_season","sportmonks_football_get_coach","sportmonks_football_get_coaches","sportmonks_football_get_coaches_by_country","sportmonks_football_get_commentaries_by_fixture","sportmonks_football_get_current_leagues_by_team","sportmonks_football_get_expected_lineups_by_player","sportmonks_football_get_expected_lineups_by_team","sportmonks_football_get_extended_team_squad","sportmonks_football_get_fixture","sportmonks_football_get_fixtures_by_date","sportmonks_football_get_fixtures_by_date_range","sportmonks_football_get_fixtures_by_date_range_for_team","sportmonks_football_get_fixtures_by_ids","sportmonks_football_get_grouped_standings_by_round","sportmonks_football_get_head_to_head","sportmonks_football_get_inplay_livescores","sportmonks_football_get_latest_coaches","sportmonks_football_get_latest_fixtures","sportmonks_football_get_latest_livescores","sportmonks_football_get_latest_players","sportmonks_football_get_latest_totw","sportmonks_football_get_latest_transfers","sportmonks_football_get_league","sportmonks_football_get_leagues","sportmonks_football_get_leagues_by_country","sportmonks_football_get_leagues_by_date","sportmonks_football_get_leagues_by_team","sportmonks_football_get_live_leagues","sportmonks_football_get_live_probabilities","sportmonks_football_get_live_probabilities_by_fixture","sportmonks_football_get_live_standings_by_league","sportmonks_football_get_livescores","sportmonks_football_get_match_facts","sportmonks_football_get_match_facts_by_date_range","sportmonks_football_get_match_facts_by_fixture","sportmonks_football_get_match_facts_by_league","sportmonks_football_get_past_fixtures_by_tv_station","sportmonks_football_get_player","sportmonks_football_get_players_by_country","sportmonks_football_get_postmatch_news","sportmonks_football_get_postmatch_news_by_season","sportmonks_football_get_predictability_by_league","sportmonks_football_get_prematch_news","sportmonks_football_get_prematch_news_by_season","sportmonks_football_get_prematch_news_upcoming","sportmonks_football_get_probabilities","sportmonks_football_get_probabilities_by_fixture","sportmonks_football_get_referee","sportmonks_football_get_referees","sportmonks_football_get_referees_by_country","sportmonks_football_get_referees_by_season","sportmonks_football_get_rivals_by_team","sportmonks_football_get_round","sportmonks_football_get_round_statistics","sportmonks_football_get_rounds","sportmonks_football_get_rounds_by_season","sportmonks_football_get_schedules_by_season","sportmonks_football_get_schedules_by_season_and_team","sportmonks_football_get_schedules_by_team","sportmonks_football_get_season","sportmonks_football_get_seasons","sportmonks_football_get_seasons_by_team","sportmonks_football_get_stage","sportmonks_football_get_stage_statistics","sportmonks_football_get_stages","sportmonks_football_get_stages_by_season","sportmonks_football_get_standing_corrections_by_season","sportmonks_football_get_standings","sportmonks_football_get_standings_by_round","sportmonks_football_get_standings_by_season","sportmonks_football_get_state","sportmonks_football_get_states","sportmonks_football_get_team","sportmonks_football_get_team_rankings","sportmonks_football_get_team_rankings_by_date","sportmonks_football_get_team_rankings_by_team","sportmonks_football_get_team_squad","sportmonks_football_get_team_squad_by_season","sportmonks_football_get_teams_by_country","sportmonks_football_get_teams_by_season","sportmonks_football_get_topscorers_by_season","sportmonks_football_get_topscorers_by_stage","sportmonks_football_get_totw","sportmonks_football_get_totw_by_round","sportmonks_football_get_transfer","sportmonks_football_get_transfer_rumour","sportmonks_football_get_transfer_rumours_between_dates","sportmonks_football_get_transfer_rumours_by_player","sportmonks_football_get_transfer_rumours_by_team","sportmonks_football_get_transfers_between_dates","sportmonks_football_get_transfers_by_player","sportmonks_football_get_transfers_by_team","sportmonks_football_get_tv_station","sportmonks_football_get_tv_stations","sportmonks_football_get_tv_stations_by_fixture","sportmonks_football_get_upcoming_fixtures_by_market","sportmonks_football_get_upcoming_fixtures_by_tv_station","sportmonks_football_get_value_bets","sportmonks_football_get_value_bets_by_fixture","sportmonks_football_get_venue","sportmonks_football_get_venues","sportmonks_football_get_venues_by_season","sportmonks_football_search_coaches","sportmonks_football_search_fixtures","sportmonks_football_search_leagues","sportmonks_football_search_players","sportmonks_football_search_referees","sportmonks_football_search_rounds","sportmonks_football_search_seasons","sportmonks_football_search_stages","sportmonks_football_search_teams","sportmonks_football_search_venues","sportmonks_motorsport_get_all_fixtures","sportmonks_motorsport_get_current_leagues_by_team","sportmonks_motorsport_get_driver","sportmonks_motorsport_get_driver_standings","sportmonks_motorsport_get_driver_standings_by_season","sportmonks_motorsport_get_drivers","sportmonks_motorsport_get_drivers_by_country","sportmonks_motorsport_get_drivers_by_season","sportmonks_motorsport_get_fixture","sportmonks_motorsport_get_fixtures_by_date","sportmonks_motorsport_get_fixtures_by_date_range","sportmonks_motorsport_get_fixtures_by_ids","sportmonks_motorsport_get_laps_by_fixture","sportmonks_motorsport_get_laps_by_fixture_and_driver","sportmonks_motorsport_get_laps_by_fixture_and_lap","sportmonks_motorsport_get_latest_laps_by_fixture","sportmonks_motorsport_get_latest_pitstops_by_fixture","sportmonks_motorsport_get_latest_stints_by_fixture","sportmonks_motorsport_get_latest_updated_drivers","sportmonks_motorsport_get_latest_updated_fixtures","sportmonks_motorsport_get_league","sportmonks_motorsport_get_leagues","sportmonks_motorsport_get_leagues_by_country","sportmonks_motorsport_get_leagues_by_date","sportmonks_motorsport_get_leagues_by_live","sportmonks_motorsport_get_leagues_by_team","sportmonks_motorsport_get_livescores","sportmonks_motorsport_get_pitstops_by_fixture","sportmonks_motorsport_get_pitstops_by_fixture_and_driver","sportmonks_motorsport_get_pitstops_by_fixture_and_lap","sportmonks_motorsport_get_race_results_by_season_and_driver","sportmonks_motorsport_get_race_results_by_season_and_team","sportmonks_motorsport_get_schedules_by_season","sportmonks_motorsport_get_season","sportmonks_motorsport_get_seasons","sportmonks_motorsport_get_stage","sportmonks_motorsport_get_stages","sportmonks_motorsport_get_stages_by_season","sportmonks_motorsport_get_state","sportmonks_motorsport_get_states","sportmonks_motorsport_get_stints_by_fixture","sportmonks_motorsport_get_stints_by_fixture_and_driver","sportmonks_motorsport_get_stints_by_fixture_and_stint","sportmonks_motorsport_get_team","sportmonks_motorsport_get_team_standings","sportmonks_motorsport_get_team_standings_by_season","sportmonks_motorsport_get_teams","sportmonks_motorsport_get_teams_by_country","sportmonks_motorsport_get_teams_by_season","sportmonks_motorsport_get_venue","sportmonks_motorsport_get_venues","sportmonks_motorsport_get_venues_by_season","sportmonks_motorsport_search_drivers","sportmonks_motorsport_search_leagues","sportmonks_motorsport_search_stages","sportmonks_motorsport_search_teams","sportmonks_motorsport_search_venues","sportmonks_odds_get_all_historical_odds","sportmonks_odds_get_all_inplay_odds","sportmonks_odds_get_all_pre_match_odds","sportmonks_odds_get_all_premium_odds","sportmonks_odds_get_bookmaker","sportmonks_odds_get_bookmaker_event_ids_by_fixture","sportmonks_odds_get_bookmakers","sportmonks_odds_get_bookmakers_by_fixture","sportmonks_odds_get_inplay_odds_by_fixture","sportmonks_odds_get_inplay_odds_by_fixture_and_bookmaker","sportmonks_odds_get_inplay_odds_by_fixture_and_market","sportmonks_odds_get_last_updated_inplay_odds","sportmonks_odds_get_last_updated_pre_match_odds","sportmonks_odds_get_market","sportmonks_odds_get_markets","sportmonks_odds_get_pre_match_odds_by_fixture","sportmonks_odds_get_pre_match_odds_by_fixture_and_bookmaker","sportmonks_odds_get_pre_match_odds_by_fixture_and_market","sportmonks_odds_get_premium_odds_by_fixture","sportmonks_odds_get_premium_odds_by_fixture_and_bookmaker","sportmonks_odds_get_premium_odds_by_fixture_and_market","sportmonks_odds_get_updated_historical_odds_between","sportmonks_odds_get_updated_premium_odds_between","sportmonks_odds_search_bookmakers","sportmonks_odds_search_markets","spotify_add_playlist_cover","spotify_add_to_queue","spotify_add_tracks_to_playlist","spotify_check_following","spotify_check_playlist_followers","spotify_check_saved_albums","spotify_check_saved_audiobooks","spotify_check_saved_episodes","spotify_check_saved_shows","spotify_check_saved_tracks","spotify_create_playlist","spotify_follow_artists","spotify_follow_playlist","spotify_get_album","spotify_get_album_tracks","spotify_get_albums","spotify_get_artist","spotify_get_artist_albums","spotify_get_artist_top_tracks","spotify_get_artists","spotify_get_audiobook","spotify_get_audiobook_chapters","spotify_get_audiobooks","spotify_get_categories","spotify_get_current_user","spotify_get_currently_playing","spotify_get_devices","spotify_get_episode","spotify_get_episodes","spotify_get_followed_artists","spotify_get_markets","spotify_get_new_releases","spotify_get_playback_state","spotify_get_playlist","spotify_get_playlist_cover","spotify_get_playlist_tracks","spotify_get_queue","spotify_get_recently_played","spotify_get_saved_albums","spotify_get_saved_audiobooks","spotify_get_saved_episodes","spotify_get_saved_shows","spotify_get_saved_tracks","spotify_get_show","spotify_get_show_episodes","spotify_get_shows","spotify_get_top_artists","spotify_get_top_tracks","spotify_get_track","spotify_get_tracks","spotify_get_user_playlists","spotify_get_user_profile","spotify_pause","spotify_play","spotify_remove_saved_albums","spotify_remove_saved_audiobooks","spotify_remove_saved_episodes","spotify_remove_saved_shows","spotify_remove_saved_tracks","spotify_remove_tracks_from_playlist","spotify_reorder_playlist_items","spotify_replace_playlist_items","spotify_save_albums","spotify_save_audiobooks","spotify_save_episodes","spotify_save_shows","spotify_save_tracks","spotify_search","spotify_seek","spotify_set_repeat","spotify_set_shuffle","spotify_set_volume","spotify_skip_next","spotify_skip_previous","spotify_transfer_playback","spotify_unfollow_artists","spotify_unfollow_playlist","spotify_update_playlist","sqs_send","square_batch_retrieve_inventory_counts","square_cancel_invoice","square_cancel_payment","square_complete_payment","square_create_catalog_image","square_create_customer","square_create_invoice","square_create_order","square_create_payment","square_delete_catalog_object","square_delete_customer","square_delete_invoice","square_get_catalog_object","square_get_customer","square_get_invoice","square_get_location","square_get_order","square_get_payment","square_get_refund","square_list_catalog","square_list_customers","square_list_invoices","square_list_locations","square_list_payments","square_list_refunds","square_pay_order","square_publish_invoice","square_refund_payment","square_search_catalog_objects","square_search_customers","square_search_invoices","square_search_orders","square_update_customer","square_upsert_catalog_object","ssh_check_command_exists","ssh_check_file_exists","ssh_create_directory","ssh_delete_file","ssh_download_file","ssh_execute_command","ssh_execute_script","ssh_get_system_info","ssh_list_directory","ssh_move_rename","ssh_read_file_content","ssh_upload_file","ssh_write_file_content","stagehand_agent","stagehand_extract","stripe_cancel_payment_intent","stripe_cancel_subscription","stripe_capture_charge","stripe_capture_payment_intent","stripe_confirm_payment_intent","stripe_create_charge","stripe_create_customer","stripe_create_invoice","stripe_create_payment_intent","stripe_create_price","stripe_create_product","stripe_create_subscription","stripe_delete_customer","stripe_delete_invoice","stripe_delete_product","stripe_finalize_invoice","stripe_list_charges","stripe_list_customers","stripe_list_events","stripe_list_invoices","stripe_list_payment_intents","stripe_list_prices","stripe_list_products","stripe_list_subscriptions","stripe_pay_invoice","stripe_resume_subscription","stripe_retrieve_charge","stripe_retrieve_customer","stripe_retrieve_event","stripe_retrieve_invoice","stripe_retrieve_payment_intent","stripe_retrieve_price","stripe_retrieve_product","stripe_retrieve_subscription","stripe_search_charges","stripe_search_customers","stripe_search_invoices","stripe_search_payment_intents","stripe_search_prices","stripe_search_products","stripe_search_subscriptions","stripe_send_invoice","stripe_update_charge","stripe_update_customer","stripe_update_invoice","stripe_update_payment_intent","stripe_update_price","stripe_update_product","stripe_update_subscription","stripe_void_invoice","sts_assume_role","sts_assume_role_with_saml","sts_assume_role_with_web_identity","sts_get_access_key_info","sts_get_caller_identity","sts_get_session_token","stt_assemblyai","stt_assemblyai_v2","stt_deepgram","stt_deepgram_v2","stt_elevenlabs","stt_elevenlabs_v2","stt_gemini","stt_gemini_v2","stt_whisper","stt_whisper_v2","supabase_count","supabase_delete","supabase_get_row","supabase_insert","supabase_introspect","supabase_invoke_function","supabase_query","supabase_rpc","supabase_storage_copy","supabase_storage_create_bucket","supabase_storage_create_signed_upload_url","supabase_storage_create_signed_url","supabase_storage_delete","supabase_storage_delete_bucket","supabase_storage_download","supabase_storage_empty_bucket","supabase_storage_get_public_url","supabase_storage_list","supabase_storage_list_buckets","supabase_storage_move","supabase_storage_update_bucket","supabase_storage_upload","supabase_text_search","supabase_update","supabase_upsert","supabase_vector_search","table_batch_insert_rows","table_create","table_delete_row","table_delete_rows_by_filter","table_get_row","table_get_schema","table_insert_row","table_list","table_query_rows","table_query_rows_v2","table_update_row","table_update_rows_by_filter","table_upsert_row","tailscale_authorize_device","tailscale_create_auth_key","tailscale_delete_auth_key","tailscale_delete_device","tailscale_delete_user","tailscale_expire_device_key","tailscale_get_acl","tailscale_get_auth_key","tailscale_get_device","tailscale_get_device_routes","tailscale_get_dns_preferences","tailscale_get_dns_searchpaths","tailscale_list_auth_keys","tailscale_list_devices","tailscale_list_dns_nameservers","tailscale_list_users","tailscale_set_acl","tailscale_set_device_routes","tailscale_set_device_tags","tailscale_set_dns_nameservers","tailscale_set_dns_preferences","tailscale_set_dns_searchpaths","tailscale_suspend_user","tailscale_update_device_key","tavily_crawl","tavily_extract","tavily_map","tavily_search","telegram_copy_message","telegram_delete_message","telegram_edit_message_text","telegram_forward_message","telegram_get_chat","telegram_get_chat_member","telegram_message","telegram_pin_message","telegram_send_animation","telegram_send_audio","telegram_send_chat_action","telegram_send_contact","telegram_send_document","telegram_send_location","telegram_send_photo","telegram_send_poll","telegram_send_video","telegram_set_message_reaction","telegram_unpin_message","temporal_cancel_workflow","temporal_count_workflows","temporal_create_schedule","temporal_delete_schedule","temporal_describe_schedule","temporal_describe_task_queue","temporal_describe_workflow","temporal_get_workflow_history","temporal_list_schedules","temporal_list_workflows","temporal_pause_schedule","temporal_query_workflow","temporal_reset_workflow","temporal_signal_with_start","temporal_signal_workflow","temporal_start_workflow","temporal_terminate_workflow","temporal_trigger_schedule","temporal_unpause_schedule","temporal_update_workflow","textract_analyze_expense","textract_analyze_id","textract_parser","textract_parser_v2","thinking_tool","thrive_add_audience_managers","thrive_add_audience_members","thrive_add_user_tags","thrive_create_assignment","thrive_create_audience","thrive_create_completion","thrive_create_user","thrive_delete_assignment","thrive_delete_audience","thrive_delete_user","thrive_get_activity","thrive_get_assignment","thrive_get_audience","thrive_get_completion","thrive_get_content","thrive_get_cpd_category","thrive_get_cpd_entry","thrive_get_cpd_requirement","thrive_get_enrolment","thrive_get_skill_levels","thrive_get_tag","thrive_get_user_by_id","thrive_get_user_by_ref","thrive_list_assignments","thrive_list_audience_managers","thrive_list_audience_members","thrive_list_audiences","thrive_list_completions","thrive_list_enrolments","thrive_list_tags","thrive_query_activities","thrive_query_content","thrive_query_cpd_categories","thrive_query_cpd_entries","thrive_query_cpd_requirements","thrive_query_cpd_user_summaries","thrive_remove_audience_manager","thrive_remove_audience_member","thrive_remove_user_tags","thrive_replace_audience_managers","thrive_replace_audience_members","thrive_search_users","thrive_suspend_user","thrive_update_assignment","thrive_update_audience","thrive_update_user","thrive_update_user_skills","tiktok_get_post_status","tiktok_get_user","tiktok_list_videos","tiktok_query_videos","tiktok_upload_video_draft","tinybird_append_datasource","tinybird_delete_datasource_rows","tinybird_events","tinybird_get_job","tinybird_query","tinybird_query_pipe","tinybird_truncate_datasource","tinyfish_cancel_run","tinyfish_fetch","tinyfish_get_run","tinyfish_list_runs","tinyfish_list_vault_items","tinyfish_run","tinyfish_run_async","tinyfish_search","trello_add_checklist","trello_add_checklist_item","trello_add_comment","trello_add_label","trello_add_member","trello_create_board","trello_create_card","trello_create_list","trello_delete_card","trello_get_actions","trello_get_board","trello_get_card","trello_list_cards","trello_list_lists","trello_list_members","trello_remove_label","trello_remove_member","trello_search","trello_update_card","trello_update_checklist_item","trello_update_list","trigger_dev_activate_schedule","trigger_dev_add_run_tags","trigger_dev_batch_trigger_task","trigger_dev_cancel_run","trigger_dev_complete_waitpoint_token","trigger_dev_create_env_var","trigger_dev_create_schedule","trigger_dev_create_waitpoint_token","trigger_dev_deactivate_schedule","trigger_dev_delete_env_var","trigger_dev_delete_schedule","trigger_dev_execute_query","trigger_dev_get_batch","trigger_dev_get_batch_results","trigger_dev_get_deployment","trigger_dev_get_env_var","trigger_dev_get_latest_deployment","trigger_dev_get_query_schema","trigger_dev_get_queue","trigger_dev_get_run","trigger_dev_get_run_events","trigger_dev_get_run_result","trigger_dev_get_run_trace","trigger_dev_get_schedule","trigger_dev_get_waitpoint_token","trigger_dev_import_env_vars","trigger_dev_list_deployments","trigger_dev_list_env_vars","trigger_dev_list_queues","trigger_dev_list_runs","trigger_dev_list_schedules","trigger_dev_list_timezones","trigger_dev_list_waitpoint_tokens","trigger_dev_override_queue_concurrency","trigger_dev_pause_queue","trigger_dev_promote_deployment","trigger_dev_replay_run","trigger_dev_reschedule_run","trigger_dev_reset_queue_concurrency","trigger_dev_resume_queue","trigger_dev_trigger_task","trigger_dev_update_env_var","trigger_dev_update_run_metadata","trigger_dev_update_schedule","tts_azure","tts_cartesia","tts_deepgram","tts_elevenlabs","tts_google","tts_openai","tts_playht","twilio_send_sms","twilio_voice_get_recording","twilio_voice_list_calls","twilio_voice_make_call","typeform_create_form","typeform_delete_form","typeform_files","typeform_get_form","typeform_insights","typeform_list_forms","typeform_responses","typeform_update_form","upstash_redis_command","upstash_redis_delete","upstash_redis_exists","upstash_redis_expire","upstash_redis_get","upstash_redis_hget","upstash_redis_hgetall","upstash_redis_hset","upstash_redis_incr","upstash_redis_incrby","upstash_redis_keys","upstash_redis_lpush","upstash_redis_lrange","upstash_redis_set","upstash_redis_setnx","upstash_redis_ttl","uptimerobot_create_alert_contact","uptimerobot_create_maintenance_window","uptimerobot_create_monitor","uptimerobot_create_psp","uptimerobot_delete_alert_contact","uptimerobot_delete_maintenance_window","uptimerobot_delete_monitor","uptimerobot_delete_psp","uptimerobot_get_account","uptimerobot_get_alert_contact","uptimerobot_get_incident","uptimerobot_get_maintenance_window","uptimerobot_get_monitor","uptimerobot_get_psp","uptimerobot_list_alert_contacts","uptimerobot_list_incidents","uptimerobot_list_maintenance_windows","uptimerobot_list_monitors","uptimerobot_list_psps","uptimerobot_pause_monitor","uptimerobot_start_monitor","uptimerobot_update_maintenance_window","uptimerobot_update_monitor","uptimerobot_update_psp","vanta_download_document_file","vanta_get_control","vanta_get_document","vanta_get_framework","vanta_get_person","vanta_get_policy","vanta_get_risk_scenario","vanta_get_test","vanta_get_vendor","vanta_get_vulnerable_asset","vanta_list_control_documents","vanta_list_control_tests","vanta_list_controls","vanta_list_document_uploads","vanta_list_documents","vanta_list_framework_controls","vanta_list_frameworks","vanta_list_monitored_computers","vanta_list_people","vanta_list_policies","vanta_list_risk_scenarios","vanta_list_test_entities","vanta_list_tests","vanta_list_vendors","vanta_list_vulnerabilities","vanta_list_vulnerability_remediations","vanta_list_vulnerable_assets","vanta_submit_document","vanta_upload_document_file","vercel_add_domain","vercel_add_project_domain","vercel_cancel_deployment","vercel_create_alias","vercel_create_check","vercel_create_deployment","vercel_create_dns_record","vercel_create_edge_config","vercel_create_env_var","vercel_create_project","vercel_create_webhook","vercel_delete_alias","vercel_delete_deployment","vercel_delete_dns_record","vercel_delete_domain","vercel_delete_edge_config","vercel_delete_env_var","vercel_delete_project","vercel_delete_webhook","vercel_get_alias","vercel_get_check","vercel_get_deployment","vercel_get_deployment_events","vercel_get_domain","vercel_get_domain_config","vercel_get_edge_config","vercel_get_edge_config_items","vercel_get_env_vars","vercel_get_project","vercel_get_team","vercel_get_user","vercel_get_webhook","vercel_list_aliases","vercel_list_checks","vercel_list_deployment_files","vercel_list_deployments","vercel_list_dns_records","vercel_list_domains","vercel_list_edge_configs","vercel_list_project_domains","vercel_list_projects","vercel_list_team_members","vercel_list_teams","vercel_list_webhooks","vercel_pause_project","vercel_promote_deployment","vercel_remove_project_domain","vercel_rerequest_check","vercel_unpause_project","vercel_update_check","vercel_update_dns_record","vercel_update_edge_config_items","vercel_update_env_var","vercel_update_project","vercel_update_project_domain","vercel_verify_project_domain","video_falai","video_luma","video_minimax","video_runway","video_veo","vision_tool","vision_tool_v2","wealthbox_read_contact","wealthbox_read_note","wealthbox_read_task","wealthbox_write_contact","wealthbox_write_note","wealthbox_write_task","webflow_create_item","webflow_delete_item","webflow_get_item","webflow_list_items","webflow_update_item","webhook_request","whatsapp_get_media","whatsapp_mark_read","whatsapp_send_interactive","whatsapp_send_media","whatsapp_send_message","whatsapp_send_reaction","whatsapp_send_template","whatsapp_upload_media","wikipedia_content","wikipedia_random","wikipedia_search","wikipedia_summary","windchill_check_in_document","windchill_check_in_documents","windchill_check_out_document","windchill_check_out_documents","windchill_create_document","windchill_create_documents","windchill_delete_document","windchill_delete_documents","windchill_download_attachment","windchill_download_primary_content","windchill_get_document","windchill_get_document_structure","windchill_get_primary_content","windchill_get_valid_state_transitions","windchill_list_attachments","windchill_list_documents","windchill_revise_document","windchill_revise_documents","windchill_set_lifecycle_state","windchill_undo_check_out_document","windchill_undo_check_out_documents","windchill_update_common_properties","windchill_update_document","windchill_update_document_security_labels","windchill_update_documents","windchill_upload_attachments","windchill_upload_primary_content","wiza_company_enrichment","wiza_get_credits","wiza_individual_reveal","wiza_prospect_search","wordpress_create_category","wordpress_create_comment","wordpress_create_page","wordpress_create_post","wordpress_create_tag","wordpress_delete_category","wordpress_delete_comment","wordpress_delete_media","wordpress_delete_page","wordpress_delete_post","wordpress_delete_tag","wordpress_get_category","wordpress_get_current_user","wordpress_get_media","wordpress_get_page","wordpress_get_post","wordpress_get_tag","wordpress_get_user","wordpress_list_categories","wordpress_list_comments","wordpress_list_media","wordpress_list_pages","wordpress_list_posts","wordpress_list_tags","wordpress_list_users","wordpress_search_content","wordpress_update_category","wordpress_update_comment","wordpress_update_page","wordpress_update_post","wordpress_update_tag","wordpress_upload_media","workday_assign_onboarding","workday_change_job","workday_create_prehire","workday_get_compensation","workday_get_organizations","workday_get_worker","workday_hire_employee","workday_list_workers","workday_terminate_worker","workday_update_worker","workflow_executor","x_create_bookmark","x_create_tweet","x_delete_bookmark","x_delete_tweet","x_get_blocking","x_get_bookmarks","x_get_followers","x_get_following","x_get_liked_tweets","x_get_liking_users","x_get_me","x_get_personalized_trends","x_get_quote_tweets","x_get_retweeted_by","x_get_trends_by_woeid","x_get_tweets_by_ids","x_get_usage","x_get_user_mentions","x_get_user_timeline","x_get_user_tweets","x_hide_reply","x_manage_block","x_manage_follow","x_manage_like","x_manage_mute","x_manage_retweet","x_read","x_search","x_search_tweets","x_search_users","x_user","x_write","youtube_channel_info","youtube_channel_playlists","youtube_channel_videos","youtube_comments","youtube_playlist_items","youtube_search","youtube_trending","youtube_video_categories","youtube_video_details","zendesk_autocomplete_organizations","zendesk_create_organization","zendesk_create_organizations_bulk","zendesk_create_ticket","zendesk_create_tickets_bulk","zendesk_create_user","zendesk_create_users_bulk","zendesk_delete_organization","zendesk_delete_ticket","zendesk_delete_user","zendesk_get_current_user","zendesk_get_organization","zendesk_get_organizations","zendesk_get_ticket","zendesk_get_tickets","zendesk_get_user","zendesk_get_users","zendesk_merge_tickets","zendesk_search","zendesk_search_count","zendesk_search_users","zendesk_update_organization","zendesk_update_ticket","zendesk_update_tickets_bulk","zendesk_update_user","zendesk_update_users_bulk","zep_add_messages","zep_add_user","zep_create_thread","zep_delete_thread","zep_get_context","zep_get_messages","zep_get_threads","zep_get_user","zep_get_user_threads","zerobounce_get_credits","zerobounce_verify_email","zoho_desk_add_comment","zoho_desk_get_attachment","zoho_desk_get_contact","zoho_desk_get_thread","zoho_desk_get_ticket","zoho_desk_list_comments","zoho_desk_list_organizations","zoho_desk_list_threads","zoho_desk_list_tickets","zoho_desk_update_ticket","zoom_create_meeting","zoom_delete_meeting","zoom_delete_recording","zoom_get_meeting","zoom_get_meeting_invitation","zoom_get_meeting_recordings","zoom_list_meetings","zoom_list_past_participants","zoom_list_recordings","zoom_update_meeting","zoominfo_enrich_companies","zoominfo_enrich_contacts","zoominfo_search_companies","zoominfo_search_contacts","zoominfo_search_intent","zoominfo_search_news"]' + '["a2a_cancel_task","a2a_get_agent_card","a2a_get_task","a2a_send_message","affinity_batch_update_entity_fields","affinity_batch_update_list_entry_fields","affinity_create_list","affinity_create_list_field_dropdown_option","affinity_create_merge","affinity_create_note","affinity_create_reminder","affinity_delete_list_field_dropdown_option","affinity_delete_note","affinity_get_company","affinity_get_current_user","affinity_get_entity_field_value","affinity_get_list","affinity_get_list_entry","affinity_get_list_entry_field","affinity_get_list_field_dropdown_option","affinity_get_merge","affinity_get_merge_task","affinity_get_note","affinity_get_opportunity","affinity_get_person","affinity_get_saved_view","affinity_get_transcript","affinity_get_user","affinity_list_calls","affinity_list_chat_messages","affinity_list_companies","affinity_list_coworker_connections","affinity_list_emails","affinity_list_entity_field_values","affinity_list_entity_list_entries","affinity_list_entity_lists","affinity_list_entity_notes","affinity_list_entity_relationships","affinity_list_field_dropdown_options","affinity_list_field_metadata","affinity_list_field_value_changes","affinity_list_investor_executive_connections","affinity_list_list_entries","affinity_list_list_entry_field_value_changes","affinity_list_list_entry_fields","affinity_list_list_field_dropdown_options","affinity_list_list_fields","affinity_list_lists","affinity_list_meetings","affinity_list_merge_tasks","affinity_list_merges","affinity_list_note_attached_companies","affinity_list_note_attached_opportunities","affinity_list_note_attached_persons","affinity_list_note_replies","affinity_list_notes","affinity_list_opportunities","affinity_list_persons","affinity_list_reminders","affinity_list_saved_view_entries","affinity_list_saved_views","affinity_list_transcript_fragments","affinity_list_transcripts","affinity_list_users","affinity_search_companies","affinity_search_files","affinity_search_list_entries","affinity_search_notes","affinity_search_persons","affinity_semantic_search","affinity_update_entity_field_value","affinity_update_list_entry_field","affinity_update_list_field_dropdown_option","affinity_update_note","agentmail_create_draft","agentmail_create_inbox","agentmail_delete_draft","agentmail_delete_inbox","agentmail_delete_thread","agentmail_forward_message","agentmail_get_draft","agentmail_get_inbox","agentmail_get_message","agentmail_get_thread","agentmail_list_drafts","agentmail_list_inboxes","agentmail_list_messages","agentmail_list_threads","agentmail_reply_message","agentmail_send_draft","agentmail_send_message","agentmail_update_draft","agentmail_update_inbox","agentmail_update_message","agentmail_update_thread","agentphone_create_call","agentphone_create_contact","agentphone_create_number","agentphone_delete_contact","agentphone_get_call","agentphone_get_call_transcript","agentphone_get_contact","agentphone_get_conversation","agentphone_get_conversation_messages","agentphone_get_number_messages","agentphone_get_usage","agentphone_get_usage_daily","agentphone_get_usage_monthly","agentphone_list_calls","agentphone_list_contacts","agentphone_list_conversations","agentphone_list_numbers","agentphone_react_to_message","agentphone_release_number","agentphone_send_message","agentphone_update_contact","agentphone_update_conversation","agiloft_async_status","agiloft_attach_file","agiloft_attachment_info","agiloft_create_record","agiloft_delete_record","agiloft_get_choice_line_id","agiloft_list_tables","agiloft_lock_record","agiloft_nlp_search","agiloft_read_record","agiloft_remove_attachment","agiloft_retrieve_attachment","agiloft_run_action_button","agiloft_saved_search","agiloft_search_records","agiloft_select_records","agiloft_update_record","agiloft_upsert_record","ahrefs_anchors","ahrefs_backlinks","ahrefs_backlinks_stats","ahrefs_batch_analysis","ahrefs_broken_backlinks","ahrefs_domain_rating","ahrefs_domain_rating_history","ahrefs_keyword_overview","ahrefs_keywords_history","ahrefs_metrics","ahrefs_metrics_history","ahrefs_organic_competitors","ahrefs_organic_keywords","ahrefs_paid_pages","ahrefs_rank_tracker_competitors_overview","ahrefs_rank_tracker_competitors_stats","ahrefs_rank_tracker_overview","ahrefs_rank_tracker_serp_overview","ahrefs_refdomains_history","ahrefs_referring_domains","ahrefs_related_terms","ahrefs_site_audit_page_explorer","ahrefs_top_pages","airtable_create_records","airtable_delete_records","airtable_get_base_schema","airtable_get_record","airtable_list_bases","airtable_list_records","airtable_list_tables","airtable_update_multiple_records","airtable_update_record","airtable_upsert_records","airweave_search","algolia_add_record","algolia_batch_operations","algolia_browse_records","algolia_clear_records","algolia_copy_move_index","algolia_delete_by_filter","algolia_delete_index","algolia_delete_record","algolia_get_record","algolia_get_records","algolia_get_settings","algolia_get_task_status","algolia_list_indices","algolia_partial_update_record","algolia_search","algolia_update_settings","amplitude_event_segmentation","amplitude_funnels","amplitude_get_active_users","amplitude_get_revenue","amplitude_group_identify","amplitude_identify_user","amplitude_list_events","amplitude_realtime_active_users","amplitude_retention","amplitude_send_event","amplitude_user_activity","amplitude_user_profile","amplitude_user_search","apify_get_dataset_items","apify_get_run","apify_run_actor_async","apify_run_actor_sync","apify_run_task","apollo_account_bulk_create","apollo_account_bulk_update","apollo_account_create","apollo_account_search","apollo_account_update","apollo_contact_bulk_create","apollo_contact_bulk_update","apollo_contact_create","apollo_contact_search","apollo_contact_update","apollo_email_accounts","apollo_opportunity_create","apollo_opportunity_get","apollo_opportunity_search","apollo_opportunity_update","apollo_organization_bulk_enrich","apollo_organization_enrich","apollo_organization_search","apollo_people_bulk_enrich","apollo_people_enrich","apollo_people_search","apollo_sequence_add_contacts","apollo_sequence_search","apollo_task_create","apollo_task_search","appconfig_create_application","appconfig_create_configuration_profile","appconfig_create_environment","appconfig_create_hosted_configuration_version","appconfig_delete_application","appconfig_delete_configuration_profile","appconfig_delete_environment","appconfig_delete_hosted_configuration_version","appconfig_get_application","appconfig_get_configuration","appconfig_get_configuration_profile","appconfig_get_deployment","appconfig_get_environment","appconfig_get_hosted_configuration_version","appconfig_list_applications","appconfig_list_configuration_profiles","appconfig_list_deployment_strategies","appconfig_list_deployments","appconfig_list_environments","appconfig_list_hosted_configuration_versions","appconfig_start_deployment","appconfig_stop_deployment","appconfig_update_application","appconfig_update_configuration_profile","appconfig_update_environment","arxiv_get_author_papers","arxiv_get_paper","arxiv_search","asana_add_comment","asana_add_followers","asana_create_project","asana_create_section","asana_create_subtask","asana_create_task","asana_delete_task","asana_get_project","asana_get_projects","asana_get_task","asana_list_sections","asana_list_workspaces","asana_search_tasks","asana_update_task","ashby_add_candidate_tag","ashby_anonymize_candidate","ashby_change_application_source","ashby_change_application_stage","ashby_create_application","ashby_create_candidate","ashby_create_note","ashby_delete_application","ashby_get_application","ashby_get_candidate","ashby_get_job","ashby_get_job_posting","ashby_get_offer","ashby_list_applications","ashby_list_archive_reasons","ashby_list_candidate_tags","ashby_list_candidates","ashby_list_custom_fields","ashby_list_departments","ashby_list_interviews","ashby_list_job_postings","ashby_list_jobs","ashby_list_locations","ashby_list_notes","ashby_list_offers","ashby_list_openings","ashby_list_sources","ashby_list_users","ashby_remove_candidate_tag","ashby_search_candidates","ashby_set_custom_field_value","ashby_set_custom_field_values","ashby_update_candidate","athena_batch_get_query_execution","athena_create_named_query","athena_delete_named_query","athena_get_named_query","athena_get_query_execution","athena_get_query_results","athena_list_databases","athena_list_named_queries","athena_list_query_executions","athena_list_table_metadata","athena_start_query","athena_stop_query","attio_assert_record","attio_create_attribute","attio_create_comment","attio_create_list","attio_create_list_entry","attio_create_note","attio_create_object","attio_create_record","attio_create_task","attio_create_webhook","attio_delete_comment","attio_delete_list_entry","attio_delete_note","attio_delete_record","attio_delete_task","attio_delete_webhook","attio_get_attribute","attio_get_comment","attio_get_list","attio_get_list_entry","attio_get_member","attio_get_note","attio_get_object","attio_get_record","attio_get_task","attio_get_thread","attio_get_webhook","attio_list_attributes","attio_list_lists","attio_list_members","attio_list_notes","attio_list_objects","attio_list_records","attio_list_tasks","attio_list_threads","attio_list_webhooks","attio_query_list_entries","attio_search_records","attio_update_attribute","attio_update_list","attio_update_list_entry","attio_update_object","attio_update_record","attio_update_task","attio_update_webhook","azure_data_explorer_create_table","azure_data_explorer_drop_table","azure_data_explorer_ingest_from_query","azure_data_explorer_ingest_inline","azure_data_explorer_list_databases","azure_data_explorer_list_functions","azure_data_explorer_list_tables","azure_data_explorer_management","azure_data_explorer_query","azure_data_explorer_show_database_schema","azure_data_explorer_show_ingestion_failures","azure_data_explorer_show_operations","azure_data_explorer_show_table_details","azure_data_explorer_show_table_schema","azure_devops_add_comment","azure_devops_create_work_item","azure_devops_get_build_log","azure_devops_get_build_timeline","azure_devops_get_comments","azure_devops_get_pipeline","azure_devops_get_pipeline_run","azure_devops_get_work_item","azure_devops_get_work_items_batch","azure_devops_get_work_items_between_builds","azure_devops_list_build_logs","azure_devops_list_builds","azure_devops_list_pipeline_runs","azure_devops_list_pipelines","azure_devops_query_work_items","azure_devops_update_work_item","bitbucket_approve_pull_request","bitbucket_create_branch","bitbucket_create_pull_request","bitbucket_create_pull_request_comment","bitbucket_decline_pull_request","bitbucket_delete_branch","bitbucket_get_commit","bitbucket_get_file","bitbucket_get_file_metadata","bitbucket_get_pipeline","bitbucket_get_pipeline_step_log","bitbucket_get_pull_request","bitbucket_get_pull_request_diff","bitbucket_get_pull_request_diffstat","bitbucket_get_pull_request_merge_task_status","bitbucket_get_repository","bitbucket_list_branches","bitbucket_list_commits","bitbucket_list_directory","bitbucket_list_pipeline_steps","bitbucket_list_pipelines","bitbucket_list_pull_request_comments","bitbucket_list_pull_request_commit_statuses","bitbucket_list_pull_requests","bitbucket_list_repositories","bitbucket_list_workspaces","bitbucket_merge_pull_request","bitbucket_request_pull_request_changes","bitbucket_stop_pipeline","bitbucket_trigger_pipeline","box_copy_file","box_create_folder","box_delete_file","box_delete_folder","box_download_file","box_get_file_info","box_list_folder_items","box_search","box_sign_cancel_request","box_sign_create_request","box_sign_get_request","box_sign_list_requests","box_sign_resend_request","box_update_file","box_upload_file","brandfetch_get_brand","brandfetch_search","brex_archive_budget","brex_create_budget","brex_create_spend_limit","brex_create_transfer","brex_create_vendor","brex_get_budget","brex_get_cash_account","brex_get_company","brex_get_current_user","brex_get_expense","brex_get_spend_limit","brex_get_transfer","brex_get_user","brex_get_vendor","brex_list_budgets","brex_list_card_accounts","brex_list_card_statements","brex_list_card_transactions","brex_list_cards","brex_list_cash_accounts","brex_list_cash_statements","brex_list_cash_transactions","brex_list_departments","brex_list_expenses","brex_list_locations","brex_list_spend_limits","brex_list_titles","brex_list_transfers","brex_list_users","brex_list_vendors","brex_match_receipt","brex_update_expense","brex_update_vendor","brex_upload_receipt","brightdata_cancel_snapshot","brightdata_discover","brightdata_download_snapshot","brightdata_scrape_dataset","brightdata_scrape_url","brightdata_serp_search","brightdata_snapshot_status","brightdata_sync_scrape","browser_use_run_task","buffer_create_idea","buffer_create_post","buffer_delete_post","buffer_edit_post","buffer_get_account","buffer_get_channels","buffer_get_idea_groups","buffer_get_ideas","buffer_get_post","buffer_get_posts","calcom_cancel_booking","calcom_confirm_booking","calcom_create_booking","calcom_create_event_type","calcom_create_schedule","calcom_decline_booking","calcom_delete_event_type","calcom_delete_schedule","calcom_get_booking","calcom_get_default_schedule","calcom_get_event_type","calcom_get_schedule","calcom_get_slots","calcom_list_bookings","calcom_list_event_types","calcom_list_schedules","calcom_reschedule_booking","calcom_update_event_type","calcom_update_schedule","calendly_cancel_event","calendly_create_event_invitee","calendly_create_invitee_no_show","calendly_create_scheduling_link","calendly_create_webhook","calendly_delete_invitee_no_show","calendly_delete_webhook","calendly_get_current_user","calendly_get_event_invitee","calendly_get_event_type","calendly_get_scheduled_event","calendly_get_user","calendly_list_event_invitees","calendly_list_event_type_available_times","calendly_list_event_types","calendly_list_organization_memberships","calendly_list_routing_form_submissions","calendly_list_routing_forms","calendly_list_scheduled_events","calendly_list_user_availability_schedules","calendly_list_user_busy_times","calendly_list_webhooks","cbinsights_chat","cbinsights_get_commercial_maturity_history","cbinsights_get_exit_probability_history","cbinsights_get_mosaic_history","cbinsights_get_org_business_relationships","cbinsights_get_org_funding_window","cbinsights_get_org_fundings","cbinsights_get_org_investments","cbinsights_get_org_management_and_board","cbinsights_get_org_outlook","cbinsights_get_org_portfolio_exits","cbinsights_get_org_revenue","cbinsights_get_scouting_report","cbinsights_get_strategy_map","cbinsights_list_business_relationships","cbinsights_list_funding_window","cbinsights_list_fundings","cbinsights_list_investments","cbinsights_list_management_and_board","cbinsights_list_outlook","cbinsights_list_portfolio_exits","cbinsights_list_revenue","cbinsights_lookup_organizations","cbinsights_rag","cbinsights_search_firmographics","clay_populate","clerk_add_organization_member","clerk_ban_user","clerk_create_actor_token","clerk_create_allowlist_identifier","clerk_create_blocklist_identifier","clerk_create_organization","clerk_create_organization_invitation","clerk_create_user","clerk_delete_allowlist_identifier","clerk_delete_blocklist_identifier","clerk_delete_organization","clerk_delete_user","clerk_get_jwt_template","clerk_get_organization","clerk_get_session","clerk_get_user","clerk_get_user_oauth_token","clerk_list_allowlist_identifiers","clerk_list_blocklist_identifiers","clerk_list_jwt_templates","clerk_list_organization_invitations","clerk_list_organization_memberships","clerk_list_organizations","clerk_list_sessions","clerk_list_users","clerk_lock_user","clerk_remove_organization_member","clerk_revoke_actor_token","clerk_revoke_session","clerk_unban_user","clerk_unlock_user","clerk_update_organization","clerk_update_organization_membership","clerk_update_user","clickhouse_count_rows","clickhouse_create_database","clickhouse_create_table","clickhouse_delete","clickhouse_describe_table","clickhouse_drop_database","clickhouse_drop_partition","clickhouse_drop_table","clickhouse_execute","clickhouse_insert","clickhouse_insert_rows","clickhouse_introspect","clickhouse_kill_query","clickhouse_list_clusters","clickhouse_list_databases","clickhouse_list_mutations","clickhouse_list_partitions","clickhouse_list_running_queries","clickhouse_list_tables","clickhouse_optimize_table","clickhouse_query","clickhouse_rename_table","clickhouse_show_create_table","clickhouse_table_stats","clickhouse_truncate_table","clickhouse_update","clickup_add_tag_to_task","clickup_create_checklist","clickup_create_checklist_item","clickup_create_comment","clickup_create_folder","clickup_create_list","clickup_create_task","clickup_create_time_entry","clickup_delete_checklist","clickup_delete_checklist_item","clickup_delete_comment","clickup_delete_task","clickup_delete_time_entry","clickup_get_comments","clickup_get_custom_fields","clickup_get_folders","clickup_get_list_members","clickup_get_lists","clickup_get_running_timer","clickup_get_space_tags","clickup_get_spaces","clickup_get_task","clickup_get_task_members","clickup_get_tasks","clickup_get_time_entries","clickup_get_workspaces","clickup_remove_custom_field_value","clickup_remove_tag_from_task","clickup_search_tasks","clickup_set_custom_field_value","clickup_start_timer","clickup_stop_timer","clickup_update_checklist","clickup_update_checklist_item","clickup_update_comment","clickup_update_task","clickup_update_time_entry","clickup_upload_attachment","cloudflare_create_access_application","cloudflare_create_access_policy","cloudflare_create_access_service_token","cloudflare_create_dns_record","cloudflare_create_r2_bucket","cloudflare_create_rate_limit_rule","cloudflare_create_ruleset","cloudflare_create_ruleset_rule","cloudflare_create_zone","cloudflare_delete_access_application","cloudflare_delete_access_policy","cloudflare_delete_dns_record","cloudflare_delete_r2_bucket","cloudflare_delete_ruleset_rule","cloudflare_delete_zone","cloudflare_dns_analytics","cloudflare_get_access_application","cloudflare_get_r2_bucket","cloudflare_get_ruleset","cloudflare_get_ruleset_entrypoint","cloudflare_get_tunnel","cloudflare_get_tunnel_configuration","cloudflare_get_worker_script_settings","cloudflare_get_zone","cloudflare_get_zone_settings","cloudflare_list_access_applications","cloudflare_list_access_groups","cloudflare_list_access_identity_providers","cloudflare_list_access_policies","cloudflare_list_access_service_tokens","cloudflare_list_certificates","cloudflare_list_dns_records","cloudflare_list_managed_ruleset_overrides","cloudflare_list_r2_buckets","cloudflare_list_rate_limit_rules","cloudflare_list_rulesets","cloudflare_list_tunnels","cloudflare_list_worker_routes","cloudflare_list_worker_scripts","cloudflare_list_zones","cloudflare_purge_cache","cloudflare_revoke_access_service_token","cloudflare_update_access_application","cloudflare_update_access_policy","cloudflare_update_dns_record","cloudflare_update_rate_limit_rule","cloudflare_update_ruleset_rule","cloudflare_update_zone_setting","cloudformation_cancel_update_stack","cloudformation_create_change_set","cloudformation_create_stack","cloudformation_delete_stack","cloudformation_describe_change_set","cloudformation_describe_stack_drift_detection_status","cloudformation_describe_stack_events","cloudformation_describe_stacks","cloudformation_detect_stack_drift","cloudformation_execute_change_set","cloudformation_get_template","cloudformation_get_template_summary","cloudformation_list_stack_resources","cloudformation_update_stack","cloudformation_validate_template","cloudwatch_describe_alarm_history","cloudwatch_describe_alarms","cloudwatch_describe_log_groups","cloudwatch_describe_log_streams","cloudwatch_filter_log_events","cloudwatch_get_log_events","cloudwatch_get_metric_statistics","cloudwatch_list_metrics","cloudwatch_mute_alarm","cloudwatch_put_log_group_retention","cloudwatch_put_metric_data","cloudwatch_query_logs","cloudwatch_unmute_alarm","codepipeline_disable_stage_transition","codepipeline_enable_stage_transition","codepipeline_get_pipeline","codepipeline_get_pipeline_execution","codepipeline_get_pipeline_state","codepipeline_list_action_executions","codepipeline_list_pipeline_executions","codepipeline_list_pipelines","codepipeline_put_approval_result","codepipeline_retry_stage_execution","codepipeline_start_execution","codepipeline_stop_execution","confluence_add_label","confluence_create_blogpost","confluence_create_comment","confluence_create_page","confluence_create_page_property","confluence_create_space","confluence_create_space_property","confluence_delete_attachment","confluence_delete_blogpost","confluence_delete_comment","confluence_delete_label","confluence_delete_page","confluence_delete_page_property","confluence_delete_space","confluence_delete_space_property","confluence_get_blogpost","confluence_get_page_ancestors","confluence_get_page_children","confluence_get_page_descendants","confluence_get_page_version","confluence_get_pages_by_label","confluence_get_space","confluence_get_task","confluence_get_user","confluence_list_attachments","confluence_list_blogposts","confluence_list_blogposts_in_space","confluence_list_comments","confluence_list_labels","confluence_list_page_properties","confluence_list_page_versions","confluence_list_pages_in_space","confluence_list_space_labels","confluence_list_space_permissions","confluence_list_space_properties","confluence_list_spaces","confluence_list_tasks","confluence_retrieve","confluence_search","confluence_search_in_space","confluence_update","confluence_update_blogpost","confluence_update_comment","confluence_update_space","confluence_update_task","confluence_upload_attachment","context_dev_classify_naics","context_dev_classify_sic","context_dev_crawl","context_dev_extract","context_dev_extract_product","context_dev_extract_products","context_dev_get_brand","context_dev_get_brand_by_email","context_dev_get_brand_by_name","context_dev_get_brand_by_ticker","context_dev_identify_transaction","context_dev_map","context_dev_scrape_fonts","context_dev_scrape_html","context_dev_scrape_images","context_dev_scrape_markdown","context_dev_scrape_styleguide","context_dev_screenshot","context_dev_search","convex_action","convex_document_deltas","convex_list_documents","convex_list_tables","convex_mutation","convex_query","convex_run_function","crowdstrike_create_indicators","crowdstrike_delete_indicators","crowdstrike_delete_rtr_session","crowdstrike_execute_rtr_command","crowdstrike_get_alert_details","crowdstrike_get_case_details","crowdstrike_get_host_group_details","crowdstrike_get_indicator_details","crowdstrike_get_rtr_command_status","crowdstrike_get_sensor_aggregates","crowdstrike_get_sensor_details","crowdstrike_get_vulnerability_details","crowdstrike_init_rtr_session","crowdstrike_perform_host_action","crowdstrike_perform_host_group_action","crowdstrike_query_alerts","crowdstrike_query_cases","crowdstrike_query_host_groups","crowdstrike_query_indicators","crowdstrike_query_sensors","crowdstrike_query_vulnerabilities","crowdstrike_update_alerts","crowdstrike_update_indicators","crunchbase_autocomplete","crunchbase_get_acquisition","crunchbase_get_entity","crunchbase_get_entity_card","crunchbase_get_fields_metadata","crunchbase_get_funding_round","crunchbase_get_organization","crunchbase_get_person","crunchbase_list_deleted_entities","crunchbase_search_acquisitions","crunchbase_search_entities","crunchbase_search_funding_rounds","crunchbase_search_organizations","crunchbase_search_people","cursor_add_followup","cursor_add_followup_v2","cursor_delete_agent","cursor_delete_agent_v2","cursor_download_artifact","cursor_download_artifact_v2","cursor_get_agent","cursor_get_agent_v2","cursor_get_api_key_info","cursor_get_api_key_info_v2","cursor_get_conversation","cursor_get_conversation_v2","cursor_launch_agent","cursor_launch_agent_v2","cursor_list_agents","cursor_list_agents_v2","cursor_list_artifacts","cursor_list_artifacts_v2","cursor_list_models","cursor_list_models_v2","cursor_list_repositories","cursor_list_repositories_v2","cursor_stop_agent","cursor_stop_agent_v2","dagster_delete_run","dagster_get_asset","dagster_get_run","dagster_get_run_logs","dagster_launch_run","dagster_list_assets","dagster_list_jobs","dagster_list_runs","dagster_list_schedules","dagster_list_sensors","dagster_materialize_assets","dagster_reexecute_run","dagster_report_asset_materialization","dagster_start_schedule","dagster_start_sensor","dagster_stop_schedule","dagster_stop_sensor","dagster_terminate_run","dagster_wipe_asset","databricks_cancel_run","databricks_execute_sql","databricks_get_cluster","databricks_get_job","databricks_get_run","databricks_get_run_output","databricks_get_statement","databricks_list_clusters","databricks_list_jobs","databricks_list_runs","databricks_list_warehouses","databricks_run_job","datadog_add_incident_todo","datadog_cancel_downtime","datadog_create_dashboard","datadog_create_downtime","datadog_create_event","datadog_create_incident","datadog_create_monitor","datadog_create_slo","datadog_delete_dashboard","datadog_delete_slo","datadog_get_browser_synthetics_results","datadog_get_dashboard","datadog_get_incident","datadog_get_monitor","datadog_get_security_signal","datadog_get_slo","datadog_get_slo_history","datadog_get_synthetics_results","datadog_get_synthetics_test","datadog_list_dashboards","datadog_list_downtimes","datadog_list_incidents","datadog_list_monitors","datadog_list_security_rules","datadog_list_security_signals","datadog_list_services","datadog_list_slos","datadog_list_synthetics_tests","datadog_mute_monitor","datadog_query_logs","datadog_query_timeseries","datadog_search_spans","datadog_send_logs","datadog_submit_metrics","datadog_trigger_synthetics_tests","datadog_unmute_monitor","datadog_update_incident","datadog_update_security_signal_assignee","datadog_update_security_signal_state","datadog_update_slo","datadog_update_synthetics_status","datagma_enrich_company","datagma_enrich_person","datagma_find_email","datagma_find_phone","datagma_get_credits","daytona_create_sandbox","daytona_delete_sandbox","daytona_download_file","daytona_execute_command","daytona_get_sandbox","daytona_git_clone","daytona_list_files","daytona_list_sandboxes","daytona_run_code","daytona_start_sandbox","daytona_stop_sandbox","daytona_upload_file","deployed_block_executor","deployments_deploy","deployments_get_version","deployments_list_versions","deployments_promote","deployments_undeploy","devin_append_session_tags","devin_archive_session","devin_create_session","devin_get_session","devin_get_session_tags","devin_list_session_attachments","devin_list_session_messages","devin_list_sessions","devin_replace_session_tags","devin_send_message","devin_terminate_session","discord_add_reaction","discord_archive_thread","discord_assign_role","discord_ban_member","discord_bulk_delete_messages","discord_create_channel","discord_create_invite","discord_create_role","discord_create_thread","discord_create_webhook","discord_delete_channel","discord_delete_invite","discord_delete_message","discord_delete_role","discord_delete_webhook","discord_edit_message","discord_execute_webhook","discord_get_channel","discord_get_invite","discord_get_member","discord_get_messages","discord_get_pinned_messages","discord_get_server","discord_get_user","discord_get_webhook","discord_join_thread","discord_kick_member","discord_leave_thread","discord_list_channels","discord_list_roles","discord_pin_message","discord_remove_reaction","discord_remove_role","discord_send_message","discord_unban_member","discord_unpin_message","discord_update_channel","discord_update_member","discord_update_role","docusign_create_from_template","docusign_download_document","docusign_get_envelope","docusign_list_envelopes","docusign_list_recipients","docusign_list_templates","docusign_send_envelope","docusign_void_envelope","downdetector_get_company","downdetector_get_company_attribution","downdetector_get_company_baseline","downdetector_get_company_events","downdetector_get_company_incidents","downdetector_get_company_indicators","downdetector_get_company_last_15","downdetector_get_company_status","downdetector_get_provider","downdetector_get_reports","downdetector_get_site_companies","downdetector_list_categories","downdetector_list_incidents","downdetector_list_sites","downdetector_search_companies","dropbox_copy","dropbox_create_folder","dropbox_create_shared_link","dropbox_delete","dropbox_download","dropbox_get_metadata","dropbox_list_folder","dropbox_list_revisions","dropbox_list_shared_links","dropbox_move","dropbox_restore","dropbox_search","dropbox_upload","dropcontact_enrich_contact","dspy_chain_of_thought","dspy_predict","dspy_react","dub_bulk_create_links","dub_bulk_delete_links","dub_bulk_update_links","dub_create_link","dub_create_tag","dub_delete_link","dub_get_analytics","dub_get_events","dub_get_link","dub_get_links_count","dub_get_qr_code","dub_list_domains","dub_list_folders","dub_list_links","dub_list_tags","dub_update_link","dub_upsert_link","duckduckgo_search","dynamodb_delete","dynamodb_get","dynamodb_introspect","dynamodb_put","dynamodb_query","dynamodb_scan","dynamodb_update","dynatrace_add_problem_comment","dynatrace_add_tags","dynatrace_close_problem","dynatrace_create_settings_object","dynatrace_create_slo","dynatrace_delete_problem_comment","dynatrace_delete_settings_object","dynatrace_delete_slo","dynatrace_delete_tag","dynatrace_execute_synthetic_monitors","dynatrace_get_attack","dynatrace_get_audit_logs","dynatrace_get_entity","dynatrace_get_event","dynatrace_get_metric","dynatrace_get_problem","dynatrace_get_problem_comment","dynatrace_get_security_problem","dynatrace_get_settings_object","dynatrace_get_slo","dynatrace_get_synthetic_batch","dynatrace_ingest_event","dynatrace_ingest_logs","dynatrace_ingest_metrics","dynatrace_list_attacks","dynatrace_list_entities","dynatrace_list_entity_types","dynatrace_list_events","dynatrace_list_metrics","dynatrace_list_problem_comments","dynatrace_list_problems","dynatrace_list_remediation_items","dynatrace_list_security_problems","dynatrace_list_settings_objects","dynatrace_list_settings_schemas","dynatrace_list_slos","dynatrace_list_synthetic_monitors","dynatrace_list_tags","dynatrace_mute_security_problem","dynatrace_mute_security_problems","dynatrace_query_metrics","dynatrace_search_logs","dynatrace_unmute_security_problem","dynatrace_unmute_security_problems","dynatrace_update_problem_comment","dynatrace_update_settings_object","dynatrace_update_slo","elasticsearch_bulk","elasticsearch_cluster_health","elasticsearch_cluster_stats","elasticsearch_count","elasticsearch_create_index","elasticsearch_delete_document","elasticsearch_delete_index","elasticsearch_get_document","elasticsearch_get_index","elasticsearch_index_document","elasticsearch_list_indices","elasticsearch_search","elasticsearch_update_document","elevenlabs_audio_isolation","elevenlabs_edit_voice_settings","elevenlabs_get_user","elevenlabs_get_voice","elevenlabs_get_voice_settings","elevenlabs_list_models","elevenlabs_list_voices","elevenlabs_sound_effects","elevenlabs_speech_to_speech","elevenlabs_tts","emailbison_attach_leads_to_campaign","emailbison_attach_tags_to_leads","emailbison_create_campaign","emailbison_create_lead","emailbison_create_tag","emailbison_get_lead","emailbison_list_campaigns","emailbison_list_leads","emailbison_list_replies","emailbison_list_tags","emailbison_update_campaign","emailbison_update_campaign_status","emailbison_update_lead","embeddings_cohere","embeddings_gemini","embeddings_mistral","embeddings_openai","embeddings_openrouter","enrich_check_credits","enrich_company_funding","enrich_company_lookup","enrich_company_revenue","enrich_disposable_email_check","enrich_email_to_ip","enrich_email_to_person_lite","enrich_email_to_phone","enrich_email_to_profile","enrich_find_email","enrich_get_post_details","enrich_ip_to_company","enrich_linkedin_profile","enrich_linkedin_to_personal_email","enrich_linkedin_to_work_email","enrich_phone_finder","enrich_reverse_hash_lookup","enrich_sales_pointer_people","enrich_search_company","enrich_search_company_activities","enrich_search_company_employees","enrich_search_jobs","enrich_search_logo","enrich_search_people","enrich_search_people_activities","enrich_search_post_comments","enrich_search_post_comments_by_url","enrich_search_post_reactions","enrich_search_post_reactions_by_url","enrich_search_posts","enrich_search_similar_companies","enrich_verify_email","enrichment_run","enrow_find_email","enrow_verify_email","exa_agent","exa_answer","exa_find_similar_links","exa_get_contents","exa_search","extend_parser","extend_parser_v2","fathom_get_summary","fathom_get_transcript","fathom_list_meeting_types","fathom_list_meetings","fathom_list_team_members","fathom_list_teams","file_append","file_compress","file_decompress","file_fetch","file_get","file_get_content","file_manage_sharing","file_parser","file_parser_v2","file_parser_v3","file_read","file_write","findymail_find_email_from_linkedin","findymail_find_email_from_name","findymail_find_emails_by_domain","findymail_find_employees","findymail_find_phone","findymail_get_company","findymail_get_credits","findymail_lookup_technologies","findymail_reverse_email_lookup","findymail_search_technologies","findymail_verify_email","firecrawl_agent","firecrawl_batch_scrape","firecrawl_batch_scrape_status","firecrawl_cancel_crawl","firecrawl_crawl","firecrawl_crawl_status","firecrawl_credit_usage","firecrawl_extract","firecrawl_extract_status","firecrawl_map","firecrawl_parse","firecrawl_scrape","firecrawl_search","fireflies_add_to_live_meeting","fireflies_create_bite","fireflies_delete_transcript","fireflies_get_transcript","fireflies_get_user","fireflies_list_bites","fireflies_list_contacts","fireflies_list_transcripts","fireflies_list_users","fireflies_upload_audio","flint_create_task","flint_generate_pages","flint_get_task","function_execute","gamma_check_status","gamma_generate","gamma_generate_from_template","gamma_list_folders","gamma_list_themes","github_add_assignees","github_add_assignees_v2","github_add_labels","github_add_labels_v2","github_cancel_workflow_run","github_cancel_workflow_run_v2","github_check_star","github_check_star_v2","github_close_issue","github_close_issue_v2","github_close_pr","github_close_pr_v2","github_comment","github_comment_v2","github_compare_commits","github_compare_commits_v2","github_create_branch","github_create_branch_v2","github_create_comment_reaction","github_create_comment_reaction_v2","github_create_file","github_create_file_v2","github_create_gist","github_create_gist_v2","github_create_issue","github_create_issue_reaction","github_create_issue_reaction_v2","github_create_issue_v2","github_create_milestone","github_create_milestone_v2","github_create_pr","github_create_pr_review","github_create_pr_review_v2","github_create_pr_v2","github_create_project","github_create_project_v2","github_create_release","github_create_release_v2","github_delete_branch","github_delete_branch_v2","github_delete_comment","github_delete_comment_reaction","github_delete_comment_reaction_v2","github_delete_comment_v2","github_delete_file","github_delete_file_v2","github_delete_gist","github_delete_gist_v2","github_delete_issue_reaction","github_delete_issue_reaction_v2","github_delete_milestone","github_delete_milestone_v2","github_delete_project","github_delete_project_v2","github_delete_release","github_delete_release_v2","github_fork_gist","github_fork_gist_v2","github_fork_repo","github_fork_repo_v2","github_get_branch","github_get_branch_protection","github_get_branch_protection_v2","github_get_branch_v2","github_get_commit","github_get_commit_v2","github_get_file_content","github_get_file_content_v2","github_get_gist","github_get_gist_v2","github_get_issue","github_get_issue_v2","github_get_latest_release","github_get_latest_release_v2","github_get_milestone","github_get_milestone_v2","github_get_pr_files","github_get_pr_files_v2","github_get_project","github_get_project_v2","github_get_readme","github_get_readme_v2","github_get_release","github_get_release_v2","github_get_tree","github_get_tree_v2","github_get_workflow","github_get_workflow_run","github_get_workflow_run_v2","github_get_workflow_v2","github_issue_comment","github_issue_comment_v2","github_job_logs","github_latest_commit","github_latest_commit_v2","github_list_branches","github_list_branches_v2","github_list_commits","github_list_commits_v2","github_list_forks","github_list_forks_v2","github_list_gists","github_list_gists_v2","github_list_issue_comments","github_list_issue_comments_v2","github_list_issues","github_list_issues_v2","github_list_milestones","github_list_milestones_v2","github_list_pr_comments","github_list_pr_comments_v2","github_list_projects","github_list_projects_v2","github_list_prs","github_list_prs_v2","github_list_releases","github_list_releases_v2","github_list_review_threads","github_list_stargazers","github_list_stargazers_v2","github_list_tags","github_list_tags_v2","github_list_workflow_runs","github_list_workflow_runs_v2","github_list_workflows","github_list_workflows_v2","github_merge_pr","github_merge_pr_v2","github_pr","github_pr_v2","github_remove_label","github_remove_label_v2","github_reply_review_thread","github_repo_info","github_repo_info_v2","github_request_reviewers","github_request_reviewers_v2","github_rerun_workflow","github_rerun_workflow_v2","github_resolve_review_thread","github_search_code","github_search_code_v2","github_search_commits","github_search_commits_v2","github_search_issues","github_search_issues_v2","github_search_repos","github_search_repos_v2","github_search_users","github_search_users_v2","github_star_gist","github_star_gist_v2","github_star_repo","github_star_repo_v2","github_status_check_rollup","github_trigger_workflow","github_trigger_workflow_v2","github_unstar_gist","github_unstar_gist_v2","github_unstar_repo","github_unstar_repo_v2","github_update_branch_protection","github_update_branch_protection_v2","github_update_comment","github_update_comment_v2","github_update_file","github_update_file_v2","github_update_gist","github_update_gist_v2","github_update_issue","github_update_issue_v2","github_update_milestone","github_update_milestone_v2","github_update_pr","github_update_pr_v2","github_update_project","github_update_project_v2","github_update_release","github_update_release_v2","gitlab_activate_user","gitlab_add_member","gitlab_add_saml_group_link","gitlab_approve_access_request","gitlab_approve_merge_request","gitlab_approve_user","gitlab_ban_user","gitlab_block_user","gitlab_cancel_pipeline","gitlab_compare_branches","gitlab_create_branch","gitlab_create_file","gitlab_create_issue","gitlab_create_issue_note","gitlab_create_merge_request","gitlab_create_merge_request_note","gitlab_create_pipeline","gitlab_create_release","gitlab_create_user","gitlab_deactivate_user","gitlab_delete_branch","gitlab_delete_issue","gitlab_delete_saml_group_link","gitlab_delete_user","gitlab_delete_user_identity","gitlab_deny_access_request","gitlab_get_file","gitlab_get_group","gitlab_get_issue","gitlab_get_job_log","gitlab_get_merge_request","gitlab_get_merge_request_changes","gitlab_get_pipeline","gitlab_get_project","gitlab_invite_member","gitlab_list_access_requests","gitlab_list_branches","gitlab_list_commits","gitlab_list_groups","gitlab_list_invitations","gitlab_list_issues","gitlab_list_members","gitlab_list_merge_requests","gitlab_list_pipeline_jobs","gitlab_list_pipelines","gitlab_list_projects","gitlab_list_releases","gitlab_list_repository_tree","gitlab_list_saml_group_links","gitlab_list_user_memberships","gitlab_merge_merge_request","gitlab_play_job","gitlab_reject_user","gitlab_remove_member","gitlab_retry_pipeline","gitlab_revoke_invitation","gitlab_search_users","gitlab_unban_user","gitlab_unblock_user","gitlab_update_file","gitlab_update_invitation","gitlab_update_issue","gitlab_update_member","gitlab_update_merge_request","gitlab_update_user","gmail_add_label","gmail_add_label_v2","gmail_archive","gmail_archive_v2","gmail_create_label_v2","gmail_delete","gmail_delete_draft_v2","gmail_delete_label_v2","gmail_delete_v2","gmail_draft","gmail_draft_v2","gmail_edit_draft_v2","gmail_get_draft_v2","gmail_get_thread_v2","gmail_list_drafts_v2","gmail_list_labels_v2","gmail_list_threads_v2","gmail_mark_read","gmail_mark_read_v2","gmail_mark_unread","gmail_mark_unread_v2","gmail_move","gmail_move_v2","gmail_read","gmail_read_v2","gmail_remove_label","gmail_remove_label_v2","gmail_search","gmail_search_v2","gmail_send","gmail_send_v2","gmail_trash_thread_v2","gmail_unarchive","gmail_unarchive_v2","gmail_untrash_thread_v2","gmail_update_label_v2","gong_aggregate_activity","gong_aggregate_by_period","gong_answered_scorecards","gong_ask_anything","gong_assign_flow_prospects","gong_create_call","gong_day_by_day_activity","gong_get_brief","gong_get_call","gong_get_call_transcript","gong_get_coaching","gong_get_extensive_calls","gong_get_folder_content","gong_get_logs","gong_get_prospect_flows","gong_get_user","gong_interaction_stats","gong_list_calls","gong_list_flows","gong_list_library_folders","gong_list_scorecards","gong_list_trackers","gong_list_users","gong_list_workspaces","gong_lookup_email","gong_lookup_phone","gong_purge_email_address","gong_purge_phone_number","gong_unassign_flow_prospects","google_ads_ad_performance","google_ads_campaign_performance","google_ads_list_ad_groups","google_ads_list_campaigns","google_ads_list_customers","google_ads_search","google_appsheet_add_rows","google_appsheet_delete_rows","google_appsheet_edit_rows","google_appsheet_find_rows","google_bigquery_create_dataset","google_bigquery_create_table","google_bigquery_delete_dataset","google_bigquery_delete_table","google_bigquery_get_query_results","google_bigquery_get_table","google_bigquery_insert_rows","google_bigquery_list_datasets","google_bigquery_list_table_data","google_bigquery_list_tables","google_bigquery_query","google_books_volume_details","google_books_volume_search","google_calendar_create","google_calendar_create_calendar","google_calendar_create_calendar_v2","google_calendar_create_v2","google_calendar_delete","google_calendar_delete_calendar","google_calendar_delete_calendar_v2","google_calendar_delete_v2","google_calendar_freebusy","google_calendar_freebusy_v2","google_calendar_get","google_calendar_get_v2","google_calendar_instances","google_calendar_instances_v2","google_calendar_invite","google_calendar_invite_v2","google_calendar_list","google_calendar_list_acl","google_calendar_list_acl_v2","google_calendar_list_calendars","google_calendar_list_calendars_v2","google_calendar_list_v2","google_calendar_move","google_calendar_move_v2","google_calendar_quick_add","google_calendar_quick_add_v2","google_calendar_share_calendar","google_calendar_share_calendar_v2","google_calendar_unshare_calendar","google_calendar_unshare_calendar_v2","google_calendar_update","google_calendar_update_acl","google_calendar_update_acl_v2","google_calendar_update_calendar","google_calendar_update_calendar_v2","google_calendar_update_v2","google_contacts_create","google_contacts_delete","google_contacts_get","google_contacts_list","google_contacts_search","google_contacts_update","google_docs_create","google_docs_create_named_range","google_docs_create_paragraph_bullets","google_docs_delete_content_range","google_docs_delete_named_range","google_docs_delete_paragraph_bullets","google_docs_insert_image","google_docs_insert_page_break","google_docs_insert_table","google_docs_insert_text","google_docs_read","google_docs_replace_text","google_docs_update_paragraph_style","google_docs_update_text_style","google_docs_write","google_drive_copy","google_drive_create_comment","google_drive_create_folder","google_drive_delete","google_drive_delete_comment","google_drive_download","google_drive_export","google_drive_get_about","google_drive_get_content","google_drive_get_file","google_drive_get_revision","google_drive_list","google_drive_list_comments","google_drive_list_permissions","google_drive_list_revisions","google_drive_move","google_drive_search","google_drive_share","google_drive_trash","google_drive_unshare","google_drive_untrash","google_drive_update","google_drive_upload","google_forms_batch_update","google_forms_create_form","google_forms_create_watch","google_forms_delete_watch","google_forms_get_form","google_forms_get_responses","google_forms_list_watches","google_forms_renew_watch","google_forms_set_publish_settings","google_groups_add_alias","google_groups_add_member","google_groups_create_group","google_groups_delete_group","google_groups_get_group","google_groups_get_member","google_groups_get_settings","google_groups_has_member","google_groups_list_aliases","google_groups_list_groups","google_groups_list_members","google_groups_remove_alias","google_groups_remove_member","google_groups_update_group","google_groups_update_member","google_groups_update_settings","google_maps_air_quality","google_maps_directions","google_maps_distance_matrix","google_maps_elevation","google_maps_geocode","google_maps_geolocate","google_maps_place_details","google_maps_places_nearby","google_maps_places_search","google_maps_pollen","google_maps_reverse_geocode","google_maps_snap_to_roads","google_maps_solar","google_maps_speed_limits","google_maps_timezone","google_maps_validate_address","google_meet_create_space","google_meet_end_conference","google_meet_get_conference_record","google_meet_get_space","google_meet_list_conference_records","google_meet_list_participants","google_pagespeed_analyze","google_search","google_sheets_append","google_sheets_append_v2","google_sheets_batch_clear_v2","google_sheets_batch_get_v2","google_sheets_batch_update_v2","google_sheets_clear_v2","google_sheets_copy_sheet_v2","google_sheets_create_spreadsheet_v2","google_sheets_delete_rows_v2","google_sheets_delete_sheet_v2","google_sheets_delete_spreadsheet_v2","google_sheets_get_spreadsheet_v2","google_sheets_read","google_sheets_read_v2","google_sheets_update","google_sheets_update_v2","google_sheets_write","google_sheets_write_v2","google_slides_add_image","google_slides_add_slide","google_slides_batch_update","google_slides_copy_presentation","google_slides_create","google_slides_create_line","google_slides_create_paragraph_bullets","google_slides_create_shape","google_slides_create_sheets_chart","google_slides_create_table","google_slides_create_video","google_slides_delete_object","google_slides_delete_paragraph_bullets","google_slides_delete_table_column","google_slides_delete_table_row","google_slides_delete_text","google_slides_duplicate_object","google_slides_export_presentation","google_slides_get_page","google_slides_get_thumbnail","google_slides_group_objects","google_slides_insert_table_columns","google_slides_insert_table_rows","google_slides_insert_text","google_slides_merge_table_cells","google_slides_read","google_slides_refresh_sheets_chart","google_slides_replace_all_shapes_with_image","google_slides_replace_all_shapes_with_sheets_chart","google_slides_replace_all_text","google_slides_replace_image","google_slides_reroute_line","google_slides_ungroup_objects","google_slides_unmerge_table_cells","google_slides_update_image_properties","google_slides_update_line_category","google_slides_update_line_properties","google_slides_update_page_element_alt_text","google_slides_update_page_element_transform","google_slides_update_page_elements_z_order","google_slides_update_page_properties","google_slides_update_paragraph_style","google_slides_update_shape_properties","google_slides_update_slide_properties","google_slides_update_slides_position","google_slides_update_table_border_properties","google_slides_update_table_cell_properties","google_slides_update_table_column_properties","google_slides_update_table_row_properties","google_slides_update_text_style","google_slides_update_video_properties","google_slides_write","google_tasks_create","google_tasks_delete","google_tasks_get","google_tasks_list","google_tasks_list_task_lists","google_tasks_update","google_translate_detect","google_translate_text","google_vault_add_held_accounts","google_vault_add_matters_permissions","google_vault_close_matters","google_vault_create_matters","google_vault_create_matters_export","google_vault_create_matters_holds","google_vault_create_saved_query","google_vault_delete_matters","google_vault_delete_matters_export","google_vault_delete_matters_holds","google_vault_delete_saved_query","google_vault_download_export_file","google_vault_list_matters","google_vault_list_matters_export","google_vault_list_matters_holds","google_vault_list_saved_queries","google_vault_remove_held_accounts","google_vault_remove_matters_permissions","google_vault_reopen_matters","google_vault_undelete_matters","google_vault_update_matters","google_vault_update_matters_holds","grafana_check_data_source_health","grafana_create_alert_rule","grafana_create_annotation","grafana_create_contact_point","grafana_create_dashboard","grafana_create_folder","grafana_delete_alert_rule","grafana_delete_annotation","grafana_delete_contact_point","grafana_delete_dashboard","grafana_delete_folder","grafana_get_alert_rule","grafana_get_alert_rule_group","grafana_get_dashboard","grafana_get_data_source","grafana_get_folder","grafana_get_health","grafana_list_alert_rules","grafana_list_annotations","grafana_list_contact_points","grafana_list_dashboards","grafana_list_data_sources","grafana_list_folders","grafana_move_folder","grafana_query_data_source","grafana_update_alert_rule","grafana_update_annotation","grafana_update_contact_point","grafana_update_dashboard","grafana_update_folder","grain_create_hook","grain_create_hook_v2","grain_delete_hook","grain_delete_hook_v2","grain_get_recording","grain_get_transcript","grain_list_hooks","grain_list_hooks_v2","grain_list_meeting_types","grain_list_recordings","grain_list_teams","grain_list_views","granola_create_webhook_endpoint","granola_delete_webhook_endpoint","granola_get_note","granola_get_transcript","granola_list_audit_events","granola_list_folders","granola_list_notes","granola_list_webhook_endpoints","granola_update_webhook_endpoint","greenhouse_get_application","greenhouse_get_candidate","greenhouse_get_job","greenhouse_get_user","greenhouse_list_applications","greenhouse_list_candidates","greenhouse_list_departments","greenhouse_list_job_stages","greenhouse_list_jobs","greenhouse_list_offices","greenhouse_list_users","greptile_index_repo","greptile_query","greptile_search","greptile_status","guardrails_validate","harmonic_batch_get_people","harmonic_clear_people_saved_search_net_new_results","harmonic_enrich_person","harmonic_get_company_employees","harmonic_get_email_enrichment_job","harmonic_get_email_enrichment_usage","harmonic_get_enrichment_status","harmonic_get_people_saved_search_net_new_results","harmonic_get_people_saved_search_results","harmonic_get_person","harmonic_list_people_saved_searches","harmonic_search_people_scout","harmonic_submit_email_enrichment_job","hex_cancel_run","hex_create_collection","hex_create_group","hex_deactivate_user","hex_delete_group","hex_get_collection","hex_get_data_connection","hex_get_group","hex_get_project","hex_get_project_runs","hex_get_queried_tables","hex_get_run_status","hex_list_collections","hex_list_data_connections","hex_list_groups","hex_list_projects","hex_list_users","hex_run_project","hex_update_collection","hex_update_group","hex_update_project","http_request","hubspot_add_list_memberships","hubspot_create_appointment","hubspot_create_association","hubspot_create_company","hubspot_create_contact","hubspot_create_deal","hubspot_create_email","hubspot_create_line_item","hubspot_create_list","hubspot_create_note","hubspot_create_ticket","hubspot_delete_association","hubspot_delete_company","hubspot_delete_contact","hubspot_delete_deal","hubspot_delete_line_item","hubspot_delete_ticket","hubspot_get_appointment","hubspot_get_association_labels","hubspot_get_cart","hubspot_get_company","hubspot_get_contact","hubspot_get_deal","hubspot_get_email","hubspot_get_line_item","hubspot_get_list","hubspot_get_list_memberships","hubspot_get_marketing_event","hubspot_get_note","hubspot_get_properties","hubspot_get_quote","hubspot_get_ticket","hubspot_get_users","hubspot_list_appointments","hubspot_list_associations","hubspot_list_carts","hubspot_list_companies","hubspot_list_contacts","hubspot_list_deals","hubspot_list_emails","hubspot_list_line_items","hubspot_list_lists","hubspot_list_marketing_events","hubspot_list_notes","hubspot_list_owners","hubspot_list_quotes","hubspot_list_tickets","hubspot_remove_list_memberships","hubspot_search_companies","hubspot_search_contacts","hubspot_search_deals","hubspot_search_emails","hubspot_search_line_items","hubspot_search_notes","hubspot_search_quotes","hubspot_search_tickets","hubspot_update_appointment","hubspot_update_company","hubspot_update_contact","hubspot_update_deal","hubspot_update_line_item","hubspot_update_ticket","huggingface_chat","hunter_companies_find","hunter_discover","hunter_domain_search","hunter_email_count","hunter_email_finder","hunter_email_verifier","iam_add_user_to_group","iam_attach_role_policy","iam_attach_user_policy","iam_create_access_key","iam_create_role","iam_create_user","iam_delete_access_key","iam_delete_role","iam_delete_user","iam_detach_role_policy","iam_detach_user_policy","iam_get_role","iam_get_user","iam_list_attached_role_policies","iam_list_attached_user_policies","iam_list_groups","iam_list_policies","iam_list_roles","iam_list_users","iam_remove_user_from_group","iam_simulate_principal_policy","icypeas_find_email","icypeas_verify_email","identity_center_check_assignment_deletion_status","identity_center_check_assignment_status","identity_center_create_account_assignment","identity_center_delete_account_assignment","identity_center_describe_account","identity_center_get_group","identity_center_get_user","identity_center_list_account_assignments","identity_center_list_accounts","identity_center_list_groups","identity_center_list_instances","identity_center_list_permission_sets","image_generate","incidentio_actions_create","incidentio_actions_list","incidentio_actions_show","incidentio_actions_update","incidentio_alert_events_create","incidentio_alerts_list","incidentio_alerts_resolve","incidentio_alerts_show","incidentio_catalog_entries_list","incidentio_catalog_types_list","incidentio_custom_fields_create","incidentio_custom_fields_delete","incidentio_custom_fields_list","incidentio_custom_fields_show","incidentio_custom_fields_update","incidentio_escalation_paths_create","incidentio_escalation_paths_delete","incidentio_escalation_paths_list","incidentio_escalation_paths_show","incidentio_escalation_paths_update","incidentio_escalations_cancel","incidentio_escalations_create","incidentio_escalations_list","incidentio_escalations_show","incidentio_follow_ups_create","incidentio_follow_ups_list","incidentio_follow_ups_show","incidentio_follow_ups_update","incidentio_incident_alerts_list","incidentio_incident_memberships_create","incidentio_incident_memberships_revoke","incidentio_incident_participants_list","incidentio_incident_roles_create","incidentio_incident_roles_delete","incidentio_incident_roles_list","incidentio_incident_roles_show","incidentio_incident_roles_update","incidentio_incident_statuses_list","incidentio_incident_timestamps_list","incidentio_incident_timestamps_show","incidentio_incident_types_list","incidentio_incident_updates_list","incidentio_incidents_create","incidentio_incidents_list","incidentio_incidents_show","incidentio_incidents_update","incidentio_on_call_now","incidentio_schedule_entries_list","incidentio_schedule_overrides_create","incidentio_schedule_overrides_list","incidentio_schedules_create","incidentio_schedules_delete","incidentio_schedules_list","incidentio_schedules_show","incidentio_schedules_update","incidentio_severities_list","incidentio_teams_list","incidentio_teams_show","incidentio_users_list","incidentio_users_show","incidentio_workflows_create","incidentio_workflows_delete","incidentio_workflows_list","incidentio_workflows_show","incidentio_workflows_update","infisical_create_secret","infisical_delete_secret","infisical_get_secret","infisical_list_secrets","infisical_update_secret","instagram_delete_comment","instagram_download_media","instagram_get_account_insights","instagram_get_container_status","instagram_get_conversation_messages","instagram_get_media","instagram_get_media_insights","instagram_get_message","instagram_get_profile","instagram_get_publishing_limit","instagram_hide_comment","instagram_list_comments","instagram_list_conversations","instagram_list_media","instagram_list_stories","instagram_private_reply","instagram_publish_carousel","instagram_publish_image","instagram_publish_reel","instagram_publish_story","instagram_publish_video","instagram_reply_to_comment","instagram_send_text_message","instagram_set_comments_enabled","instantly_activate_campaign","instantly_create_campaign","instantly_create_lead","instantly_create_lead_list","instantly_delete_campaign","instantly_delete_leads","instantly_get_lead","instantly_list_campaigns","instantly_list_emails","instantly_list_lead_lists","instantly_list_leads","instantly_patch_campaign","instantly_patch_lead","instantly_pause_campaign","instantly_reply_to_email","instantly_update_lead_interest_status","intercom_assign_conversation_v2","intercom_attach_contact_to_company_v2","intercom_close_conversation_v2","intercom_create_company","intercom_create_company_v2","intercom_create_contact","intercom_create_contact_v2","intercom_create_event_v2","intercom_create_message","intercom_create_message_v2","intercom_create_note_v2","intercom_create_tag_v2","intercom_create_ticket","intercom_create_ticket_v2","intercom_delete_contact","intercom_delete_contact_v2","intercom_detach_contact_from_company_v2","intercom_get_company","intercom_get_company_v2","intercom_get_contact","intercom_get_contact_v2","intercom_get_conversation","intercom_get_conversation_v2","intercom_get_ticket","intercom_get_ticket_v2","intercom_list_admins_v2","intercom_list_companies","intercom_list_companies_v2","intercom_list_contacts","intercom_list_contacts_v2","intercom_list_conversations","intercom_list_conversations_v2","intercom_list_tags_v2","intercom_open_conversation_v2","intercom_reply_conversation","intercom_reply_conversation_v2","intercom_search_contacts","intercom_search_contacts_v2","intercom_search_conversations","intercom_search_conversations_v2","intercom_snooze_conversation_v2","intercom_tag_contact_v2","intercom_tag_conversation_v2","intercom_untag_contact_v2","intercom_update_contact","intercom_update_contact_v2","intercom_update_ticket_v2","jina_read_url","jina_search","jira_add_attachment","jira_add_comment","jira_add_watcher","jira_add_worklog","jira_assign_issue","jira_bulk_read","jira_create_issue_link","jira_delete_attachment","jira_delete_comment","jira_delete_issue","jira_delete_issue_link","jira_delete_worklog","jira_get_attachments","jira_get_comments","jira_get_fields","jira_get_project","jira_get_transitions","jira_get_users","jira_get_worklogs","jira_list_issue_types","jira_list_projects","jira_remove_watcher","jira_retrieve","jira_search_issues","jira_search_users","jira_transition_issue","jira_update","jira_update_comment","jira_update_worklog","jira_write","jotform_add_label_resources","jotform_clone_form","jotform_create_form","jotform_create_label","jotform_create_question","jotform_create_questions","jotform_create_report","jotform_create_submission","jotform_create_submissions","jotform_create_webhook","jotform_delete_form","jotform_delete_label","jotform_delete_question","jotform_delete_report","jotform_delete_submission","jotform_delete_webhook","jotform_get_form","jotform_get_form_properties","jotform_get_history","jotform_get_label","jotform_get_question","jotform_get_report","jotform_get_settings","jotform_get_submission","jotform_get_usage","jotform_get_user","jotform_list_form_files","jotform_list_form_reports","jotform_list_form_submissions","jotform_list_forms","jotform_list_label_resources","jotform_list_labels","jotform_list_questions","jotform_list_reports","jotform_list_submissions","jotform_list_subusers","jotform_list_webhooks","jotform_remove_label_resources","jotform_update_form_properties","jotform_update_label","jotform_update_question","jotform_update_settings","jotform_update_submission","jsm_add_comment","jsm_add_customer","jsm_add_organization","jsm_add_participants","jsm_answer_approval","jsm_attach_form","jsm_copy_forms","jsm_create_object","jsm_create_organization","jsm_create_request","jsm_delete_form","jsm_delete_object","jsm_externalise_form","jsm_get_approvals","jsm_get_comments","jsm_get_customers","jsm_get_form","jsm_get_form_answers","jsm_get_form_structure","jsm_get_form_templates","jsm_get_issue_forms","jsm_get_object","jsm_get_object_schema","jsm_get_object_type_attributes","jsm_get_organizations","jsm_get_participants","jsm_get_queues","jsm_get_request","jsm_get_request_type_fields","jsm_get_request_types","jsm_get_requests","jsm_get_service_desks","jsm_get_sla","jsm_get_transitions","jsm_internalise_form","jsm_list_object_schemas","jsm_list_object_types","jsm_reopen_form","jsm_save_form_answers","jsm_search_objects_aql","jsm_submit_form","jsm_transition_request","jsm_update_object","jupyter_copy_content","jupyter_create_file","jupyter_create_session","jupyter_delete_content","jupyter_delete_session","jupyter_get_content","jupyter_interrupt_kernel","jupyter_list_contents","jupyter_list_kernels","jupyter_list_kernelspecs","jupyter_list_sessions","jupyter_rename_content","jupyter_restart_kernel","jupyter_start_kernel","jupyter_stop_kernel","jupyter_upload_file","kalshi_amend_order","kalshi_amend_order_v2","kalshi_cancel_order","kalshi_cancel_order_v2","kalshi_create_order","kalshi_create_order_v2","kalshi_get_balance","kalshi_get_balance_v2","kalshi_get_candlesticks","kalshi_get_candlesticks_v2","kalshi_get_event","kalshi_get_event_candlesticks","kalshi_get_event_candlesticks_v2","kalshi_get_event_v2","kalshi_get_events","kalshi_get_events_v2","kalshi_get_exchange_announcements","kalshi_get_exchange_announcements_v2","kalshi_get_exchange_schedule","kalshi_get_exchange_schedule_v2","kalshi_get_exchange_status","kalshi_get_exchange_status_v2","kalshi_get_fills","kalshi_get_fills_v2","kalshi_get_market","kalshi_get_market_v2","kalshi_get_markets","kalshi_get_markets_v2","kalshi_get_order","kalshi_get_order_v2","kalshi_get_orderbook","kalshi_get_orderbook_v2","kalshi_get_orders","kalshi_get_orders_v2","kalshi_get_positions","kalshi_get_positions_v2","kalshi_get_series_by_ticker","kalshi_get_series_by_ticker_v2","kalshi_get_series_list","kalshi_get_series_list_v2","kalshi_get_settlements","kalshi_get_settlements_v2","kalshi_get_trades","kalshi_get_trades_v2","ketch_get_consent","ketch_get_subscriptions","ketch_invoke_right","ketch_set_consent","ketch_set_subscriptions","knowledge_create_document","knowledge_delete_chunk","knowledge_delete_document","knowledge_get_connector","knowledge_get_document","knowledge_list_chunks","knowledge_list_connectors","knowledge_list_documents","knowledge_list_tags","knowledge_search","knowledge_trigger_sync","knowledge_update_chunk","knowledge_upload_chunk","knowledge_upsert_document","lambda_add_permission","lambda_create_alias","lambda_create_event_source_mapping","lambda_create_function","lambda_create_function_url_config","lambda_delete_alias","lambda_delete_event_source_mapping","lambda_delete_function","lambda_delete_function_concurrency","lambda_delete_function_event_invoke_config","lambda_delete_function_url_config","lambda_delete_provisioned_concurrency_config","lambda_get_account_settings","lambda_get_alias","lambda_get_event_source_mapping","lambda_get_function","lambda_get_function_concurrency","lambda_get_function_configuration","lambda_get_function_event_invoke_config","lambda_get_function_recursion_config","lambda_get_function_url_config","lambda_get_layer_version","lambda_get_policy","lambda_get_provisioned_concurrency_config","lambda_get_runtime_management_config","lambda_invoke","lambda_list_aliases","lambda_list_event_source_mappings","lambda_list_function_event_invoke_configs","lambda_list_function_url_configs","lambda_list_functions","lambda_list_layer_versions","lambda_list_layers","lambda_list_provisioned_concurrency_configs","lambda_list_tags","lambda_list_versions_by_function","lambda_publish_version","lambda_put_function_concurrency","lambda_put_function_event_invoke_config","lambda_put_function_recursion_config","lambda_put_provisioned_concurrency_config","lambda_put_runtime_management_config","lambda_remove_permission","lambda_tag_resource","lambda_untag_resource","lambda_update_alias","lambda_update_event_source_mapping","lambda_update_function_code","lambda_update_function_configuration","lambda_update_function_url_config","langsmith_create_feedback","langsmith_create_run","langsmith_create_runs_batch","langsmith_get_run","langsmith_update_run","latex_compile","latex_get_package","latex_list_fonts","latex_search_packages","launchdarkly_create_flag","launchdarkly_delete_flag","launchdarkly_get_audit_log","launchdarkly_get_flag","launchdarkly_get_flag_status","launchdarkly_list_environments","launchdarkly_list_flags","launchdarkly_list_members","launchdarkly_list_projects","launchdarkly_list_segments","launchdarkly_toggle_flag","launchdarkly_update_flag","leadmagic_company_search","leadmagic_email_to_profile","leadmagic_find_email","leadmagic_find_mobile","leadmagic_get_credits","leadmagic_profile_search","leadmagic_profile_to_email","leadmagic_role_finder","leadmagic_validate_email","lemlist_get_activities","lemlist_get_lead","lemlist_send_email","linear_add_label_to_issue","linear_add_label_to_project","linear_archive_issue","linear_archive_label","linear_archive_project","linear_create_attachment","linear_create_comment","linear_create_customer","linear_create_customer_request","linear_create_customer_status","linear_create_customer_tier","linear_create_cycle","linear_create_favorite","linear_create_issue","linear_create_issue_relation","linear_create_label","linear_create_project","linear_create_project_label","linear_create_project_milestone","linear_create_project_status","linear_create_project_update","linear_create_workflow_state","linear_delete_attachment","linear_delete_comment","linear_delete_customer","linear_delete_customer_status","linear_delete_customer_tier","linear_delete_issue","linear_delete_issue_relation","linear_delete_project","linear_delete_project_label","linear_delete_project_milestone","linear_delete_project_status","linear_get_active_cycle","linear_get_customer","linear_get_cycle","linear_get_issue","linear_get_project","linear_get_viewer","linear_list_attachments","linear_list_comments","linear_list_customer_requests","linear_list_customer_statuses","linear_list_customer_tiers","linear_list_customers","linear_list_cycles","linear_list_favorites","linear_list_issue_relations","linear_list_labels","linear_list_notifications","linear_list_project_labels","linear_list_project_milestones","linear_list_project_statuses","linear_list_project_updates","linear_list_projects","linear_list_teams","linear_list_users","linear_list_workflow_states","linear_merge_customers","linear_read_issues","linear_remove_label_from_issue","linear_remove_label_from_project","linear_search_issues","linear_unarchive_issue","linear_update_attachment","linear_update_comment","linear_update_customer","linear_update_customer_request","linear_update_customer_status","linear_update_customer_tier","linear_update_issue","linear_update_label","linear_update_notification","linear_update_project","linear_update_project_label","linear_update_project_milestone","linear_update_project_status","linear_update_workflow_state","linkedin_get_profile","linkedin_share_post","linkup_search","linq_add_participant","linq_check_imessage","linq_check_rcs","linq_create_attachment","linq_create_chat","linq_create_contact_card","linq_create_webhook_subscription","linq_delete_attachment","linq_delete_message","linq_delete_webhook_subscription","linq_edit_message","linq_get_attachment","linq_get_chat","linq_get_contact_card","linq_get_message","linq_get_webhook_subscription","linq_leave_chat","linq_list_chats","linq_list_messages","linq_list_phone_numbers","linq_list_thread","linq_list_webhook_events","linq_list_webhook_subscriptions","linq_mark_chat_read","linq_react_to_message","linq_remove_participant","linq_send_message","linq_send_voice_memo","linq_share_contact_card","linq_start_typing","linq_stop_typing","linq_update_chat","linq_update_contact_card","linq_update_webhook_subscription","llm_chat","logfire_get_token_info","logfire_get_trace","logfire_query","logfire_search_records","logrocket_create_release","logrocket_get_audit_logs","logrocket_get_highlights","logrocket_identify_user","logrocket_list_exported_sessions","logrocket_request_highlights","logs_get","logs_get_execution","logs_get_run_details","logs_query","logs_query_runs","loops_check_contact_suppression","loops_create_contact","loops_create_contact_property","loops_delete_contact","loops_find_contact","loops_get_transactional_email","loops_list_contact_properties","loops_list_mailing_lists","loops_list_transactional_emails","loops_remove_contact_suppression","loops_send_event","loops_send_transactional_email","loops_update_contact","luma_add_guests","luma_cancel_event","luma_create_event","luma_get_event","luma_get_guest","luma_get_guests","luma_list_events","luma_lookup_event","luma_send_invites","luma_update_event","luma_update_guest_status","mailchimp_add_member","mailchimp_add_member_tags","mailchimp_add_or_update_member","mailchimp_add_segment_member","mailchimp_add_subscriber_to_automation","mailchimp_archive_member","mailchimp_create_audience","mailchimp_create_batch_operation","mailchimp_create_campaign","mailchimp_create_interest","mailchimp_create_interest_category","mailchimp_create_landing_page","mailchimp_create_merge_field","mailchimp_create_segment","mailchimp_create_template","mailchimp_delete_audience","mailchimp_delete_batch_operation","mailchimp_delete_campaign","mailchimp_delete_interest","mailchimp_delete_interest_category","mailchimp_delete_landing_page","mailchimp_delete_member","mailchimp_delete_merge_field","mailchimp_delete_segment","mailchimp_delete_template","mailchimp_get_audience","mailchimp_get_audiences","mailchimp_get_automation","mailchimp_get_automations","mailchimp_get_batch_operation","mailchimp_get_batch_operations","mailchimp_get_campaign","mailchimp_get_campaign_content","mailchimp_get_campaign_report","mailchimp_get_campaign_reports","mailchimp_get_campaigns","mailchimp_get_interest","mailchimp_get_interest_categories","mailchimp_get_interest_category","mailchimp_get_interests","mailchimp_get_landing_page","mailchimp_get_landing_pages","mailchimp_get_member","mailchimp_get_member_tags","mailchimp_get_members","mailchimp_get_merge_field","mailchimp_get_merge_fields","mailchimp_get_segment","mailchimp_get_segment_members","mailchimp_get_segments","mailchimp_get_template","mailchimp_get_templates","mailchimp_pause_automation","mailchimp_publish_landing_page","mailchimp_remove_member_tags","mailchimp_remove_segment_member","mailchimp_replicate_campaign","mailchimp_schedule_campaign","mailchimp_send_campaign","mailchimp_set_campaign_content","mailchimp_start_automation","mailchimp_unarchive_member","mailchimp_unpublish_landing_page","mailchimp_unschedule_campaign","mailchimp_update_audience","mailchimp_update_campaign","mailchimp_update_interest","mailchimp_update_interest_category","mailchimp_update_landing_page","mailchimp_update_member","mailchimp_update_merge_field","mailchimp_update_segment","mailchimp_update_template","mailgun_add_list_member","mailgun_create_mailing_list","mailgun_get_domain","mailgun_get_mailing_list","mailgun_get_message","mailgun_list_domains","mailgun_list_messages","mailgun_send_message","managed_agent_archive_session","managed_agent_create_session","managed_agent_delete_session","managed_agent_get_session","managed_agent_interrupt_session","managed_agent_list_events","managed_agent_respond_custom_tool","managed_agent_respond_tool_confirmation","managed_agent_run_session","managed_agent_send_message","managed_agent_update_session","mem0_add_memories","mem0_get_memories","mem0_search_memories","memory_add","memory_delete","memory_get","memory_get_all","microsoft_ad_add_directory_role_member","microsoft_ad_add_group_member","microsoft_ad_add_user_app_role_assignment","microsoft_ad_assign_license","microsoft_ad_create_group","microsoft_ad_create_user","microsoft_ad_delete_group","microsoft_ad_delete_user","microsoft_ad_get_conditional_access_policy","microsoft_ad_get_device","microsoft_ad_get_group","microsoft_ad_get_user","microsoft_ad_list_authentication_methods","microsoft_ad_list_conditional_access_policies","microsoft_ad_list_devices","microsoft_ad_list_directory_audits","microsoft_ad_list_directory_role_members","microsoft_ad_list_directory_roles","microsoft_ad_list_group_members","microsoft_ad_list_groups","microsoft_ad_list_service_principal_app_role_assignments","microsoft_ad_list_service_principals","microsoft_ad_list_sign_ins","microsoft_ad_list_subscribed_skus","microsoft_ad_list_user_app_role_assignments","microsoft_ad_list_user_devices","microsoft_ad_list_user_licenses","microsoft_ad_list_users","microsoft_ad_remove_directory_role_member","microsoft_ad_remove_group_member","microsoft_ad_remove_user_app_role_assignment","microsoft_ad_reset_password","microsoft_ad_revoke_sign_in_sessions","microsoft_ad_set_password","microsoft_ad_update_group","microsoft_ad_update_user","microsoft_dataverse_associate","microsoft_dataverse_create_multiple","microsoft_dataverse_create_record","microsoft_dataverse_delete_record","microsoft_dataverse_disassociate","microsoft_dataverse_download_file","microsoft_dataverse_execute_action","microsoft_dataverse_execute_function","microsoft_dataverse_fetchxml_query","microsoft_dataverse_get_entity_metadata","microsoft_dataverse_get_record","microsoft_dataverse_list_records","microsoft_dataverse_search","microsoft_dataverse_update_multiple","microsoft_dataverse_update_record","microsoft_dataverse_upload_file","microsoft_dataverse_upsert_record","microsoft_dataverse_whoami","microsoft_excel_clear_range","microsoft_excel_create_table","microsoft_excel_delete_worksheet","microsoft_excel_format_range","microsoft_excel_read","microsoft_excel_read_v2","microsoft_excel_sort_range","microsoft_excel_table_add","microsoft_excel_worksheet_add","microsoft_excel_write","microsoft_excel_write_v2","microsoft_planner_create_bucket","microsoft_planner_create_plan","microsoft_planner_create_task","microsoft_planner_delete_bucket","microsoft_planner_delete_plan","microsoft_planner_delete_task","microsoft_planner_get_plan_details","microsoft_planner_get_task_details","microsoft_planner_list_buckets","microsoft_planner_list_plans","microsoft_planner_read_bucket","microsoft_planner_read_plan","microsoft_planner_read_task","microsoft_planner_update_bucket","microsoft_planner_update_plan","microsoft_planner_update_plan_details","microsoft_planner_update_task","microsoft_planner_update_task_details","microsoft_teams_delete_channel_message","microsoft_teams_delete_chat_message","microsoft_teams_get_message","microsoft_teams_list_channel_members","microsoft_teams_list_channels","microsoft_teams_list_chat_members","microsoft_teams_list_chats","microsoft_teams_list_team_members","microsoft_teams_list_teams","microsoft_teams_read_channel","microsoft_teams_read_chat","microsoft_teams_reply_to_message","microsoft_teams_set_reaction","microsoft_teams_unset_reaction","microsoft_teams_update_channel_message","microsoft_teams_update_chat_message","microsoft_teams_write_channel","microsoft_teams_write_chat","microsoft_word_append","microsoft_word_create","microsoft_word_create_from_template","microsoft_word_export_pdf","microsoft_word_list","microsoft_word_read","microsoft_word_replace_text","microsoft_word_update","millionverifier_get_credits","millionverifier_verify_email","mintlify_create_agent_job","mintlify_create_assistant_message","mintlify_detect_ai_prose","mintlify_get_agent_job","mintlify_get_assistant_caller_stats","mintlify_get_assistant_conversations","mintlify_get_feedback","mintlify_get_feedback_by_page","mintlify_get_page_content","mintlify_get_searches","mintlify_get_update_status","mintlify_get_views","mintlify_get_visitors","mintlify_search","mintlify_send_agent_message","mintlify_trigger_automation","mintlify_trigger_preview","mintlify_trigger_update","mistral_parser","mistral_parser_v2","mistral_parser_v3","modal_call_function","modal_chat_completion","modal_list_models","monday_archive_item","monday_change_column_value","monday_create_board","monday_create_column","monday_create_group","monday_create_item","monday_create_subitem","monday_create_update","monday_delete_item","monday_duplicate_item","monday_get_board","monday_get_groups","monday_get_item","monday_get_items","monday_list_boards","monday_move_item_to_group","monday_search_items","monday_update_item","mongodb_delete","mongodb_execute","mongodb_insert","mongodb_introspect","mongodb_query","mongodb_update","mssql_delete","mssql_execute","mssql_insert","mssql_introspect","mssql_query","mssql_update","mysql_delete","mysql_execute","mysql_insert","mysql_introspect","mysql_query","mysql_update","neo4j_create","neo4j_delete","neo4j_execute","neo4j_introspect","neo4j_merge","neo4j_query","neo4j_update","netsuite_attach_record","netsuite_batch_create_records","netsuite_batch_delete_records","netsuite_batch_get_records","netsuite_batch_update_records","netsuite_batch_upsert_records","netsuite_create_record","netsuite_delete_record","netsuite_detach_record","netsuite_execute_action","netsuite_execute_dataset","netsuite_execute_suiteql","netsuite_get_async_result","netsuite_get_async_status","netsuite_get_governance_limits","netsuite_get_record","netsuite_get_record_form","netsuite_get_record_metadata","netsuite_get_select_options","netsuite_get_server_time","netsuite_get_subresource","netsuite_list_datasets","netsuite_list_record_types","netsuite_list_records","netsuite_transform_record","netsuite_update_record","netsuite_upsert_record","neverbounce_get_credits","neverbounce_verify_email","new_relic_create_deployment_event","new_relic_get_entity","new_relic_nrql_query","new_relic_search_entities","notion_add_database_row","notion_add_database_row_v2","notion_append_blocks","notion_append_blocks_v2","notion_create_comment","notion_create_comment_v2","notion_create_database","notion_create_database_v2","notion_create_page","notion_create_page_v2","notion_delete_block","notion_delete_block_v2","notion_list_comments","notion_list_comments_v2","notion_list_users","notion_list_users_v2","notion_query_database","notion_query_database_v2","notion_read","notion_read_database","notion_read_database_v2","notion_read_v2","notion_retrieve_block","notion_retrieve_block_children","notion_retrieve_block_children_v2","notion_retrieve_block_v2","notion_retrieve_user","notion_retrieve_user_v2","notion_search","notion_search_v2","notion_update_block","notion_update_block_v2","notion_update_page","notion_update_page_v2","notion_write","notion_write_v2","obsidian_append_active","obsidian_append_note","obsidian_append_periodic_note","obsidian_create_note","obsidian_delete_note","obsidian_execute_command","obsidian_get_active","obsidian_get_note","obsidian_get_periodic_note","obsidian_list_commands","obsidian_list_files","obsidian_open_file","obsidian_patch_active","obsidian_patch_note","obsidian_search","okta_activate_group_rule","okta_activate_user","okta_add_user_to_group","okta_assign_group_to_app","okta_assign_user_role","okta_assign_user_to_app","okta_clear_user_sessions","okta_create_group","okta_create_group_rule","okta_create_user","okta_deactivate_group_rule","okta_deactivate_user","okta_delete_group","okta_delete_group_rule","okta_delete_user","okta_enroll_factor","okta_get_app","okta_get_factor","okta_get_group","okta_get_group_rule","okta_get_logs","okta_get_session","okta_get_user","okta_list_app_groups","okta_list_app_users","okta_list_apps","okta_list_factors","okta_list_group_members","okta_list_group_rules","okta_list_groups","okta_list_user_roles","okta_list_users","okta_remove_group_from_app","okta_remove_user_from_app","okta_remove_user_from_group","okta_remove_user_role","okta_reset_all_factors","okta_reset_factor","okta_reset_password","okta_revoke_session","okta_suspend_user","okta_unsuspend_user","okta_update_group","okta_update_user","onedrive_copy","onedrive_create_folder","onedrive_create_share_link","onedrive_delete","onedrive_download","onedrive_get_drive_info","onedrive_get_item","onedrive_list","onedrive_move","onedrive_search","onedrive_upload","onepassword_create_item","onepassword_delete_item","onepassword_get_item","onepassword_get_item_file","onepassword_get_vault","onepassword_list_items","onepassword_list_vaults","onepassword_replace_item","onepassword_resolve_secret","onepassword_update_item","openai_embeddings","openai_image","outlook_calendar_create_event","outlook_calendar_delete_event","outlook_calendar_get_event","outlook_calendar_list_events","outlook_calendar_respond","outlook_calendar_update_event","outlook_copy","outlook_create_folder","outlook_delete","outlook_draft","outlook_forward","outlook_get_attachment","outlook_list_attachments","outlook_list_folders","outlook_mark_read","outlook_mark_unread","outlook_move","outlook_read","outlook_reply","outlook_reply_all","outlook_search","outlook_send","outlook_update_message","pagerduty_add_note","pagerduty_create_incident","pagerduty_get_incident","pagerduty_get_service","pagerduty_list_escalation_policies","pagerduty_list_incident_alerts","pagerduty_list_incidents","pagerduty_list_oncalls","pagerduty_list_schedules","pagerduty_list_services","pagerduty_list_users","pagerduty_merge_incidents","pagerduty_send_event","pagerduty_snooze_incident","pagerduty_update_incident","parallel_deep_research","parallel_extract","parallel_search","pdl_autocomplete","pdl_bulk_company_enrich","pdl_bulk_person_enrich","pdl_clean_company","pdl_clean_location","pdl_clean_school","pdl_company_enrich","pdl_company_search","pdl_person_enrich","pdl_person_identify","pdl_person_search","perplexity_chat","perplexity_search","persona_approve_inquiry","persona_create_account","persona_create_inquiry","persona_create_report","persona_decline_inquiry","persona_expire_inquiry","persona_generate_inquiry_link","persona_get_account","persona_get_case","persona_get_document","persona_get_inquiry","persona_get_report","persona_get_verification","persona_import_accounts","persona_list_accounts","persona_list_cases","persona_list_inquiries","persona_list_inquiry_templates","persona_list_reports","persona_mark_inquiry_for_review","persona_print_inquiry_pdf","persona_redact_account","persona_redact_inquiry","persona_resume_inquiry","persona_update_account","persona_update_inquiry","pinecone_delete_vectors","pinecone_describe_index","pinecone_describe_index_stats","pinecone_fetch","pinecone_generate_embeddings","pinecone_list_indexes","pinecone_list_vector_ids","pinecone_search_text","pinecone_search_vector","pinecone_update_vector","pinecone_upsert_text","pipedrive_create_activity","pipedrive_create_deal","pipedrive_create_lead","pipedrive_create_project","pipedrive_delete_lead","pipedrive_get_activities","pipedrive_get_all_deals","pipedrive_get_deal","pipedrive_get_files","pipedrive_get_leads","pipedrive_get_mail_messages","pipedrive_get_mail_thread","pipedrive_get_pipeline_deals","pipedrive_get_pipelines","pipedrive_get_projects","pipedrive_update_activity","pipedrive_update_deal","pipedrive_update_lead","pitchbook_company_active_investors","pitchbook_company_bio","pitchbook_company_deal_service_providers","pitchbook_company_deals","pitchbook_company_financials","pitchbook_company_general_service_providers","pitchbook_company_industries","pitchbook_company_investors","pitchbook_company_most_recent_debt_financing","pitchbook_company_most_recent_financials","pitchbook_company_most_recent_financing","pitchbook_company_search","pitchbook_company_similar_companies","pitchbook_company_social_analytics","pitchbook_company_updates","pitchbook_company_vc_exit_predictions","pitchbook_contracts_history","pitchbook_cost_of_calls","pitchbook_credit_history","pitchbook_credit_news","pitchbook_credit_news_bulk","pitchbook_credit_news_most_recent","pitchbook_credit_news_search","pitchbook_deal_bio","pitchbook_deal_cap_table_history","pitchbook_deal_debt_lenders","pitchbook_deal_detailed","pitchbook_deal_investors","pitchbook_deal_multiples","pitchbook_deal_search","pitchbook_deal_service_providers","pitchbook_deal_stock_info","pitchbook_deal_tranche_info","pitchbook_deal_updates","pitchbook_deal_valuation","pitchbook_entity_affiliates","pitchbook_entity_locations","pitchbook_entity_news","pitchbook_entity_people","pitchbook_entity_updates","pitchbook_fund_active_investments","pitchbook_fund_benchmark","pitchbook_fund_bio","pitchbook_fund_cash_flows","pitchbook_fund_commitments","pitchbook_fund_investment_preferences","pitchbook_fund_investments","pitchbook_fund_performance","pitchbook_fund_search","pitchbook_fund_team","pitchbook_fund_updates","pitchbook_investor_active_investments","pitchbook_investor_bio","pitchbook_investor_board_seats","pitchbook_investor_deal_service_providers","pitchbook_investor_funds","pitchbook_investor_general_service_providers","pitchbook_investor_investments","pitchbook_investor_last_closed_fund","pitchbook_investor_preferences","pitchbook_investor_search","pitchbook_investor_updates","pitchbook_limited_partner_actual_allocations","pitchbook_limited_partner_bio","pitchbook_limited_partner_commitment_aggregates","pitchbook_limited_partner_commitment_preferences","pitchbook_limited_partner_commitments_detailed","pitchbook_limited_partner_search","pitchbook_limited_partner_service_providers","pitchbook_limited_partner_target_allocations","pitchbook_limited_partner_updates","pitchbook_lookup_table_structure","pitchbook_lookup_tables","pitchbook_patent_detailed","pitchbook_patent_search","pitchbook_people_search","pitchbook_person_bio","pitchbook_person_contact","pitchbook_person_education_work","pitchbook_sandbox_entities","pitchbook_search","pitchbook_service_provider_bio","pitchbook_service_provider_search","pitchbook_service_provider_updates","pitchbook_serviced_companies","pitchbook_serviced_deals","pitchbook_serviced_funds","pitchbook_serviced_investors","pitchbook_serviced_limited_partners","pitchbook_shared_search","pitchbook_usage_report","polymarket_get_activity","polymarket_get_event","polymarket_get_events","polymarket_get_holders","polymarket_get_last_trade_price","polymarket_get_leaderboard","polymarket_get_market","polymarket_get_markets","polymarket_get_midpoint","polymarket_get_orderbook","polymarket_get_positions","polymarket_get_price","polymarket_get_price_history","polymarket_get_series","polymarket_get_series_by_id","polymarket_get_spread","polymarket_get_tags","polymarket_get_tick_size","polymarket_get_trades","polymarket_search","postgresql_delete","postgresql_execute","postgresql_insert","postgresql_introspect","postgresql_query","postgresql_update","posthog_batch_events","posthog_capture_event","posthog_create_annotation","posthog_create_cohort","posthog_create_dashboard","posthog_create_experiment","posthog_create_feature_flag","posthog_create_insight","posthog_create_survey","posthog_delete_feature_flag","posthog_delete_person","posthog_delete_survey","posthog_evaluate_flags","posthog_get_cohort","posthog_get_dashboard","posthog_get_event_definition","posthog_get_experiment","posthog_get_feature_flag","posthog_get_insight","posthog_get_organization","posthog_get_person","posthog_get_project","posthog_get_property_definition","posthog_get_session_recording","posthog_get_survey","posthog_list_actions","posthog_list_annotations","posthog_list_cohorts","posthog_list_dashboards","posthog_list_event_definitions","posthog_list_experiments","posthog_list_feature_flags","posthog_list_insights","posthog_list_organizations","posthog_list_persons","posthog_list_projects","posthog_list_property_definitions","posthog_list_recording_playlists","posthog_list_session_recordings","posthog_list_surveys","posthog_query","posthog_update_cohort","posthog_update_event_definition","posthog_update_experiment","posthog_update_feature_flag","posthog_update_insight","posthog_update_property_definition","posthog_update_survey","profound_bot_logs","profound_bots_report","profound_category_assets","profound_category_personas","profound_category_prompts","profound_category_tags","profound_category_topics","profound_citation_prompts","profound_citations_report","profound_list_assets","profound_list_categories","profound_list_domains","profound_list_models","profound_list_optimizations","profound_list_personas","profound_list_regions","profound_optimization_analysis","profound_prompt_answers","profound_prompt_volume","profound_query_fanouts","profound_raw_logs","profound_referrals_report","profound_sentiment_report","profound_visibility_report","prospeo_account_information","prospeo_bulk_enrich_company","prospeo_bulk_enrich_person","prospeo_enrich_company","prospeo_enrich_person","prospeo_search_company","prospeo_search_person","prospeo_search_suggestions","pulse_parser","pulse_parser_v2","qdrant_fetch_points","qdrant_search_vector","qdrant_upsert_points","quartr_get_audio","quartr_get_company","quartr_get_event","quartr_get_event_summary","quartr_get_report","quartr_get_slide_deck","quartr_get_transcript","quartr_list_audio","quartr_list_companies","quartr_list_document_types","quartr_list_documents","quartr_list_event_types","quartr_list_events","quartr_list_live_events","quartr_list_reports","quartr_list_slide_decks","quartr_list_transcripts","quickbooks_add_attachment","quickbooks_create_bill","quickbooks_create_bill_payment","quickbooks_create_credit_memo","quickbooks_create_customer","quickbooks_create_customer_payment","quickbooks_create_deposit","quickbooks_create_employee","quickbooks_create_estimate","quickbooks_create_invoice","quickbooks_create_item","quickbooks_create_journal_entry","quickbooks_create_purchase","quickbooks_create_purchase_order","quickbooks_create_refund_receipt","quickbooks_create_sales_receipt","quickbooks_create_vendor","quickbooks_create_vendor_credit","quickbooks_download_attachment","quickbooks_download_transaction_pdf","quickbooks_email_transaction","quickbooks_get_company_info","quickbooks_read_accounting_transactions","quickbooks_read_attachments","quickbooks_read_master_data","quickbooks_read_purchasing_transactions","quickbooks_read_sales_transactions","quickbooks_run_financial_report","quickbooks_update_bill","quickbooks_update_bill_payment","quickbooks_update_credit_memo","quickbooks_update_customer","quickbooks_update_customer_payment","quickbooks_update_deposit","quickbooks_update_employee","quickbooks_update_estimate","quickbooks_update_invoice","quickbooks_update_item","quickbooks_update_journal_entry","quickbooks_update_purchase","quickbooks_update_purchase_order","quickbooks_update_refund_receipt","quickbooks_update_sales_receipt","quickbooks_update_vendor","quickbooks_update_vendor_credit","quickbooks_void_customer_payment","quickbooks_void_invoice","quiver_image_to_svg","quiver_list_models","quiver_text_to_svg","rabbitmq_create_binding","rabbitmq_create_exchange","rabbitmq_create_policy","rabbitmq_create_queue","rabbitmq_delete_binding","rabbitmq_delete_exchange","rabbitmq_delete_policy","rabbitmq_delete_queue","rabbitmq_get_exchange","rabbitmq_get_messages","rabbitmq_get_overview","rabbitmq_get_queue","rabbitmq_health_check","rabbitmq_list_bindings","rabbitmq_list_channels","rabbitmq_list_connections","rabbitmq_list_consumers","rabbitmq_list_exchange_bindings","rabbitmq_list_exchanges","rabbitmq_list_nodes","rabbitmq_list_policies","rabbitmq_list_queues","rabbitmq_list_vhosts","rabbitmq_publish_message","rabbitmq_purge_queue","railway_create_environment","railway_create_project","railway_create_service","railway_delete_environment","railway_delete_project","railway_delete_service","railway_delete_variable","railway_deploy_service","railway_get_deployment","railway_get_deployment_logs","railway_get_project","railway_list_deployments","railway_list_project_members","railway_list_projects","railway_list_variables","railway_restart_deployment","railway_rollback_deployment","railway_transfer_project","railway_update_project","railway_upsert_variable","rb2b_credit_check","rb2b_email_to_activity","rb2b_hem_to_best_linkedin","rb2b_hem_to_business_profile","rb2b_hem_to_linkedin","rb2b_hem_to_maid","rb2b_ip_to_company","rb2b_ip_to_hem","rb2b_ip_to_maid","rb2b_linkedin_slug_search","rb2b_linkedin_to_best_personal_email","rb2b_linkedin_to_business_profile","rb2b_linkedin_to_hashed_emails","rb2b_linkedin_to_mobile_phone","rb2b_linkedin_to_personal_email","rds_delete","rds_execute","rds_insert","rds_introspect","rds_query","rds_update","reddit_delete","reddit_edit","reddit_get_comments","reddit_get_controversial","reddit_get_info","reddit_get_me","reddit_get_messages","reddit_get_posts","reddit_get_saved","reddit_get_subreddit_info","reddit_get_subreddit_rules","reddit_get_user","reddit_get_user_comments","reddit_get_user_posts","reddit_hide","reddit_hot_posts","reddit_list_my_subreddits","reddit_lock","reddit_mark_all_read","reddit_mark_read","reddit_marknsfw","reddit_mod_approve","reddit_mod_distinguish","reddit_mod_remove","reddit_mod_sticky","reddit_reply","reddit_report","reddit_save","reddit_search","reddit_search_subreddits","reddit_send_message","reddit_submit_post","reddit_subscribe","reddit_unhide","reddit_unlock","reddit_unmarknsfw","reddit_unsave","reddit_vote","redis_command","redis_delete","redis_exists","redis_expire","redis_get","redis_hdel","redis_hget","redis_hgetall","redis_hset","redis_incr","redis_incrby","redis_keys","redis_llen","redis_lpop","redis_lpush","redis_lrange","redis_persist","redis_rpop","redis_rpush","redis_set","redis_setnx","redis_ttl","reducto_parser","reducto_parser_v2","resend_cancel_email","resend_create_audience","resend_create_broadcast","resend_create_contact","resend_delete_audience","resend_delete_contact","resend_get_audience","resend_get_broadcast","resend_get_contact","resend_get_email","resend_list_audiences","resend_list_contacts","resend_list_domains","resend_send","resend_send_broadcast","resend_update_contact","revenuecat_create_purchase","revenuecat_defer_google_subscription","revenuecat_delete_customer","revenuecat_get_customer","revenuecat_grant_entitlement","revenuecat_list_offerings","revenuecat_refund_google_subscription","revenuecat_revoke_entitlement","revenuecat_revoke_google_subscription","revenuecat_update_subscriber_attributes","rippling_bulk_create_custom_object_records","rippling_bulk_delete_custom_object_records","rippling_bulk_update_custom_object_records","rippling_create_business_partner","rippling_create_business_partner_group","rippling_create_custom_app","rippling_create_custom_object","rippling_create_custom_object_field","rippling_create_custom_object_record","rippling_create_custom_page","rippling_create_custom_setting","rippling_create_department","rippling_create_draft_hires","rippling_create_object_category","rippling_create_title","rippling_create_work_location","rippling_delete_business_partner","rippling_delete_business_partner_group","rippling_delete_custom_app","rippling_delete_custom_object","rippling_delete_custom_object_field","rippling_delete_custom_object_record","rippling_delete_custom_page","rippling_delete_custom_setting","rippling_delete_object_category","rippling_delete_title","rippling_delete_work_location","rippling_get_business_partner","rippling_get_business_partner_group","rippling_get_current_user","rippling_get_custom_app","rippling_get_custom_object","rippling_get_custom_object_field","rippling_get_custom_object_record","rippling_get_custom_object_record_by_external_id","rippling_get_custom_page","rippling_get_custom_setting","rippling_get_department","rippling_get_employment_type","rippling_get_job_function","rippling_get_object_category","rippling_get_report_run","rippling_get_supergroup","rippling_get_team","rippling_get_title","rippling_get_user","rippling_get_work_location","rippling_get_worker","rippling_list_business_partner_groups","rippling_list_business_partners","rippling_list_companies","rippling_list_custom_apps","rippling_list_custom_fields","rippling_list_custom_object_fields","rippling_list_custom_object_records","rippling_list_custom_objects","rippling_list_custom_pages","rippling_list_custom_settings","rippling_list_departments","rippling_list_employment_types","rippling_list_entitlements","rippling_list_job_functions","rippling_list_object_categories","rippling_list_supergroup_exclusion_members","rippling_list_supergroup_inclusion_members","rippling_list_supergroup_members","rippling_list_supergroups","rippling_list_teams","rippling_list_titles","rippling_list_users","rippling_list_work_locations","rippling_list_workers","rippling_query_custom_object_records","rippling_trigger_report_run","rippling_update_custom_app","rippling_update_custom_object","rippling_update_custom_object_field","rippling_update_custom_object_record","rippling_update_custom_page","rippling_update_custom_setting","rippling_update_department","rippling_update_object_category","rippling_update_supergroup_exclusion_members","rippling_update_supergroup_inclusion_members","rippling_update_title","rippling_update_work_location","rocketlane_add_field_option","rocketlane_add_project_members","rocketlane_add_task_assignees","rocketlane_add_task_dependencies","rocketlane_add_task_followers","rocketlane_archive_project","rocketlane_assign_placeholders","rocketlane_create_field","rocketlane_create_phase","rocketlane_create_project","rocketlane_create_space","rocketlane_create_space_document","rocketlane_create_task","rocketlane_create_time_entry","rocketlane_create_time_off","rocketlane_delete_field","rocketlane_delete_phase","rocketlane_delete_project","rocketlane_delete_space","rocketlane_delete_space_document","rocketlane_delete_task","rocketlane_delete_time_entry","rocketlane_delete_time_off","rocketlane_get_field","rocketlane_get_invoice","rocketlane_get_invoice_line_items","rocketlane_get_invoice_payments","rocketlane_get_phase","rocketlane_get_project","rocketlane_get_space","rocketlane_get_space_document","rocketlane_get_task","rocketlane_get_time_entry","rocketlane_get_time_off","rocketlane_get_user","rocketlane_import_template","rocketlane_list_fields","rocketlane_list_invoices","rocketlane_list_phases","rocketlane_list_placeholders","rocketlane_list_projects","rocketlane_list_resource_allocations","rocketlane_list_space_documents","rocketlane_list_spaces","rocketlane_list_tasks","rocketlane_list_time_entries","rocketlane_list_time_entry_categories","rocketlane_list_time_offs","rocketlane_list_users","rocketlane_move_task_to_phase","rocketlane_remove_project_members","rocketlane_remove_task_assignees","rocketlane_remove_task_dependencies","rocketlane_remove_task_followers","rocketlane_search_time_entries","rocketlane_unassign_placeholders","rocketlane_update_field","rocketlane_update_field_option","rocketlane_update_phase","rocketlane_update_project","rocketlane_update_space","rocketlane_update_space_document","rocketlane_update_task","rocketlane_update_time_entry","rootly_acknowledge_alert","rootly_add_incident_event","rootly_add_subscribers","rootly_assign_incident_role","rootly_create_action_item","rootly_create_alert","rootly_create_incident","rootly_create_status_page_event","rootly_delete_action_item","rootly_delete_incident","rootly_escalate_alert","rootly_get_alert","rootly_get_incident","rootly_list_action_items","rootly_list_alerts","rootly_list_causes","rootly_list_environments","rootly_list_escalation_policies","rootly_list_functionalities","rootly_list_incident_events","rootly_list_incident_roles","rootly_list_incident_types","rootly_list_incidents","rootly_list_on_calls","rootly_list_playbooks","rootly_list_retrospectives","rootly_list_schedules","rootly_list_services","rootly_list_severities","rootly_list_teams","rootly_list_users","rootly_mitigate_incident","rootly_remove_subscribers","rootly_resolve_alert","rootly_resolve_incident","rootly_run_workflow","rootly_snooze_alert","rootly_unassign_incident_role","rootly_update_action_item","rootly_update_alert","rootly_update_incident","s3_copy_object","s3_create_bucket","s3_delete_bucket","s3_delete_object","s3_delete_objects","s3_get_object","s3_head_object","s3_list_buckets","s3_list_objects","s3_presigned_url","s3_put_object","salesforce_create_account","salesforce_create_case","salesforce_create_contact","salesforce_create_custom_field","salesforce_create_custom_object","salesforce_create_lead","salesforce_create_opportunity","salesforce_create_task","salesforce_delete_account","salesforce_delete_case","salesforce_delete_contact","salesforce_delete_custom_field","salesforce_delete_lead","salesforce_delete_opportunity","salesforce_delete_task","salesforce_describe_object","salesforce_get_accounts","salesforce_get_cases","salesforce_get_contacts","salesforce_get_dashboard","salesforce_get_leads","salesforce_get_opportunities","salesforce_get_report","salesforce_get_tasks","salesforce_list_dashboards","salesforce_list_objects","salesforce_list_report_types","salesforce_list_reports","salesforce_query","salesforce_query_more","salesforce_refresh_dashboard","salesforce_run_report","salesforce_tooling_query","salesforce_update_account","salesforce_update_case","salesforce_update_contact","salesforce_update_custom_field","salesforce_update_lead","salesforce_update_opportunity","salesforce_update_task","sap_concur_approve_expense_report","sap_concur_associate_attendees","sap_concur_create_cash_advance","sap_concur_create_expected_expense","sap_concur_create_expense_report","sap_concur_create_list_item","sap_concur_create_purchase_request","sap_concur_create_quick_expense","sap_concur_create_quick_expense_with_image","sap_concur_create_report_comment","sap_concur_create_travel_request","sap_concur_create_user","sap_concur_delete_expected_expense","sap_concur_delete_expense","sap_concur_delete_expense_report","sap_concur_delete_list_item","sap_concur_delete_travel_request","sap_concur_delete_user","sap_concur_get_allocation","sap_concur_get_budget","sap_concur_get_cash_advance","sap_concur_get_expected_expense","sap_concur_get_expense","sap_concur_get_expense_report","sap_concur_get_itemizations","sap_concur_get_itinerary","sap_concur_get_list","sap_concur_get_list_item","sap_concur_get_purchase_request","sap_concur_get_receipt","sap_concur_get_receipt_status","sap_concur_get_request_cash_advance","sap_concur_get_travel_profile","sap_concur_get_travel_request","sap_concur_get_user","sap_concur_issue_cash_advance","sap_concur_list_allocations","sap_concur_list_attendee_associations","sap_concur_list_budget_categories","sap_concur_list_budgets","sap_concur_list_exceptions","sap_concur_list_expected_expenses","sap_concur_list_expense_reports","sap_concur_list_expenses","sap_concur_list_itineraries","sap_concur_list_list_items","sap_concur_list_lists","sap_concur_list_receipts","sap_concur_list_report_comments","sap_concur_list_reports_to_approve","sap_concur_list_travel_profiles_summary","sap_concur_list_travel_request_comments","sap_concur_list_travel_requests","sap_concur_list_users","sap_concur_move_travel_request","sap_concur_recall_expense_report","sap_concur_remove_all_attendees","sap_concur_search_locations","sap_concur_search_users","sap_concur_send_back_expense_report","sap_concur_submit_expense_report","sap_concur_update_allocation","sap_concur_update_expected_expense","sap_concur_update_expense","sap_concur_update_expense_report","sap_concur_update_list_item","sap_concur_update_travel_request","sap_concur_update_user","sap_concur_upload_exchange_rates","sap_concur_upload_receipt_image","sap_s4hana_create_business_partner","sap_s4hana_create_purchase_order","sap_s4hana_create_purchase_requisition","sap_s4hana_create_sales_order","sap_s4hana_delete_sales_order","sap_s4hana_get_billing_document","sap_s4hana_get_business_partner","sap_s4hana_get_customer","sap_s4hana_get_inbound_delivery","sap_s4hana_get_material_document","sap_s4hana_get_outbound_delivery","sap_s4hana_get_product","sap_s4hana_get_purchase_order","sap_s4hana_get_purchase_requisition","sap_s4hana_get_sales_order","sap_s4hana_get_supplier","sap_s4hana_get_supplier_invoice","sap_s4hana_list_billing_documents","sap_s4hana_list_business_partners","sap_s4hana_list_customers","sap_s4hana_list_inbound_deliveries","sap_s4hana_list_material_documents","sap_s4hana_list_material_stock","sap_s4hana_list_outbound_deliveries","sap_s4hana_list_products","sap_s4hana_list_purchase_orders","sap_s4hana_list_purchase_requisitions","sap_s4hana_list_sales_orders","sap_s4hana_list_supplier_invoices","sap_s4hana_list_suppliers","sap_s4hana_odata_query","sap_s4hana_update_business_partner","sap_s4hana_update_customer","sap_s4hana_update_product","sap_s4hana_update_purchase_order","sap_s4hana_update_purchase_requisition","sap_s4hana_update_sales_order","sap_s4hana_update_supplier","search_tool","secrets_manager_create_secret","secrets_manager_delete_secret","secrets_manager_describe_secret","secrets_manager_get_secret","secrets_manager_list_secrets","secrets_manager_restore_secret","secrets_manager_rotate_secret","secrets_manager_tag_resource","secrets_manager_untag_resource","secrets_manager_update_secret","semrush_backlinks","semrush_backlinks_anchors","semrush_backlinks_competitors","semrush_backlinks_geo_distribution","semrush_backlinks_indexed_pages","semrush_backlinks_overview","semrush_backlinks_tld_distribution","semrush_batch_keyword_overview","semrush_broad_match_keywords","semrush_domain_ad_copies","semrush_domain_ad_history","semrush_domain_organic_competitors","semrush_domain_organic_keywords","semrush_domain_overview","semrush_domain_overview_all","semrush_domain_overview_history","semrush_domain_paid_competitors","semrush_domain_paid_keywords","semrush_domain_pla_copies","semrush_domain_pla_keywords","semrush_domain_vs_domain","semrush_keyword_ad_history","semrush_keyword_difficulty","semrush_keyword_overview","semrush_keyword_overview_all","semrush_keyword_questions","semrush_organic_results","semrush_paid_results","semrush_referring_domains","semrush_referring_ips","semrush_related_keywords","semrush_subdomain_ad_copies","semrush_subdomain_organic_keywords","semrush_subdomain_overview","semrush_subdomain_overview_all","semrush_subdomain_overview_history","semrush_subdomain_paid_keywords","semrush_top_domains","semrush_url_organic_keywords","semrush_url_overview","semrush_url_overview_all","semrush_url_overview_history","semrush_url_paid_keywords","semrush_winners_and_losers","sendblue_evaluate_service","sendblue_get_message","sendblue_send_group_message","sendblue_send_message","sendblue_send_typing_indicator","sendgrid_add_contact","sendgrid_add_contacts_to_list","sendgrid_create_list","sendgrid_create_template","sendgrid_create_template_version","sendgrid_delete_contacts","sendgrid_delete_list","sendgrid_delete_template","sendgrid_get_contact","sendgrid_get_list","sendgrid_get_template","sendgrid_list_all_lists","sendgrid_list_templates","sendgrid_remove_contacts_from_list","sendgrid_search_contacts","sendgrid_send_mail","sentry_events_get","sentry_events_list","sentry_issues_get","sentry_issues_list","sentry_issues_update","sentry_projects_create","sentry_projects_get","sentry_projects_list","sentry_projects_update","sentry_releases_create","sentry_releases_deploy","sentry_releases_list","sentry_teams_list","serper_search","servicenow_add_incident_comment","servicenow_aggregate","servicenow_close_incident","servicenow_create_change_request","servicenow_create_incident","servicenow_create_record","servicenow_delete_record","servicenow_download_attachment","servicenow_find_user","servicenow_get_change_next_states","servicenow_get_change_request","servicenow_get_ci","servicenow_get_incident","servicenow_get_knowledge_article","servicenow_get_requested_item","servicenow_list_approvals","servicenow_list_attachments","servicenow_list_catalog_items","servicenow_list_change_requests","servicenow_list_change_tasks","servicenow_list_ci_relationships","servicenow_list_group_members","servicenow_list_incidents","servicenow_list_requested_items","servicenow_order_catalog_item","servicenow_read_record","servicenow_resolve_incident","servicenow_search_cis","servicenow_search_knowledge","servicenow_update_approval","servicenow_update_change_request","servicenow_update_change_state","servicenow_update_incident","servicenow_update_record","servicenow_upload_attachment","ses_create_configuration_set","ses_create_email_identity","ses_create_template","ses_delete_email_identity","ses_delete_suppressed_destination","ses_delete_template","ses_get_account","ses_get_email_identity","ses_get_suppressed_destination","ses_get_template","ses_list_identities","ses_list_suppressed_destinations","ses_list_templates","ses_put_suppressed_destination","ses_send_bulk_email","ses_send_custom_verification_email","ses_send_email","ses_send_templated_email","ses_update_template","sftp_delete","sftp_download","sftp_list","sftp_mkdir","sftp_upload","sharepoint_add_list_items","sharepoint_create_list","sharepoint_create_page","sharepoint_delete_file","sharepoint_delete_list_item","sharepoint_delete_page","sharepoint_download_file","sharepoint_get_drive_item","sharepoint_get_list","sharepoint_get_list_item","sharepoint_list_sites","sharepoint_publish_page","sharepoint_read_page","sharepoint_update_list","sharepoint_update_page","sharepoint_upload_file","shopify_adjust_inventory","shopify_cancel_order","shopify_create_customer","shopify_create_fulfillment","shopify_create_product","shopify_delete_customer","shopify_delete_product","shopify_get_collection","shopify_get_customer","shopify_get_inventory_level","shopify_get_order","shopify_get_product","shopify_list_collections","shopify_list_customers","shopify_list_inventory_items","shopify_list_locations","shopify_list_orders","shopify_list_products","shopify_update_customer","shopify_update_order","shopify_update_product","similarweb_bounce_rate","similarweb_page_views","similarweb_pages_per_visit","similarweb_traffic_visits","similarweb_visit_duration","similarweb_website_overview","sixtyfour_enrich_company","sixtyfour_enrich_lead","sixtyfour_find_email","sixtyfour_find_phone","slack_add_reaction","slack_archive_conversation","slack_canvas","slack_create_channel_canvas","slack_create_conversation","slack_delete_canvas","slack_delete_message","slack_delete_scheduled_message","slack_download","slack_edit_canvas","slack_ephemeral_message","slack_get_canvas","slack_get_channel_history","slack_get_channel_info","slack_get_message","slack_get_permalink","slack_get_thread","slack_get_thread_replies","slack_get_user","slack_get_user_presence","slack_invite_to_conversation","slack_list_canvases","slack_list_channels","slack_list_members","slack_list_scheduled_messages","slack_list_users","slack_lookup_canvas_sections","slack_message","slack_message_reader","slack_open_view","slack_publish_view","slack_push_view","slack_remove_reaction","slack_rename_conversation","slack_schedule_message","slack_set_conversation_purpose","slack_set_conversation_topic","slack_set_status","slack_set_suggested_prompts","slack_set_title","slack_update_message","slack_update_view","smartlead_add_email_accounts_to_campaign","smartlead_add_leads_to_campaign","smartlead_create_campaign","smartlead_create_lead_list","smartlead_delete_campaign","smartlead_delete_campaign_webhook","smartlead_delete_lead_from_campaign","smartlead_delete_lead_list","smartlead_duplicate_campaign","smartlead_export_campaign_leads","smartlead_get_campaign","smartlead_get_campaign_analytics","smartlead_get_campaign_analytics_by_date","smartlead_get_campaign_lead_statistics","smartlead_get_campaign_mailbox_statistics","smartlead_get_campaign_sequences","smartlead_get_campaign_statistics","smartlead_get_campaign_top_level_analytics_by_date","smartlead_get_campaign_webhook_summary","smartlead_get_lead_by_email","smartlead_get_lead_by_id","smartlead_get_lead_list","smartlead_get_lead_message_history","smartlead_list_campaign_email_accounts","smartlead_list_campaign_leads","smartlead_list_campaign_webhooks","smartlead_list_campaigns","smartlead_list_clients","smartlead_list_email_accounts","smartlead_list_inbox_replies","smartlead_list_lead_activities","smartlead_list_lead_categories","smartlead_list_lead_lists","smartlead_mark_lead_complete","smartlead_pause_lead","smartlead_remove_email_accounts_from_campaign","smartlead_resume_lead","smartlead_save_campaign_sequences","smartlead_unsubscribe_lead_from_campaign","smartlead_unsubscribe_lead_globally","smartlead_update_campaign_schedule","smartlead_update_campaign_settings","smartlead_update_campaign_status","smartlead_update_lead","smartlead_update_lead_category","smartlead_update_lead_list","smartlead_upsert_campaign_webhook","sms_send","smtp_send_mail","snowflake_alter_warehouse","snowflake_call_procedure","snowflake_cancel_statement","snowflake_cancel_task_run","snowflake_delete_rows","snowflake_execute_sql","snowflake_get_statement","snowflake_get_task","snowflake_get_task_run","snowflake_get_task_run_output","snowflake_get_warehouse","snowflake_insert_rows","snowflake_introspect_schema","snowflake_list_copy_history","snowflake_list_databases","snowflake_list_query_history","snowflake_list_schemas","snowflake_list_tables","snowflake_list_task_runs","snowflake_list_tasks","snowflake_list_warehouses","snowflake_load_data","snowflake_resume_task","snowflake_resume_warehouse","snowflake_run_task","snowflake_suspend_task","snowflake_suspend_warehouse","snowflake_unload_data","snowflake_update_rows","snowflake_upsert_rows","splunk_cancel_search_job","splunk_create_search_job","splunk_dispatch_saved_search","splunk_get_fired_alerts","splunk_get_saved_search","splunk_get_search_job","splunk_get_search_results","splunk_list_apps","splunk_list_fired_alerts","splunk_list_indexes","splunk_list_saved_searches","splunk_run_search","sportmonks_core_get_cities","sportmonks_core_get_city","sportmonks_core_get_continent","sportmonks_core_get_continents","sportmonks_core_get_countries","sportmonks_core_get_country","sportmonks_core_get_entity_filters","sportmonks_core_get_my_usage","sportmonks_core_get_region","sportmonks_core_get_regions","sportmonks_core_get_timezones","sportmonks_core_get_type","sportmonks_core_get_type_by_entity","sportmonks_core_get_types","sportmonks_core_search_cities","sportmonks_core_search_countries","sportmonks_core_search_regions","sportmonks_football_expected_by_player","sportmonks_football_expected_by_team","sportmonks_football_get_all_commentaries","sportmonks_football_get_all_fixtures","sportmonks_football_get_all_players","sportmonks_football_get_all_rivals","sportmonks_football_get_all_teams","sportmonks_football_get_all_transfer_rumours","sportmonks_football_get_all_transfers","sportmonks_football_get_brackets_by_season","sportmonks_football_get_coach","sportmonks_football_get_coaches","sportmonks_football_get_coaches_by_country","sportmonks_football_get_commentaries_by_fixture","sportmonks_football_get_current_leagues_by_team","sportmonks_football_get_expected_lineups_by_player","sportmonks_football_get_expected_lineups_by_team","sportmonks_football_get_extended_team_squad","sportmonks_football_get_fixture","sportmonks_football_get_fixtures_by_date","sportmonks_football_get_fixtures_by_date_range","sportmonks_football_get_fixtures_by_date_range_for_team","sportmonks_football_get_fixtures_by_ids","sportmonks_football_get_grouped_standings_by_round","sportmonks_football_get_head_to_head","sportmonks_football_get_inplay_livescores","sportmonks_football_get_latest_coaches","sportmonks_football_get_latest_fixtures","sportmonks_football_get_latest_livescores","sportmonks_football_get_latest_players","sportmonks_football_get_latest_totw","sportmonks_football_get_latest_transfers","sportmonks_football_get_league","sportmonks_football_get_leagues","sportmonks_football_get_leagues_by_country","sportmonks_football_get_leagues_by_date","sportmonks_football_get_leagues_by_team","sportmonks_football_get_live_leagues","sportmonks_football_get_live_probabilities","sportmonks_football_get_live_probabilities_by_fixture","sportmonks_football_get_live_standings_by_league","sportmonks_football_get_livescores","sportmonks_football_get_match_facts","sportmonks_football_get_match_facts_by_date_range","sportmonks_football_get_match_facts_by_fixture","sportmonks_football_get_match_facts_by_league","sportmonks_football_get_past_fixtures_by_tv_station","sportmonks_football_get_player","sportmonks_football_get_players_by_country","sportmonks_football_get_postmatch_news","sportmonks_football_get_postmatch_news_by_season","sportmonks_football_get_predictability_by_league","sportmonks_football_get_prematch_news","sportmonks_football_get_prematch_news_by_season","sportmonks_football_get_prematch_news_upcoming","sportmonks_football_get_probabilities","sportmonks_football_get_probabilities_by_fixture","sportmonks_football_get_referee","sportmonks_football_get_referees","sportmonks_football_get_referees_by_country","sportmonks_football_get_referees_by_season","sportmonks_football_get_rivals_by_team","sportmonks_football_get_round","sportmonks_football_get_round_statistics","sportmonks_football_get_rounds","sportmonks_football_get_rounds_by_season","sportmonks_football_get_schedules_by_season","sportmonks_football_get_schedules_by_season_and_team","sportmonks_football_get_schedules_by_team","sportmonks_football_get_season","sportmonks_football_get_seasons","sportmonks_football_get_seasons_by_team","sportmonks_football_get_stage","sportmonks_football_get_stage_statistics","sportmonks_football_get_stages","sportmonks_football_get_stages_by_season","sportmonks_football_get_standing_corrections_by_season","sportmonks_football_get_standings","sportmonks_football_get_standings_by_round","sportmonks_football_get_standings_by_season","sportmonks_football_get_state","sportmonks_football_get_states","sportmonks_football_get_team","sportmonks_football_get_team_rankings","sportmonks_football_get_team_rankings_by_date","sportmonks_football_get_team_rankings_by_team","sportmonks_football_get_team_squad","sportmonks_football_get_team_squad_by_season","sportmonks_football_get_teams_by_country","sportmonks_football_get_teams_by_season","sportmonks_football_get_topscorers_by_season","sportmonks_football_get_topscorers_by_stage","sportmonks_football_get_totw","sportmonks_football_get_totw_by_round","sportmonks_football_get_transfer","sportmonks_football_get_transfer_rumour","sportmonks_football_get_transfer_rumours_between_dates","sportmonks_football_get_transfer_rumours_by_player","sportmonks_football_get_transfer_rumours_by_team","sportmonks_football_get_transfers_between_dates","sportmonks_football_get_transfers_by_player","sportmonks_football_get_transfers_by_team","sportmonks_football_get_tv_station","sportmonks_football_get_tv_stations","sportmonks_football_get_tv_stations_by_fixture","sportmonks_football_get_upcoming_fixtures_by_market","sportmonks_football_get_upcoming_fixtures_by_tv_station","sportmonks_football_get_value_bets","sportmonks_football_get_value_bets_by_fixture","sportmonks_football_get_venue","sportmonks_football_get_venues","sportmonks_football_get_venues_by_season","sportmonks_football_search_coaches","sportmonks_football_search_fixtures","sportmonks_football_search_leagues","sportmonks_football_search_players","sportmonks_football_search_referees","sportmonks_football_search_rounds","sportmonks_football_search_seasons","sportmonks_football_search_stages","sportmonks_football_search_teams","sportmonks_football_search_venues","sportmonks_motorsport_get_all_fixtures","sportmonks_motorsport_get_current_leagues_by_team","sportmonks_motorsport_get_driver","sportmonks_motorsport_get_driver_standings","sportmonks_motorsport_get_driver_standings_by_season","sportmonks_motorsport_get_drivers","sportmonks_motorsport_get_drivers_by_country","sportmonks_motorsport_get_drivers_by_season","sportmonks_motorsport_get_fixture","sportmonks_motorsport_get_fixtures_by_date","sportmonks_motorsport_get_fixtures_by_date_range","sportmonks_motorsport_get_fixtures_by_ids","sportmonks_motorsport_get_laps_by_fixture","sportmonks_motorsport_get_laps_by_fixture_and_driver","sportmonks_motorsport_get_laps_by_fixture_and_lap","sportmonks_motorsport_get_latest_laps_by_fixture","sportmonks_motorsport_get_latest_pitstops_by_fixture","sportmonks_motorsport_get_latest_stints_by_fixture","sportmonks_motorsport_get_latest_updated_drivers","sportmonks_motorsport_get_latest_updated_fixtures","sportmonks_motorsport_get_league","sportmonks_motorsport_get_leagues","sportmonks_motorsport_get_leagues_by_country","sportmonks_motorsport_get_leagues_by_date","sportmonks_motorsport_get_leagues_by_live","sportmonks_motorsport_get_leagues_by_team","sportmonks_motorsport_get_livescores","sportmonks_motorsport_get_pitstops_by_fixture","sportmonks_motorsport_get_pitstops_by_fixture_and_driver","sportmonks_motorsport_get_pitstops_by_fixture_and_lap","sportmonks_motorsport_get_race_results_by_season_and_driver","sportmonks_motorsport_get_race_results_by_season_and_team","sportmonks_motorsport_get_schedules_by_season","sportmonks_motorsport_get_season","sportmonks_motorsport_get_seasons","sportmonks_motorsport_get_stage","sportmonks_motorsport_get_stages","sportmonks_motorsport_get_stages_by_season","sportmonks_motorsport_get_state","sportmonks_motorsport_get_states","sportmonks_motorsport_get_stints_by_fixture","sportmonks_motorsport_get_stints_by_fixture_and_driver","sportmonks_motorsport_get_stints_by_fixture_and_stint","sportmonks_motorsport_get_team","sportmonks_motorsport_get_team_standings","sportmonks_motorsport_get_team_standings_by_season","sportmonks_motorsport_get_teams","sportmonks_motorsport_get_teams_by_country","sportmonks_motorsport_get_teams_by_season","sportmonks_motorsport_get_venue","sportmonks_motorsport_get_venues","sportmonks_motorsport_get_venues_by_season","sportmonks_motorsport_search_drivers","sportmonks_motorsport_search_leagues","sportmonks_motorsport_search_stages","sportmonks_motorsport_search_teams","sportmonks_motorsport_search_venues","sportmonks_odds_get_all_historical_odds","sportmonks_odds_get_all_inplay_odds","sportmonks_odds_get_all_pre_match_odds","sportmonks_odds_get_all_premium_odds","sportmonks_odds_get_bookmaker","sportmonks_odds_get_bookmaker_event_ids_by_fixture","sportmonks_odds_get_bookmakers","sportmonks_odds_get_bookmakers_by_fixture","sportmonks_odds_get_inplay_odds_by_fixture","sportmonks_odds_get_inplay_odds_by_fixture_and_bookmaker","sportmonks_odds_get_inplay_odds_by_fixture_and_market","sportmonks_odds_get_last_updated_inplay_odds","sportmonks_odds_get_last_updated_pre_match_odds","sportmonks_odds_get_market","sportmonks_odds_get_markets","sportmonks_odds_get_pre_match_odds_by_fixture","sportmonks_odds_get_pre_match_odds_by_fixture_and_bookmaker","sportmonks_odds_get_pre_match_odds_by_fixture_and_market","sportmonks_odds_get_premium_odds_by_fixture","sportmonks_odds_get_premium_odds_by_fixture_and_bookmaker","sportmonks_odds_get_premium_odds_by_fixture_and_market","sportmonks_odds_get_updated_historical_odds_between","sportmonks_odds_get_updated_premium_odds_between","sportmonks_odds_search_bookmakers","sportmonks_odds_search_markets","spotify_add_playlist_cover","spotify_add_to_queue","spotify_add_tracks_to_playlist","spotify_check_following","spotify_check_playlist_followers","spotify_check_saved_albums","spotify_check_saved_audiobooks","spotify_check_saved_episodes","spotify_check_saved_shows","spotify_check_saved_tracks","spotify_create_playlist","spotify_follow_artists","spotify_follow_playlist","spotify_get_album","spotify_get_album_tracks","spotify_get_albums","spotify_get_artist","spotify_get_artist_albums","spotify_get_artist_top_tracks","spotify_get_artists","spotify_get_audiobook","spotify_get_audiobook_chapters","spotify_get_audiobooks","spotify_get_categories","spotify_get_current_user","spotify_get_currently_playing","spotify_get_devices","spotify_get_episode","spotify_get_episodes","spotify_get_followed_artists","spotify_get_markets","spotify_get_new_releases","spotify_get_playback_state","spotify_get_playlist","spotify_get_playlist_cover","spotify_get_playlist_tracks","spotify_get_queue","spotify_get_recently_played","spotify_get_saved_albums","spotify_get_saved_audiobooks","spotify_get_saved_episodes","spotify_get_saved_shows","spotify_get_saved_tracks","spotify_get_show","spotify_get_show_episodes","spotify_get_shows","spotify_get_top_artists","spotify_get_top_tracks","spotify_get_track","spotify_get_tracks","spotify_get_user_playlists","spotify_get_user_profile","spotify_pause","spotify_play","spotify_remove_saved_albums","spotify_remove_saved_audiobooks","spotify_remove_saved_episodes","spotify_remove_saved_shows","spotify_remove_saved_tracks","spotify_remove_tracks_from_playlist","spotify_reorder_playlist_items","spotify_replace_playlist_items","spotify_save_albums","spotify_save_audiobooks","spotify_save_episodes","spotify_save_shows","spotify_save_tracks","spotify_search","spotify_seek","spotify_set_repeat","spotify_set_shuffle","spotify_set_volume","spotify_skip_next","spotify_skip_previous","spotify_transfer_playback","spotify_unfollow_artists","spotify_unfollow_playlist","spotify_update_playlist","sqs_send","square_batch_retrieve_inventory_counts","square_cancel_invoice","square_cancel_payment","square_complete_payment","square_create_catalog_image","square_create_customer","square_create_invoice","square_create_order","square_create_payment","square_delete_catalog_object","square_delete_customer","square_delete_invoice","square_get_catalog_object","square_get_customer","square_get_invoice","square_get_location","square_get_order","square_get_payment","square_get_refund","square_list_catalog","square_list_customers","square_list_invoices","square_list_locations","square_list_payments","square_list_refunds","square_pay_order","square_publish_invoice","square_refund_payment","square_search_catalog_objects","square_search_customers","square_search_invoices","square_search_orders","square_update_customer","square_upsert_catalog_object","ssh_check_command_exists","ssh_check_file_exists","ssh_create_directory","ssh_delete_file","ssh_download_file","ssh_execute_command","ssh_execute_script","ssh_get_system_info","ssh_list_directory","ssh_move_rename","ssh_read_file_content","ssh_upload_file","ssh_write_file_content","stagehand_agent","stagehand_extract","stripe_cancel_payment_intent","stripe_cancel_subscription","stripe_capture_charge","stripe_capture_payment_intent","stripe_confirm_payment_intent","stripe_create_charge","stripe_create_customer","stripe_create_invoice","stripe_create_payment_intent","stripe_create_price","stripe_create_product","stripe_create_subscription","stripe_delete_customer","stripe_delete_invoice","stripe_delete_product","stripe_finalize_invoice","stripe_list_charges","stripe_list_customers","stripe_list_events","stripe_list_invoices","stripe_list_payment_intents","stripe_list_prices","stripe_list_products","stripe_list_subscriptions","stripe_pay_invoice","stripe_resume_subscription","stripe_retrieve_charge","stripe_retrieve_customer","stripe_retrieve_event","stripe_retrieve_invoice","stripe_retrieve_payment_intent","stripe_retrieve_price","stripe_retrieve_product","stripe_retrieve_subscription","stripe_search_charges","stripe_search_customers","stripe_search_invoices","stripe_search_payment_intents","stripe_search_prices","stripe_search_products","stripe_search_subscriptions","stripe_send_invoice","stripe_update_charge","stripe_update_customer","stripe_update_invoice","stripe_update_payment_intent","stripe_update_price","stripe_update_product","stripe_update_subscription","stripe_void_invoice","sts_assume_role","sts_assume_role_with_saml","sts_assume_role_with_web_identity","sts_get_access_key_info","sts_get_caller_identity","sts_get_session_token","stt_assemblyai","stt_assemblyai_v2","stt_deepgram","stt_deepgram_v2","stt_elevenlabs","stt_elevenlabs_v2","stt_gemini","stt_gemini_v2","stt_whisper","stt_whisper_v2","supabase_count","supabase_delete","supabase_get_row","supabase_insert","supabase_introspect","supabase_invoke_function","supabase_query","supabase_rpc","supabase_storage_copy","supabase_storage_create_bucket","supabase_storage_create_signed_upload_url","supabase_storage_create_signed_url","supabase_storage_delete","supabase_storage_delete_bucket","supabase_storage_download","supabase_storage_empty_bucket","supabase_storage_get_public_url","supabase_storage_list","supabase_storage_list_buckets","supabase_storage_move","supabase_storage_update_bucket","supabase_storage_upload","supabase_text_search","supabase_update","supabase_upsert","supabase_vector_search","table_batch_insert_rows","table_create","table_delete_row","table_delete_rows_by_filter","table_get_row","table_get_schema","table_insert_row","table_list","table_query_rows","table_query_rows_v2","table_update_row","table_update_rows_by_filter","table_upsert_row","tailscale_authorize_device","tailscale_create_auth_key","tailscale_delete_auth_key","tailscale_delete_device","tailscale_delete_user","tailscale_expire_device_key","tailscale_get_acl","tailscale_get_auth_key","tailscale_get_device","tailscale_get_device_routes","tailscale_get_dns_preferences","tailscale_get_dns_searchpaths","tailscale_list_auth_keys","tailscale_list_devices","tailscale_list_dns_nameservers","tailscale_list_users","tailscale_set_acl","tailscale_set_device_routes","tailscale_set_device_tags","tailscale_set_dns_nameservers","tailscale_set_dns_preferences","tailscale_set_dns_searchpaths","tailscale_suspend_user","tailscale_update_device_key","tavily_crawl","tavily_extract","tavily_map","tavily_search","telegram_copy_message","telegram_delete_message","telegram_edit_message_text","telegram_forward_message","telegram_get_chat","telegram_get_chat_member","telegram_message","telegram_pin_message","telegram_send_animation","telegram_send_audio","telegram_send_chat_action","telegram_send_contact","telegram_send_document","telegram_send_location","telegram_send_photo","telegram_send_poll","telegram_send_video","telegram_set_message_reaction","telegram_unpin_message","temporal_cancel_workflow","temporal_count_workflows","temporal_create_schedule","temporal_delete_schedule","temporal_describe_schedule","temporal_describe_task_queue","temporal_describe_workflow","temporal_get_workflow_history","temporal_list_schedules","temporal_list_workflows","temporal_pause_schedule","temporal_query_workflow","temporal_reset_workflow","temporal_signal_with_start","temporal_signal_workflow","temporal_start_workflow","temporal_terminate_workflow","temporal_trigger_schedule","temporal_unpause_schedule","temporal_update_workflow","textract_analyze_expense","textract_analyze_id","textract_parser","textract_parser_v2","thinking_tool","thrive_add_audience_managers","thrive_add_audience_members","thrive_add_user_tags","thrive_create_assignment","thrive_create_audience","thrive_create_completion","thrive_create_user","thrive_delete_assignment","thrive_delete_audience","thrive_delete_user","thrive_get_activity","thrive_get_assignment","thrive_get_audience","thrive_get_completion","thrive_get_content","thrive_get_cpd_category","thrive_get_cpd_entry","thrive_get_cpd_requirement","thrive_get_enrolment","thrive_get_skill_levels","thrive_get_tag","thrive_get_user_by_id","thrive_get_user_by_ref","thrive_list_assignments","thrive_list_audience_managers","thrive_list_audience_members","thrive_list_audiences","thrive_list_completions","thrive_list_enrolments","thrive_list_tags","thrive_query_activities","thrive_query_content","thrive_query_cpd_categories","thrive_query_cpd_entries","thrive_query_cpd_requirements","thrive_query_cpd_user_summaries","thrive_remove_audience_manager","thrive_remove_audience_member","thrive_remove_user_tags","thrive_replace_audience_managers","thrive_replace_audience_members","thrive_search_users","thrive_suspend_user","thrive_update_assignment","thrive_update_audience","thrive_update_user","thrive_update_user_skills","tiktok_get_post_status","tiktok_get_user","tiktok_list_videos","tiktok_query_videos","tiktok_upload_video_draft","tinybird_append_datasource","tinybird_delete_datasource_rows","tinybird_events","tinybird_get_job","tinybird_query","tinybird_query_pipe","tinybird_truncate_datasource","tinyfish_cancel_run","tinyfish_fetch","tinyfish_get_run","tinyfish_list_runs","tinyfish_list_vault_items","tinyfish_run","tinyfish_run_async","tinyfish_search","trello_add_checklist","trello_add_checklist_item","trello_add_comment","trello_add_label","trello_add_member","trello_create_board","trello_create_card","trello_create_list","trello_delete_card","trello_get_actions","trello_get_board","trello_get_card","trello_list_cards","trello_list_lists","trello_list_members","trello_remove_label","trello_remove_member","trello_search","trello_update_card","trello_update_checklist_item","trello_update_list","trigger_dev_activate_schedule","trigger_dev_add_run_tags","trigger_dev_batch_trigger_task","trigger_dev_cancel_run","trigger_dev_complete_waitpoint_token","trigger_dev_create_env_var","trigger_dev_create_schedule","trigger_dev_create_waitpoint_token","trigger_dev_deactivate_schedule","trigger_dev_delete_env_var","trigger_dev_delete_schedule","trigger_dev_execute_query","trigger_dev_get_batch","trigger_dev_get_batch_results","trigger_dev_get_deployment","trigger_dev_get_env_var","trigger_dev_get_latest_deployment","trigger_dev_get_query_schema","trigger_dev_get_queue","trigger_dev_get_run","trigger_dev_get_run_events","trigger_dev_get_run_result","trigger_dev_get_run_trace","trigger_dev_get_schedule","trigger_dev_get_waitpoint_token","trigger_dev_import_env_vars","trigger_dev_list_deployments","trigger_dev_list_env_vars","trigger_dev_list_queues","trigger_dev_list_runs","trigger_dev_list_schedules","trigger_dev_list_timezones","trigger_dev_list_waitpoint_tokens","trigger_dev_override_queue_concurrency","trigger_dev_pause_queue","trigger_dev_promote_deployment","trigger_dev_replay_run","trigger_dev_reschedule_run","trigger_dev_reset_queue_concurrency","trigger_dev_resume_queue","trigger_dev_trigger_task","trigger_dev_update_env_var","trigger_dev_update_run_metadata","trigger_dev_update_schedule","tts_azure","tts_cartesia","tts_deepgram","tts_elevenlabs","tts_google","tts_openai","tts_playht","twilio_send_sms","twilio_voice_get_recording","twilio_voice_list_calls","twilio_voice_make_call","typeform_create_form","typeform_delete_form","typeform_files","typeform_get_form","typeform_insights","typeform_list_forms","typeform_responses","typeform_update_form","upstash_redis_command","upstash_redis_delete","upstash_redis_exists","upstash_redis_expire","upstash_redis_get","upstash_redis_hget","upstash_redis_hgetall","upstash_redis_hset","upstash_redis_incr","upstash_redis_incrby","upstash_redis_keys","upstash_redis_lpush","upstash_redis_lrange","upstash_redis_set","upstash_redis_setnx","upstash_redis_ttl","uptimerobot_create_alert_contact","uptimerobot_create_maintenance_window","uptimerobot_create_monitor","uptimerobot_create_psp","uptimerobot_delete_alert_contact","uptimerobot_delete_maintenance_window","uptimerobot_delete_monitor","uptimerobot_delete_psp","uptimerobot_get_account","uptimerobot_get_alert_contact","uptimerobot_get_incident","uptimerobot_get_maintenance_window","uptimerobot_get_monitor","uptimerobot_get_psp","uptimerobot_list_alert_contacts","uptimerobot_list_incidents","uptimerobot_list_maintenance_windows","uptimerobot_list_monitors","uptimerobot_list_psps","uptimerobot_pause_monitor","uptimerobot_start_monitor","uptimerobot_update_maintenance_window","uptimerobot_update_monitor","uptimerobot_update_psp","vanta_download_document_file","vanta_get_control","vanta_get_document","vanta_get_framework","vanta_get_person","vanta_get_policy","vanta_get_risk_scenario","vanta_get_test","vanta_get_vendor","vanta_get_vulnerable_asset","vanta_list_control_documents","vanta_list_control_tests","vanta_list_controls","vanta_list_document_uploads","vanta_list_documents","vanta_list_framework_controls","vanta_list_frameworks","vanta_list_monitored_computers","vanta_list_people","vanta_list_policies","vanta_list_risk_scenarios","vanta_list_test_entities","vanta_list_tests","vanta_list_vendors","vanta_list_vulnerabilities","vanta_list_vulnerability_remediations","vanta_list_vulnerable_assets","vanta_submit_document","vanta_upload_document_file","vercel_add_domain","vercel_add_project_domain","vercel_cancel_deployment","vercel_create_alias","vercel_create_check","vercel_create_deployment","vercel_create_dns_record","vercel_create_edge_config","vercel_create_env_var","vercel_create_project","vercel_create_webhook","vercel_delete_alias","vercel_delete_deployment","vercel_delete_dns_record","vercel_delete_domain","vercel_delete_edge_config","vercel_delete_env_var","vercel_delete_project","vercel_delete_webhook","vercel_get_alias","vercel_get_check","vercel_get_deployment","vercel_get_deployment_events","vercel_get_domain","vercel_get_domain_config","vercel_get_edge_config","vercel_get_edge_config_items","vercel_get_env_vars","vercel_get_project","vercel_get_team","vercel_get_user","vercel_get_webhook","vercel_list_aliases","vercel_list_checks","vercel_list_deployment_files","vercel_list_deployments","vercel_list_dns_records","vercel_list_domains","vercel_list_edge_configs","vercel_list_project_domains","vercel_list_projects","vercel_list_team_members","vercel_list_teams","vercel_list_webhooks","vercel_pause_project","vercel_promote_deployment","vercel_remove_project_domain","vercel_rerequest_check","vercel_unpause_project","vercel_update_check","vercel_update_dns_record","vercel_update_edge_config_items","vercel_update_env_var","vercel_update_project","vercel_update_project_domain","vercel_verify_project_domain","video_falai","video_luma","video_minimax","video_runway","video_veo","vision_tool","vision_tool_v2","wealthbox_read_contact","wealthbox_read_note","wealthbox_read_task","wealthbox_write_contact","wealthbox_write_note","wealthbox_write_task","webflow_create_item","webflow_delete_item","webflow_get_item","webflow_list_items","webflow_update_item","webhook_request","whatsapp_get_media","whatsapp_mark_read","whatsapp_send_interactive","whatsapp_send_media","whatsapp_send_message","whatsapp_send_reaction","whatsapp_send_template","whatsapp_upload_media","wikipedia_content","wikipedia_random","wikipedia_search","wikipedia_summary","windchill_check_in_document","windchill_check_in_documents","windchill_check_out_document","windchill_check_out_documents","windchill_create_document","windchill_create_documents","windchill_delete_document","windchill_delete_documents","windchill_download_attachment","windchill_download_primary_content","windchill_get_document","windchill_get_document_structure","windchill_get_primary_content","windchill_get_valid_state_transitions","windchill_list_attachments","windchill_list_documents","windchill_revise_document","windchill_revise_documents","windchill_set_lifecycle_state","windchill_undo_check_out_document","windchill_undo_check_out_documents","windchill_update_common_properties","windchill_update_document","windchill_update_document_security_labels","windchill_update_documents","windchill_upload_attachments","windchill_upload_primary_content","wiza_company_enrichment","wiza_get_credits","wiza_individual_reveal","wiza_prospect_search","wordpress_create_category","wordpress_create_comment","wordpress_create_page","wordpress_create_post","wordpress_create_tag","wordpress_delete_category","wordpress_delete_comment","wordpress_delete_media","wordpress_delete_page","wordpress_delete_post","wordpress_delete_tag","wordpress_get_category","wordpress_get_current_user","wordpress_get_media","wordpress_get_page","wordpress_get_post","wordpress_get_tag","wordpress_get_user","wordpress_list_categories","wordpress_list_comments","wordpress_list_media","wordpress_list_pages","wordpress_list_posts","wordpress_list_tags","wordpress_list_users","wordpress_search_content","wordpress_update_category","wordpress_update_comment","wordpress_update_page","wordpress_update_post","wordpress_update_tag","wordpress_upload_media","workday_assign_onboarding","workday_change_job","workday_create_prehire","workday_get_compensation","workday_get_organizations","workday_get_worker","workday_hire_employee","workday_list_workers","workday_terminate_worker","workday_update_worker","workflow_executor","x_create_bookmark","x_create_tweet","x_delete_bookmark","x_delete_tweet","x_get_blocking","x_get_bookmarks","x_get_followers","x_get_following","x_get_liked_tweets","x_get_liking_users","x_get_me","x_get_personalized_trends","x_get_quote_tweets","x_get_retweeted_by","x_get_trends_by_woeid","x_get_tweets_by_ids","x_get_usage","x_get_user_mentions","x_get_user_timeline","x_get_user_tweets","x_hide_reply","x_manage_block","x_manage_follow","x_manage_like","x_manage_mute","x_manage_retweet","x_read","x_search","x_search_tweets","x_search_users","x_user","x_write","youtube_channel_info","youtube_channel_playlists","youtube_channel_videos","youtube_comments","youtube_playlist_items","youtube_search","youtube_trending","youtube_video_categories","youtube_video_details","zendesk_autocomplete_organizations","zendesk_create_organization","zendesk_create_organizations_bulk","zendesk_create_ticket","zendesk_create_tickets_bulk","zendesk_create_user","zendesk_create_users_bulk","zendesk_delete_organization","zendesk_delete_ticket","zendesk_delete_user","zendesk_get_current_user","zendesk_get_organization","zendesk_get_organizations","zendesk_get_ticket","zendesk_get_tickets","zendesk_get_user","zendesk_get_users","zendesk_merge_tickets","zendesk_search","zendesk_search_count","zendesk_search_users","zendesk_update_organization","zendesk_update_ticket","zendesk_update_tickets_bulk","zendesk_update_user","zendesk_update_users_bulk","zep_add_messages","zep_add_user","zep_create_thread","zep_delete_thread","zep_get_context","zep_get_messages","zep_get_threads","zep_get_user","zep_get_user_threads","zerobounce_get_credits","zerobounce_verify_email","zoho_desk_add_comment","zoho_desk_get_attachment","zoho_desk_get_contact","zoho_desk_get_thread","zoho_desk_get_ticket","zoho_desk_list_comments","zoho_desk_list_organizations","zoho_desk_list_threads","zoho_desk_list_tickets","zoho_desk_update_ticket","zoom_create_meeting","zoom_delete_meeting","zoom_delete_recording","zoom_get_meeting","zoom_get_meeting_invitation","zoom_get_meeting_recordings","zoom_list_meetings","zoom_list_past_participants","zoom_list_recordings","zoom_update_meeting","zoominfo_enrich_companies","zoominfo_enrich_contacts","zoominfo_search_companies","zoominfo_search_contacts","zoominfo_search_intent","zoominfo_search_news"]' ) export default toolIds diff --git a/apps/sim/tools/generated/tool-metadata.ts b/apps/sim/tools/generated/tool-metadata.ts index 26858671349..e34d372198e 100644 --- a/apps/sim/tools/generated/tool-metadata.ts +++ b/apps/sim/tools/generated/tool-metadata.ts @@ -3,7 +3,7 @@ /** Serializable metadata for every built-in tool, keyed by tool id. */ const toolMetadata: Record = JSON.parse( - '{"a2a_cancel_task":{"id":"a2a_cancel_task","name":"A2A Cancel Task","description":"Request cancellation of an in-progress A2A task.","version":"1.0.0","params":{"agentUrl":{"type":"string","required":true,"visibility":"user-only","description":"The A2A agent endpoint URL"},"taskId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The task ID to cancel"},"apiKey":{"type":"string","required":false,"visibility":"user-only","description":"API key for authentication (if required)"}},"hostedApiKey":"none"},"a2a_get_agent_card":{"id":"a2a_get_agent_card","name":"A2A Get Agent Card","description":"Fetch the Agent Card (discovery document) for an external A2A agent.","version":"1.0.0","params":{"agentUrl":{"type":"string","required":true,"visibility":"user-only","description":"The A2A agent endpoint URL"},"apiKey":{"type":"string","required":false,"visibility":"user-only","description":"API key for authentication (if required)"}},"hostedApiKey":"none"},"a2a_get_task":{"id":"a2a_get_task","name":"A2A Get Task","description":"Retrieve the current state and result of an A2A task.","version":"1.0.0","params":{"agentUrl":{"type":"string","required":true,"visibility":"user-only","description":"The A2A agent endpoint URL"},"taskId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The task ID to retrieve"},"historyLength":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of history messages to include"},"apiKey":{"type":"string","required":false,"visibility":"user-only","description":"API key for authentication (if required)"}},"hostedApiKey":"none"},"a2a_send_message":{"id":"a2a_send_message","name":"A2A Send Message","description":"Send a message to an external A2A agent and return its response.","version":"1.0.0","params":{"agentUrl":{"type":"string","required":true,"visibility":"user-only","description":"The A2A agent endpoint URL"},"message":{"type":"string","required":true,"visibility":"user-or-llm","description":"The message text to send"},"data":{"type":"json","required":false,"visibility":"user-or-llm","description":"Optional structured JSON data to attach"},"files":{"type":"json","required":false,"visibility":"user-or-llm","description":"Optional files to attach"},"taskId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Existing task ID to continue"},"contextId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Conversation context ID to continue"},"apiKey":{"type":"string","required":false,"visibility":"user-only","description":"API key for authentication (if required)"}},"hostedApiKey":"none"},"affinity_batch_update_entity_fields":{"id":"affinity_batch_update_entity_fields","name":"Affinity Batch Update Entity Fields","description":"Write up to 100 non-list field values on one company or person in a single request.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which entity to write the fields on: companies or persons"},"entityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of that company or person"},"updates":{"type":"json","required":true,"visibility":"user-or-llm","description":"Up to 100 field updates as [{\\"id\\":\\"\\",\\"value\\":{\\"type\\":\\"…\\",\\"data\\":…}}], using the same value shapes as a single field update"}},"hostedApiKey":"none"},"affinity_batch_update_list_entry_fields":{"id":"affinity_batch_update_list_entry_fields","name":"Affinity Batch Update List Entry Fields","description":"Write up to 100 field values on one list row in a single request. Requires the \\"Export data from Lists\\" permission.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"listEntryId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list entry ID"},"updates":{"type":"json","required":true,"visibility":"user-or-llm","description":"Up to 100 field updates as [{\\"id\\":\\"\\",\\"value\\":{\\"type\\":\\"…\\",\\"data\\":…}}], using the same value shapes as a single field update"}},"hostedApiKey":"none"},"affinity_create_list":{"id":"affinity_create_list","name":"Affinity Create List","description":"Create a list. Its type fixes which entities it can hold, and the API key holder becomes its creator and owner.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the new list"},"type":{"type":"string","required":true,"visibility":"user-or-llm","description":"Entity kind the list holds: company, opportunity, or person"},"isPublic":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Whether everyone in the organization can see the list"}},"hostedApiKey":"none"},"affinity_create_list_field_dropdown_option":{"id":"affinity_create_list_field_dropdown_option","name":"Affinity Create List Field Dropdown Option","description":"Add a selectable option to a dropdown field on a list. A ranked or status option also needs a rank and a color.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The dropdown field ID on that list"},"type":{"type":"string","required":true,"visibility":"user-or-llm","description":"Kind of option to create, matching the field. dropdown takes only a label; ranked-dropdown also requires rank and color; status-dropdown additionally requires a status category. Sending a field the kind does not accept is rejected"},"text":{"type":"string","required":true,"visibility":"user-or-llm","description":"The option label"},"rank":{"type":"number","required":false,"visibility":"user-or-llm","description":"Sort order. Required on a ranked-dropdown or status-dropdown option"},"color":{"type":"string","required":false,"visibility":"user-or-llm","description":"Option color: white, gray, blue, green, purple, orange, or red. Required on a ranked-dropdown or status-dropdown option"},"statusCategory":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pipeline meaning of the option: open, won, lost, or on-hold. Status-dropdown options only"},"winRate":{"type":"number","required":false,"visibility":"user-or-llm","description":"Expected win rate of the status. Status-dropdown options only"}},"hostedApiKey":"none"},"affinity_create_merge":{"id":"affinity_create_merge","name":"Affinity Create Merge","description":"Fold a duplicate company or person into the record you are keeping. The merge runs asynchronously — poll the returned task to see it finish. Requires the \\"Manage duplicates\\" permission and an admin role.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"What to merge: companies or persons"},"primaryId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record to keep"},"duplicateId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the duplicate record to fold in"}},"hostedApiKey":"none"},"affinity_create_note":{"id":"affinity_create_note","name":"Affinity Create Note","description":"Write a note — attached to companies, persons, and opportunities, anchored to a meeting, call, or chat message, or posted as a reply to an existing note.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"type":{"type":"string","required":true,"visibility":"user-or-llm","description":"Note shape: entities to attach it to records, interaction to anchor it to a meeting, call, or chat message, or user-reply to reply to a note"},"html":{"type":"string","required":true,"visibility":"user-or-llm","description":"The note body as HTML"},"companyIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Companies to attach the note to, e.g. [1, 2]. Not used on a reply"},"personIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Persons to attach the note to, e.g. [1, 2]. Not used on a reply"},"opportunityIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Opportunities to attach the note to, e.g. [1, 2]. Not used on a reply"},"interactionId":{"type":"string","required":false,"visibility":"user-or-llm","description":"The interaction to anchor the note to. Required for an interaction note"},"interactionType":{"type":"string","required":false,"visibility":"user-or-llm","description":"Kind of the anchoring interaction: meeting, call, or chat-message. Required for an interaction note"},"parentId":{"type":"string","required":false,"visibility":"user-or-llm","description":"The note being replied to. Required for a user-reply note"},"creatorId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Attribute the note to another internal person. Defaults to the API key holder"},"createdAt":{"type":"string","required":false,"visibility":"user-or-llm","description":"Backdate the note to this ISO 8601 timestamp"}},"hostedApiKey":"none"},"affinity_create_reminder":{"id":"affinity_create_reminder","name":"Affinity Create Reminder","description":"Create a reminder on one company, person, or opportunity. A recurring reminder resets whenever the chosen signal happens instead of firing once.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"type":{"type":"string","required":true,"visibility":"user-or-llm","description":"one-time to fire once, or recurring to reset on a signal"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"What the reminder is about: company, person, or opportunity"},"entityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of that company, person, or opportunity"},"dueDate":{"type":"string","required":false,"visibility":"user-or-llm","description":"When the reminder is due, as an ISO 8601 timestamp. Required for a one-time reminder; on a recurring one Affinity computes it from the period when omitted"},"content":{"type":"string","required":false,"visibility":"user-or-llm","description":"What the reminder says"},"ownerId":{"type":"string","required":true,"visibility":"user-or-llm","description":"User the reminder is assigned to. Must be an internal user. The API key holder is recorded as the creator, which is a separate field"},"resetTrigger":{"type":"string","required":false,"visibility":"user-or-llm","description":"What restarts a recurring reminder: interaction, email, or event. Required when the type is recurring"},"periodDays":{"type":"number","required":false,"visibility":"user-or-llm","description":"Days between firings of a recurring reminder. Required when the type is recurring"}},"hostedApiKey":"none"},"affinity_delete_list_field_dropdown_option":{"id":"affinity_delete_list_field_dropdown_option","name":"Affinity Delete List Field Dropdown Option","description":"Permanently delete a dropdown option on a list field. Every list entry currently set to it is cleared, and those values cannot be recovered.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The dropdown field ID on that list"},"dropdownOptionId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The dropdown option ID to delete"}},"hostedApiKey":"none"},"affinity_delete_note":{"id":"affinity_delete_note","name":"Affinity Delete Note","description":"Delete a note you created. Deleting a root note also deletes its replies; deleting a reply removes only that reply.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"noteId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The note ID to delete"}},"hostedApiKey":"none"},"affinity_get_company":{"id":"affinity_get_company","name":"Affinity Get Company","description":"Look up one company by ID. Field data is returned only for the Field IDs or Field Types asked for.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"companyId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The company ID"},"fieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs to return values for, e.g. [\\"affinity-data-location\\"]. Mutually exclusive with Field Types"},"fieldTypes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field categories to return values for: enriched, global, or relationship-intelligence. Mutually exclusive with Field IDs"}},"hostedApiKey":"none"},"affinity_get_current_user":{"id":"affinity_get_current_user","name":"Affinity Get Current User","description":"Verify an Affinity API key and return the tenant, the user behind the key, and the scopes the grant carries.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"}},"hostedApiKey":"none"},"affinity_get_entity_field_value":{"id":"affinity_get_entity_field_value","name":"Affinity Get Entity Field Value","description":"Read one non-list field value from a company or person.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which entity to read the field from: companies or persons"},"entityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of that company or person"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The field ID to read"}},"hostedApiKey":"none"},"affinity_get_list":{"id":"affinity_get_list","name":"Affinity Get List","description":"Read one list — its name, type, owner, and privacy setting.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"}},"hostedApiKey":"none"},"affinity_get_list_entry":{"id":"affinity_get_list_entry","name":"Affinity Get List Entry","description":"Read one row of a list with its entity. Field data is returned only for the Field IDs or Field Types asked for.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"listEntryId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list entry ID"},"fieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs to return values for, e.g. [\\"affinity-data-location\\"]. Mutually exclusive with Field Types"},"fieldTypes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field categories to return values for: enriched, global, list, or relationship-intelligence. Mutually exclusive with Field IDs"}},"hostedApiKey":"none"},"affinity_get_list_entry_field":{"id":"affinity_get_list_entry_field","name":"Affinity Get List Entry Field","description":"Read one field value on a list row.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"listEntryId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list entry ID"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The field ID to read"}},"hostedApiKey":"none"},"affinity_get_list_field_dropdown_option":{"id":"affinity_get_list_field_dropdown_option","name":"Affinity Get List Field Dropdown Option","description":"Read one dropdown option on a list field.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The dropdown field ID on that list"},"dropdownOptionId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The dropdown option ID"}},"hostedApiKey":"none"},"affinity_get_merge":{"id":"affinity_get_merge","name":"Affinity Get Merge","description":"Read the status of one company or person merge, including why it failed if it did.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which merge to read: companies or persons"},"mergeId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The merge ID"}},"hostedApiKey":"none"},"affinity_get_merge_task":{"id":"affinity_get_merge_task","name":"Affinity Get Merge Task","description":"Read one merge task and how its merges are progressing. Poll this after starting a merge.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which merge task to read: companies or persons"},"taskId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The merge task ID"}},"hostedApiKey":"none"},"affinity_get_note":{"id":"affinity_get_note","name":"Affinity Get Note","description":"Read one note with its body, author, mentions, and attached records.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"noteId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The note ID"},"includes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Extra properties to return, e.g. [\\"repliesCount\\",\\"personsPreview\\",\\"companiesPreview\\",\\"opportunitiesPreview\\"]. Those four fields are omitted unless requested here"}},"hostedApiKey":"none"},"affinity_get_opportunity":{"id":"affinity_get_opportunity","name":"Affinity Get Opportunity","description":"Read one opportunity and the list it belongs to. Its field data lives on the list entry.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"opportunityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The opportunity ID"}},"hostedApiKey":"none"},"affinity_get_person":{"id":"affinity_get_person","name":"Affinity Get Person","description":"Look up one person by ID. Field data is returned only for the Field IDs or Field Types asked for.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"personId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The person ID"},"fieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs to return values for, e.g. [\\"affinity-data-location\\"]. Mutually exclusive with Field Types"},"fieldTypes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field categories to return values for: enriched, global, or relationship-intelligence. Mutually exclusive with Field IDs"}},"hostedApiKey":"none"},"affinity_get_saved_view":{"id":"affinity_get_saved_view","name":"Affinity Get Saved View","description":"Read one saved view — its name, kind, and creation date.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"viewId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The saved view ID"}},"hostedApiKey":"none"},"affinity_get_transcript":{"id":"affinity_get_transcript","name":"Affinity Get Transcript","description":"Read one transcript with its first 100 fragments. Page the fragments endpoint for a longer meeting.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"transcriptId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The transcript ID"}},"hostedApiKey":"none"},"affinity_get_user":{"id":"affinity_get_user","name":"Affinity Get User","description":"Read one internal user. A user and their person record share the same numeric ID, so a person ID works here.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"userId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The user ID, which is also their person ID"}},"hostedApiKey":"none"},"affinity_list_calls":{"id":"affinity_list_calls","name":"Affinity List Calls","description":"Page through logged calls and their participants. Only calls the API key holder can see are returned.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression, e.g. \\"createdAt>=2026-01-01\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_chat_messages":{"id":"affinity_list_chat_messages","name":"Affinity List Chat Messages","description":"Page through logged chat messages and their participants. Only messages the API key holder can see are returned.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression, e.g. \\"createdAt>=2026-01-01\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_companies":{"id":"affinity_list_companies","name":"Affinity List Companies","description":"Page through companies. Companies come back without field data unless Field IDs or Field Types asks for it.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"ids":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict the page to these company IDs, e.g. [1, 2, 3]"},"fieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs to return values for, e.g. [\\"affinity-data-location\\"]. Mutually exclusive with Field Types"},"fieldTypes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field categories to return values for: enriched, global, or relationship-intelligence. Mutually exclusive with Field IDs"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_coworker_connections":{"id":"affinity_list_coworker_connections","name":"Affinity List Coworker Connections","description":"Find warm paths into a company through shared work history: who in your Affinity data once worked alongside the people you want to reach. Grouped by target, strongest first.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filter":{"type":"string","required":true,"visibility":"user-or-llm","description":"Required scope. The only supported filter is target.currentCompany.id, e.g. \\"target.currentCompany.id=123\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of targets to return per page, 1-50. Defaults to 20"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_list_emails":{"id":"affinity_list_emails","name":"Affinity List Emails","description":"Page through email metadata — subject, participants, and timestamps. Affinity never exposes email bodies through the API.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression, e.g. \\"createdAt>=2026-01-01\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_entity_field_values":{"id":"affinity_list_entity_field_values","name":"Affinity List Entity Field Values","description":"Page through a company\'s or person\'s non-list field values. List fields are not returned here — read those through the list entry.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which entity to read field values from: companies or persons"},"entityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of that company or person"},"ids":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict to these field IDs. Mutually exclusive with Field Types"},"types":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict to these field categories: enriched, global, relationship-intelligence. Mutually exclusive with Field IDs"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 20"}},"hostedApiKey":"none"},"affinity_list_entity_list_entries":{"id":"affinity_list_entity_list_entries","name":"Affinity List Entity List Entries","description":"Page through a company\'s or person\'s rows across every list, each carrying that list\'s field values and when the entity was added.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which entity to look up the rows of: companies or persons"},"entityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of that company or person"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_entity_lists":{"id":"affinity_list_entity_lists","name":"Affinity List Entity Lists","description":"List every list a company or person appears on that the caller can view.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which entity to look up the lists of: companies or persons"},"entityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of that company or person"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_entity_notes":{"id":"affinity_list_entity_notes","name":"Affinity List Entity Notes","description":"List the notes relevant to one company, person, or opportunity — directly attached notes plus notes reaching it through its people and meetings.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which entity the notes hang off: companies, persons, or opportunities"},"entityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of that company, person, or opportunity"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression, e.g. \\"createdAt>=2026-01-01\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_list_entity_relationships":{"id":"affinity_list_entity_relationships","name":"Affinity List Entity Relationships","description":"List who knows a company or person, scored 0.0 to 1.0 by how much the two actually interact. Strongest first by default.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which entity to look up relationships for: companies or persons"},"entityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of that company or person"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression. This endpoint filters on interactionScore only, e.g. \\"interactionScore>=0.5\\""},"orderBy":{"type":"json","required":false,"visibility":"user-or-llm","description":"Sort order: [\\"interactionScore\\"] for weakest first, [\\"-interactionScore\\"] for strongest first (the default)"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_list_field_dropdown_options":{"id":"affinity_list_field_dropdown_options","name":"Affinity List Field Dropdown Options","description":"List the selectable options on a dropdown or ranked-dropdown company or person field. Writing such a field needs the option ID, not its text.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which field family the field belongs to: companies or persons"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The dropdown or ranked-dropdown field ID"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_field_metadata":{"id":"affinity_list_field_metadata","name":"Affinity List Field Metadata","description":"List the non-list company or person fields, with the value type, filter operators, and sort support of each. Start here to find the Field IDs the read and write tools take.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which fields to describe: companies or persons"},"includes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Extra properties to return: [\\"filterability\\",\\"sortability\\"]. Both are omitted unless requested here"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression. This endpoint filters on name only, e.g. \\"name=~Status\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_field_value_changes":{"id":"affinity_list_field_value_changes","name":"Affinity List Field Value Changes","description":"Page through field value changes across the whole workspace. Built for delta sync: follow nextCursor to the end of a run, then resume from the last cursor next time.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression over field.id, listEntry.id, changer.id, changedAt, or actionType. Resume a sync with e.g. \\"changedAt>2026-06-01T12:00:00Z\\""},"orderBy":{"type":"json","required":false,"visibility":"user-or-llm","description":"Sort order: [\\"changedAt\\"] for oldest first (the default), [\\"-changedAt\\"] for newest first"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_investor_executive_connections":{"id":"affinity_list_investor_executive_connections","name":"Affinity List Investor Executive Connections","description":"Find warm paths into a company through investment history: which investors in your Affinity data backed a company the people you want to reach once led. Grouped by target, strongest first.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filter":{"type":"string","required":true,"visibility":"user-or-llm","description":"Required scope. The only supported filter is target.currentCompany.id, e.g. \\"target.currentCompany.id=123\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of targets to return per page, 1-50. Defaults to 20"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_list_list_entries":{"id":"affinity_list_list_entries","name":"Affinity List List Entries","description":"Page through the rows of a list. Rows come back without field data unless Field IDs or Field Types asks for it.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"fieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs to return values for, e.g. [\\"affinity-data-location\\"]. Mutually exclusive with Field Types"},"fieldTypes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field categories to return values for: enriched, global, list, or relationship-intelligence. Mutually exclusive with Field IDs"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_list_entry_field_value_changes":{"id":"affinity_list_list_entry_field_value_changes","name":"Affinity List List Entry Field Value Changes","description":"Page through the history of one list row — who changed which field, when, and to what.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"listEntryId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list entry ID"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression over field.id, changer.id, changedAt, or actionType, e.g. \\"field.id=field-1234\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_list_entry_fields":{"id":"affinity_list_list_entry_fields","name":"Affinity List List Entry Fields","description":"Page through every field value on one list row, including the list-specific columns. All fields are returned unless narrowed.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"listEntryId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list entry ID"},"ids":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict to these field IDs. Mutually exclusive with Field Types"},"types":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict to these field categories: enriched, global, list, relationship-intelligence. Mutually exclusive with Field IDs"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 20"}},"hostedApiKey":"none"},"affinity_list_list_field_dropdown_options":{"id":"affinity_list_list_field_dropdown_options","name":"Affinity List List Field Dropdown Options","description":"List the selectable options on a dropdown, ranked-dropdown, or status-dropdown field of a list.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The dropdown field ID on that list"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_list_fields":{"id":"affinity_list_list_fields","name":"Affinity List List Fields","description":"List the fields available on one list, including its list-specific columns. Use these Field IDs when reading or writing list entries.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"includes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Extra properties to return: [\\"filterability\\",\\"sortability\\"]. Both are omitted unless requested here"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression. This endpoint filters on name only, e.g. \\"name=~Stage\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_lists":{"id":"affinity_list_lists","name":"Affinity List Lists","description":"Page through the lists in the organization that the caller can view.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"term":{"type":"string","required":false,"visibility":"user-or-llm","description":"Case-insensitive substring match on the list name"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_meetings":{"id":"affinity_list_meetings","name":"Affinity List Meetings","description":"Page through past and upcoming meetings with their organizer and attendees.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression, e.g. \\"createdAt>=2026-01-01\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_merge_tasks":{"id":"affinity_list_merge_tasks","name":"Affinity List Merge Tasks","description":"Page through merge tasks, each summarizing how many of its merges are in progress, succeeded, or failed.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which merge tasks to list: companies or persons"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression. This endpoint filters on status only, e.g. \\"status=in-progress\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_merges":{"id":"affinity_list_merges","name":"Affinity List Merges","description":"Page through the company or person merges the organization has run, with the status and the records involved in each.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which merges to list: companies or persons"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression over status or taskId, e.g. \\"status=failed\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_note_attached_companies":{"id":"affinity_list_note_attached_companies","name":"Affinity List Note Attached Companies","description":"List the companies directly attached to one note.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"noteId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The note ID"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_list_note_attached_opportunities":{"id":"affinity_list_note_attached_opportunities","name":"Affinity List Note Attached Opportunities","description":"List the opportunities directly attached to one note.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"noteId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The note ID"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_list_note_attached_persons":{"id":"affinity_list_note_attached_persons","name":"Affinity List Note Attached Persons","description":"List the persons directly attached to one note.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"noteId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The note ID"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_list_note_replies":{"id":"affinity_list_note_replies","name":"Affinity List Note Replies","description":"Page through the replies on one note, including AI Notetaker replies.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"noteId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The note ID whose replies to read"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression, e.g. \\"createdAt>=2026-01-01\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_list_notes":{"id":"affinity_list_notes","name":"Affinity List Notes","description":"Page through every note the caller can see. Replies are excluded.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"includes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Extra properties to return, e.g. [\\"repliesCount\\",\\"personsPreview\\",\\"companiesPreview\\",\\"opportunitiesPreview\\"]. Those four fields are omitted unless requested here"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression, e.g. \\"createdAt>=2026-01-01\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_list_opportunities":{"id":"affinity_list_opportunities","name":"Affinity List Opportunities","description":"Page through opportunities. Field data lives on the list entry, not here — read it through the list or saved view the opportunity belongs to.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"ids":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict the page to these opportunity IDs, e.g. [1, 2, 3]"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_persons":{"id":"affinity_list_persons","name":"Affinity List Persons","description":"Page through persons. Persons come back without field data unless Field IDs or Field Types asks for it.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"ids":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict the page to these person IDs, e.g. [1, 2, 3]"},"fieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs to return values for, e.g. [\\"affinity-data-location\\"]. Mutually exclusive with Field Types"},"fieldTypes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field categories to return values for: enriched, global, or relationship-intelligence. Mutually exclusive with Field IDs"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_reminders":{"id":"affinity_list_reminders","name":"Affinity List Reminders","description":"Page through the reminders the caller can see. Filter by status to surface what is overdue.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression, e.g. \\"createdAt>=2026-01-01\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_list_saved_view_entries":{"id":"affinity_list_saved_view_entries","name":"Affinity List Saved View Entries","description":"Page through the rows of a saved view. The view\'s own filters and columns decide which rows and which field data come back.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"viewId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The saved view ID"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_saved_views":{"id":"affinity_list_saved_views","name":"Affinity List Saved Views","description":"List the saved views on a list that the caller can view.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_list_transcript_fragments":{"id":"affinity_list_transcript_fragments","name":"Affinity List Transcript Fragments","description":"Page through everything said in a meeting, segment by segment with the speaker.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"transcriptId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The transcript ID"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_list_transcripts":{"id":"affinity_list_transcripts","name":"Affinity List Transcripts","description":"Page through meeting transcript metadata. Read one transcript to get what was actually said.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression, e.g. \\"createdAt>=2026-01-01\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_list_users":{"id":"affinity_list_users","name":"Affinity List Users","description":"Page through the internal users in the organization. Email addresses and roles are returned only to callers with the \\"Manage Users\\" permission.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"term":{"type":"string","required":false,"visibility":"user-or-llm","description":"Case-insensitive match across first name, last name, and primary email"},"filter":{"type":"string","required":false,"visibility":"user-or-llm","description":"Affinity Filtering Language expression over id or status, e.g. \\"status=active\\""},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_search_companies":{"id":"affinity_search_companies","name":"Affinity Search Companies","description":"Search companies by filters, sorts, and a free-text term. Requires the \\"Export All Organizations directory\\" permission.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filters":{"type":"json","required":false,"visibility":"user-or-llm","description":"Filter group as {operator: \\"and\\"|\\"or\\", filters: [...]}, at most 50 leaves. Each leaf is {valueType, fieldId, operator, value}, and a leaf may itself be a nested group"},"searchTerm":{"type":"string","required":false,"visibility":"user-or-llm","description":"Free-text term matched against the searchable fields. At least 3 characters"},"searchFieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs the search term is matched against. Defaults to the searchable fields"},"sorts":{"type":"json","required":false,"visibility":"user-or-llm","description":"Sort order as [{fieldId, direction: \\"asc\\"|\\"desc\\", attributeId?}], up to 5, applied in order"},"fieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs to return values for, e.g. [\\"affinity-data-location\\"]. Mutually exclusive with Field Types"},"fieldTypes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field categories to return values for: enriched, global, or relationship-intelligence. Mutually exclusive with Field IDs"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_search_files":{"id":"affinity_search_files","name":"Affinity Search Files","description":"Search files by keyword, ordered by relevance. Narrow to specific files or to one company, or leave both unset to search the whole account.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"prompt":{"type":"string","required":true,"visibility":"user-or-llm","description":"What to search for. Between 3 and 500 characters"},"ids":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict the search to these file IDs. Cannot be combined with Company ID"},"companyId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Restrict the search to one company\'s files. Cannot be combined with file IDs"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of files to return, 1-100. Defaults to 20"}},"hostedApiKey":"none"},"affinity_search_list_entries":{"id":"affinity_search_list_entries","name":"Affinity Search List Entries","description":"Search the rows of one list by filters, sorts, and a free-text term. Requires the \\"Export data from Lists\\" permission.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID to search"},"filters":{"type":"json","required":false,"visibility":"user-or-llm","description":"Filter group as {operator: \\"and\\"|\\"or\\", filters: [...]}, at most 50 leaves. Each leaf is {valueType, fieldId, operator, value}, and a leaf may itself be a nested group"},"searchTerm":{"type":"string","required":false,"visibility":"user-or-llm","description":"Free-text term matched against the searchable fields. At least 3 characters"},"searchFieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs the search term is matched against. Defaults to the searchable fields"},"sorts":{"type":"json","required":false,"visibility":"user-or-llm","description":"Sort order as [{fieldId, direction: \\"asc\\"|\\"desc\\", attributeId?}], up to 5, applied in order"},"fieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs to return values for, e.g. [\\"affinity-data-location\\"]. Mutually exclusive with Field Types"},"fieldTypes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field categories to return values for: enriched, global, list, or relationship-intelligence. Mutually exclusive with Field IDs"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_search_notes":{"id":"affinity_search_notes","name":"Affinity Search Notes","description":"Search notes by keyword, ordered by relevance. Narrow to specific notes or to one company, or leave both unset to search the whole account.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"prompt":{"type":"string","required":true,"visibility":"user-or-llm","description":"What to search for. Between 3 and 500 characters"},"ids":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict the search to these note IDs. Cannot be combined with Company ID"},"companyId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Restrict the search to one company\'s notes. Cannot be combined with note IDs"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of notes to return, 1-100. Defaults to 20"}},"hostedApiKey":"none"},"affinity_search_persons":{"id":"affinity_search_persons","name":"Affinity Search Persons","description":"Search persons by filters, sorts, and a free-text term. Requires the \\"Export All People directory\\" permission.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"filters":{"type":"json","required":false,"visibility":"user-or-llm","description":"Filter group as {operator: \\"and\\"|\\"or\\", filters: [...]}, at most 50 leaves. Each leaf is {valueType, fieldId, operator, value}, and a leaf may itself be a nested group"},"searchTerm":{"type":"string","required":false,"visibility":"user-or-llm","description":"Free-text term matched against the searchable fields. At least 3 characters"},"searchFieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs the search term is matched against. Defaults to the searchable fields"},"sorts":{"type":"json","required":false,"visibility":"user-or-llm","description":"Sort order as [{fieldId, direction: \\"asc\\"|\\"desc\\", attributeId?}], up to 5, applied in order"},"fieldIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field IDs to return values for, e.g. [\\"affinity-data-location\\"]. Mutually exclusive with Field Types"},"fieldTypes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Field categories to return values for: enriched, global, or relationship-intelligence. Mutually exclusive with Field IDs"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous page, returned as nextCursor or prevCursor"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to return per page, 1-100. Defaults to 100"},"totalCount":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the total size of the collection. Costs an extra query"}},"hostedApiKey":"none"},"affinity_semantic_search":{"id":"affinity_semantic_search","name":"Affinity Semantic Search","description":"Find companies from a description in plain language — industry, technology, stage, or business model. Currently searches companies only.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"prompt":{"type":"string","required":true,"visibility":"user-or-llm","description":"What to look for, in plain language, e.g. \\"climate tech companies in our pipeline\\". Up to 500 characters"},"listIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Restrict the search to companies on these lists, e.g. [1, 2]"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of companies to return, 1-100. Defaults to 100"}},"hostedApiKey":"none"},"affinity_update_entity_field_value":{"id":"affinity_update_entity_field_value","name":"Affinity Update Entity Field Value","description":"Write one non-list field value on a company or person. The value type must match how the field is defined.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"entityType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Which entity to write the field on: companies or persons"},"entityId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of that company or person"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The field ID to write"},"value":{"type":"json","required":true,"visibility":"user-or-llm","description":"The new value as {type, data}, where type matches the field\'s value type. Examples: {\\"type\\":\\"text\\",\\"data\\":\\"Series B\\"}, {\\"type\\":\\"number\\",\\"data\\":42}, {\\"type\\":\\"dropdown\\",\\"data\\":{\\"dropdownOptionId\\":7}}, {\\"type\\":\\"person\\",\\"data\\":{\\"id\\":123}}, {\\"type\\":\\"person-multi\\",\\"data\\":[{\\"id\\":123}]}. Pass data as null to clear the field"}},"hostedApiKey":"none"},"affinity_update_list_entry_field":{"id":"affinity_update_list_entry_field","name":"Affinity Update List Entry Field","description":"Write one field value on a list row. Requires the \\"Export data from Lists\\" permission.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"listEntryId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list entry ID"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The field ID to write"},"value":{"type":"json","required":true,"visibility":"user-or-llm","description":"The new value as {type, data}, where type matches the field\'s value type. Examples: {\\"type\\":\\"text\\",\\"data\\":\\"Series B\\"}, {\\"type\\":\\"number\\",\\"data\\":42}, {\\"type\\":\\"dropdown\\",\\"data\\":{\\"dropdownOptionId\\":7}}, {\\"type\\":\\"person\\",\\"data\\":{\\"id\\":123}}, {\\"type\\":\\"person-multi\\",\\"data\\":[{\\"id\\":123}]}. Pass data as null to clear the field"}},"hostedApiKey":"none"},"affinity_update_list_field_dropdown_option":{"id":"affinity_update_list_field_dropdown_option","name":"Affinity Update List Field Dropdown Option","description":"Change a dropdown option on a list field. Every field is optional — supply only what should change, and only fields the option\'s kind actually has.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"listId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The list ID"},"fieldId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The dropdown field ID on that list"},"dropdownOptionId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The dropdown option ID to update"},"text":{"type":"string","required":false,"visibility":"user-or-llm","description":"Replacement option label. Supply at least one field to change"},"rank":{"type":"number","required":false,"visibility":"user-or-llm","description":"Sort order. Required on a ranked-dropdown or status-dropdown option"},"color":{"type":"string","required":false,"visibility":"user-or-llm","description":"Option color: white, gray, blue, green, purple, orange, or red. Required on a ranked-dropdown or status-dropdown option"},"statusCategory":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pipeline meaning of the option: open, won, lost, or on-hold. Status-dropdown options only"},"winRate":{"type":"number","required":false,"visibility":"user-or-llm","description":"Expected win rate of the status. Status-dropdown options only"}},"hostedApiKey":"none"},"affinity_update_note":{"id":"affinity_update_note","name":"Affinity Update Note","description":"Rewrite a note\'s body or replace which records it is attached to. Each list of IDs replaces that association wholesale, an empty list clears it, and omitting one leaves it untouched. A note\'s type cannot be changed.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Affinity API key, sent as a bearer token"},"noteId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The note ID to update"},"html":{"type":"string","required":false,"visibility":"user-or-llm","description":"Replacement note body as HTML"},"companyIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Replacement set of attached companies, e.g. [1, 2]. Send [] to detach every company; omit to leave them unchanged"},"personIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Replacement set of attached persons, e.g. [1, 2]. Send [] to detach every person; omit to leave them unchanged"},"opportunityIds":{"type":"json","required":false,"visibility":"user-or-llm","description":"Replacement set of attached opportunities, e.g. [1, 2]. Send [] to detach every opportunity; omit to leave them unchanged"}},"hostedApiKey":"none"},"agentmail_create_draft":{"id":"agentmail_create_draft","name":"Create Draft","description":"Create a new email draft in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox to create the draft in"},"to":{"type":"string","required":false,"visibility":"user-or-llm","description":"Recipient email addresses (comma-separated)"},"subject":{"type":"string","required":false,"visibility":"user-or-llm","description":"Draft subject line"},"text":{"type":"string","required":false,"visibility":"user-or-llm","description":"Plain text draft body"},"html":{"type":"string","required":false,"visibility":"user-or-llm","description":"HTML draft body"},"cc":{"type":"string","required":false,"visibility":"user-or-llm","description":"CC recipient email addresses (comma-separated)"},"bcc":{"type":"string","required":false,"visibility":"user-or-llm","description":"BCC recipient email addresses (comma-separated)"},"inReplyTo":{"type":"string","required":false,"visibility":"user-or-llm","description":"ID of message being replied to"},"sendAt":{"type":"string","required":false,"visibility":"user-or-llm","description":"ISO 8601 timestamp to schedule sending"}},"hostedApiKey":"none"},"agentmail_create_inbox":{"id":"agentmail_create_inbox","name":"Create Inbox","description":"Create a new email inbox with AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"username":{"type":"string","required":false,"visibility":"user-or-llm","description":"Username for the inbox email address"},"domain":{"type":"string","required":false,"visibility":"user-or-llm","description":"Domain for the inbox email address"},"displayName":{"type":"string","required":false,"visibility":"user-or-llm","description":"Display name for the inbox"}},"hostedApiKey":"none"},"agentmail_delete_draft":{"id":"agentmail_delete_draft","name":"Delete Draft","description":"Delete an email draft in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox containing the draft"},"draftId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the draft to delete"}},"hostedApiKey":"none"},"agentmail_delete_inbox":{"id":"agentmail_delete_inbox","name":"Delete Inbox","description":"Delete an email inbox in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox to delete"}},"hostedApiKey":"none"},"agentmail_delete_thread":{"id":"agentmail_delete_thread","name":"Delete Thread","description":"Delete an email thread in AgentMail (moves to trash, or permanently deletes if already in trash)","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox containing the thread"},"threadId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the thread to delete"},"permanent":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Force permanent deletion instead of moving to trash"}},"hostedApiKey":"none"},"agentmail_forward_message":{"id":"agentmail_forward_message","name":"Forward Message","description":"Forward an email message to new recipients in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox containing the message"},"messageId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the message to forward"},"to":{"type":"string","required":true,"visibility":"user-or-llm","description":"Recipient email addresses (comma-separated)"},"subject":{"type":"string","required":false,"visibility":"user-or-llm","description":"Override subject line"},"text":{"type":"string","required":false,"visibility":"user-or-llm","description":"Additional plain text to prepend"},"html":{"type":"string","required":false,"visibility":"user-or-llm","description":"Additional HTML to prepend"},"cc":{"type":"string","required":false,"visibility":"user-or-llm","description":"CC recipient email addresses (comma-separated)"},"bcc":{"type":"string","required":false,"visibility":"user-or-llm","description":"BCC recipient email addresses (comma-separated)"}},"hostedApiKey":"none"},"agentmail_get_draft":{"id":"agentmail_get_draft","name":"Get Draft","description":"Get details of a specific email draft in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox the draft belongs to"},"draftId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the draft to retrieve"}},"hostedApiKey":"none"},"agentmail_get_inbox":{"id":"agentmail_get_inbox","name":"Get Inbox","description":"Get details of a specific email inbox in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox to retrieve"}},"hostedApiKey":"none"},"agentmail_get_message":{"id":"agentmail_get_message","name":"Get Message","description":"Get details of a specific email message in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox containing the message"},"messageId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the message to retrieve"}},"hostedApiKey":"none"},"agentmail_get_thread":{"id":"agentmail_get_thread","name":"Get Thread","description":"Get details of a specific email thread including messages in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox containing the thread"},"threadId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the thread to retrieve"}},"hostedApiKey":"none"},"agentmail_list_drafts":{"id":"agentmail_list_drafts","name":"List Drafts","description":"List email drafts in an inbox in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox to list drafts from"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of drafts to return"},"pageToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token for next page of results"}},"hostedApiKey":"none"},"agentmail_list_inboxes":{"id":"agentmail_list_inboxes","name":"List Inboxes","description":"List all email inboxes in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of inboxes to return"},"pageToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token for next page of results"}},"hostedApiKey":"none"},"agentmail_list_messages":{"id":"agentmail_list_messages","name":"List Messages","description":"List messages in an inbox in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox to list messages from"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of messages to return"},"pageToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token for next page of results"}},"hostedApiKey":"none"},"agentmail_list_threads":{"id":"agentmail_list_threads","name":"List Threads","description":"List email threads in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox to list threads from"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of threads to return"},"pageToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token for next page of results"},"labels":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated labels to filter threads by"},"before":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter threads before this ISO 8601 timestamp"},"after":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter threads after this ISO 8601 timestamp"}},"hostedApiKey":"none"},"agentmail_reply_message":{"id":"agentmail_reply_message","name":"Reply to Message","description":"Reply to an existing email message in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox to reply from"},"messageId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the message to reply to"},"text":{"type":"string","required":false,"visibility":"user-or-llm","description":"Plain text reply body"},"html":{"type":"string","required":false,"visibility":"user-or-llm","description":"HTML reply body"},"to":{"type":"string","required":false,"visibility":"user-or-llm","description":"Override recipient email addresses (comma-separated)"},"cc":{"type":"string","required":false,"visibility":"user-or-llm","description":"CC email addresses (comma-separated)"},"bcc":{"type":"string","required":false,"visibility":"user-or-llm","description":"BCC email addresses (comma-separated)"},"replyAll":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Reply to all recipients of the original message"}},"hostedApiKey":"none"},"agentmail_send_draft":{"id":"agentmail_send_draft","name":"Send Draft","description":"Send an existing email draft in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox containing the draft"},"draftId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the draft to send"}},"hostedApiKey":"none"},"agentmail_send_message":{"id":"agentmail_send_message","name":"Send Message","description":"Send an email message from an AgentMail inbox","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox to send from"},"to":{"type":"string","required":true,"visibility":"user-or-llm","description":"Recipient email address (comma-separated for multiple)"},"subject":{"type":"string","required":true,"visibility":"user-or-llm","description":"Email subject line"},"text":{"type":"string","required":false,"visibility":"user-or-llm","description":"Plain text email body"},"html":{"type":"string","required":false,"visibility":"user-or-llm","description":"HTML email body"},"cc":{"type":"string","required":false,"visibility":"user-or-llm","description":"CC recipient email addresses (comma-separated)"},"bcc":{"type":"string","required":false,"visibility":"user-or-llm","description":"BCC recipient email addresses (comma-separated)"}},"hostedApiKey":"none"},"agentmail_update_draft":{"id":"agentmail_update_draft","name":"Update Draft","description":"Update an existing email draft in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox containing the draft"},"draftId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the draft to update"},"to":{"type":"string","required":false,"visibility":"user-or-llm","description":"Recipient email addresses (comma-separated)"},"subject":{"type":"string","required":false,"visibility":"user-or-llm","description":"Draft subject line"},"text":{"type":"string","required":false,"visibility":"user-or-llm","description":"Plain text draft body"},"html":{"type":"string","required":false,"visibility":"user-or-llm","description":"HTML draft body"},"cc":{"type":"string","required":false,"visibility":"user-or-llm","description":"CC recipient email addresses (comma-separated)"},"bcc":{"type":"string","required":false,"visibility":"user-or-llm","description":"BCC recipient email addresses (comma-separated)"},"sendAt":{"type":"string","required":false,"visibility":"user-or-llm","description":"ISO 8601 timestamp to schedule sending"}},"hostedApiKey":"none"},"agentmail_update_inbox":{"id":"agentmail_update_inbox","name":"Update Inbox","description":"Update the display name of an email inbox in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox to update"},"displayName":{"type":"string","required":true,"visibility":"user-or-llm","description":"New display name for the inbox"}},"hostedApiKey":"none"},"agentmail_update_message":{"id":"agentmail_update_message","name":"Update Message","description":"Add or remove labels on an email message in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox containing the message"},"messageId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the message to update"},"addLabels":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated labels to add to the message"},"removeLabels":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated labels to remove from the message"}},"hostedApiKey":"none"},"agentmail_update_thread":{"id":"agentmail_update_thread","name":"Update Thread Labels","description":"Add or remove labels on an email thread in AgentMail","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentMail API key"},"inboxId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the inbox containing the thread"},"threadId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the thread to update"},"addLabels":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated labels to add to the thread"},"removeLabels":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated labels to remove from the thread"}},"hostedApiKey":"none"},"agentphone_create_call":{"id":"agentphone_create_call","name":"Create Outbound Call","description":"Initiate an outbound voice call from an AgentPhone agent","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"agentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Agent that will handle the call"},"toNumber":{"type":"string","required":true,"visibility":"user-or-llm","description":"Phone number to call in E.164 format (e.g. +14155551234)"},"fromNumberId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Phone number ID to use as caller ID. Must belong to the agent. If omitted, the agent\'s first assigned number is used."},"initialGreeting":{"type":"string","required":false,"visibility":"user-or-llm","description":"Optional greeting spoken when the recipient answers"},"voice":{"type":"string","required":false,"visibility":"user-or-llm","description":"Voice ID override for this call (defaults to the agent\'s configured voice)"},"systemPrompt":{"type":"string","required":false,"visibility":"user-or-llm","description":"When provided, uses a built-in LLM for the conversation instead of forwarding to your webhook"}},"hostedApiKey":"none"},"agentphone_create_contact":{"id":"agentphone_create_contact","name":"Create Contact","description":"Create a new contact in AgentPhone","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"phoneNumber":{"type":"string","required":true,"visibility":"user-or-llm","description":"Phone number in E.164 format (e.g. +14155551234)"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Contact\'s full name"},"email":{"type":"string","required":false,"visibility":"user-or-llm","description":"Contact\'s email address"},"notes":{"type":"string","required":false,"visibility":"user-or-llm","description":"Freeform notes stored on the contact"}},"hostedApiKey":"none"},"agentphone_create_number":{"id":"agentphone_create_number","name":"Create Phone Number","description":"Provision a new SMS- and voice-enabled phone number","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Two-letter country code (e.g. US, CA). Defaults to US."},"areaCode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Preferred area code (US/CA only, e.g. \\"415\\"). Best-effort — may be ignored if unavailable."},"agentId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Optionally attach the number to an agent immediately"}},"hostedApiKey":"none"},"agentphone_delete_contact":{"id":"agentphone_delete_contact","name":"Delete Contact","description":"Delete a contact by ID","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"contactId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Contact ID"}},"hostedApiKey":"none"},"agentphone_get_call":{"id":"agentphone_get_call","name":"Get Call","description":"Fetch a call and its full transcript","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"callId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the call to retrieve"}},"hostedApiKey":"none"},"agentphone_get_call_transcript":{"id":"agentphone_get_call_transcript","name":"Get Call Transcript","description":"Get the full ordered transcript for a call","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"callId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the call to retrieve the transcript for"}},"hostedApiKey":"none"},"agentphone_get_contact":{"id":"agentphone_get_contact","name":"Get Contact","description":"Fetch a single contact by ID","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"contactId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Contact ID"}},"hostedApiKey":"none"},"agentphone_get_conversation":{"id":"agentphone_get_conversation","name":"Get Conversation","description":"Get a conversation along with its recent messages","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"conversationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Conversation ID"},"messageLimit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of recent messages to include (default 50, max 100)"}},"hostedApiKey":"none"},"agentphone_get_conversation_messages":{"id":"agentphone_get_conversation_messages","name":"Get Conversation Messages","description":"Get paginated messages for a conversation","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"conversationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Conversation ID"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of messages to return (default 50, max 200)"},"before":{"type":"string","required":false,"visibility":"user-or-llm","description":"Return messages received before this ISO 8601 timestamp"},"after":{"type":"string","required":false,"visibility":"user-or-llm","description":"Return messages received after this ISO 8601 timestamp"}},"hostedApiKey":"none"},"agentphone_get_number_messages":{"id":"agentphone_get_number_messages","name":"Get Phone Number Messages","description":"Fetch messages received on a specific phone number","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"numberId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the phone number"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of messages to return (default 50, max 200)"},"before":{"type":"string","required":false,"visibility":"user-or-llm","description":"Return messages received before this ISO 8601 timestamp"},"after":{"type":"string","required":false,"visibility":"user-or-llm","description":"Return messages received after this ISO 8601 timestamp"}},"hostedApiKey":"none"},"agentphone_get_usage":{"id":"agentphone_get_usage","name":"Get Usage","description":"Retrieve current usage statistics for the AgentPhone account","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"}},"hostedApiKey":"none"},"agentphone_get_usage_daily":{"id":"agentphone_get_usage_daily","name":"Get Daily Usage","description":"Get a daily breakdown of usage (messages, calls, webhooks) for the last N days","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"days":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of days to return (1-365, default 30)"}},"hostedApiKey":"none"},"agentphone_get_usage_monthly":{"id":"agentphone_get_usage_monthly","name":"Get Monthly Usage","description":"Get monthly usage aggregation (messages, calls, webhooks) for the last N months","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"months":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of months to return (1-24, default 6)"}},"hostedApiKey":"none"},"agentphone_list_calls":{"id":"agentphone_list_calls","name":"List Calls","description":"List voice calls for this AgentPhone account","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of results to return (default 20, max 100)"},"offset":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of results to skip (min 0)"},"status":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter by status (completed, in-progress, failed)"},"direction":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter by direction (inbound, outbound)"},"type":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter by call type (pstn, web)"},"search":{"type":"string","required":false,"visibility":"user-or-llm","description":"Search by phone number (matches fromNumber or toNumber)"}},"hostedApiKey":"none"},"agentphone_list_contacts":{"id":"agentphone_list_contacts","name":"List Contacts","description":"List contacts for this AgentPhone account","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"search":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter by name or phone number (case-insensitive contains)"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of results to return (default 50, max 200)"},"offset":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of results to skip (min 0)"}},"hostedApiKey":"none"},"agentphone_list_conversations":{"id":"agentphone_list_conversations","name":"List Conversations","description":"List conversations (message threads) for this AgentPhone account","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of results to return (default 20, max 100)"},"offset":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of results to skip (min 0)"}},"hostedApiKey":"none"},"agentphone_list_numbers":{"id":"agentphone_list_numbers","name":"List Phone Numbers","description":"List all phone numbers provisioned for this AgentPhone account","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of results to return (default 20, max 100)"},"offset":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of results to skip (min 0)"}},"hostedApiKey":"none"},"agentphone_react_to_message":{"id":"agentphone_react_to_message","name":"React to Message","description":"Send an iMessage tapback reaction to a message (iMessage only)","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"messageId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the message to react to"},"reaction":{"type":"string","required":true,"visibility":"user-or-llm","description":"Reaction type: love, like, dislike, laugh, emphasize, or question"}},"hostedApiKey":"none"},"agentphone_release_number":{"id":"agentphone_release_number","name":"Release Phone Number","description":"Release (delete) a phone number. This action is irreversible.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"numberId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the phone number to release"}},"hostedApiKey":"none"},"agentphone_send_message":{"id":"agentphone_send_message","name":"Send Message","description":"Send an outbound SMS or iMessage from an AgentPhone agent","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"agentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Agent sending the message"},"toNumber":{"type":"string","required":true,"visibility":"user-or-llm","description":"Recipient phone number in E.164 format (e.g. +14155551234)"},"body":{"type":"string","required":true,"visibility":"user-or-llm","description":"Message text to send"},"mediaUrl":{"type":"string","required":false,"visibility":"user-or-llm","description":"Optional URL of an image, video, or file to attach"},"numberId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Phone number ID to send from. If omitted, the agent\'s first assigned number is used."}},"hostedApiKey":"none"},"agentphone_update_contact":{"id":"agentphone_update_contact","name":"Update Contact","description":"Update a contact\'s fields","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"contactId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Contact ID"},"phoneNumber":{"type":"string","required":false,"visibility":"user-or-llm","description":"New phone number in E.164 format"},"name":{"type":"string","required":false,"visibility":"user-or-llm","description":"New contact name"},"email":{"type":"string","required":false,"visibility":"user-or-llm","description":"New email address"},"notes":{"type":"string","required":false,"visibility":"user-or-llm","description":"New freeform notes"}},"hostedApiKey":"none"},"agentphone_update_conversation":{"id":"agentphone_update_conversation","name":"Update Conversation","description":"Update conversation metadata (stored state). Pass null to clear existing metadata.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"AgentPhone API key"},"conversationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Conversation ID"},"metadata":{"type":"json","required":false,"visibility":"user-or-llm","description":"Custom key-value metadata to store on the conversation. Pass null to clear existing metadata."}},"hostedApiKey":"none"},"agiloft_async_status":{"id":"agiloft_async_status","name":"Agiloft Async Status","description":"Check whether an asynchronous Agiloft call, such as a run action button, has completed.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table the asynchronous call was made against"},"callbackId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Callback ID returned by the asynchronous call, e.g. from Run Action Button"}},"hostedApiKey":"none"},"agiloft_attach_file":{"id":"agiloft_attach_file","name":"Agiloft Attach File","description":"Attach a file to a field in an Agiloft record.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\")"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record to attach the file to"},"fieldName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the attachment field"},"file":{"type":"file","required":true,"visibility":"user-or-llm","description":"File to attach"},"fileName":{"type":"string","required":false,"visibility":"user-or-llm","description":"Name to assign to the file (defaults to original file name)"},"overwrite":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Replace the contents of the field instead of adding another file to it"}},"hostedApiKey":"none"},"agiloft_attachment_info":{"id":"agiloft_attachment_info","name":"Agiloft Attachment Info","description":"Get information about file attachments on a record field.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\")"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record to check attachments on"},"fieldName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the attachment field to inspect"}},"hostedApiKey":"none"},"agiloft_create_record":{"id":"agiloft_create_record","name":"Agiloft Create Record","description":"Create a new record in an Agiloft table.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\", \\"contacts.employees\\")"},"data":{"type":"string","required":true,"visibility":"user-or-llm","description":"Record field values as a JSON object (e.g., {\\"first_name\\": \\"John\\", \\"status\\": \\"Active\\"})"}},"hostedApiKey":"none"},"agiloft_delete_record":{"id":"agiloft_delete_record","name":"Agiloft Delete Record","description":"Delete a record from an Agiloft table.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\", \\"contacts.employees\\")"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record to delete"},"substituteIds":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated IDs of records that adopt the dependants of the deleted record. Read only when the delete rule is REPLACE_WITH_ANOTHER."},"deleteRule":{"type":"string","required":false,"visibility":"user-or-llm","description":"How to treat records that depend on this one: ERROR_IF_DEPENDANTS (default — fails rather than cascading), APPLY_DELETE_WHERE_POSSIBLE, DELETE_WHERE_POSSIBLE_OTHERWISE_UNLINK, APPLY_UNLINK, UNLINK_WHERE_POSSIBLE_OTHERWISE_DELETE, or REPLACE_WITH_ANOTHER"}},"hostedApiKey":"none"},"agiloft_get_choice_line_id":{"id":"agiloft_get_choice_line_id","name":"Agiloft Get Choice Line ID","description":"Resolve the internal numeric ID of a choice-list value, for use in EWSelect WHERE clauses against choice fields.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"case\\", \\"contracts\\")"},"fieldName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Choice field name (e.g., \\"priority\\", \\"status\\")"},"value":{"type":"string","required":true,"visibility":"user-or-llm","description":"Choice display value to resolve (e.g., \\"High\\", \\"Active\\")"}},"hostedApiKey":"none"},"agiloft_list_tables":{"id":"agiloft_list_tables","name":"Agiloft List Tables","description":"List the tables and fields in an Agiloft knowledge base, to discover the logical names other operations need.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":false,"visibility":"user-or-llm","description":"Logical name of a single table to describe (e.g., \\"contacts\\"). Leave empty to list every table in the knowledge base."},"includeLinkedInfo":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Include the source table and column behind each linked field"},"skipColumnsInfo":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Return table names only, omitting field details, for a much smaller response"}},"hostedApiKey":"none"},"agiloft_lock_record":{"id":"agiloft_lock_record","name":"Agiloft Lock Record","description":"Lock, unlock, or check the lock status of an Agiloft record.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\")"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record to lock, unlock, or check"},"lockAction":{"type":"string","required":true,"visibility":"user-or-llm","description":"Action to perform: \\"lock\\", \\"unlock\\", or \\"check\\""},"force":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Unlock only: release a lock held by another user."}},"hostedApiKey":"none"},"agiloft_nlp_search":{"id":"agiloft_nlp_search","name":"Agiloft Natural Language Search","description":"Search Agiloft records by describing what you want in plain language, such as \\"active NDAs submitted last month\\".","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"nlpQuery":{"type":"string","required":true,"visibility":"user-or-llm","description":"The request in plain language, e.g. \\"Show me open, high-priority contracts\\". Structured field filters are not accepted — use Search Records for those."},"fields":{"type":"string","required":true,"visibility":"user-or-llm","description":"Comma-separated field names to return, e.g. \\"id, contract_title1, company_name\\""},"page":{"type":"string","required":false,"visibility":"user-or-llm","description":"Page number, starting from 0"},"limit":{"type":"string","required":false,"visibility":"user-or-llm","description":"Records per page"}},"hostedApiKey":"none"},"agiloft_read_record":{"id":"agiloft_read_record","name":"Agiloft Read Record","description":"Read a record by ID from an Agiloft table.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\", \\"contacts.employees\\")"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record to read"},"fields":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated list of field names to include in the response"}},"hostedApiKey":"none"},"agiloft_remove_attachment":{"id":"agiloft_remove_attachment","name":"Agiloft Remove Attachment","description":"Remove an attached file from a field in an Agiloft record.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\")"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record containing the attachment"},"fieldName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the attachment field"},"position":{"type":"string","required":true,"visibility":"user-or-llm","description":"Position index of the file to remove (starting from 0)"}},"hostedApiKey":"none"},"agiloft_retrieve_attachment":{"id":"agiloft_retrieve_attachment","name":"Agiloft Retrieve Attachment","description":"Download an attached file from an Agiloft record field.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\")"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record containing the attachment"},"fieldName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the attachment field"},"position":{"type":"string","required":true,"visibility":"user-or-llm","description":"Position index of the file in the field (starting from 0)"}},"hostedApiKey":"none"},"agiloft_run_action_button":{"id":"agiloft_run_action_button","name":"Agiloft Run Action Button","description":"Run an action button on an Agiloft record, such as an approval or send-for-signature step.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\", \\"case\\")"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record to run the action button on"},"actionButtonField":{"type":"string","required":true,"visibility":"user-or-llm","description":"Logical name of the field holding the action button (e.g., \\"ab_field\\")"}},"hostedApiKey":"none"},"agiloft_saved_search":{"id":"agiloft_saved_search","name":"Agiloft Saved Search","description":"List the saved searches defined for an Agiloft table.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Logical table name to list saved searches for (e.g., \\"contract\\")"}},"hostedApiKey":"none"},"agiloft_search_records":{"id":"agiloft_search_records","name":"Agiloft Search Records","description":"Search for records in an Agiloft table using a query.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name to search in (e.g., \\"contracts\\", \\"contacts.employees\\")"},"query":{"type":"string","required":false,"visibility":"user-or-llm","description":"Ad hoc EWSearch query. Combine conditions with && (and) or || (or) and quote every value — e.g. \\"summary~=\'test\'&&priority=\'High\'\\". Required unless a saved search is given."},"search":{"type":"string","required":false,"visibility":"user-or-llm","description":"Label of a saved search defined on the table (e.g., \\"C: Status is Closed\\"). Can be combined with a query to narrow it further."},"fields":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated list of field names to include in the results"},"page":{"type":"string","required":false,"visibility":"user-or-llm","description":"Page number for paginated results (starting from 0)"},"limit":{"type":"string","required":false,"visibility":"user-or-llm","description":"Maximum number of records to return per page. Agiloft treats 0 as \\"all records\\", so leave it unset or use a positive value to keep result sizes bounded."}},"hostedApiKey":"none"},"agiloft_select_records":{"id":"agiloft_select_records","name":"Agiloft Select Records","description":"Select record IDs matching a SQL WHERE clause from an Agiloft table.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\", \\"contacts.employees\\")"},"where":{"type":"string","required":true,"visibility":"user-or-llm","description":"SQL WHERE clause using database column names (e.g., \\"summary like \'%new%\'\\" or \\"assigned_person=\'John Doe\'\\"). EWSelect has no page size and returns every matching ID, so append a database limit such as \\"limit 0,200\\" to bound the result."}},"hostedApiKey":"none"},"agiloft_update_record":{"id":"agiloft_update_record","name":"Agiloft Update Record","description":"Update an existing record in an Agiloft table.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\", \\"contacts.employees\\")"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the record to update"},"data":{"type":"string","required":true,"visibility":"user-or-llm","description":"Updated field values as a JSON object (e.g., {\\"status\\": \\"Active\\", \\"priority\\": \\"High\\"})"}},"hostedApiKey":"none"},"agiloft_upsert_record":{"id":"agiloft_upsert_record","name":"Agiloft Upsert Record","description":"Create an Agiloft record, or update it when a record already matches the given fields.","version":"1.0.0","params":{"instanceUrl":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft instance URL (e.g., https://mycompany.agiloft.com)"},"knowledgeBase":{"type":"string","required":true,"visibility":"user-only","description":"Knowledge base name"},"login":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft username"},"password":{"type":"string","required":true,"visibility":"user-only","description":"Agiloft password"},"table":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table name (e.g., \\"contracts\\", \\"contacts.employees\\")"},"match":{"type":"string","required":true,"visibility":"user-or-llm","description":"Field used to find an existing record (e.g., \\"ext_id\\"). Pick something that identifies a record uniquely — if more than one record matches, Agiloft writes nothing and returns a conflict."},"async":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Queue the write instead of waiting for it. Returns a callback ID instead of a record ID; pass that to Async Status to poll the result."},"data":{"type":"string","required":true,"visibility":"user-or-llm","description":"Field values as a JSON object. On create these populate the new record; on update only the supplied fields change."}},"hostedApiKey":"none"},"ahrefs_anchors":{"id":"ahrefs_anchors","name":"Ahrefs Anchors","description":"Get the anchor text distribution for a target domain or URL\'s backlinks, showing how many links and referring domains use each anchor text.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\" or \\"https://example.com/page\\""},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match)"},"history":{"type":"string","required":false,"visibility":"user-or-llm","description":"Historical scope: \\"live\\" (currently live), \\"all_time\\" (default, includes lost backlinks), or \\"since:YYYY-MM-DD\\" (backlinks found since a date)"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_backlinks":{"id":"ahrefs_backlinks","name":"Ahrefs Backlinks","description":"Get a list of backlinks pointing to a target domain or URL. Returns details about each backlink including source URL, anchor text, and domain rating.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\" or \\"https://example.com/page\\""},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match). Example: \\"domain\\""},"history":{"type":"string","required":false,"visibility":"user-or-llm","description":"Historical scope: \\"live\\" (currently live backlinks), \\"all_time\\" (default, includes lost backlinks), or \\"since:YYYY-MM-DD\\" (backlinks found since a date)."},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_backlinks_stats":{"id":"ahrefs_backlinks_stats","name":"Ahrefs Backlinks Stats","description":"Get backlink and referring domain totals for a target domain or URL, both currently live and across all time.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\" or \\"https://example.com/page\\""},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match). Example: \\"domain\\""},"date":{"type":"string","required":false,"visibility":"user-only","description":"Date to report metrics on, in YYYY-MM-DD format (defaults to today)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_batch_analysis":{"id":"ahrefs_batch_analysis","name":"Ahrefs Batch Analysis","description":"Get bulk SEO metrics (Domain Rating, backlinks, referring domains, organic traffic, and more) for multiple domains or URLs in a single request. Useful for comparing many competitors at once.","version":"1.0.0","params":{"targets":{"type":"string","required":true,"visibility":"user-or-llm","description":"Comma-separated list of domains or URLs to analyze. Example: \\"example.com,competitor.com\\""},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode applied to every target: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match)"},"protocol":{"type":"string","required":false,"visibility":"user-or-llm","description":"Protocol applied to every target: \\"both\\" (default), \\"http\\", or \\"https\\""},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for traffic data. Example: \\"us\\", \\"gb\\", \\"de\\" (default: \\"us\\")"},"volumeMode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Search volume calculation: \\"monthly\\" or \\"average\\" (default: \\"monthly\\")"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_broken_backlinks":{"id":"ahrefs_broken_backlinks","name":"Ahrefs Broken Backlinks","description":"Get a list of broken backlinks pointing to a target domain or URL. Useful for identifying link reclamation opportunities.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\" or \\"https://example.com/page\\""},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match). Example: \\"domain\\""},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_domain_rating":{"id":"ahrefs_domain_rating","name":"Ahrefs Domain Rating","description":"Get the Domain Rating (DR) and Ahrefs Rank for a target domain. Domain Rating shows the strength of a website\'s backlink profile on a scale from 0 to 100.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain to analyze (e.g., example.com)"},"date":{"type":"string","required":false,"visibility":"user-only","description":"Date for historical data in YYYY-MM-DD format (defaults to today)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_domain_rating_history":{"id":"ahrefs_domain_rating_history","name":"Ahrefs Domain Rating History","description":"Get the historical Domain Rating (DR) trend for a target domain or URL over a date range, grouped daily, weekly, or monthly.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\""},"dateFrom":{"type":"string","required":true,"visibility":"user-only","description":"Start date of the historical period, in YYYY-MM-DD format"},"dateTo":{"type":"string","required":false,"visibility":"user-only","description":"End date of the historical period, in YYYY-MM-DD format (defaults to today)"},"historyGrouping":{"type":"string","required":false,"visibility":"user-or-llm","description":"Time interval for grouping data points: \\"daily\\", \\"weekly\\", or \\"monthly\\" (default: \\"monthly\\")"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_keyword_overview":{"id":"ahrefs_keyword_overview","name":"Ahrefs Keyword Overview","description":"Get detailed metrics for a keyword including search volume, keyword difficulty, CPC, clicks, and traffic potential.","version":"1.0.0","params":{"keyword":{"type":"string","required":true,"visibility":"user-or-llm","description":"The keyword to analyze"},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for keyword data. Example: \\"us\\", \\"gb\\", \\"de\\" (default: \\"us\\")"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_keywords_history":{"id":"ahrefs_keywords_history","name":"Ahrefs Keywords History","description":"Get the historical organic keyword ranking distribution for a target domain or URL over a date range: how many keywords rank in each position bucket at each point in time.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\""},"dateFrom":{"type":"string","required":true,"visibility":"user-only","description":"Start date of the historical period, in YYYY-MM-DD format"},"dateTo":{"type":"string","required":false,"visibility":"user-only","description":"End date of the historical period, in YYYY-MM-DD format (defaults to today)"},"historyGrouping":{"type":"string","required":false,"visibility":"user-or-llm","description":"Time interval for grouping data points: \\"daily\\", \\"weekly\\", or \\"monthly\\" (default: \\"monthly\\")"},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for search results. Example: \\"us\\", \\"gb\\", \\"de\\" (default: \\"us\\")"},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_metrics":{"id":"ahrefs_metrics","name":"Ahrefs Metrics","description":"Get a one-call organic and paid search overview for a target domain or URL: organic traffic, organic keywords, paid traffic, paid keywords, and estimated traffic cost.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\""},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for traffic data. Example: \\"us\\", \\"gb\\", \\"de\\""},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match). Example: \\"domain\\""},"date":{"type":"string","required":false,"visibility":"user-only","description":"Date to report metrics on, in YYYY-MM-DD format (defaults to today)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_metrics_history":{"id":"ahrefs_metrics_history","name":"Ahrefs Metrics History","description":"Get the historical organic and paid traffic trend for a target domain or URL over a date range: organic traffic/cost and paid traffic/cost at each point in time.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\""},"dateFrom":{"type":"string","required":true,"visibility":"user-only","description":"Start date of the historical period, in YYYY-MM-DD format"},"dateTo":{"type":"string","required":false,"visibility":"user-only","description":"End date of the historical period, in YYYY-MM-DD format (defaults to today)"},"volumeMode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Search volume calculation: \\"monthly\\" or \\"average\\" (default: \\"monthly\\")"},"historyGrouping":{"type":"string","required":false,"visibility":"user-or-llm","description":"Time interval for grouping data points: \\"daily\\", \\"weekly\\", or \\"monthly\\" (default: \\"monthly\\")"},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for traffic data. Example: \\"us\\", \\"gb\\", \\"de\\" (default: \\"us\\")"},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_organic_competitors":{"id":"ahrefs_organic_competitors","name":"Ahrefs Organic Competitors","description":"Get domains that compete with a target domain or URL for the same organic keywords, ranked by keyword overlap.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\""},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for search results. Example: \\"us\\", \\"gb\\", \\"de\\" (default: \\"us\\")"},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match). Example: \\"domain\\""},"date":{"type":"string","required":false,"visibility":"user-only","description":"Date to report metrics on, in YYYY-MM-DD format (defaults to today)"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_organic_keywords":{"id":"ahrefs_organic_keywords","name":"Ahrefs Organic Keywords","description":"Get organic keywords that a target domain or URL ranks for in Google search results. Returns keyword details including search volume, ranking position, and estimated traffic.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\" or \\"https://example.com/page\\""},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for search results. Example: \\"us\\", \\"gb\\", \\"de\\" (default: \\"us\\")"},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match). Example: \\"domain\\""},"date":{"type":"string","required":false,"visibility":"user-only","description":"Date to report metrics on, in YYYY-MM-DD format (defaults to today)"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_paid_pages":{"id":"ahrefs_paid_pages","name":"Ahrefs Paid Pages","description":"Get a target domain\'s pages that receive paid search traffic, sorted by estimated paid traffic. Returns page URLs with their paid traffic, keyword counts, and estimated spend.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\""},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for traffic data. Example: \\"us\\", \\"gb\\", \\"de\\" (default: \\"us\\")"},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match)"},"date":{"type":"string","required":false,"visibility":"user-only","description":"Date to report metrics on, in YYYY-MM-DD format (defaults to today)"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_rank_tracker_competitors_overview":{"id":"ahrefs_rank_tracker_competitors_overview","name":"Ahrefs Rank Tracker Competitors Overview","description":"Get competitor rankings for the keywords tracked in an Ahrefs Rank Tracker project: each tracked keyword\'s volume and difficulty alongside every competitor\'s position, traffic, and traffic value. This endpoint is free and does not consume API units.","version":"1.0.0","params":{"projectId":{"type":"number","required":true,"visibility":"user-or-llm","description":"The Rank Tracker project ID (found in the project URL in Ahrefs)"},"date":{"type":"string","required":true,"visibility":"user-only","description":"Date to report rankings for, in YYYY-MM-DD format"},"device":{"type":"string","required":true,"visibility":"user-or-llm","description":"Rankings device type: \\"desktop\\" or \\"mobile\\""},"dateCompared":{"type":"string","required":false,"visibility":"user-only","description":"Comparison date in YYYY-MM-DD format, to compute position/traffic deltas"},"volumeMode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Search volume calculation: \\"monthly\\" or \\"average\\" (default: \\"monthly\\")"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_rank_tracker_competitors_stats":{"id":"ahrefs_rank_tracker_competitors_stats","name":"Ahrefs Rank Tracker Competitors Stats","description":"Get aggregate competitor stats for an Ahrefs Rank Tracker project: each competitor\'s traffic, traffic value, average position, and share of voice across all tracked keywords. This endpoint is free and does not consume API units.","version":"1.0.0","params":{"projectId":{"type":"number","required":true,"visibility":"user-or-llm","description":"The Rank Tracker project ID (found in the project URL in Ahrefs)"},"date":{"type":"string","required":true,"visibility":"user-only","description":"Date to report metrics for, in YYYY-MM-DD format"},"device":{"type":"string","required":true,"visibility":"user-or-llm","description":"Rankings device type: \\"desktop\\" or \\"mobile\\""},"volumeMode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Search volume calculation: \\"monthly\\" or \\"average\\" (default: \\"monthly\\")"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_rank_tracker_overview":{"id":"ahrefs_rank_tracker_overview","name":"Ahrefs Rank Tracker Overview","description":"Get ranking overview metrics for the keywords tracked in an Ahrefs Rank Tracker project: position, search volume, keyword difficulty, and estimated traffic. This endpoint is free and does not consume API units.","version":"1.0.0","params":{"projectId":{"type":"number","required":true,"visibility":"user-or-llm","description":"The Rank Tracker project ID (found in the project URL in Ahrefs)"},"date":{"type":"string","required":true,"visibility":"user-only","description":"Date to report rankings for, in YYYY-MM-DD format"},"device":{"type":"string","required":true,"visibility":"user-or-llm","description":"Rankings device type: \\"desktop\\" or \\"mobile\\""},"dateCompared":{"type":"string","required":false,"visibility":"user-only","description":"Comparison date in YYYY-MM-DD format, to compute position/traffic deltas"},"volumeMode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Search volume calculation: \\"monthly\\" or \\"average\\" (default: \\"monthly\\")"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_rank_tracker_serp_overview":{"id":"ahrefs_rank_tracker_serp_overview","name":"Ahrefs Rank Tracker SERP Overview","description":"Get the full SERP (search engine results page) for a keyword tracked in an Ahrefs Rank Tracker project, including every ranking URL with its position, title, and authority metrics. This endpoint is free and does not consume API units.","version":"1.0.0","params":{"projectId":{"type":"number","required":true,"visibility":"user-or-llm","description":"The Rank Tracker project ID (found in the project URL in Ahrefs)"},"keyword":{"type":"string","required":true,"visibility":"user-or-llm","description":"The tracked keyword to retrieve SERP data for"},"country":{"type":"string","required":true,"visibility":"user-or-llm","description":"Country code for the tracked keyword. Example: \\"us\\", \\"gb\\", \\"de\\""},"device":{"type":"string","required":true,"visibility":"user-or-llm","description":"Rankings device type: \\"desktop\\" or \\"mobile\\""},"topPositions":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of top organic positions to return (defaults to all available)"},"date":{"type":"string","required":false,"visibility":"user-only","description":"Timestamp to return the last available SERP Overview at, in YYYY-MM-DDThh:mm:ss format"},"locationId":{"type":"number","required":false,"visibility":"user-or-llm","description":"Location ID of the tracked keyword, if tracked at a specific location"},"languageCode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Language code of the tracked keyword"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_refdomains_history":{"id":"ahrefs_refdomains_history","name":"Ahrefs Referring Domains History","description":"Get the historical referring domains trend for a target domain or URL over a date range, grouped daily, weekly, or monthly.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\""},"dateFrom":{"type":"string","required":true,"visibility":"user-only","description":"Start date of the historical period, in YYYY-MM-DD format"},"dateTo":{"type":"string","required":false,"visibility":"user-only","description":"End date of the historical period, in YYYY-MM-DD format (defaults to today)"},"historyGrouping":{"type":"string","required":false,"visibility":"user-or-llm","description":"Time interval for grouping data points: \\"daily\\", \\"weekly\\", or \\"monthly\\" (default: \\"monthly\\")"},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_referring_domains":{"id":"ahrefs_referring_domains","name":"Ahrefs Referring Domains","description":"Get a list of domains that link to a target domain or URL. Returns unique referring domains with their domain rating, backlink counts, and discovery dates.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain or URL to analyze. Example: \\"example.com\\" or \\"https://example.com/page\\""},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match). Example: \\"domain\\""},"history":{"type":"string","required":false,"visibility":"user-or-llm","description":"Historical scope: \\"live\\" (currently live), \\"all_time\\" (default, includes lost domains), or \\"since:YYYY-MM-DD\\" (domains found since a date)."},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_related_terms":{"id":"ahrefs_related_terms","name":"Ahrefs Related Terms","description":"Get keyword ideas related to a seed keyword: terms the same top-ranking pages also rank for (\\"also rank for\\") or also discuss (\\"also talk about\\"), with volume, difficulty, and CPC.","version":"1.0.0","params":{"keyword":{"type":"string","required":true,"visibility":"user-or-llm","description":"The seed keyword to find related terms for"},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for keyword data. Example: \\"us\\", \\"gb\\", \\"de\\" (default: \\"us\\")"},"terms":{"type":"string","required":false,"visibility":"user-or-llm","description":"Type of related keywords to return: \\"also_rank_for\\", \\"also_talk_about\\", or \\"all\\" (default: \\"all\\")"},"viewFor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Whether to derive related terms from the top 10 or top 100 ranking pages (default: \\"top_10\\")"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_site_audit_page_explorer":{"id":"ahrefs_site_audit_page_explorer","name":"Ahrefs Site Audit Page Explorer","description":"Get crawled pages from an Ahrefs Site Audit project with health and SEO metrics: HTTP status, title, link counts, backlinks, indexability, and traffic. Optionally filter to pages affected by a specific issue.","version":"1.0.0","params":{"projectId":{"type":"number","required":true,"visibility":"user-or-llm","description":"The Site Audit project ID (found in the project URL in Ahrefs)"},"date":{"type":"string","required":false,"visibility":"user-only","description":"Crawl date in YYYY-MM-DDThh:mm:ss format (defaults to the most recent crawl)"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"offset":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of results to skip, for pagination"},"issueId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Only return pages affected by this issue ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"ahrefs_top_pages":{"id":"ahrefs_top_pages","name":"Ahrefs Top Pages","description":"Get the top pages of a target domain sorted by organic traffic. Returns page URLs with their traffic, keyword counts, and estimated traffic value.","version":"1.0.0","params":{"target":{"type":"string","required":true,"visibility":"user-or-llm","description":"The target domain to analyze. Example: \\"example.com\\""},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Country code for traffic data. Example: \\"us\\", \\"gb\\", \\"de\\" (default: \\"us\\")"},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match). Example: \\"domain\\""},"date":{"type":"string","required":false,"visibility":"user-only","description":"Date to report metrics on, in YYYY-MM-DD format (defaults to today)"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of results to return. Example: 50 (default: 1000)"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ahrefs API Key"}},"hostedApiKey":"none"},"airtable_create_records":{"id":"airtable_create_records","name":"Airtable Create Records","description":"Write new records to an Airtable table","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"baseId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Airtable base ID (starts with \\"app\\", e.g., \\"appXXXXXXXXXXXXXX\\")"},"tableId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table ID (starts with \\"tbl\\") or table name"},"records":{"type":"json","required":true,"visibility":"user-or-llm","description":"Array of records to create, each with a `fields` object"},"typecast":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"When true, Airtable automatically converts string values to the field type"}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"airtable_delete_records":{"id":"airtable_delete_records","name":"Airtable Delete Records","description":"Delete one or more records from an Airtable table by ID","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"baseId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Airtable base ID (starts with \\"app\\", e.g., \\"appXXXXXXXXXXXXXX\\")"},"tableId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table ID (starts with \\"tbl\\") or table name"},"recordIds":{"type":"json","required":true,"visibility":"user-or-llm","description":"Array of record IDs to delete (each starts with \\"rec\\", e.g., [\\"recXXXXXXXXXXXXXX\\"]). Pass a single-element array to delete one record."}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"airtable_get_base_schema":{"id":"airtable_get_base_schema","name":"Airtable Get Base Schema","description":"Get the schema of all tables, fields, and views in an Airtable base","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"baseId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Airtable base ID (starts with \\"app\\", e.g., \\"appXXXXXXXXXXXXXX\\")"}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"airtable_get_record":{"id":"airtable_get_record","name":"Airtable Get Record","description":"Retrieve a single record from an Airtable table by its ID","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"baseId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Airtable base ID (starts with \\"app\\", e.g., \\"appXXXXXXXXXXXXXX\\")"},"tableId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table ID (starts with \\"tbl\\") or table name"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Record ID to retrieve (starts with \\"rec\\", e.g., \\"recXXXXXXXXXXXXXX\\")"}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"airtable_list_bases":{"id":"airtable_list_bases","name":"Airtable List Bases","description":"List all bases the authenticated user has access to","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"offset":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination offset for retrieving additional bases"}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"airtable_list_records":{"id":"airtable_list_records","name":"Airtable List Records","description":"Read records from an Airtable table","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"baseId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Airtable base ID (starts with \\"app\\", e.g., \\"appXXXXXXXXXXXXXX\\")"},"tableId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table ID (starts with \\"tbl\\") or table name"},"maxRecords":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of records to return (default: all records)"},"filterFormula":{"type":"string","required":false,"visibility":"user-or-llm","description":"Formula to filter records (e.g., \\"({Field Name} = \'Value\')\\")"}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"airtable_list_tables":{"id":"airtable_list_tables","name":"Airtable List Tables","description":"List all tables and their schema in an Airtable base","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"baseId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Airtable base ID (starts with \\"app\\", e.g., \\"appXXXXXXXXXXXXXX\\")"}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"airtable_update_multiple_records":{"id":"airtable_update_multiple_records","name":"Airtable Update Multiple Records","description":"Update multiple existing records in an Airtable table","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"baseId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Airtable base ID (starts with \\"app\\", e.g., \\"appXXXXXXXXXXXXXX\\")"},"tableId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table ID (starts with \\"tbl\\") or table name"},"records":{"type":"json","required":true,"visibility":"user-or-llm","description":"Array of records to update, each with an `id` and a `fields` object"},"typecast":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"When true, Airtable automatically converts string values to the field type"}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"airtable_update_record":{"id":"airtable_update_record","name":"Airtable Update Record","description":"Update an existing record in an Airtable table by ID","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"baseId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Airtable base ID (starts with \\"app\\", e.g., \\"appXXXXXXXXXXXXXX\\")"},"tableId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table ID (starts with \\"tbl\\") or table name"},"recordId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Record ID to update (starts with \\"rec\\", e.g., \\"recXXXXXXXXXXXXXX\\")"},"fields":{"type":"json","required":true,"visibility":"user-or-llm","description":"An object containing the field names and their new values"},"typecast":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"When true, Airtable automatically converts string values to the field type"}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"airtable_upsert_records":{"id":"airtable_upsert_records","name":"Airtable Upsert Records","description":"Update existing records or create new ones in an Airtable table, matching on the specified merge fields","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token"},"baseId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Airtable base ID (starts with \\"app\\", e.g., \\"appXXXXXXXXXXXXXX\\")"},"tableId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Table ID (starts with \\"tbl\\") or table name"},"records":{"type":"json","required":true,"visibility":"user-or-llm","description":"Array of records to upsert, each with a `fields` object"},"fieldsToMergeOn":{"type":"json","required":true,"visibility":"user-or-llm","description":"Array of field names used to match existing records (max 3). A record is updated when all merge fields match, otherwise it is created. Example: [\\"Name\\"]"},"typecast":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"When true, Airtable automatically converts string values to the field type"}},"oauth":{"required":true,"provider":"airtable"},"hostedApiKey":"none"},"airweave_search":{"id":"airweave_search","name":"Airweave Search","description":"Search your synced data collections using Airweave. Supports semantic search with hybrid, neural, or keyword retrieval strategies. Optionally generate AI-powered answers from search results.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Airweave API Key for authentication"},"collectionId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The readable ID of the collection to search"},"query":{"type":"string","required":true,"visibility":"user-or-llm","description":"The search query text"},"limit":{"type":"number","required":false,"visibility":"user-only","description":"Maximum number of results to return (default: 100)"},"retrievalStrategy":{"type":"string","required":false,"visibility":"user-or-llm","description":"Retrieval strategy: hybrid (default), neural, or keyword"},"expandQuery":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Generate query variations to improve recall"},"rerank":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Reorder results for improved relevance using LLM"},"generateAnswer":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Generate a natural-language answer to the query"}},"hostedApiKey":"none"},"algolia_add_record":{"id":"algolia_add_record","name":"Algolia Add Record","description":"Add or replace a record in an Algolia index","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Admin API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index"},"objectID":{"type":"string","required":false,"visibility":"user-or-llm","description":"Object ID for the record (auto-generated if not provided)"},"record":{"type":"json","required":true,"visibility":"user-or-llm","description":"JSON object representing the record to add"}},"hostedApiKey":"none"},"algolia_batch_operations":{"id":"algolia_batch_operations","name":"Algolia Batch Operations","description":"Perform batch add, update, partial update, or delete operations on records in an Algolia index","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Admin API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index"},"requests":{"type":"json","required":true,"visibility":"user-or-llm","description":"Array of batch operations. Each item has \\"action\\" (addObject, updateObject, partialUpdateObject, partialUpdateObjectNoCreate, deleteObject, delete, clear) and \\"body\\" (the record data; must include objectID for update/delete; use an empty object {} for the index-level delete/clear actions)"}},"hostedApiKey":"none"},"algolia_browse_records":{"id":"algolia_browse_records","name":"Algolia Browse Records","description":"Browse and iterate over all records in an Algolia index using cursor pagination","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia API Key (must have browse ACL)"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index to browse"},"query":{"type":"string","required":false,"visibility":"user-or-llm","description":"Search query to filter browsed records"},"filters":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter string to narrow down results"},"attributesToRetrieve":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated list of attributes to retrieve"},"hitsPerPage":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of hits per page (default: 1000, max: 1000)"},"cursor":{"type":"string","required":false,"visibility":"user-or-llm","description":"Cursor from a previous browse response for pagination"},"aroundLatLng":{"type":"string","required":false,"visibility":"user-or-llm","description":"Coordinates for geo-search (e.g., \\"40.71,-74.01\\")"},"aroundRadius":{"type":"string","required":false,"visibility":"user-or-llm","description":"Maximum radius in meters for geo-search, or \\"all\\" for unlimited"},"insideBoundingBox":{"type":"json","required":false,"visibility":"user-or-llm","description":"Bounding box coordinates as [[lat1, lng1, lat2, lng2]] for geo-search"},"insidePolygon":{"type":"json","required":false,"visibility":"user-or-llm","description":"Polygon coordinates as [[lat1, lng1, lat2, lng2, lat3, lng3, ...]] for geo-search"}},"hostedApiKey":"none"},"algolia_clear_records":{"id":"algolia_clear_records","name":"Algolia Clear Records","description":"Clear all records from an Algolia index while keeping settings, synonyms, and rules","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Admin API Key (must have deleteIndex ACL)"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index to clear"}},"hostedApiKey":"none"},"algolia_copy_move_index":{"id":"algolia_copy_move_index","name":"Algolia Copy/Move Index","description":"Copy or move an Algolia index to a new destination","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Admin API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the source index"},"operation":{"type":"string","required":true,"visibility":"user-or-llm","description":"Operation to perform: \\"copy\\" or \\"move\\""},"destination":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the destination index"},"scope":{"type":"json","required":false,"visibility":"user-or-llm","description":"Array of scopes to copy (only for \\"copy\\" operation): [\\"settings\\", \\"synonyms\\", \\"rules\\"]. Omit to copy everything including records."}},"hostedApiKey":"none"},"algolia_delete_by_filter":{"id":"algolia_delete_by_filter","name":"Algolia Delete By Filter","description":"Delete all records matching a filter from an Algolia index","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Admin API Key (must have deleteIndex ACL)"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index"},"filters":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter expression to match records for deletion (e.g., \\"category:outdated\\")"},"facetFilters":{"type":"json","required":false,"visibility":"user-or-llm","description":"Array of facet filters (e.g., [\\"brand:Acme\\"])"},"numericFilters":{"type":"json","required":false,"visibility":"user-or-llm","description":"Array of numeric filters (e.g., [\\"price > 100\\"])"},"tagFilters":{"type":"json","required":false,"visibility":"user-or-llm","description":"Array of tag filters using the _tags attribute (e.g., [\\"published\\"])"},"aroundLatLng":{"type":"string","required":false,"visibility":"user-or-llm","description":"Coordinates for geo-search filter (e.g., \\"40.71,-74.01\\")"},"aroundRadius":{"type":"string","required":false,"visibility":"user-or-llm","description":"Maximum radius in meters for geo-search, or \\"all\\" for unlimited"},"insideBoundingBox":{"type":"json","required":false,"visibility":"user-or-llm","description":"Bounding box coordinates as [[lat1, lng1, lat2, lng2]] for geo-search filter"},"insidePolygon":{"type":"json","required":false,"visibility":"user-or-llm","description":"Polygon coordinates as [[lat1, lng1, lat2, lng2, lat3, lng3, ...]] for geo-search filter"}},"hostedApiKey":"none"},"algolia_delete_index":{"id":"algolia_delete_index","name":"Algolia Delete Index","description":"Delete an entire Algolia index and all its records","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Admin API Key (must have deleteIndex ACL)"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index to delete"}},"hostedApiKey":"none"},"algolia_delete_record":{"id":"algolia_delete_record","name":"Algolia Delete Record","description":"Delete a record by objectID from an Algolia index","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Admin API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index"},"objectID":{"type":"string","required":true,"visibility":"user-or-llm","description":"The objectID of the record to delete"}},"hostedApiKey":"none"},"algolia_get_record":{"id":"algolia_get_record","name":"Algolia Get Record","description":"Get a record by objectID from an Algolia index","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index"},"objectID":{"type":"string","required":true,"visibility":"user-or-llm","description":"The objectID of the record to retrieve"},"attributesToRetrieve":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated list of attributes to retrieve"}},"hostedApiKey":"none"},"algolia_get_records":{"id":"algolia_get_records","name":"Algolia Get Records","description":"Retrieve multiple records by objectID from one or more Algolia indices","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Default index name for all requests"},"requests":{"type":"json","required":true,"visibility":"user-or-llm","description":"Array of objects specifying records to retrieve. Each must have \\"objectID\\" and optionally \\"indexName\\" and \\"attributesToRetrieve\\"."}},"hostedApiKey":"none"},"algolia_get_settings":{"id":"algolia_get_settings","name":"Algolia Get Settings","description":"Retrieve the settings of an Algolia index","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index"}},"hostedApiKey":"none"},"algolia_get_task_status":{"id":"algolia_get_task_status","name":"Algolia Get Task Status","description":"Check whether an Algolia indexing task has finished publishing","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index the task ran against"},"taskID":{"type":"number","required":true,"visibility":"user-or-llm","description":"The taskID returned by a previous write operation"}},"hostedApiKey":"none"},"algolia_list_indices":{"id":"algolia_list_indices","name":"Algolia List Indices","description":"List all indices in an Algolia application","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia API Key"},"page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Page number for paginating indices (default: not paginated)"},"hitsPerPage":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of indices per page (default: 100)"}},"hostedApiKey":"none"},"algolia_partial_update_record":{"id":"algolia_partial_update_record","name":"Algolia Partial Update Record","description":"Partially update a record in an Algolia index without replacing it entirely","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Admin API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index"},"objectID":{"type":"string","required":true,"visibility":"user-or-llm","description":"The objectID of the record to update"},"attributes":{"type":"json","required":true,"visibility":"user-or-llm","description":"JSON object with attributes to update. Supports built-in operations like {\\"stock\\": {\\"_operation\\": \\"Decrement\\", \\"value\\": 1}}"},"createIfNotExists":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Whether to create the record if it does not exist (default: true)"}},"hostedApiKey":"none"},"algolia_search":{"id":"algolia_search","name":"Algolia Search","description":"Search an Algolia index","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia API Key"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index to search"},"query":{"type":"string","required":true,"visibility":"user-or-llm","description":"Search query text"},"hitsPerPage":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of hits per page (default: 20)"},"page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Page number to retrieve (default: 0)"},"filters":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter string (e.g., \\"category:electronics AND price < 100\\")"},"attributesToRetrieve":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated list of attributes to retrieve"},"facets":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated list of facet attribute names to retrieve counts for (use \\"*\\" for all)"},"getRankingInfo":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Whether to include detailed ranking information in each hit"},"aroundLatLng":{"type":"string","required":false,"visibility":"user-or-llm","description":"Coordinates for geo-search (e.g., \\"40.71,-74.01\\")"},"aroundRadius":{"type":"string","required":false,"visibility":"user-or-llm","description":"Maximum radius in meters for geo-search, or \\"all\\" for unlimited"},"insideBoundingBox":{"type":"json","required":false,"visibility":"user-or-llm","description":"Bounding box coordinates as [[lat1, lng1, lat2, lng2]] for geo-search"},"insidePolygon":{"type":"json","required":false,"visibility":"user-or-llm","description":"Polygon coordinates as [[lat1, lng1, lat2, lng2, lat3, lng3, ...]] for geo-search"}},"hostedApiKey":"none"},"algolia_update_settings":{"id":"algolia_update_settings","name":"Algolia Update Settings","description":"Update the settings of an Algolia index","version":"1.0","params":{"applicationId":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Application ID"},"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Algolia Admin API Key (must have editSettings ACL)"},"indexName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the Algolia index"},"settings":{"type":"json","required":true,"visibility":"user-or-llm","description":"JSON object with settings to update (e.g., {\\"searchableAttributes\\": [\\"name\\", \\"description\\"], \\"customRanking\\": [\\"desc(popularity)\\"]})"},"forwardToReplicas":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Whether to apply changes to replica indices (default: false)"}},"hostedApiKey":"none"},"amplitude_event_segmentation":{"id":"amplitude_event_segmentation","name":"Amplitude Event Segmentation","description":"Query event analytics data with segmentation. Get event counts, uniques, averages, and more.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"eventType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Event type name to analyze"},"start":{"type":"string","required":true,"visibility":"user-or-llm","description":"Start date in YYYYMMDD format"},"end":{"type":"string","required":true,"visibility":"user-or-llm","description":"End date in YYYYMMDD format"},"metric":{"type":"string","required":false,"visibility":"user-or-llm","description":"Metric type: uniques, totals, pct_dau, average, histogram, sums, value_avg, or formula (default: uniques)"},"interval":{"type":"string","required":false,"visibility":"user-or-llm","description":"Time interval: 1 (daily), 7 (weekly), or 30 (monthly)"},"groupBy":{"type":"string","required":false,"visibility":"user-or-llm","description":"Property name to group by (prefix custom user properties with \\"gp:\\")"},"groupBy2":{"type":"string","required":false,"visibility":"user-or-llm","description":"Second property name to group by (prefix custom user properties with \\"gp:\\")"},"limit":{"type":"string","required":false,"visibility":"user-or-llm","description":"Maximum number of group-by values (max 1000)"},"filters":{"type":"string","required":false,"visibility":"user-or-llm","description":"JSON array of filter objects applied to the event, e.g. [{\\"subprop_type\\":\\"event\\",\\"subprop_key\\":\\"city\\",\\"subprop_op\\":\\"is\\",\\"subprop_value\\":[\\"San Francisco\\"]}]"},"formula":{"type":"string","required":false,"visibility":"user-or-llm","description":"Required when metric is \\"formula\\", e.g. \\"UNIQUES(A)/UNIQUES(B)\\""},"segment":{"type":"string","required":false,"visibility":"user-or-llm","description":"JSON segment definition(s) applied to the query"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"hostedApiKey":"none"},"amplitude_funnels":{"id":"amplitude_funnels","name":"Amplitude Funnels","description":"Analyze conversion rates and drop-off between a sequence of events.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"events":{"type":"string","required":true,"visibility":"user-or-llm","description":"JSON array of event objects, one per funnel step in order, e.g. [{\\"event_type\\":\\"signup\\"},{\\"event_type\\":\\"purchase\\"}]"},"start":{"type":"string","required":true,"visibility":"user-or-llm","description":"Start date in YYYYMMDD format"},"end":{"type":"string","required":true,"visibility":"user-or-llm","description":"End date in YYYYMMDD format"},"mode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Funnel ordering: \\"ordered\\", \\"unordered\\", or \\"sequential\\" (default: ordered)"},"userType":{"type":"string","required":false,"visibility":"user-or-llm","description":"User type: \\"new\\" or \\"active\\" (default: active)"},"interval":{"type":"string","required":false,"visibility":"user-or-llm","description":"Time interval: -300000 (real-time), -3600000 (hourly), 1 (daily), 7 (weekly), or 30 (monthly)"},"conversionWindowSeconds":{"type":"string","required":false,"visibility":"user-or-llm","description":"Conversion window in seconds (default: 2592000, i.e. 30 days)"},"groupBy":{"type":"string","required":false,"visibility":"user-or-llm","description":"Property to group by (limit: one; prefix custom properties with \\"gp:\\")"},"limit":{"type":"string","required":false,"visibility":"user-or-llm","description":"Maximum number of group-by values (default: 100, max: 1000)"},"segment":{"type":"string","required":false,"visibility":"user-or-llm","description":"JSON segment definition(s) applied to the query"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"hostedApiKey":"none"},"amplitude_get_active_users":{"id":"amplitude_get_active_users","name":"Amplitude Get Active Users","description":"Get active or new user counts over a date range from the Dashboard REST API.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"start":{"type":"string","required":true,"visibility":"user-or-llm","description":"Start date in YYYYMMDD format"},"end":{"type":"string","required":true,"visibility":"user-or-llm","description":"End date in YYYYMMDD format"},"metric":{"type":"string","required":false,"visibility":"user-or-llm","description":"Metric type: \\"active\\" or \\"new\\" (default: active)"},"interval":{"type":"string","required":false,"visibility":"user-or-llm","description":"Time interval: 1 (daily), 7 (weekly), or 30 (monthly)"},"groupBy":{"type":"string","required":false,"visibility":"user-or-llm","description":"Property name to group by"},"segment":{"type":"string","required":false,"visibility":"user-or-llm","description":"JSON segment definition(s) applied to the query"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"hostedApiKey":"none"},"amplitude_get_revenue":{"id":"amplitude_get_revenue","name":"Amplitude Get Revenue","description":"Get revenue LTV data including ARPU, ARPPU, total revenue, and paying user counts.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"start":{"type":"string","required":true,"visibility":"user-or-llm","description":"Start date in YYYYMMDD format"},"end":{"type":"string","required":true,"visibility":"user-or-llm","description":"End date in YYYYMMDD format"},"metric":{"type":"string","required":false,"visibility":"user-or-llm","description":"Metric: 0 (ARPU), 1 (ARPPU), 2 (Total Revenue), 3 (Paying Users)"},"interval":{"type":"string","required":false,"visibility":"user-or-llm","description":"Time interval: 1 (daily), 7 (weekly), or 30 (monthly)"},"groupBy":{"type":"string","required":false,"visibility":"user-or-llm","description":"Property name to group by (limit: one)"},"segment":{"type":"string","required":false,"visibility":"user-or-llm","description":"JSON segment definition(s) applied to the query"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"hostedApiKey":"none"},"amplitude_group_identify":{"id":"amplitude_group_identify","name":"Amplitude Group Identify","description":"Set group-level properties in Amplitude. Supports $set, $setOnce, $add, $append, $unset operations.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"groupType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Group classification (e.g., \\"company\\", \\"org_id\\")"},"groupValue":{"type":"string","required":true,"visibility":"user-or-llm","description":"Specific group identifier (e.g., \\"Acme Corp\\")"},"groupProperties":{"type":"string","required":true,"visibility":"user-or-llm","description":"JSON object of group properties. Use operations like $set, $setOnce, $add, $append, $unset."},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"hostedApiKey":"none"},"amplitude_identify_user":{"id":"amplitude_identify_user","name":"Amplitude Identify User","description":"Set user properties in Amplitude using the Identify API. Supports $set, $setOnce, $add, $append, $unset operations.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"userId":{"type":"string","required":false,"visibility":"user-or-llm","description":"User ID (required if no device_id)"},"deviceId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Device ID (required if no user_id)"},"userProperties":{"type":"string","required":true,"visibility":"user-or-llm","description":"JSON object of user properties. Use operations like $set, $setOnce, $add, $append, $unset."},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"hostedApiKey":"none"},"amplitude_list_events":{"id":"amplitude_list_events","name":"Amplitude List Events","description":"List all event types in the Amplitude project with their weekly totals and unique counts.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"hostedApiKey":"none"},"amplitude_realtime_active_users":{"id":"amplitude_realtime_active_users","name":"Amplitude Real-time Active Users","description":"Get real-time active user counts at 5-minute granularity for the last 2 days.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"hostedApiKey":"none"},"amplitude_retention":{"id":"amplitude_retention","name":"Amplitude Retention","description":"Measure how many users return to perform an action after a starting action.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"startEvent":{"type":"string","required":true,"visibility":"user-or-llm","description":"JSON starting event object, e.g. {\\"event_type\\":\\"_new\\"} or {\\"event_type\\":\\"_active\\"}"},"returnEvent":{"type":"string","required":true,"visibility":"user-or-llm","description":"JSON returning event object, e.g. {\\"event_type\\":\\"_all\\"} or {\\"event_type\\":\\"_active\\"}"},"start":{"type":"string","required":true,"visibility":"user-or-llm","description":"Start date in YYYYMMDD format"},"end":{"type":"string","required":true,"visibility":"user-or-llm","description":"End date in YYYYMMDD format"},"retentionMode":{"type":"string","required":false,"visibility":"user-or-llm","description":"Retention type: \\"bracket\\", \\"rolling\\", or \\"n-day\\" (default: n-day)"},"retentionBrackets":{"type":"string","required":false,"visibility":"user-or-llm","description":"Required when Retention Mode is \\"bracket\\". Day ranges, e.g. [[0,4]]"},"interval":{"type":"string","required":false,"visibility":"user-or-llm","description":"Time interval: 1 (daily), 7 (weekly), or 30 (monthly)"},"groupBy":{"type":"string","required":false,"visibility":"user-or-llm","description":"Property to group by (limit: one; prefix custom properties with \\"gp:\\")"},"segment":{"type":"string","required":false,"visibility":"user-or-llm","description":"JSON segment definition(s) applied to the query"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"hostedApiKey":"none"},"amplitude_send_event":{"id":"amplitude_send_event","name":"Amplitude Send Event","description":"Track an event in Amplitude using the HTTP V2 API.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"userId":{"type":"string","required":false,"visibility":"user-or-llm","description":"User ID (required if no device_id)"},"deviceId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Device ID (required if no user_id)"},"eventType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the event (e.g., \\"page_view\\", \\"purchase\\")"},"eventProperties":{"type":"string","required":false,"visibility":"user-or-llm","description":"JSON object of custom event properties"},"userProperties":{"type":"string","required":false,"visibility":"user-or-llm","description":"JSON object of user properties to set (supports $set, $setOnce, $add, $append, $unset)"},"time":{"type":"string","required":false,"visibility":"user-or-llm","description":"Event timestamp in milliseconds since epoch"},"sessionId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Session start time in milliseconds since epoch"},"insertId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Unique ID for deduplication (within 7-day window)"},"appVersion":{"type":"string","required":false,"visibility":"user-or-llm","description":"Application version string"},"platform":{"type":"string","required":false,"visibility":"user-or-llm","description":"Platform (e.g., \\"Web\\", \\"iOS\\", \\"Android\\")"},"country":{"type":"string","required":false,"visibility":"user-or-llm","description":"Two-letter country code"},"language":{"type":"string","required":false,"visibility":"user-or-llm","description":"Language code (e.g., \\"en\\")"},"ip":{"type":"string","required":false,"visibility":"user-or-llm","description":"IP address for geo-location"},"price":{"type":"string","required":false,"visibility":"user-or-llm","description":"Price of the item purchased"},"quantity":{"type":"string","required":false,"visibility":"user-or-llm","description":"Quantity of items purchased"},"revenue":{"type":"string","required":false,"visibility":"user-or-llm","description":"Revenue amount"},"productId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Product identifier"},"revenueType":{"type":"string","required":false,"visibility":"user-or-llm","description":"Revenue type (e.g., \\"purchase\\", \\"refund\\")"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"hostedApiKey":"none"},"amplitude_user_activity":{"id":"amplitude_user_activity","name":"Amplitude User Activity","description":"Get the event stream for a specific user by their Amplitude ID.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"amplitudeId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Amplitude internal user ID"},"offset":{"type":"string","required":false,"visibility":"user-or-llm","description":"Offset for pagination (default 0)"},"limit":{"type":"string","required":false,"visibility":"user-or-llm","description":"Maximum number of events to return (default 1000, max 1000)"},"direction":{"type":"string","required":false,"visibility":"user-or-llm","description":"Sort direction: \\"latest\\" or \\"earliest\\" (default: latest)"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"hostedApiKey":"none"},"amplitude_user_profile":{"id":"amplitude_user_profile","name":"Amplitude User Profile","description":"Get a user profile including properties, cohort memberships, and computed properties. Not available for EU data-residency projects.","version":"1.0.0","params":{"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"userId":{"type":"string","required":false,"visibility":"user-or-llm","description":"External user ID (required if no device_id)"},"deviceId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Device ID (required if no user_id)"},"getAmpProps":{"type":"string","required":false,"visibility":"user-or-llm","description":"Include Amplitude user properties (true/false, default: false)"},"getCohortIds":{"type":"string","required":false,"visibility":"user-or-llm","description":"Include cohort IDs the user belongs to (true/false, default: false)"},"getComputations":{"type":"string","required":false,"visibility":"user-or-llm","description":"Include computed user properties (true/false, default: false)"}},"hostedApiKey":"none"},"amplitude_user_search":{"id":"amplitude_user_search","name":"Amplitude User Search","description":"Search for a user by User ID, Device ID, or Amplitude ID using the Dashboard REST API.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude API Key"},"secretKey":{"type":"string","required":true,"visibility":"user-only","description":"Amplitude Secret Key"},"user":{"type":"string","required":true,"visibility":"user-or-llm","description":"User ID, Device ID, or Amplitude ID to search for"},"dataResidency":{"type":"string","required":false,"visibility":"user-or-llm","description":"Data residency region: \\"us\\" (default) or \\"eu\\""}},"hostedApiKey":"none"},"apify_get_dataset_items":{"id":"apify_get_dataset_items","name":"APIFY Get Dataset Items","description":"Retrieve items stored in an APIFY dataset","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"APIFY API token from console.apify.com/account#/integrations"},"datasetId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Dataset ID to read items from. Example: \\"9RnD3Pql2vGZkc5H5\\""},"itemLimit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Max items to return (1-250000). Default: all items. Example: 500"},"offset":{"type":"number","required":false,"visibility":"user-or-llm","description":"Number of items to skip at the start. Default: 0"},"fields":{"type":"string","required":false,"visibility":"user-or-llm","description":"Comma-separated list of fields to include. Example: \\"title,url,price\\""}},"hostedApiKey":"none"},"apify_get_run":{"id":"apify_get_run","name":"APIFY Get Run","description":"Get the status and details of an APIFY actor run","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"APIFY API token from console.apify.com/account#/integrations"},"runId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Actor run ID to fetch. Example: \\"HG7ML7M8z78YcAPEB\\""}},"hostedApiKey":"none"},"apify_run_actor_async":{"id":"apify_run_actor_async","name":"APIFY Run Actor (Async)","description":"Run an APIFY actor asynchronously with polling for long-running tasks","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"APIFY API token from console.apify.com/account#/integrations"},"actorId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Actor ID or username/actor-name. Examples: \\"apify/web-scraper\\", \\"janedoe/my-actor\\", \\"moJRLRc85AitArpNN\\""},"input":{"type":"string","required":false,"visibility":"user-or-llm","description":"Actor input as JSON string. Example: {\\"startUrls\\": [{\\"url\\": \\"https://example.com\\"}], \\"maxPages\\": 10}"},"waitForFinish":{"type":"number","required":false,"visibility":"user-or-llm","description":"Initial wait time in seconds (0-60) before polling starts. Example: 30"},"itemLimit":{"type":"number","required":false,"default":100,"visibility":"user-or-llm","description":"Max dataset items to fetch (1-250000). Default: 100. Example: 500"},"memory":{"type":"number","required":false,"visibility":"user-or-llm","description":"Memory in megabytes allocated for the actor run (128-32768). Example: 1024 for 1GB, 2048 for 2GB"},"timeout":{"type":"number","required":false,"visibility":"user-or-llm","description":"Timeout in seconds for the actor run. Example: 300 for 5 minutes, 3600 for 1 hour"},"build":{"type":"string","required":false,"visibility":"user-or-llm","description":"Actor build to run. Examples: \\"latest\\", \\"beta\\", \\"1.2.3\\", \\"build-tag-name\\""}},"hostedApiKey":"none"},"apify_run_actor_sync":{"id":"apify_run_actor_sync","name":"APIFY Run Actor (Sync)","description":"Run an APIFY actor synchronously and get results (max 5 minutes)","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"APIFY API token from console.apify.com/account#/integrations"},"actorId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Actor ID or username/actor-name. Examples: \\"apify/web-scraper\\", \\"janedoe/my-actor\\", \\"moJRLRc85AitArpNN\\""},"input":{"type":"string","required":false,"visibility":"user-or-llm","description":"Actor input as JSON string. Example: {\\"startUrls\\": [{\\"url\\": \\"https://example.com\\"}], \\"maxPages\\": 10}"},"memory":{"type":"number","required":false,"visibility":"user-or-llm","description":"Memory in megabytes allocated for the actor run (128-32768). Example: 1024 for 1GB, 2048 for 2GB"},"timeout":{"type":"number","required":false,"visibility":"user-or-llm","description":"Timeout in seconds for the actor run. Example: 300 for 5 minutes, 3600 for 1 hour"},"build":{"type":"string","required":false,"visibility":"user-or-llm","description":"Actor build to run. Examples: \\"latest\\", \\"beta\\", \\"1.2.3\\", \\"build-tag-name\\""}},"hostedApiKey":"none"},"apify_run_task":{"id":"apify_run_task","name":"APIFY Run Task","description":"Run a saved APIFY actor task synchronously and get dataset items (max 5 minutes)","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"APIFY API token from console.apify.com/account#/integrations"},"taskId":{"type":"string","required":true,"visibility":"user-or-llm","description":"Task ID or username/task-name. Examples: \\"janedoe/my-task\\", \\"moJRLRc85AitArpNN\\""},"input":{"type":"string","required":false,"visibility":"user-or-llm","description":"JSON string that overrides the task\'s saved input. Example: {\\"startUrls\\": [{\\"url\\": \\"https://example.com\\"}]}"},"itemLimit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Max dataset items to return (1-250000). Example: 500"},"memory":{"type":"number","required":false,"visibility":"user-or-llm","description":"Memory in megabytes allocated for the run (128-32768). Example: 1024 for 1GB"},"timeout":{"type":"number","required":false,"visibility":"user-or-llm","description":"Timeout in seconds for the run. Example: 300 for 5 minutes"},"build":{"type":"string","required":false,"visibility":"user-or-llm","description":"Actor build to run. Examples: \\"latest\\", \\"beta\\", \\"1.2.3\\""}},"hostedApiKey":"none"},"apollo_account_bulk_create":{"id":"apollo_account_bulk_create","name":"Apollo Bulk Create Accounts","description":"Create up to 100 accounts at once in your Apollo database. Set run_dedupe=true to deduplicate by domain, organization_id, and name. Master key required.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"accounts":{"type":"array","required":true,"visibility":"user-or-llm","description":"Array of accounts to create (max 100). Each account should include a name, and may optionally include domain, phone, phone_status_cd, raw_address, owner_id, linkedin_url, facebook_url, twitter_url, salesforce_id, and hubspot_id."},"append_label_names":{"type":"array","required":false,"visibility":"user-only","description":"Array of label names to add to ALL accounts in this request"},"run_dedupe":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"When true, performs aggressive deduplication by domain, organization_id, and name (defaults to false)"}},"hostedApiKey":"none"},"apollo_account_bulk_update":{"id":"apollo_account_bulk_update","name":"Apollo Bulk Update Accounts","description":"Update up to 1000 existing accounts at once in your Apollo database (higher limit than contacts!). Each account must include an id field. Master key required.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"account_ids":{"type":"array","required":false,"visibility":"user-or-llm","description":"Array of account IDs to update with the same values (max 1000). Use with name/owner_id for uniform updates. Use either this OR account_attributes."},"name":{"type":"string","required":false,"visibility":"user-or-llm","description":"When using account_ids, apply this name to all accounts"},"owner_id":{"type":"string","required":false,"visibility":"user-or-llm","description":"When using account_ids, apply this owner to all accounts"},"account_stage_id":{"type":"string","required":false,"visibility":"user-or-llm","description":"When using account_ids, apply this account stage to all accounts"},"account_attributes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Array of account objects with individual updates (each must include id). Example: [{\\"id\\": \\"acc1\\", \\"name\\": \\"Acme\\", \\"owner_id\\": \\"u1\\", \\"account_stage_id\\": \\"s1\\", \\"typed_custom_fields\\": {\\"field_id\\": \\"value\\"}}]"},"async":{"type":"boolean","required":false,"visibility":"user-only","description":"When true, processes the update asynchronously. Only supported when using account_ids; returns 422 if used with account_attributes."}},"hostedApiKey":"none"},"apollo_account_create":{"id":"apollo_account_create","name":"Apollo Create Account","description":"Create a new account (company) in your Apollo database","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Company name (e.g., \\"Acme Corporation\\")"},"domain":{"type":"string","required":false,"visibility":"user-or-llm","description":"Company domain without www. prefix (e.g., \\"acme.com\\")"},"phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Primary phone number for the account"},"owner_id":{"type":"string","required":false,"visibility":"user-only","description":"Apollo user ID of the account owner"},"account_stage_id":{"type":"string","required":false,"visibility":"user-only","description":"Apollo ID for the account stage to assign this account to"},"raw_address":{"type":"string","required":false,"visibility":"user-or-llm","description":"Corporate location (e.g., \\"San Francisco, CA, USA\\")"},"typed_custom_fields":{"type":"json","required":false,"visibility":"user-only","description":"Custom field values as { custom_field_id: value } map"}},"hostedApiKey":"none"},"apollo_account_search":{"id":"apollo_account_search","name":"Apollo Search Accounts","description":"Search your team\'s accounts in Apollo. Display limit: 50,000 records (100 records per page, 500 pages max). Use filters to narrow results. Master key required.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"q_organization_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter accounts by organization name (partial-match search)"},"account_stage_ids":{"type":"array","required":false,"visibility":"user-only","description":"Filter by account stage IDs"},"account_label_ids":{"type":"array","required":false,"visibility":"user-only","description":"Filter by account label IDs"},"sort_by_field":{"type":"string","required":false,"visibility":"user-or-llm","description":"Sort field: \\"account_last_activity_date\\", \\"account_created_at\\", or \\"account_updated_at\\""},"sort_ascending":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Sort ascending when true. Defaults to descending."},"page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Page number for pagination (e.g., 1, 2, 3)"},"per_page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Results per page, max 100 (e.g., 25, 50, 100)"}},"hostedApiKey":"none"},"apollo_account_update":{"id":"apollo_account_update","name":"Apollo Update Account","description":"Update an existing account in your Apollo database","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"account_id":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the account to update (e.g., \\"acc_abc123\\")"},"name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Company name (e.g., \\"Acme Corporation\\")"},"domain":{"type":"string","required":false,"visibility":"user-or-llm","description":"Company domain (e.g., \\"acme.com\\")"},"phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Company phone number"},"owner_id":{"type":"string","required":false,"visibility":"user-only","description":"Apollo user ID of the account owner"},"account_stage_id":{"type":"string","required":false,"visibility":"user-only","description":"Apollo ID for the account stage to assign this account to"},"raw_address":{"type":"string","required":false,"visibility":"user-or-llm","description":"Corporate location (e.g., \\"San Francisco, CA, USA\\")"},"typed_custom_fields":{"type":"json","required":false,"visibility":"user-only","description":"Custom field values as { custom_field_id: value } map"}},"hostedApiKey":"none"},"apollo_contact_bulk_create":{"id":"apollo_contact_bulk_create","name":"Apollo Bulk Create Contacts","description":"Create up to 100 contacts at once in your Apollo database. Supports deduplication to prevent creating duplicate contacts. Master key required.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"contacts":{"type":"array","required":true,"visibility":"user-or-llm","description":"Array of contacts to create (max 100). Each contact may include first_name, last_name, email, title, organization_name, account_id, owner_id, contact_stage_id, linkedin_url, phone (single string) or phone_numbers (array of {raw_number, position}), contact_emails, typed_custom_fields, and CRM IDs (salesforce_contact_id, hubspot_id, team_id) for cross-system matching"},"append_label_names":{"type":"array","required":false,"visibility":"user-or-llm","description":"Label names to add to all contacts in this request (e.g., [\\"Hot Lead\\"])"},"run_dedupe":{"type":"boolean","required":false,"visibility":"user-only","description":"Enable deduplication to prevent creating duplicate contacts. When true, existing contacts are returned without modification"}},"hostedApiKey":"none"},"apollo_contact_bulk_update":{"id":"apollo_contact_bulk_update","name":"Apollo Bulk Update Contacts","description":"Update up to 100 existing contacts at once in your Apollo database. Each contact must include an id field. Master key required.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"contact_ids":{"type":"array","required":false,"visibility":"user-or-llm","description":"Array of contact IDs to update. Must be paired with an object-form contact_attributes specifying the fields to apply uniformly to all listed contacts."},"contact_attributes":{"type":"json","required":false,"visibility":"user-or-llm","description":"Required. Either an array of per-contact updates (each with id) — used standalone — or a single object of attributes to apply to all contact_ids. Supported fields: owner_id, email, organization_name, title, first_name, last_name, account_id, present_raw_address, linkedin_url, typed_custom_fields"},"async":{"type":"boolean","required":false,"visibility":"user-only","description":"Force asynchronous processing. Automatically enabled for >100 contacts"}},"hostedApiKey":"none"},"apollo_contact_create":{"id":"apollo_contact_create","name":"Apollo Create Contact","description":"Create a new contact in your Apollo database","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"first_name":{"type":"string","required":true,"visibility":"user-or-llm","description":"First name of the contact"},"last_name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Last name of the contact"},"email":{"type":"string","required":false,"visibility":"user-or-llm","description":"Email address of the contact"},"title":{"type":"string","required":false,"visibility":"user-or-llm","description":"Job title (e.g., \\"VP of Sales\\", \\"Software Engineer\\")"},"account_id":{"type":"string","required":false,"visibility":"user-or-llm","description":"Apollo account ID to associate with (e.g., \\"acc_abc123\\")"},"owner_id":{"type":"string","required":false,"visibility":"user-only","description":"User ID of the contact owner (accepted by Apollo but not officially documented for POST /contacts)"},"organization_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Name of the contact\'s employer (e.g., \\"Apollo\\")"},"website_url":{"type":"string","required":false,"visibility":"user-or-llm","description":"Corporate website URL (e.g., \\"https://www.apollo.io/\\")"},"label_names":{"type":"array","required":false,"visibility":"user-or-llm","description":"Lists/labels to add the contact to (e.g., [\\"Prospects\\"])"},"contact_stage_id":{"type":"string","required":false,"visibility":"user-or-llm","description":"Apollo ID for the contact stage"},"present_raw_address":{"type":"string","required":false,"visibility":"user-or-llm","description":"Personal location for the contact (e.g., \\"Atlanta, United States\\")"},"direct_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Primary phone number"},"corporate_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Work/office phone number"},"mobile_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Mobile phone number"},"home_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Home phone number"},"other_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Alternative phone number"},"typed_custom_fields":{"type":"json","required":false,"visibility":"user-or-llm","description":"Custom field values keyed by custom field ID"},"run_dedupe":{"type":"boolean","required":false,"visibility":"user-only","description":"When true, Apollo deduplicates against existing contacts"}},"hostedApiKey":"none"},"apollo_contact_search":{"id":"apollo_contact_search","name":"Apollo Search Contacts","description":"Search your team\'s contacts in Apollo","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"q_keywords":{"type":"string","required":false,"visibility":"user-or-llm","description":"Keywords to search for"},"contact_stage_ids":{"type":"array","required":false,"visibility":"user-only","description":"Filter by contact stage IDs"},"contact_label_ids":{"type":"array","required":false,"visibility":"user-only","description":"Filter by Apollo label IDs (lists)"},"sort_by_field":{"type":"string","required":false,"visibility":"user-only","description":"Sort field: contact_last_activity_date, contact_email_last_opened_at, contact_email_last_clicked_at, contact_created_at, or contact_updated_at"},"sort_ascending":{"type":"boolean","required":false,"visibility":"user-only","description":"When true, sort ascending. Must be used together with sort_by_field"},"page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Page number for pagination (e.g., 1, 2, 3)"},"per_page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Results per page, max 100 (e.g., 25, 50, 100)"}},"hostedApiKey":"none"},"apollo_contact_update":{"id":"apollo_contact_update","name":"Apollo Update Contact","description":"Update an existing contact in your Apollo database","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"contact_id":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the contact to update (e.g., \\"con_abc123\\")"},"first_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"First name of the contact"},"last_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Last name of the contact"},"email":{"type":"string","required":false,"visibility":"user-or-llm","description":"Email address"},"title":{"type":"string","required":false,"visibility":"user-or-llm","description":"Job title (e.g., \\"VP of Sales\\", \\"Software Engineer\\")"},"account_id":{"type":"string","required":false,"visibility":"user-or-llm","description":"Apollo account ID (e.g., \\"acc_abc123\\")"},"owner_id":{"type":"string","required":false,"visibility":"user-only","description":"User ID of the contact owner (accepted by Apollo but not officially documented for PATCH /contacts/{id})"},"organization_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Name of the contact\'s employer (e.g., \\"Apollo\\")"},"website_url":{"type":"string","required":false,"visibility":"user-or-llm","description":"Corporate website URL (e.g., \\"https://www.apollo.io/\\")"},"label_names":{"type":"array","required":false,"visibility":"user-or-llm","description":"Lists/labels to add the contact to (e.g., [\\"Prospects\\"])"},"contact_stage_id":{"type":"string","required":false,"visibility":"user-or-llm","description":"Apollo ID for the contact stage"},"present_raw_address":{"type":"string","required":false,"visibility":"user-or-llm","description":"Personal location for the contact (e.g., \\"Atlanta, United States\\")"},"direct_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Primary phone number"},"corporate_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Work/office phone number"},"mobile_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Mobile phone number"},"home_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Home phone number"},"other_phone":{"type":"string","required":false,"visibility":"user-or-llm","description":"Alternative phone number"},"typed_custom_fields":{"type":"json","required":false,"visibility":"user-or-llm","description":"Custom field values keyed by custom field ID"}},"hostedApiKey":"none"},"apollo_email_accounts":{"id":"apollo_email_accounts","name":"Apollo Get Email Accounts","description":"Get list of team\'s linked email accounts in Apollo","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"}},"hostedApiKey":"none"},"apollo_opportunity_create":{"id":"apollo_opportunity_create","name":"Apollo Create Opportunity","description":"Create a new deal for an account in your Apollo database (master key required)","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the opportunity/deal (e.g., \\"Enterprise License - Q1\\")"},"account_id":{"type":"string","required":false,"visibility":"user-or-llm","description":"ID of the account this opportunity belongs to (e.g., \\"acc_abc123\\")"},"amount":{"type":"string","required":false,"visibility":"user-or-llm","description":"Monetary value as a plain number string with no commas or currency symbols"},"opportunity_stage_id":{"type":"string","required":false,"visibility":"user-only","description":"ID of the opportunity stage"},"owner_id":{"type":"string","required":false,"visibility":"user-only","description":"User ID of the opportunity owner"},"closed_date":{"type":"string","required":false,"visibility":"user-or-llm","description":"Expected close date in YYYY-MM-DD format"},"typed_custom_fields":{"type":"json","required":false,"visibility":"user-only","description":"Custom field values as { custom_field_id: value } map"}},"hostedApiKey":"none"},"apollo_opportunity_get":{"id":"apollo_opportunity_get","name":"Apollo Get Opportunity","description":"Retrieve complete details of a specific deal/opportunity by ID","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"opportunity_id":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the opportunity to retrieve (e.g., \\"opp_abc123\\")"}},"hostedApiKey":"none"},"apollo_opportunity_search":{"id":"apollo_opportunity_search","name":"Apollo Search Opportunities","description":"Search and list all deals/opportunities in your team\'s Apollo account","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"sort_by_field":{"type":"string","required":false,"visibility":"user-or-llm","description":"Sort field: \\"amount\\", \\"is_closed\\", or \\"is_won\\""},"page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Page number for pagination (e.g., 1, 2, 3)"},"per_page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Results per page, max 100 (e.g., 25, 50, 100)"}},"hostedApiKey":"none"},"apollo_opportunity_update":{"id":"apollo_opportunity_update","name":"Apollo Update Opportunity","description":"Update an existing deal/opportunity in your Apollo database","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"opportunity_id":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the opportunity to update (e.g., \\"opp_abc123\\")"},"name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Name of the opportunity/deal (e.g., \\"Enterprise License - Q1\\")"},"amount":{"type":"string","required":false,"visibility":"user-or-llm","description":"Monetary value as a plain number string with no commas or currency symbols"},"opportunity_stage_id":{"type":"string","required":false,"visibility":"user-only","description":"ID of the opportunity stage"},"owner_id":{"type":"string","required":false,"visibility":"user-only","description":"User ID of the opportunity owner"},"closed_date":{"type":"string","required":false,"visibility":"user-or-llm","description":"Expected close date in YYYY-MM-DD format"},"typed_custom_fields":{"type":"json","required":false,"visibility":"user-only","description":"Custom field values as { custom_field_id: value } map"}},"hostedApiKey":"none"},"apollo_organization_bulk_enrich":{"id":"apollo_organization_bulk_enrich","name":"Apollo Bulk Organization Enrichment","description":"Enrich data for up to 10 organizations at once using Apollo","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"domains":{"type":"array","required":true,"visibility":"user-or-llm","description":"Array of company domains to enrich (max 10, no www. or @, e.g., [\\"apollo.io\\", \\"stripe.com\\"])"}},"hostedApiKey":"none"},"apollo_organization_enrich":{"id":"apollo_organization_enrich","name":"Apollo Organization Enrichment","description":"Enrich data for a single organization using Apollo","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"domain":{"type":"string","required":true,"visibility":"user-or-llm","description":"Company domain (e.g., \\"apollo.io\\", \\"acme.com\\")"}},"hostedApiKey":"none"},"apollo_organization_search":{"id":"apollo_organization_search","name":"Apollo Organization Search","description":"Search Apollo\'s database for companies using filters","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"organization_locations":{"type":"array","required":false,"visibility":"user-or-llm","description":"Company HQ locations (cities, US states, or countries)"},"organization_not_locations":{"type":"array","required":false,"visibility":"user-or-llm","description":"Exclude companies whose HQ is in these locations"},"organization_num_employees_ranges":{"type":"array","required":false,"visibility":"user-or-llm","description":"Employee count ranges as \\"min,max\\" strings (e.g., [\\"1,10\\", \\"250,500\\", \\"10000,20000\\"])"},"q_organization_keyword_tags":{"type":"array","required":false,"visibility":"user-or-llm","description":"Industry or keyword tags"},"q_organization_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Organization name to search for (e.g., \\"Acme\\", \\"TechCorp\\")"},"organization_ids":{"type":"array","required":false,"visibility":"user-or-llm","description":"Apollo organization IDs to include (e.g., [\\"5e66b6381e05b4008c8331b8\\"])"},"q_organization_domains_list":{"type":"array","required":false,"visibility":"user-or-llm","description":"Domain names to filter by (no www. or @, up to 1,000)"},"page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Page number for pagination (e.g., 1, 2, 3)"},"per_page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Results per page, max 100 (e.g., 25, 50, 100)"}},"hostedApiKey":"none"},"apollo_people_bulk_enrich":{"id":"apollo_people_bulk_enrich","name":"Apollo Bulk People Enrichment","description":"Enrich data for up to 10 people at once using Apollo","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"people":{"type":"array","required":true,"visibility":"user-or-llm","description":"Array of people to enrich (max 10)"},"reveal_personal_emails":{"type":"boolean","required":false,"visibility":"user-only","description":"Reveal personal email addresses (uses credits)"},"reveal_phone_number":{"type":"boolean","required":false,"visibility":"user-only","description":"Reveal phone numbers (uses credits, requires webhook_url)"},"webhook_url":{"type":"string","required":false,"visibility":"user-only","description":"Webhook URL for async phone number delivery (required when reveal_phone_number is true)"}},"hostedApiKey":"none"},"apollo_people_enrich":{"id":"apollo_people_enrich","name":"Apollo People Enrichment","description":"Enrich data for a single person using Apollo","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"first_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"First name of the person"},"last_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Last name of the person"},"name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Full name of the person (alternative to first_name/last_name)"},"id":{"type":"string","required":false,"visibility":"user-or-llm","description":"Apollo ID for the person"},"hashed_email":{"type":"string","required":false,"visibility":"user-or-llm","description":"MD5 or SHA-256 hashed email"},"email":{"type":"string","required":false,"visibility":"user-or-llm","description":"Email address of the person"},"organization_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Company name where the person works"},"domain":{"type":"string","required":false,"visibility":"user-or-llm","description":"Company domain (e.g., \\"apollo.io\\", \\"acme.com\\")"},"linkedin_url":{"type":"string","required":false,"visibility":"user-or-llm","description":"LinkedIn profile URL"},"reveal_personal_emails":{"type":"boolean","required":false,"visibility":"user-only","description":"Reveal personal email addresses (uses credits)"},"reveal_phone_number":{"type":"boolean","required":false,"visibility":"user-only","description":"Reveal phone numbers (uses credits, requires webhook_url)"},"webhook_url":{"type":"string","required":false,"visibility":"user-only","description":"Webhook URL for async phone number delivery (required when reveal_phone_number is true)"}},"hostedApiKey":"none"},"apollo_people_search":{"id":"apollo_people_search","name":"Apollo People Search","description":"Search Apollo\'s database for people using demographic filters","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key"},"person_titles":{"type":"array","required":false,"visibility":"user-or-llm","description":"Job titles to search for (e.g., [\\"CEO\\", \\"VP of Sales\\"])"},"include_similar_titles":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Whether to return people with job titles similar to person_titles"},"person_locations":{"type":"array","required":false,"visibility":"user-or-llm","description":"Locations to search in (e.g., [\\"San Francisco, CA\\", \\"New York, NY\\"])"},"person_seniorities":{"type":"array","required":false,"visibility":"user-or-llm","description":"Seniority levels (one of: owner, founder, c_suite, partner, vp, head, director, manager, senior, entry, intern)"},"organization_ids":{"type":"array","required":false,"visibility":"user-or-llm","description":"Apollo organization IDs to filter by (e.g., [\\"5e66b6381e05b4008c8331b8\\"])"},"organization_names":{"type":"array","required":false,"visibility":"user-or-llm","description":"Company names to search within (legacy filter)"},"organization_locations":{"type":"array","required":false,"visibility":"user-or-llm","description":"Headquarters locations of the people\'s current employer (e.g., [\'texas\', \'tokyo\', \'spain\'])"},"q_organization_domains_list":{"type":"array","required":false,"visibility":"user-or-llm","description":"Employer domain names (e.g., [\\"apollo.io\\", \\"microsoft.com\\"]) — up to 1,000, no www. or @"},"organization_num_employees_ranges":{"type":"array","required":false,"visibility":"user-or-llm","description":"Employee count ranges for the person\'s current employer. Each entry is \\"min,max\\" (e.g., [\\"1,10\\", \\"250,500\\", \\"10000,20000\\"])"},"contact_email_status":{"type":"array","required":false,"visibility":"user-or-llm","description":"Email statuses to filter by: \\"verified\\", \\"unverified\\", \\"likely to engage\\", \\"unavailable\\""},"q_keywords":{"type":"string","required":false,"visibility":"user-or-llm","description":"Keywords to search for"},"page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Page number for pagination, default 1 (e.g., 1, 2, 3)"},"per_page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Results per page, default 25, max 100 (e.g., 25, 50, 100)"}},"hostedApiKey":"none"},"apollo_sequence_add_contacts":{"id":"apollo_sequence_add_contacts","name":"Apollo Add Contacts to Sequence","description":"Add contacts to an Apollo sequence","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"sequence_id":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the sequence to add contacts to (e.g., \\"seq_abc123\\")"},"contact_ids":{"type":"array","required":false,"visibility":"user-or-llm","description":"Array of contact IDs to add to the sequence (e.g., [\\"con_abc123\\", \\"con_def456\\"]). Either contact_ids or label_names must be provided."},"label_names":{"type":"array","required":false,"visibility":"user-or-llm","description":"Array of label names to identify contacts to add to the sequence. Either contact_ids or label_names must be provided."},"send_email_from_email_account_id":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the email account to send from. Use the Get Email Accounts operation to look this up."},"send_email_from_email_address":{"type":"string","required":false,"visibility":"user-only","description":"Specific email address to send from within the email account."},"sequence_no_email":{"type":"boolean","required":false,"visibility":"user-only","description":"Add contacts even if they have no email address"},"sequence_unverified_email":{"type":"boolean","required":false,"visibility":"user-only","description":"Add contacts with unverified email addresses"},"sequence_job_change":{"type":"boolean","required":false,"visibility":"user-only","description":"Add contacts who recently changed jobs"},"sequence_active_in_other_campaigns":{"type":"boolean","required":false,"visibility":"user-only","description":"Add contacts active in other campaigns"},"sequence_finished_in_other_campaigns":{"type":"boolean","required":false,"visibility":"user-only","description":"Add contacts who finished other campaigns"},"sequence_same_company_in_same_campaign":{"type":"boolean","required":false,"visibility":"user-only","description":"Add contacts even if others from the same company are in the sequence"},"contacts_without_ownership_permission":{"type":"boolean","required":false,"visibility":"user-only","description":"Add contacts without ownership permission"},"add_if_in_queue":{"type":"boolean","required":false,"visibility":"user-only","description":"Add contacts even if they are in the queue"},"contact_verification_skipped":{"type":"boolean","required":false,"visibility":"user-only","description":"Skip contact verification when adding"},"user_id":{"type":"string","required":false,"visibility":"user-only","description":"ID of the user performing the action"},"status":{"type":"string","required":false,"visibility":"user-only","description":"Initial status for added contacts: \\"active\\" or \\"paused\\""},"auto_unpause_at":{"type":"string","required":false,"visibility":"user-only","description":"ISO 8601 datetime to automatically unpause contacts"}},"hostedApiKey":"none"},"apollo_sequence_search":{"id":"apollo_sequence_search","name":"Apollo Search Sequences","description":"Search for sequences/campaigns in your team\'s Apollo account (master key required)","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"q_name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Search sequences by name (e.g., \\"Outbound Q1\\", \\"Follow-up\\")"},"page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Page number for pagination (e.g., 1, 2, 3)"},"per_page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Results per page, max 100 (e.g., 25, 50, 100)"}},"hostedApiKey":"none"},"apollo_task_create":{"id":"apollo_task_create","name":"Apollo Create Task","description":"Create one or more tasks in Apollo (one task per contact_id, master key required)","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"user_id":{"type":"string","required":true,"visibility":"user-or-llm","description":"ID of the Apollo user the task is assigned to"},"contact_ids":{"type":"array","required":true,"visibility":"user-or-llm","description":"Array of contact IDs. One task is created per contact."},"priority":{"type":"string","required":false,"visibility":"user-or-llm","description":"Task priority: \\"high\\", \\"medium\\", or \\"low\\" (defaults to \\"medium\\")"},"due_at":{"type":"string","required":true,"visibility":"user-or-llm","description":"Due date/time in ISO 8601 format (e.g., \\"2024-12-31T23:59:59Z\\")"},"type":{"type":"string","required":true,"visibility":"user-or-llm","description":"Task type: \\"call\\", \\"outreach_manual_email\\", \\"linkedin_step_connect\\", \\"linkedin_step_message\\", \\"linkedin_step_view_profile\\", \\"linkedin_step_interact_post\\", or \\"action_item\\""},"status":{"type":"string","required":true,"visibility":"user-or-llm","description":"Task status: \\"scheduled\\", \\"completed\\", or \\"skipped\\""},"note":{"type":"string","required":false,"visibility":"user-or-llm","description":"Free-form note providing context for the task"}},"hostedApiKey":"none"},"apollo_task_search":{"id":"apollo_task_search","name":"Apollo Search Tasks","description":"Search for tasks in Apollo","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Apollo API key (master key required)"},"sort_by_field":{"type":"string","required":false,"visibility":"user-or-llm","description":"Sort field: \\"task_due_at\\" or \\"task_priority\\""},"open_factor_names":{"type":"array","required":false,"visibility":"user-or-llm","description":"Filter by status. Common values: [\\"task_types\\"] for open tasks, [\\"task_completed_at\\"] for completed tasks."},"page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Page number for pagination (e.g., 1, 2, 3)"},"per_page":{"type":"number","required":false,"visibility":"user-or-llm","description":"Results per page, max 100 (e.g., 25, 50, 100)"}},"hostedApiKey":"none"},"appconfig_create_application":{"id":"appconfig_create_application","name":"AppConfig Create Application","description":"Create an application in AWS AppConfig","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the application to create"},"description":{"type":"string","required":false,"visibility":"user-or-llm","description":"Description of the application"}},"hostedApiKey":"none"},"appconfig_create_configuration_profile":{"id":"appconfig_create_configuration_profile","name":"AppConfig Create Configuration Profile","description":"Create a configuration profile in an AWS AppConfig application","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID to create the configuration profile in"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the configuration profile"},"locationUri":{"type":"string","required":true,"visibility":"user-or-llm","description":"Where the configuration is stored. Use \\"hosted\\" for AppConfig-hosted configurations, or an SSM/S3 URI"},"description":{"type":"string","required":false,"visibility":"user-or-llm","description":"Description of the configuration profile"},"retrievalRoleArn":{"type":"string","required":false,"visibility":"user-or-llm","description":"ARN of an IAM role to retrieve the configuration (required for non-hosted URIs)"},"type":{"type":"string","required":false,"visibility":"user-or-llm","description":"Profile type: AWS.Freeform (default) or AWS.AppConfig.FeatureFlags"}},"hostedApiKey":"none"},"appconfig_create_environment":{"id":"appconfig_create_environment","name":"AppConfig Create Environment","description":"Create an environment for an AWS AppConfig application","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID to create the environment in"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the environment to create"},"description":{"type":"string","required":false,"visibility":"user-or-llm","description":"Description of the environment"}},"hostedApiKey":"none"},"appconfig_create_hosted_configuration_version":{"id":"appconfig_create_hosted_configuration_version","name":"AppConfig Create Hosted Configuration Version","description":"Create a new hosted configuration version for an AppConfig configuration profile","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the configuration profile"},"configurationProfileId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration profile ID to add the version to"},"content":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration content (e.g., a JSON or YAML document)"},"contentType":{"type":"string","required":true,"visibility":"user-or-llm","description":"Content type of the configuration (e.g., application/json, text/plain)"},"description":{"type":"string","required":false,"visibility":"user-or-llm","description":"Description of the configuration version"},"latestVersionNumber":{"type":"number","required":false,"visibility":"user-or-llm","description":"The version number of the latest version, used for optimistic concurrency"},"versionLabel":{"type":"string","required":false,"visibility":"user-or-llm","description":"A user-defined label for the configuration version"}},"hostedApiKey":"none"},"appconfig_delete_application":{"id":"appconfig_delete_application","name":"AppConfig Delete Application","description":"Delete an AWS AppConfig application","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID to delete"}},"hostedApiKey":"none"},"appconfig_delete_configuration_profile":{"id":"appconfig_delete_configuration_profile","name":"AppConfig Delete Configuration Profile","description":"Delete an AWS AppConfig configuration profile","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the configuration profile"},"configurationProfileId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration profile ID to delete"}},"hostedApiKey":"none"},"appconfig_delete_environment":{"id":"appconfig_delete_environment","name":"AppConfig Delete Environment","description":"Delete an AWS AppConfig environment","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the environment"},"environmentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The environment ID to delete"}},"hostedApiKey":"none"},"appconfig_delete_hosted_configuration_version":{"id":"appconfig_delete_hosted_configuration_version","name":"AppConfig Delete Hosted Configuration Version","description":"Delete a specific hosted configuration version from an AppConfig profile","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the configuration profile"},"configurationProfileId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration profile ID that owns the version"},"versionNumber":{"type":"number","required":true,"visibility":"user-or-llm","description":"The version number to delete"}},"hostedApiKey":"none"},"appconfig_get_application":{"id":"appconfig_get_application","name":"AppConfig Get Application","description":"Get details about a single AWS AppConfig application","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID to retrieve"}},"hostedApiKey":"none"},"appconfig_get_configuration":{"id":"appconfig_get_configuration","name":"AppConfig Get Configuration","description":"Retrieve the latest deployed configuration for an AppConfig application, environment, and profile","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID or name to retrieve configuration for"},"environmentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The environment ID or name to retrieve configuration for"},"configurationProfileId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration profile ID or name to retrieve"}},"hostedApiKey":"none"},"appconfig_get_configuration_profile":{"id":"appconfig_get_configuration_profile","name":"AppConfig Get Configuration Profile","description":"Get details about a single AWS AppConfig configuration profile","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the configuration profile"},"configurationProfileId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration profile ID to retrieve"}},"hostedApiKey":"none"},"appconfig_get_deployment":{"id":"appconfig_get_deployment","name":"AppConfig Get Deployment","description":"Get details about a specific AWS AppConfig deployment","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID of the deployment"},"environmentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The environment ID of the deployment"},"deploymentNumber":{"type":"number","required":true,"visibility":"user-or-llm","description":"The sequence number of the deployment"}},"hostedApiKey":"none"},"appconfig_get_environment":{"id":"appconfig_get_environment","name":"AppConfig Get Environment","description":"Get details about a single AWS AppConfig environment","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the environment"},"environmentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The environment ID to retrieve"}},"hostedApiKey":"none"},"appconfig_get_hosted_configuration_version":{"id":"appconfig_get_hosted_configuration_version","name":"AppConfig Get Hosted Configuration Version","description":"Retrieve a specific hosted configuration version from an AppConfig profile","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the configuration profile"},"configurationProfileId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration profile ID to read the version from"},"versionNumber":{"type":"number","required":true,"visibility":"user-or-llm","description":"The version number to retrieve"}},"hostedApiKey":"none"},"appconfig_list_applications":{"id":"appconfig_list_applications","name":"AppConfig List Applications","description":"List applications in AWS AppConfig","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"maxResults":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of applications to return (1-50)"},"nextToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token from a previous response"}},"hostedApiKey":"none"},"appconfig_list_configuration_profiles":{"id":"appconfig_list_configuration_profiles","name":"AppConfig List Configuration Profiles","description":"List configuration profiles for an AWS AppConfig application","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the configuration profiles"},"maxResults":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of configuration profiles to return (1-50)"},"nextToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token from a previous response"}},"hostedApiKey":"none"},"appconfig_list_deployment_strategies":{"id":"appconfig_list_deployment_strategies","name":"AppConfig List Deployment Strategies","description":"List deployment strategies available in AWS AppConfig","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"maxResults":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of deployment strategies to return (1-50)"},"nextToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token from a previous response"}},"hostedApiKey":"none"},"appconfig_list_deployments":{"id":"appconfig_list_deployments","name":"AppConfig List Deployments","description":"List deployments for an AWS AppConfig environment","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID of the deployments"},"environmentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The environment ID of the deployments"},"maxResults":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of deployments to return (1-50)"},"nextToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token from a previous response"}},"hostedApiKey":"none"},"appconfig_list_environments":{"id":"appconfig_list_environments","name":"AppConfig List Environments","description":"List environments for an AWS AppConfig application","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the environments"},"maxResults":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of environments to return (1-50)"},"nextToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token from a previous response"}},"hostedApiKey":"none"},"appconfig_list_hosted_configuration_versions":{"id":"appconfig_list_hosted_configuration_versions","name":"AppConfig List Hosted Configuration Versions","description":"List hosted configuration versions for an AWS AppConfig configuration profile","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the configuration profile"},"configurationProfileId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration profile ID to list versions for"},"maxResults":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of versions to return (1-50)"},"nextToken":{"type":"string","required":false,"visibility":"user-or-llm","description":"Pagination token from a previous response"}},"hostedApiKey":"none"},"appconfig_start_deployment":{"id":"appconfig_start_deployment","name":"AppConfig Start Deployment","description":"Start deploying a configuration version to an AWS AppConfig environment","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID to deploy in"},"environmentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The environment ID to deploy to"},"deploymentStrategyId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The deployment strategy ID to use"},"configurationProfileId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration profile ID to deploy"},"configurationVersion":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration version to deploy"},"description":{"type":"string","required":false,"visibility":"user-or-llm","description":"Description of the deployment"}},"hostedApiKey":"none"},"appconfig_stop_deployment":{"id":"appconfig_stop_deployment","name":"AppConfig Stop Deployment","description":"Stop an in-progress AWS AppConfig deployment","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID of the deployment"},"environmentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The environment ID of the deployment"},"deploymentNumber":{"type":"number","required":true,"visibility":"user-or-llm","description":"The sequence number of the deployment to stop"}},"hostedApiKey":"none"},"appconfig_update_application":{"id":"appconfig_update_application","name":"AppConfig Update Application","description":"Update the name or description of an AWS AppConfig application","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID to update"},"name":{"type":"string","required":false,"visibility":"user-or-llm","description":"New name for the application"},"description":{"type":"string","required":false,"visibility":"user-or-llm","description":"New description for the application"}},"hostedApiKey":"none"},"appconfig_update_configuration_profile":{"id":"appconfig_update_configuration_profile","name":"AppConfig Update Configuration Profile","description":"Update the name, description, or retrieval role of an AppConfig configuration profile","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the configuration profile"},"configurationProfileId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The configuration profile ID to update"},"name":{"type":"string","required":false,"visibility":"user-or-llm","description":"New name for the configuration profile"},"description":{"type":"string","required":false,"visibility":"user-or-llm","description":"New description for the configuration profile"},"retrievalRoleArn":{"type":"string","required":false,"visibility":"user-or-llm","description":"New ARN of the IAM role used to retrieve the configuration"}},"hostedApiKey":"none"},"appconfig_update_environment":{"id":"appconfig_update_environment","name":"AppConfig Update Environment","description":"Update the name or description of an AWS AppConfig environment","version":"1.0","params":{"region":{"type":"string","required":true,"visibility":"user-only","description":"AWS region (e.g., us-east-1)"},"accessKeyId":{"type":"string","required":true,"visibility":"user-only","description":"AWS access key ID"},"secretAccessKey":{"type":"string","required":true,"visibility":"user-only","description":"AWS secret access key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The application ID that owns the environment"},"environmentId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The environment ID to update"},"name":{"type":"string","required":false,"visibility":"user-or-llm","description":"New name for the environment"},"description":{"type":"string","required":false,"visibility":"user-or-llm","description":"New description for the environment"}},"hostedApiKey":"none"},"arxiv_get_author_papers":{"id":"arxiv_get_author_papers","name":"ArXiv Get Author Papers","description":"Search for papers by a specific author on ArXiv.","version":"1.0.0","params":{"authorName":{"type":"string","required":true,"visibility":"user-or-llm","description":"Author name to search for"},"maxResults":{"type":"number","required":false,"visibility":"user-only","description":"Maximum number of results to return (default: 10, max: 2000)"}},"hostedApiKey":"none"},"arxiv_get_paper":{"id":"arxiv_get_paper","name":"ArXiv Get Paper","description":"Get detailed information about a specific ArXiv paper by its ID.","version":"1.0.0","params":{"paperId":{"type":"string","required":true,"visibility":"user-or-llm","description":"ArXiv paper ID (e.g., \\"1706.03762\\")"}},"hostedApiKey":"none"},"arxiv_search":{"id":"arxiv_search","name":"ArXiv Search","description":"Search for academic papers on ArXiv by keywords, authors, titles, or other fields.","version":"1.0.0","params":{"searchQuery":{"type":"string","required":true,"visibility":"user-or-llm","description":"The search query to execute"},"searchField":{"type":"string","required":false,"visibility":"user-only","description":"Field to search in: all, ti (title), au (author), abs (abstract), co (comment), jr (journal), cat (category), rn (report number)"},"maxResults":{"type":"number","required":false,"visibility":"user-only","description":"Maximum number of results to return (default: 10, max: 2000)"},"sortBy":{"type":"string","required":false,"visibility":"user-only","description":"Sort by: relevance, lastUpdatedDate, submittedDate (default: relevance)"},"sortOrder":{"type":"string","required":false,"visibility":"user-only","description":"Sort order: ascending, descending (default: descending)"}},"hostedApiKey":"none"},"asana_add_comment":{"id":"asana_add_comment","name":"Asana Add Comment","description":"Add a comment (story) to an Asana task","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"taskGid":{"type":"string","required":true,"visibility":"user-or-llm","description":"Asana task GID (numeric string)"},"text":{"type":"string","required":true,"visibility":"user-or-llm","description":"The text content of the comment"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_add_followers":{"id":"asana_add_followers","name":"Asana Add Followers","description":"Add one or more followers to an Asana task","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"taskGid":{"type":"string","required":true,"visibility":"user-or-llm","description":"GID of the Asana task (numeric string)"},"followers":{"type":"array","required":true,"visibility":"user-or-llm","description":"Array of user GIDs to add as followers to the task"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_create_project":{"id":"asana_create_project","name":"Asana Create Project","description":"Create a new project in an Asana workspace","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"workspace":{"type":"string","required":true,"visibility":"user-or-llm","description":"Asana workspace GID (numeric string) where the project will be created"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the project"},"notes":{"type":"string","required":false,"visibility":"user-or-llm","description":"Notes or description for the project"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_create_section":{"id":"asana_create_section","name":"Asana Create Section","description":"Create a new section in an Asana project","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"projectGid":{"type":"string","required":true,"visibility":"user-or-llm","description":"GID of the Asana project (numeric string) to add the section to"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the section"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_create_subtask":{"id":"asana_create_subtask","name":"Asana Create Subtask","description":"Create a subtask under an existing Asana task","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"taskGid":{"type":"string","required":true,"visibility":"user-or-llm","description":"GID of the parent Asana task (numeric string)"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the subtask"},"notes":{"type":"string","required":false,"visibility":"user-or-llm","description":"Notes or description for the subtask"},"assignee":{"type":"string","required":false,"visibility":"user-or-llm","description":"User GID to assign the subtask to"},"due_on":{"type":"string","required":false,"visibility":"user-or-llm","description":"Due date in YYYY-MM-DD format"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_create_task":{"id":"asana_create_task","name":"Asana Create Task","description":"Create a new task in Asana","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"workspace":{"type":"string","required":true,"visibility":"user-or-llm","description":"Asana workspace GID (numeric string) where the task will be created"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"Name of the task"},"notes":{"type":"string","required":false,"visibility":"user-or-llm","description":"Notes or description for the task"},"assignee":{"type":"string","required":false,"visibility":"user-or-llm","description":"User GID to assign the task to"},"due_on":{"type":"string","required":false,"visibility":"user-or-llm","description":"Due date in YYYY-MM-DD format"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_delete_task":{"id":"asana_delete_task","name":"Asana Delete Task","description":"Delete an Asana task by its GID (moves it to the trash)","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"taskGid":{"type":"string","required":true,"visibility":"user-or-llm","description":"GID of the Asana task to delete (numeric string)"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_get_project":{"id":"asana_get_project","name":"Asana Get Project","description":"Retrieve a single Asana project by its GID","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"projectGid":{"type":"string","required":true,"visibility":"user-or-llm","description":"Asana project GID (numeric string) to retrieve"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_get_projects":{"id":"asana_get_projects","name":"Asana Get Projects","description":"Retrieve all projects from an Asana workspace","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"workspace":{"type":"string","required":true,"visibility":"user-or-llm","description":"Asana workspace GID (numeric string) to retrieve projects from"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_get_task":{"id":"asana_get_task","name":"Asana Get Task","description":"Retrieve a single task by GID or get multiple tasks with filters","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"taskGid":{"type":"string","required":false,"visibility":"user-or-llm","description":"The globally unique identifier (GID) of the task. If not provided, will get multiple tasks."},"workspace":{"type":"string","required":false,"visibility":"user-or-llm","description":"Asana workspace GID (numeric string) to filter tasks (required when not using taskGid)"},"project":{"type":"string","required":false,"visibility":"user-or-llm","description":"Asana project GID (numeric string) to filter tasks"},"limit":{"type":"number","required":false,"visibility":"user-or-llm","description":"Maximum number of tasks to return (default: 50)"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_list_sections":{"id":"asana_list_sections","name":"Asana List Sections","description":"List all sections in an Asana project","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"projectGid":{"type":"string","required":true,"visibility":"user-or-llm","description":"GID of the Asana project (numeric string) to list sections from"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_list_workspaces":{"id":"asana_list_workspaces","name":"Asana List Workspaces","description":"List all Asana workspaces and organizations the authenticated user belongs to","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_search_tasks":{"id":"asana_search_tasks","name":"Asana Search Tasks","description":"Search for tasks in an Asana workspace","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"workspace":{"type":"string","required":true,"visibility":"user-or-llm","description":"Asana workspace GID (numeric string) to search tasks in"},"text":{"type":"string","required":false,"visibility":"user-or-llm","description":"Text to search for in task names"},"assignee":{"type":"string","required":false,"visibility":"user-or-llm","description":"Filter tasks by assignee user GID"},"projects":{"type":"array","required":false,"visibility":"user-or-llm","description":"Array of Asana project GIDs (numeric strings) to filter tasks by"},"completed":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Filter by completion status"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"asana_update_task":{"id":"asana_update_task","name":"Asana Update Task","description":"Update an existing task in Asana","version":"1.0.0","params":{"accessToken":{"type":"string","required":true,"visibility":"hidden","description":"OAuth access token for Asana"},"taskGid":{"type":"string","required":true,"visibility":"user-or-llm","description":"Asana task GID (numeric string) of the task to update"},"name":{"type":"string","required":false,"visibility":"user-or-llm","description":"Updated name for the task"},"notes":{"type":"string","required":false,"visibility":"user-or-llm","description":"Updated notes or description for the task"},"assignee":{"type":"string","required":false,"visibility":"user-or-llm","description":"Updated assignee user GID"},"completed":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Mark task as completed or not completed"},"due_on":{"type":"string","required":false,"visibility":"user-or-llm","description":"Updated due date in YYYY-MM-DD format"}},"oauth":{"required":true,"provider":"asana"},"hostedApiKey":"none"},"ashby_add_candidate_tag":{"id":"ashby_add_candidate_tag","name":"Ashby Add Candidate Tag","description":"Adds a tag to a candidate in Ashby and returns the updated candidate.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ashby API Key"},"candidateId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The UUID of the candidate to add the tag to"},"tagId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The UUID of the tag to add"}},"hostedApiKey":"none"},"ashby_anonymize_candidate":{"id":"ashby_anonymize_candidate","name":"Ashby Anonymize Candidate","description":"Strips personally identifiable information from a candidate in Ashby. This does not delete the candidate - the record and its applications remain, with the PII removed. Ashby exposes no candidate deletion endpoint; true deletion is UI-only, restricted by role, and limited to a 10-day window. Requires the candidatesWrite permission.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ashby API Key"},"candidateId":{"type":"string","required":true,"visibility":"user-or-llm","description":"UUID of the candidate to anonymize"}},"hostedApiKey":"none"},"ashby_change_application_source":{"id":"ashby_change_application_source","name":"Ashby Change Application Source","description":"Changes the source attributed to an existing application, so programmatically created applications report correctly on the recruiting side. Requires the candidatesWrite permission.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ashby API Key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"UUID of the application whose source should change"},"sourceId":{"type":"string","required":false,"visibility":"user-or-llm","description":"UUID of the source to attribute the application to, as returned by List Sources. Omit only when unsetSource is true."},"unsetSource":{"type":"boolean","required":false,"visibility":"user-or-llm","description":"Set true to deliberately clear the application source. Required to unset, so that a missing or empty sourceId cannot wipe attribution by accident."}},"hostedApiKey":"none"},"ashby_change_application_stage":{"id":"ashby_change_application_stage","name":"Ashby Change Application Stage","description":"Moves an application to a different interview stage. Requires an archive reason when moving to an Archived stage.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ashby API Key"},"applicationId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The UUID of the application to update the stage of"},"interviewStageId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The UUID of the interview stage to move the application to"},"archiveReasonId":{"type":"string","required":false,"visibility":"user-or-llm","description":"Archive reason UUID. Required when moving to an Archived stage, ignored otherwise"}},"hostedApiKey":"none"},"ashby_create_application":{"id":"ashby_create_application","name":"Ashby Create Application","description":"Creates a new application for a candidate on a job. Optionally specify interview plan, stage, source, and credited user.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ashby API Key"},"candidateId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The UUID of the candidate to consider for the job"},"jobId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The UUID of the job to consider the candidate for"},"interviewPlanId":{"type":"string","required":false,"visibility":"user-or-llm","description":"UUID of the interview plan to use (defaults to the job default plan)"},"interviewStageId":{"type":"string","required":false,"visibility":"user-or-llm","description":"UUID of the interview stage to place the application in (defaults to first Lead stage)"},"sourceId":{"type":"string","required":false,"visibility":"user-or-llm","description":"UUID of the source to set on the application"},"creditedToUserId":{"type":"string","required":false,"visibility":"user-or-llm","description":"UUID of the user the application is credited to"},"createdAt":{"type":"string","required":false,"visibility":"user-or-llm","description":"ISO 8601 timestamp to set as the application creation date (defaults to now)"}},"hostedApiKey":"none"},"ashby_create_candidate":{"id":"ashby_create_candidate","name":"Ashby Create Candidate","description":"Creates a new candidate record in Ashby.","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ashby API Key"},"name":{"type":"string","required":true,"visibility":"user-or-llm","description":"The candidate full name"},"email":{"type":"string","required":false,"visibility":"user-or-llm","description":"Primary email address for the candidate"},"phoneNumber":{"type":"string","required":false,"visibility":"user-or-llm","description":"Primary phone number for the candidate"},"linkedInUrl":{"type":"string","required":false,"visibility":"user-or-llm","description":"LinkedIn profile URL"},"githubUrl":{"type":"string","required":false,"visibility":"user-or-llm","description":"GitHub profile URL"},"website":{"type":"string","required":false,"visibility":"user-or-llm","description":"Personal website URL"},"sourceId":{"type":"string","required":false,"visibility":"user-or-llm","description":"UUID of the source to attribute the candidate to"},"creditedToUserId":{"type":"string","required":false,"visibility":"user-or-llm","description":"UUID of the Ashby user to credit with sourcing this candidate"},"createdAt":{"type":"string","required":false,"visibility":"user-or-llm","description":"Backdated creation timestamp in ISO 8601 (e.g. 2024-01-01T00:00:00Z). Defaults to now."},"alternateEmailAddresses":{"type":"json","required":false,"visibility":"user-or-llm","description":"Array of additional email address strings to add to the candidate, e.g. [\\"a@x.com\\",\\"b@y.com\\"]"}},"hostedApiKey":"none"},"ashby_create_note":{"id":"ashby_create_note","name":"Ashby Create Note","description":"Creates a note on a candidate in Ashby. Supports plain text and HTML content (bold, italic, underline, links, lists, code).","version":"1.0.0","params":{"apiKey":{"type":"string","required":true,"visibility":"user-only","description":"Ashby API Key"},"candidateId":{"type":"string","required":true,"visibility":"user-or-llm","description":"The UUID of the candidate to add the note to"},"note":{"type":"string","required":true,"visibility":"user-or-llm","description":"The note content. If noteType is text/html, supports: , , , ,