jaz-clio 5.2.1 → 5.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/skills/api/SKILL.md +1 -1
- package/assets/skills/cli/SKILL.md +1 -1
- package/assets/skills/conversion/SKILL.md +1 -1
- package/assets/skills/jobs/SKILL.md +1 -1
- package/assets/skills/practice/SKILL.md +1 -1
- package/assets/skills/transaction-recipes/SKILL.md +1 -1
- package/cli.mjs +18 -3
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -760,8 +760,21 @@ WHEN NOT TO USE: receiving money from external parties (use create_cash_in) or p
|
|
|
760
760
|
- cashOut = source account (money leaves), cashIn = destination account (money arrives).
|
|
761
761
|
- Each side needs accountResourceId + amount.
|
|
762
762
|
- reference is auto-generated if not provided.
|
|
763
|
-
- Do NOT send currency/exchangeRate \u2014 derived server-side from bank account currencies.`,params:{reference:{type:"string",description:"Reference number"},valueDate:{type:"string",description:"Date (YYYY-MM-DD)"},cashOut:{type:"object",properties:{accountResourceId:{type:"string",description:"Source bank account resourceId"},amount:{type:"number",description:"Transfer amount"}},required:["accountResourceId","amount"]},cashIn:{type:"object",properties:{accountResourceId:{type:"string",description:"Destination bank account resourceId"},amount:{type:"number",description:"Transfer amount"}},required:["accountResourceId","amount"]},tags:{type:"array",items:{type:"string"},description:"Tags (string array)"},saveAsDraft:{type:"boolean",description:"Save as draft (default true)"}},required:["valueDate","cashOut","cashIn"],group:"cash_transfers",readOnly:!1,searchHint:"create cash transfer between bank accounts",execute:async(e,t)=>{let r={...t};return r.reference||(r.reference=`CT-${Date.now()}`),Of(e.client,r)}},mn("delete_cash_in","Delete (void) a cash-in entry. Uses parentEntityResourceId from create response.","cash_entries",(e,t)=>xs(e,t),"delete void a cash in receipt entry"),mn("delete_cash_out","Delete (void) a cash-out entry. Uses parentEntityResourceId from create response.","cash_entries",(e,t)=>xs(e,t),"delete void a cash out payment entry"),mn("delete_cash_transfer","Delete (void) a cash transfer. Uses parentEntityResourceId from create response.","cash_transfers",(e,t)=>xs(e,t),"delete void a cash transfer between accounts"),yt("list_scheduled_invoices","List scheduled (recurring) invoices. Paginated.","schedulers",(e,t,r)=>sv(e,{limit:r,offset:t}),"list recurring scheduled invoices subscriptions"),yt("list_scheduled_bills","List scheduled (recurring) bills. Paginated.","schedulers",(e,t,r)=>av(e,{limit:r,offset:t}),"list recurring scheduled bills subscriptions"),yt("list_scheduled_journals","List scheduled (recurring) journals. Paginated.","schedulers",(e,t,r)=>cv(e,{limit:r,offset:t}),"list recurring scheduled journal entries"),{name:"get_bank_account",description:"Get full bank account details by resourceId.",params:{resourceId:{type:"string",description:"Bank account resourceId"}},required:["resourceId"],group:"bank",readOnly:!0,searchHint:"get bank account details balance by id",isConcurrencySafe:!0,maxResultSizeChars:2e4,execute:async(e,t)=>Hc(e.client,t.resourceId)},Nt({name:"search_bank_records",description:"Search bank records for a specific account. Filter by status, date, description, payer, reference, amount range. Call list_bank_accounts first to get accountResourceId.",group:"bank",fields:Wp,defaults:Zp,fetcher:Cy,pathParam:"accountResourceId",pathParamDescription:"Bank account resourceId (UUID). Call list_bank_accounts first.",searchHint:"find bank records by status date amount description"}),Nt({name:"search_cashflow_transactions",description:"Search cashflow transactions (unified ledger). Filter by type, direction (PAYIN/PAYOUT), status, date, reference, account.",group:"cashflow",fields:ki,defaults:Fi,fetcher:ws,searchHint:"find cashflow transactions by type direction status"}),yt("list_bookmarks","List organization bookmarks (saved values/settings).","bookmarks",(e,t,r)=>Z0(e,{limit:r,offset:t}),"list saved bookmarks reports shortcuts"),{name:"get_bookmark",description:"Get a bookmark by resourceId.",params:{resourceId:{type:"string",description:"Bookmark resourceId"}},required:["resourceId"],group:"bookmarks",readOnly:!0,searchHint:"get bookmark saved report details",isConcurrencySafe:!0,maxResultSizeChars:2e4,execute:async(e,t)=>K0(e.client,t.resourceId)},{name:"create_bookmarks",description:"Create one or more bookmarks. categoryCode must be one of: AUDIT_AND_ASSURANCE, BANKING_AND_FINANCE, BUDGETS_AND_CONTROLS, EMPLOYEES_AND_PAYROLL, EXTERNAL_DOCUMENTS, GENERAL_INFORMATION, OWNERS_AND_DIRECTORS, TAXATION_AND_COMPLIANCE, WORKFLOWS_AND_PROCESSES.",params:{items:{type:"array",items:{type:"object",properties:{name:{type:"string",description:"Bookmark name"},value:{type:"string",description:"Bookmark value"},categoryCode:{type:"string",description:"Category code (e.g., GENERAL_INFORMATION)"},datatypeCode:{type:"string",description:"Datatype code (default: TEXT)"}},required:["name","value","categoryCode","datatypeCode"]},description:"Bookmarks to create"}},required:["items"],group:"bookmarks",readOnly:!1,searchHint:"create new bookmark saved report shortcut",execute:async(e,t)=>Uf(e.client,t.items)},{name:"update_bookmark",description:"Update an existing bookmark (name, value, or category). Use when modifying a previously created bookmark.",params:{resourceId:{type:"string",description:"Bookmark resourceId"},name:{type:"string",description:"New name"},value:{type:"string",description:"New value"},categoryCode:{type:"string",description:"New category code"}},required:["resourceId"],group:"bookmarks",readOnly:!1,searchHint:"update bookmark name or configuration",execute:async(e,t)=>{let{resourceId:r,...n}=t;return X0(e.client,r,n)}},yt("list_org_users","List organization users (team members). Returns name, email, roles.","org_users",(e,t,r)=>Q0(e,{limit:r,offset:t}),"list organization users team members"),Nt({name:"search_org_users",description:"Search organization users by name, email, role, status. For OR search (name or email), use filter param.",group:"org_users",fields:Df,defaults:bf,fetcher:ev,searchHint:"find organization users by name email role status"}),{name:"invite_org_user",description:"Invite a new user to the organization.",params:{firstName:{type:"string",description:"First name"},lastName:{type:"string",description:"Last name"},email:{type:"string",description:"Email address"},moduleRoles:{type:"array",items:{type:"object",properties:{moduleName:{type:"string",description:"Module name: ORGANIZATION, USER_MANAGEMENT, ACCOUNTING, SALES, PURCHASES, REPORTS, or FIXED_ASSET"},roleCode:{type:"string",description:"Role code: ADMIN, PREPARER, MEMBER, or NO_ACCESS"}},required:["moduleName","roleCode"]},description:"Module role assignments"}},required:["firstName","lastName","email","moduleRoles"],group:"org_users",readOnly:!1,searchHint:"invite new user to join organization team",execute:async(e,t)=>Mu(e.client,t)},{name:"update_org_user",description:"Update an organization user's module roles.",params:{resourceId:{type:"string",description:"Org user resourceId"},moduleRoles:{type:"array",items:{type:"object",properties:{moduleName:{type:"string",description:"Module name: ORGANIZATION, USER_MANAGEMENT, ACCOUNTING, SALES, PURCHASES, REPORTS, or FIXED_ASSET"},roleCode:{type:"string",description:"Role code: ADMIN, PREPARER, MEMBER, or NO_ACCESS"}},required:["moduleName","roleCode"]}}},required:["resourceId","moduleRoles"],group:"org_users",readOnly:!1,searchHint:"update organization user role permissions",execute:async(e,t)=>tv(e.client,t.resourceId,{moduleRoles:t.moduleRoles})},{name:"remove_org_user",description:"Remove a user from the organization.",params:{resourceId:{type:"string",description:"Org user resourceId"}},required:["resourceId"],group:"org_users",readOnly:!1,searchHint:"remove user from organization team",isDestructive:!0,execute:async(e,t)=>rv(e.client,t.resourceId)},{name:"list_payments",description:"List recent payments across all transaction types. Paginated.",params:{...O$},required:[],group:"payments",readOnly:!0,searchHint:"list payment records transactions with pagination",isConcurrencySafe:!0,maxResultSizeChars:5e4,execute:async(e,t)=>{let r=t.limit,n=t.offset;return l0(e.client,{limit:r??100,offset:n??0})}},Nt({name:"search_payments",description:"Search payments by type, direction (PAYIN/PAYOUT), method, date, reference, account.",group:"payments",fields:Vp,defaults:Hp,fetcher:$f,searchHint:"find payments by type direction method date account"}),{name:"download_export",description:`
|
|
764
|
-
|
|
763
|
+
- Do NOT send currency/exchangeRate \u2014 derived server-side from bank account currencies.`,params:{reference:{type:"string",description:"Reference number"},valueDate:{type:"string",description:"Date (YYYY-MM-DD)"},cashOut:{type:"object",properties:{accountResourceId:{type:"string",description:"Source bank account resourceId"},amount:{type:"number",description:"Transfer amount"}},required:["accountResourceId","amount"]},cashIn:{type:"object",properties:{accountResourceId:{type:"string",description:"Destination bank account resourceId"},amount:{type:"number",description:"Transfer amount"}},required:["accountResourceId","amount"]},tags:{type:"array",items:{type:"string"},description:"Tags (string array)"},saveAsDraft:{type:"boolean",description:"Save as draft (default true)"}},required:["valueDate","cashOut","cashIn"],group:"cash_transfers",readOnly:!1,searchHint:"create cash transfer between bank accounts",execute:async(e,t)=>{let r={...t};return r.reference||(r.reference=`CT-${Date.now()}`),Of(e.client,r)}},mn("delete_cash_in","Delete (void) a cash-in entry. Uses parentEntityResourceId from create response.","cash_entries",(e,t)=>xs(e,t),"delete void a cash in receipt entry"),mn("delete_cash_out","Delete (void) a cash-out entry. Uses parentEntityResourceId from create response.","cash_entries",(e,t)=>xs(e,t),"delete void a cash out payment entry"),mn("delete_cash_transfer","Delete (void) a cash transfer. Uses parentEntityResourceId from create response.","cash_transfers",(e,t)=>xs(e,t),"delete void a cash transfer between accounts"),yt("list_scheduled_invoices","List scheduled (recurring) invoices. Paginated.","schedulers",(e,t,r)=>sv(e,{limit:r,offset:t}),"list recurring scheduled invoices subscriptions"),yt("list_scheduled_bills","List scheduled (recurring) bills. Paginated.","schedulers",(e,t,r)=>av(e,{limit:r,offset:t}),"list recurring scheduled bills subscriptions"),yt("list_scheduled_journals","List scheduled (recurring) journals. Paginated.","schedulers",(e,t,r)=>cv(e,{limit:r,offset:t}),"list recurring scheduled journal entries"),{name:"get_bank_account",description:"Get full bank account details by resourceId.",params:{resourceId:{type:"string",description:"Bank account resourceId"}},required:["resourceId"],group:"bank",readOnly:!0,searchHint:"get bank account details balance by id",isConcurrencySafe:!0,maxResultSizeChars:2e4,execute:async(e,t)=>Hc(e.client,t.resourceId)},Nt({name:"search_bank_records",description:"Search bank records for a specific account. Filter by status, date, description, payer, reference, amount range. Call list_bank_accounts first to get accountResourceId.",group:"bank",fields:Wp,defaults:Zp,fetcher:Cy,pathParam:"accountResourceId",pathParamDescription:"Bank account resourceId (UUID). Call list_bank_accounts first.",searchHint:"find bank records by status date amount description"}),Nt({name:"search_cashflow_transactions",description:"Search cashflow transactions (unified ledger). Filter by type, direction (PAYIN/PAYOUT), status, date, reference, account.",group:"cashflow",fields:ki,defaults:Fi,fetcher:ws,searchHint:"find cashflow transactions by type direction status"}),yt("list_bookmarks","List organization bookmarks (saved values/settings).","bookmarks",(e,t,r)=>Z0(e,{limit:r,offset:t}),"list saved bookmarks reports shortcuts"),{name:"get_bookmark",description:"Get a bookmark by resourceId.",params:{resourceId:{type:"string",description:"Bookmark resourceId"}},required:["resourceId"],group:"bookmarks",readOnly:!0,searchHint:"get bookmark saved report details",isConcurrencySafe:!0,maxResultSizeChars:2e4,execute:async(e,t)=>K0(e.client,t.resourceId)},{name:"create_bookmarks",description:"Create one or more bookmarks. categoryCode must be one of: AUDIT_AND_ASSURANCE, BANKING_AND_FINANCE, BUDGETS_AND_CONTROLS, EMPLOYEES_AND_PAYROLL, EXTERNAL_DOCUMENTS, GENERAL_INFORMATION, OWNERS_AND_DIRECTORS, TAXATION_AND_COMPLIANCE, WORKFLOWS_AND_PROCESSES.",params:{items:{type:"array",items:{type:"object",properties:{name:{type:"string",description:"Bookmark name"},value:{type:"string",description:"Bookmark value"},categoryCode:{type:"string",description:"Category code (e.g., GENERAL_INFORMATION)"},datatypeCode:{type:"string",description:"Datatype code (default: TEXT)"}},required:["name","value","categoryCode","datatypeCode"]},description:"Bookmarks to create"}},required:["items"],group:"bookmarks",readOnly:!1,searchHint:"create new bookmark saved report shortcut",execute:async(e,t)=>Uf(e.client,t.items)},{name:"update_bookmark",description:"Update an existing bookmark (name, value, or category). Use when modifying a previously created bookmark.",params:{resourceId:{type:"string",description:"Bookmark resourceId"},name:{type:"string",description:"New name"},value:{type:"string",description:"New value"},categoryCode:{type:"string",description:"New category code"}},required:["resourceId"],group:"bookmarks",readOnly:!1,searchHint:"update bookmark name or configuration",execute:async(e,t)=>{let{resourceId:r,...n}=t;return X0(e.client,r,n)}},yt("list_org_users","List organization users (team members). Returns name, email, roles.","org_users",(e,t,r)=>Q0(e,{limit:r,offset:t}),"list organization users team members"),Nt({name:"search_org_users",description:"Search organization users by name, email, role, status. For OR search (name or email), use filter param.",group:"org_users",fields:Df,defaults:bf,fetcher:ev,searchHint:"find organization users by name email role status"}),{name:"invite_org_user",description:"Invite a new user to the organization.",params:{firstName:{type:"string",description:"First name"},lastName:{type:"string",description:"Last name"},email:{type:"string",description:"Email address"},moduleRoles:{type:"array",items:{type:"object",properties:{moduleName:{type:"string",description:"Module name: ORGANIZATION, USER_MANAGEMENT, ACCOUNTING, SALES, PURCHASES, REPORTS, or FIXED_ASSET"},roleCode:{type:"string",description:"Role code: ADMIN, PREPARER, MEMBER, or NO_ACCESS"}},required:["moduleName","roleCode"]},description:"Module role assignments"}},required:["firstName","lastName","email","moduleRoles"],group:"org_users",readOnly:!1,searchHint:"invite new user to join organization team",execute:async(e,t)=>Mu(e.client,t)},{name:"update_org_user",description:"Update an organization user's module roles.",params:{resourceId:{type:"string",description:"Org user resourceId"},moduleRoles:{type:"array",items:{type:"object",properties:{moduleName:{type:"string",description:"Module name: ORGANIZATION, USER_MANAGEMENT, ACCOUNTING, SALES, PURCHASES, REPORTS, or FIXED_ASSET"},roleCode:{type:"string",description:"Role code: ADMIN, PREPARER, MEMBER, or NO_ACCESS"}},required:["moduleName","roleCode"]}}},required:["resourceId","moduleRoles"],group:"org_users",readOnly:!1,searchHint:"update organization user role permissions",execute:async(e,t)=>tv(e.client,t.resourceId,{moduleRoles:t.moduleRoles})},{name:"remove_org_user",description:"Remove a user from the organization.",params:{resourceId:{type:"string",description:"Org user resourceId"}},required:["resourceId"],group:"org_users",readOnly:!1,searchHint:"remove user from organization team",isDestructive:!0,execute:async(e,t)=>rv(e.client,t.resourceId)},{name:"list_payments",description:"List recent payments across all transaction types. Paginated.",params:{...O$},required:[],group:"payments",readOnly:!0,searchHint:"list payment records transactions with pagination",isConcurrencySafe:!0,maxResultSizeChars:5e4,execute:async(e,t)=>{let r=t.limit,n=t.offset;return l0(e.client,{limit:r??100,offset:n??0})}},Nt({name:"search_payments",description:"Search payments by type, direction (PAYIN/PAYOUT), method, date, reference, account.",group:"payments",fields:Vp,defaults:Hp,fetcher:$f,searchHint:"find payments by type direction method date account"}),{name:"download_export",description:`Generate an analytical, financial, or audit report as a downloadable XLSX file. Returns { fileName, fileUrl }.
|
|
764
|
+
|
|
765
|
+
USE THIS TOOL (not export_records) when the user asks for any of:
|
|
766
|
+
- Anomaly detection \u2014 anomalous invoices, anomalous bills, cashflow anomalies (analysis-anomalous-invoices, analysis-anomalous-bills, analysis-cashflow-anomalies)
|
|
767
|
+
- Audit analyses \u2014 GL journal audit, exchange rate audit (analysis-gl-journal-audit, analysis-exchange-rate-audit)
|
|
768
|
+
- Risk analyses \u2014 receivables customer risk, cash expense health (analysis-receivables-customer-risk, analysis-cash-expense-health)
|
|
769
|
+
- Financial statements \u2014 trial balance, balance sheet, P&L, cashflow, general ledger, cash balance (trial-balance, balance-sheet, profit-and-loss, cashflow, general-ledger, cash-balance)
|
|
770
|
+
- Aging \u2014 AR / AP report (ar-report, ap-report)
|
|
771
|
+
- Summaries \u2014 sales, sales-payments, purchase, purchase-payments, customer-revenue, product-sales, periodic-revenue, supplier-expense, product-purchase, periodic-expense, credit-note, sales-cost-margin
|
|
772
|
+
- Inventory movement \u2014 sale, purchase (sale-inventory-movement, purchase-inventory-movement)
|
|
773
|
+
- Statement of account (statement-of-account-export)
|
|
774
|
+
|
|
775
|
+
DO NOT use export_records for these \u2014 that tool is for raw entity dumps (list of invoices/bills/contacts as rows), not for analytical reports.
|
|
776
|
+
|
|
777
|
+
All export types accept startDate / endDate (YYYY-MM-DD), currencyCode, tags, contactResourceId. The fileUrl is pre-signed (~5 min).`,params:{exportType:{type:"string",description:"Export type (see description for full list)"},startDate:{type:"string",description:"Period start (YYYY-MM-DD)"},endDate:{type:"string",description:"Period end (YYYY-MM-DD)"},currencyCode:{type:"string",description:"Currency override"},tags:{type:"array",items:{type:"string"},description:"Filter by tags"},contactResourceId:{type:"string",description:"Filter by contact"}},required:["exportType"],group:"exports",readOnly:!0,searchHint:"download data export report CSV XLSX file. Includes anomaly detection (anomalous invoices, anomalous bills, cashflow anomalies), audit analyses (GL journal audit, exchange rate audit), risk analyses (receivables customer risk, cash expense health), plus standard reports (trial balance, P&L, balance sheet, general ledger, AR/AP, sales/purchase summaries, statement of account).",isConcurrencySafe:!0,execute:async(e,t)=>{let{exportType:r,...n}=t;return Dv(e.client,r,n)}},{name:"plan_recipe",description:`Use this when an agent needs to model an IFRS accounting transaction without writing to the books. Returns a complete schedule plus the journal entries that go with it. No API key needed.
|
|
765
778
|
|
|
766
779
|
Covers: loans, IFRS 16 leases, depreciation (SL/DDB/150DB), FX revaluation, ECL provisions, IAS 37 provisions, fixed deposits, asset disposals, accruals, leave, dividends, prepaids, deferred revenue.
|
|
767
780
|
|
|
@@ -845,7 +858,9 @@ Line item attributes by type:
|
|
|
845
858
|
- Scheduler (sale/purchase/subscription, Pattern C): name, description, sku, unit, unitPrice, quantity, discount, taxProfileResourceId, organizationAccountResourceId, classifierConfig, itemResourceId, withholdingTax (purchase only). Uses arrayIndex (zero-based).
|
|
846
859
|
- Journal/cash-entry: organizationAccountResourceId, amount, description, taxProfileResourceId, classifierConfig
|
|
847
860
|
- Journal-schedule (Pattern D): amount, description, organizationAccountResourceId, taxProfileResourceId, classifierConfig, itemResourceId, unit, quantity, pricePerUnit. Uses lineItemResourceId (UUID).
|
|
848
|
-
Response: { updated: string[], failed: [{ resourceId, error, errorCode }] }. On partial failure (HTTP 207), check failed.length.`,params:{entity:{type:"string",enum:[...fl],description:"Transaction type"},lineItemResourceIds:{type:"array",items:{type:"string"},description:"Line item resourceIds to update (ARAP + accounting entities)"},attributes:{type:"object",description:"Fields to update on all specified line items"},schedulerUpdates:{type:"array",items:{type:"object"},description:"Per-scheduler updates: [{ schedulerResourceId, lineItemUpdates: [{ arrayIndex, ...fields }] }]. EXCEPTION: journal-schedules use lineItemResourceId (UUID) instead of arrayIndex."}},required:["entity"],group:"quick_fix",readOnly:!1,searchHint:"bulk update line item accounts tax profiles",execute:async(e,t)=>{let r=t.entity,n=["sale-schedules","purchase-schedules","subscription-schedules","journal-schedules"].includes(r),o={};if(n){if(!t.schedulerUpdates)throw new Error("schedulerUpdates is required for scheduler entities (sale-schedules, purchase-schedules, subscription-schedules, journal-schedules)");o.schedulerUpdates=t.schedulerUpdates}else{if(!t.lineItemResourceIds)throw new Error("lineItemResourceIds is required for non-scheduler entities");o.lineItemResourceIds=t.lineItemResourceIds,o.attributes=t.attributes??{}}return Zm(e.client,r,o)}},yt("list_nano_classifiers","List nano classifiers (tracking categories). Paginated. Nano classifiers tag line items with structured categories.","nano_classifiers",(e,t,r)=>__(e,{limit:r,offset:t}),"list nano classifiers tracking categories types"),Hn("get_nano_classifier","Get a nano classifier by resourceId. Returns type and all classes.","nano_classifiers",(e,t)=>E_(e,t),"get nano classifier tracking category details"),Nt({name:"search_nano_classifiers",description:"Search nano classifiers (tracking categories) by type name.",group:"nano_classifiers",fields:_f,defaults:Ef,fetcher:C_,searchHint:"find nano classifiers tracking categories by type"}),{name:"create_nano_classifier",description:"Create a nano classifier (tracking category). Provide a type name and list of class names. printable defaults to true (NOTE: printable: false is currently rejected by a server bug \u2014 always use true).",params:{type:{type:"string",description:'Classifier type name (e.g., "Department", "Project")'},classes:{type:"array",items:{type:"string"},description:'Class names: ["Sales", "Marketing", "Engineering"]'},printable:{type:"boolean",description:"Show on printed documents (default: true). NOTE: false is rejected by a server bug."}},required:["type","classes"],group:"nano_classifiers",readOnly:!1,searchHint:"create new nano classifier tracking category",execute:async(e,t)=>Km(e.client,{type:t.type,classes:t.classes,printable:t.printable??!0})},{name:"update_nano_classifier",description:"Update a nano classifier \u2014 change type name, modify classes, or toggle printable.",params:{resourceId:{type:"string",description:"Nano classifier resourceId"},type:{type:"string",description:"New type name"},classes:{type:"array",items:{type:"string"},description:'Updated class names: ["Sales", "Marketing"]'},printable:{type:"boolean",description:"Show on printed documents"}},required:["resourceId"],group:"nano_classifiers",readOnly:!1,searchHint:"update nano classifier classes and settings",execute:async(e,t)=>{let r={};return t.type&&(r.type=t.type),t.classes&&(r.classes=t.classes),t.printable!==void 0&&(r.printable=t.printable),Xm(e.client,t.resourceId,r)}},mn("delete_nano_classifier","Delete a nano classifier.","nano_classifiers",(e,t)=>I_(e,t),"permanently delete a nano classifier type"),{name:"list_invoice_payments",description:"List all payments recorded against an invoice. Returns payment records with amounts, dates, and methods.",params:{resourceId:{type:"string",description:"Invoice resourceId"}},required:["resourceId"],group:"payments",readOnly:!0,searchHint:"list payment records on an invoice",isConcurrencySafe:!0,maxResultSizeChars:5e4,execute:async(e,t)=>Bb(e.client,t.resourceId)},{name:"list_invoice_credits",description:"List all credit notes applied to an invoice.",params:{resourceId:{type:"string",description:"Invoice resourceId"}},required:["resourceId"],group:"payments",readOnly:!0,searchHint:"list credit applications on an invoice",isConcurrencySafe:!0,maxResultSizeChars:5e4,execute:async(e,t)=>Ub(e.client,t.resourceId)},{name:"reverse_invoice_credit",description:"Reverse (unapply) a credit note from an invoice. The credit note becomes UNAPPLIED again.",params:{resourceId:{type:"string",description:"Invoice resourceId"},creditResourceId:{type:"string",description:"Credit application resourceId to reverse"}},required:["resourceId","creditResourceId"],group:"payments",readOnly:!1,searchHint:"reverse a credit note application on invoice",isDestructive:!0,execute:async(e,t)=>(await qb(e.client,t.resourceId,t.creditResourceId),{reversed:!0,invoiceId:t.resourceId,creditId:t.creditResourceId})},{name:"list_bill_payments",description:"List all payments recorded against a bill. Returns payment records with amounts, dates, and methods.",params:{resourceId:{type:"string",description:"Bill resourceId"}},required:["resourceId"],group:"payments",readOnly:!0,searchHint:"list payment records on a bill",isConcurrencySafe:!0,maxResultSizeChars:5e4,execute:async(e,t)=>Oy(e.client,t.resourceId)},{name:"list_bill_credits",description:"List all credit notes applied to a bill.",params:{resourceId:{type:"string",description:"Bill resourceId"}},required:["resourceId"],group:"payments",readOnly:!0,searchHint:"list credit applications on a bill",isConcurrencySafe:!0,maxResultSizeChars:5e4,execute:async(e,t)=>$y(e.client,t.resourceId)},{name:"reverse_bill_credit",description:"Reverse (unapply) a supplier credit note from a bill. The credit note becomes UNAPPLIED again.",params:{resourceId:{type:"string",description:"Bill resourceId"},creditResourceId:{type:"string",description:"Credit application resourceId to reverse"}},required:["resourceId","creditResourceId"],group:"payments",readOnly:!1,searchHint:"reverse a credit note application on bill",isDestructive:!0,execute:async(e,t)=>(await Ny(e.client,t.resourceId,t.creditResourceId),{reversed:!0,billId:t.resourceId,creditId:t.creditResourceId})},Hn("get_scheduled_invoice","Get a scheduled (recurring) invoice by resourceId.","schedulers",(e,t)=>uv(e,t),"get scheduled recurring invoice details"),{name:"update_scheduled_invoice",description:"Update a scheduled invoice \u2014 change schedule settings and/or the invoice template.",params:{resourceId:{type:"string",description:"Scheduled invoice resourceId"},repeat:{type:"string",description:"Recurrence: WEEKLY, MONTHLY, QUARTERLY, YEARLY"},startDate:{type:"string",description:"First occurrence date (YYYY-MM-DD)"},endDate:{type:"string",description:"Last occurrence date (YYYY-MM-DD)"},status:{type:"string",description:"Status: ACTIVE or PAUSED"},invoice:{type:"object",description:"Invoice template: { reference, valueDate, dueDate, contactResourceId, lineItems, currency, tag, saveAsDraft }"}},required:["resourceId"],group:"schedulers",readOnly:!1,searchHint:"update recurring scheduled invoice settings",execute:async(e,t)=>{let r={};return t.repeat&&(r.repeat=t.repeat),t.startDate&&(r.startDate=t.startDate),t.endDate&&(r.endDate=t.endDate),t.status&&(r.status=t.status),t.invoice&&(r.invoice=t.invoice),lv(e.client,t.resourceId,r)}},mn("delete_scheduled_invoice","Delete a scheduled (recurring) invoice.","schedulers",(e,t)=>dv(e,t),"delete a recurring scheduled invoice"),Hn("get_scheduled_bill","Get a scheduled (recurring) bill by resourceId.","schedulers",(e,t)=>pv(e,t),"get scheduled recurring bill details"),{name:"update_scheduled_bill",description:"Update a scheduled bill \u2014 change schedule settings and/or the bill template.",params:{resourceId:{type:"string",description:"Scheduled bill resourceId"},repeat:{type:"string",description:"Recurrence: WEEKLY, MONTHLY, QUARTERLY, YEARLY"},startDate:{type:"string",description:"First occurrence date (YYYY-MM-DD)"},endDate:{type:"string",description:"Last occurrence date (YYYY-MM-DD)"},status:{type:"string",description:"Status: ACTIVE or PAUSED"},bill:{type:"object",description:"Bill template: { reference, valueDate, dueDate, contactResourceId, lineItems, currency, tag, saveAsDraft }"}},required:["resourceId"],group:"schedulers",readOnly:!1,searchHint:"update recurring scheduled bill settings",execute:async(e,t)=>{let r={};return t.repeat&&(r.repeat=t.repeat),t.startDate&&(r.startDate=t.startDate),t.endDate&&(r.endDate=t.endDate),t.status&&(r.status=t.status),t.bill&&(r.bill=t.bill),fv(e.client,t.resourceId,r)}},mn("delete_scheduled_bill","Delete a scheduled (recurring) bill.","schedulers",(e,t)=>mv(e,t),"delete a recurring scheduled bill"),Hn("get_scheduled_journal","Get a scheduled (recurring) journal by resourceId.","schedulers",(e,t)=>hv(e,t),"get scheduled recurring journal details"),{name:"update_scheduled_journal",description:"Update a scheduled journal \u2014 change schedule settings and/or the journal template.",params:{resourceId:{type:"string",description:"Scheduled journal resourceId"},repeat:{type:"string",description:"Recurrence: WEEKLY, MONTHLY, QUARTERLY, YEARLY"},startDate:{type:"string",description:"First occurrence date (YYYY-MM-DD)"},endDate:{type:"string",description:"Last occurrence date (YYYY-MM-DD)"},status:{type:"string",description:"Status: ACTIVE or PAUSED"},valueDate:{type:"string",description:"Journal date (YYYY-MM-DD)"},schedulerEntries:{type:"array",items:{type:"object"},description:"Journal entries: [{ accountResourceId, type: CREDIT|DEBIT, amount, ... }]"},reference:{type:"string",description:"Journal reference"},notes:{type:"string",description:"Journal notes"}},required:["resourceId"],group:"schedulers",readOnly:!1,searchHint:"update recurring scheduled journal settings",execute:async(e,t)=>{let r={};return t.repeat&&(r.repeat=t.repeat),t.startDate&&(r.startDate=t.startDate),t.endDate&&(r.endDate=t.endDate),t.status&&(r.status=t.status),t.valueDate&&(r.valueDate=t.valueDate),t.schedulerEntries&&(r.schedulerEntries=t.schedulerEntries),t.reference&&(r.reference=t.reference),t.notes&&(r.notes=t.notes),gv(e.client,t.resourceId,r)}},mn("delete_scheduled_journal","Delete a scheduled (recurring) journal.","schedulers",(e,t)=>yv(e,t),"delete a recurring scheduled journal"),Hn("get_payment","Get a specific payment record by resourceId. Returns payment amount, method, date, and reference.","payments",(e,t)=>d0(e,t),"get payment record details by id"),{name:"update_payment",description:"Update a payment record \u2014 correct amount, reference, date, method, or account.",params:{resourceId:{type:"string",description:"Payment resourceId (from invoice/bill paymentRecords)"},paymentAmount:{type:"number",description:"Corrected payment amount (bank currency)"},reference:{type:"string",description:"Payment reference"},valueDate:{type:"string",description:"Payment date (YYYY-MM-DD)"},paymentMethod:th,accountResourceId:{type:"string",description:"Bank/cash account resourceId"},transactionFee:{type:"number",description:"Transaction fee amount"}},required:["resourceId"],group:"payments",readOnly:!1,searchHint:"update payment amount reference date method",execute:async(e,t)=>{let r={};return t.paymentAmount!==void 0&&(r.paymentAmount=t.paymentAmount),t.reference&&(r.reference=t.reference),t.valueDate&&(r.valueDate=t.valueDate),t.paymentMethod&&(r.paymentMethod=t.paymentMethod),t.accountResourceId&&(r.accountResourceId=t.accountResourceId),t.transactionFee!==void 0&&(r.transactionFee=t.transactionFee),p0(e.client,t.resourceId,r)}},mn("delete_payment","Delete (void) a payment record. The associated invoice/bill balance is restored.","payments",(e,t)=>f0(e,t),"delete void a payment record restore balance"),{name:"get_export_columns",description:"List all exportable columns for an entity type, including their paths and data types. Use paths from this response to build custom column sets for export_records or preview_export_records.",params:{entityType:T$},required:["entityType"],group:"export_records",readOnly:!0,isConcurrencySafe:!0,searchHint:"list export columns fields for entity type",execute:async(e,t)=>w_(e.client,t.entityType)},{name:"preview_export_records",description:"Preview an export before generating the file. Returns totalRecords, up to 10 sample rows, resolved column definitions, and a human-readable filterDescription. Use this to confirm scope before calling export_records. Pass either query OR filter, never both.",params:{entityType:T$,query:aG,filter:cG,columns:uG,sort:lG},required:["entityType"],group:"export_records",readOnly:!0,isConcurrencySafe:!0,searchHint:"preview export records count sample rows filter",execute:async(e,t)=>x_(e.client,{entityType:t.entityType,outputFormat:"XLSX",query:t.query,filter:t.filter,columns:t.columns,sort:t.sort})},{name:"export_records",description:"Generate a filtered XLSX export for an entity type. Returns a pre-signed download URL (expires in ~5 minutes \u2014 download immediately), file name, and total record count. Pass either query OR filter, never both. Use preview_export_records first to confirm scope.",params:{entityType:T$,query:aG,filter:cG,columns:uG,sort:lG},required:["entityType"],group:"export_records",readOnly:!0,isConcurrencySafe:!0,searchHint:"export records download xlsx file url",execute:async(e,t)=>A_(e.client,{entityType:t.entityType,outputFormat:"XLSX",query:t.query,filter:t.filter,columns:t.columns,sort:t.sort})},Nt({name:"search_background_jobs",description:"Search and poll background jobs. ANY operation that returns a jobId (bulk_upsert_contacts, bulk_upsert_items, bank statement import, magic file processing, etc.) can be tracked here. Filter by resourceId (the jobId value) to poll a specific job. Poll until status is SUCCESS, FAILED, or PARTIAL_SUCCESS. Use processedCount/failedCount/totalRecords for progress. IMPORTANT: filter by resourceId field, NOT jobId \u2014 they differ.",group:"background_jobs",fields:nf,defaults:of,fetcher:Qm,searchHint:"poll background job status by jobId type status"}),{name:"bulk_upsert_contacts",description:"Create or update contacts in bulk (max 500 per call). Provide resourceId per contact to update (partial \u2014 only changed fields needed). Omit resourceId to create new contacts. Returns a jobId \u2014 this is async. Poll search_background_jobs with filter {resourceId:{eq:jobId}} until status is SUCCESS, FAILED, or PARTIAL_SUCCESS. NOTE: unlike bulk_upsert_items (sync), contacts bulk-upsert is async.",params:{contacts:{type:"array",description:"Array of contacts to create or update (max 500)",items:{type:"object",properties:{resourceId:{type:"string",description:"Contact resourceId (omit for create, provide UUID for update)"},billingName:{type:"string",description:"Billing name (required for create)"},name:{type:"string",description:"Display name (defaults to billingName)"},emails:{type:"array",items:{type:"string"},description:"Email addresses"},customer:{type:"boolean",description:"Mark as customer"},supplier:{type:"boolean",description:"Mark as supplier"},taxId:{type:"string",description:"Tax ID / GST registration number"},taxIdType:{type:"string",description:"Tax ID type (e.g., GST, VAT)"},registrationNumber:{type:"string",description:"Business registration number"},currencyCode:{type:"string",description:"Default currency code (e.g., SGD)"},status:{type:"string",enum:["ACTIVE","INACTIVE"],description:"Contact status"},paymentTerms:{type:"number",description:"Payment terms in days (e.g., 30 for Net 30)"},notes:{type:"string",description:"Internal notes"},billingAddress:{type:"object",description:"Billing address",properties:{address:{type:"string"},city:{type:"string"},state:{type:"string"},postalCode:{type:"string"},country:{type:"string"}}},shippingAddress:{type:"object",description:"Shipping address",properties:{address:{type:"string"},city:{type:"string"},state:{type:"string"},postalCode:{type:"string"},country:{type:"string"}}}}}}},required:["contacts"],group:"contacts",readOnly:!1,searchHint:"bulk create update contacts upsert",execute:async(e,t)=>(Gr(t.contacts,"contacts"),Ly(e.client,t.contacts))},{name:"bulk_upsert_invoices",description:"Create or update invoices in bulk (max 500 per call). FLAT shape: ONE line per invoice via `itemDescription` + `totalAmount` + `invoiceAccountResourceId` at row level. For multi-line invoices use `bulk_upsert_invoice_line_items` instead \u2014 that variant takes nested `lineItems[]`. Natural key: `invoiceReference` (rows sharing one within a batch are MERGED \u2014 last wins). Provide resourceId per invoice to update via UUID; or omit and rely on invoiceReference for upsert. Async \u2014 returns a jobId. Poll search_background_jobs with filter {resourceId:{eq:jobId}} until SUCCESS / FAILED / PARTIAL_SUCCESS; on PARTIAL_SUCCESS read data[0].errorDetails on the same response for per-row failures. Dates are ISO 8601 (YYYY-MM-DD) only \u2014 the dateFormat field was removed.",params:{invoices:{type:"array",description:"Array of invoices to create or update (max 500). Each row needs at least: invoiceReference, contactResourceId, valueDate, totalAmount, invoiceAccountResourceId.",items:{type:"object",properties:{rowIndex:{type:"string",description:"Optional caller-supplied row index for error reporting"},resourceId:{type:"string",description:"Invoice resourceId (UUID) \u2014 provide to update by ID"},invoiceReference:{type:"string",description:"Natural key (e.g., INV-2025-001) \u2014 required"},contactResourceId:{type:"string",description:"Customer contact UUID \u2014 required"},valueDate:{type:"string",description:"Invoice date YYYY-MM-DD \u2014 required"},dueDate:{type:"string",description:"Due date YYYY-MM-DD"},totalAmount:{type:"number",description:"Total amount (BigDecimal)"},currencyCode:{type:"string",description:"Currency (e.g., SGD)"},invoiceAccountResourceId:{type:"string",description:"Revenue account UUID"},itemDescription:{type:"string",description:"Single-line item description"},internalNotes:{type:"string",description:"Internal notes"},tags:{type:"array",items:{type:"string"},description:"Tag resourceIds"}}}}},required:["invoices"],group:"invoices",readOnly:!1,searchHint:"bulk create update invoices upsert import migrate",execute:async(e,t)=>{Gr(t.invoices,"invoices");let r=t.invoices;return no(r,["valueDate","dueDate"]),zb(e.client,r)}},{name:"bulk_upsert_invoice_line_items",description:"Create or update invoices with nested line items in bulk (max 500 invoices per call). Each row carries lineItems[] under its parent invoice (scoped by invoiceReference). Async \u2014 returns a jobId. Poll search_background_jobs filtered by resourceId; on PARTIAL_SUCCESS read data[0].errorDetails for per-row failures. Dates are ISO 8601 only.",params:{invoices:{type:"array",description:"Array of invoices with line items (max 500). Each invoice row has lineItems[].",items:{type:"object",properties:{rowIndex:{type:"string"},resourceId:{type:"string",description:"Invoice resourceId \u2014 provide to update by ID"},invoiceReference:{type:"string",description:"Natural key \u2014 required"},contactResourceId:{type:"string",description:"Customer UUID \u2014 required"},valueDate:{type:"string",description:"YYYY-MM-DD \u2014 required"},dueDate:{type:"string",description:"YYYY-MM-DD"},currencyCode:{type:"string"},internalNotes:{type:"string"},tags:{type:"array",items:{type:"string"}},lineItems:{type:"array",description:"Line items belonging to this invoice",items:{type:"object",properties:{itemDescription:{type:"string",description:"Line description \u2014 required"},quantity:{type:"number"},unit:{type:"string",description:"Unit of measure (pcs, kg, etc.)"},unitPrice:{type:"number"},accountResourceId:{type:"string",description:"Revenue account UUID"},taxProfileResourceId:{type:"string"}}}}}}}},required:["invoices"],group:"invoices",readOnly:!1,searchHint:"bulk invoices line items multi-line upsert import",execute:async(e,t)=>{Gr(t.invoices,"invoices");let r=t.invoices;return no(r,["valueDate","dueDate"]),Yb(e.client,r)}},{name:"bulk_upsert_bills",description:"Create or update bills in bulk (max 500 per call). FLAT shape: ONE line per bill via `itemDescription` + `totalAmount` + `billAccountResourceId` at row level. For multi-line bills use `bulk_upsert_bill_line_items` instead \u2014 that variant takes nested `lineItems[]`. Natural key: `billReference` (rows sharing one within a batch are MERGED \u2014 last wins). Async \u2014 returns a jobId. Poll search_background_jobs filtered by resourceId; on PARTIAL_SUCCESS read data[0].errorDetails for per-row failures. Dates are ISO 8601 only \u2014 dateFormat field was removed.",params:{bills:{type:"array",description:"Array of bills to create or update (max 500). Each row needs at least: billReference, contactResourceId, valueDate, totalAmount, billAccountResourceId.",items:{type:"object",properties:{rowIndex:{type:"string"},resourceId:{type:"string"},billReference:{type:"string",description:"Natural key \u2014 required"},contactResourceId:{type:"string",description:"Supplier UUID \u2014 required"},valueDate:{type:"string",description:"YYYY-MM-DD \u2014 required"},dueDate:{type:"string"},totalAmount:{type:"number"},currencyCode:{type:"string"},billAccountResourceId:{type:"string",description:"Expense account UUID"},itemDescription:{type:"string"},internalNotes:{type:"string"},tags:{type:"array",items:{type:"string"}}}}}},required:["bills"],group:"bills",readOnly:!1,searchHint:"bulk create update bills upsert import migrate",execute:async(e,t)=>{Gr(t.bills,"bills");let r=t.bills;return no(r,["valueDate","dueDate"]),Ry(e.client,r)}},{name:"bulk_upsert_bill_line_items",description:"Create or update bills with nested line items in bulk (max 500 bills per call). Each row carries lineItems[] under its parent bill (scoped by billReference). Async \u2014 returns a jobId. Poll search_background_jobs filtered by resourceId; on PARTIAL_SUCCESS read data[0].errorDetails for per-row failures.",params:{bills:{type:"array",description:"Array of bills with line items (max 500). Each bill row has lineItems[].",items:{type:"object",properties:{rowIndex:{type:"string"},resourceId:{type:"string"},billReference:{type:"string",description:"Natural key \u2014 required"},contactResourceId:{type:"string",description:"Supplier UUID \u2014 required"},valueDate:{type:"string",description:"YYYY-MM-DD \u2014 required"},dueDate:{type:"string"},currencyCode:{type:"string"},internalNotes:{type:"string"},tags:{type:"array",items:{type:"string"}},lineItems:{type:"array",items:{type:"object",properties:{itemDescription:{type:"string",description:"Required"},quantity:{type:"number"},unit:{type:"string"},unitPrice:{type:"number"},accountResourceId:{type:"string",description:"Expense account UUID"},taxProfileResourceId:{type:"string"}}}}}}}},required:["bills"],group:"bills",readOnly:!1,searchHint:"bulk bills line items multi-line upsert import",execute:async(e,t)=>{Gr(t.bills,"bills");let r=t.bills;return no(r,["valueDate","dueDate"]),ky(e.client,r)}},{name:"bulk_upsert_customer_credit_notes",description:"Create or update customer credit notes in bulk (max 500 per call). Natural key: creditNoteReference. Async \u2014 returns a jobId. Poll search_background_jobs filtered by resourceId; on PARTIAL_SUCCESS read data[0].errorDetails for per-row failures. Dates are ISO 8601 only.",params:{customerCreditNotes:{type:"array",description:"Array of customer credit notes (max 500).",items:{type:"object",properties:{rowIndex:{type:"string"},resourceId:{type:"string"},creditNoteReference:{type:"string",description:"Natural key \u2014 required"},contactResourceId:{type:"string",description:"Customer UUID \u2014 required"},valueDate:{type:"string",description:"YYYY-MM-DD \u2014 required"},currencyCode:{type:"string"},internalNotes:{type:"string"},tags:{type:"array",items:{type:"string"}},lineItems:{type:"array",items:{type:"object",properties:{itemDescription:{type:"string",description:"Required"},quantity:{type:"number"},unitPrice:{type:"number"},accountResourceId:{type:"string"},taxProfileResourceId:{type:"string"}}}}}}}},required:["customerCreditNotes"],group:"customer_credit_notes",readOnly:!1,searchHint:"bulk customer credit notes refund upsert import",execute:async(e,t)=>{Gr(t.customerCreditNotes,"customerCreditNotes",500,"customer credit notes");let r=t.customerCreditNotes;return no(r,["valueDate"]),L0(e.client,r)}},{name:"bulk_upsert_supplier_credit_notes",description:"Create or update supplier credit notes in bulk (max 500 per call). Natural key: creditNoteReference. Async \u2014 returns a jobId. Poll search_background_jobs filtered by resourceId; on PARTIAL_SUCCESS read data[0].errorDetails for per-row failures. Dates are ISO 8601 only.",params:{supplierCreditNotes:{type:"array",description:"Array of supplier credit notes (max 500).",items:{type:"object",properties:{rowIndex:{type:"string"},resourceId:{type:"string"},creditNoteReference:{type:"string",description:"Natural key \u2014 required"},contactResourceId:{type:"string",description:"Supplier UUID \u2014 required"},valueDate:{type:"string",description:"YYYY-MM-DD \u2014 required"},currencyCode:{type:"string"},internalNotes:{type:"string"},tags:{type:"array",items:{type:"string"}},lineItems:{type:"array",items:{type:"object",properties:{itemDescription:{type:"string",description:"Required"},quantity:{type:"number"},unitPrice:{type:"number"},accountResourceId:{type:"string"},taxProfileResourceId:{type:"string"}}}}}}}},required:["supplierCreditNotes"],group:"supplier_credit_notes",readOnly:!1,searchHint:"bulk supplier credit notes refund upsert import",execute:async(e,t)=>{Gr(t.supplierCreditNotes,"supplierCreditNotes",500,"supplier credit notes");let r=t.supplierCreditNotes;return no(r,["valueDate"]),q0(e.client,r)}},{name:"bulk_upsert_journals",description:"Create or update manual journals in bulk (max 500 per call). NATURAL KEY: `journalReference` (NOT `reference` \u2014 every other bulk-upsert uses entityReference, this one is asymmetric). LEGS field: `journalEntries[]` (NOT `entries[]` \u2014 different from `clio journals create` which uses entries). Each leg has `accountResourceId` + `debitAmount` + `creditAmount` (debit + credit must balance per row). Async \u2014 returns a jobId. Poll search_background_jobs filtered by resourceId; on PARTIAL_SUCCESS read data[0].errorDetails for per-row failures. Dates are ISO 8601 (YYYY-MM-DD) only \u2014 dateFormat field was removed.",params:{journals:{type:"array",description:"Array of journals to create or update (max 500). Each row has entries[] (debit/credit legs).",items:{type:"object",properties:{rowIndex:{type:"string"},resourceId:{type:"string"},journalReference:{type:"string",description:"Natural key \u2014 required (NOTE: field is `journalReference`, not `reference`)"},valueDate:{type:"string",description:"YYYY-MM-DD \u2014 required"},currencyCode:{type:"string"},internalNotes:{type:"string"},tags:{type:"array",items:{type:"string"}},journalEntries:{type:"array",description:"Journal legs (debit + credit amounts must balance) \u2014 field is `journalEntries`, NOT `entries`",items:{type:"object",properties:{accountResourceId:{type:"string",description:"Required"},description:{type:"string"},debitAmount:{type:"number"},creditAmount:{type:"number"},contactResourceId:{type:"string"},taxProfileResourceId:{type:"string"}}}}}}}},required:["journals"],group:"journals",readOnly:!1,searchHint:"bulk manual journals upsert import migration",execute:async(e,t)=>{Gr(t.journals,"journals");let r=t.journals;return no(r,["valueDate"]),Kb(e.client,r)}},{name:"bulk_upsert_fixed_assets",description:'\u26A0\uFE0F DATE FIELD MISMATCH: bulk-upsert REQUEST uses `valueDate` (not `purchaseDate`); the GET response uses `purchaseDate`. Sending `purchaseDate` returns a cryptic 400 "Invalid request body" with no field detail. Create or update fixed assets in bulk (max 500 per call). Natural key: `reference`. Each row REQUIRED: `reference`, `registrationType` (NEW | TRANSFER). Recommended: `typeCode`, `typeName`, `category` (TANGIBLE | INTANGIBLE), `cost` (or synonym `purchaseAmount`), `valueDate`, `depreciationStartDate`, `effectiveLife` (or synonym `usefulLifeMonths`), `depreciationMethod`, `purchaseAssetAccountResourceId`, `depreciationExpenseAccountResourceId`, `accumulatedDepreciationAccountResourceId`. Account fields must be valid UUIDv4. Async \u2014 returns a jobId. Poll search_background_jobs filtered by resourceId; on PARTIAL_SUCCESS read data[0].errorDetails for per-row failures. Dates are ISO 8601 (YYYY-MM-DD) only.',params:{fixedAssets:{type:"array",description:"Array of fixed assets to create or update (max 500).",items:{type:"object",properties:{rowIndex:{type:"string"},resourceId:{type:"string"},reference:{type:"string",description:"Natural key \u2014 required"},registrationType:{type:"string",enum:["NEW","TRANSFER"],description:"NEW = newly acquired, TRANSFER = inherited from prior system \u2014 required"},typeCode:{type:"string",description:"Asset class code (e.g., FURNITURE_AND_FIXTURE)"},typeName:{type:"string",description:'Human label for the typeCode (e.g., "Furniture and Fixtures")'},category:{type:"string",description:"TANGIBLE | INTANGIBLE"},name:{type:"string",description:"Asset name"},valueDate:{type:"string",description:"Acquisition date YYYY-MM-DD (NOTE: bulk uses `valueDate`, the GET response uses `purchaseDate` \u2014 different fields)"},cost:{type:"number",description:"Cost basis (alias for purchaseAmount on the bulk endpoint)"},purchaseAmount:{type:"number",description:"Cost basis (synonym of `cost`)"},currencyCode:{type:"string"},depreciationStartDate:{type:"number",description:'Epoch milliseconds (NOT YYYY-MM-DD \u2014 inconsistent with valueDate which IS YYYY-MM-DD on this same endpoint). Sending YYYY-MM-DD returns generic 400 "Invalid request body" with no detail. Omit to default to valueDate.'},effectiveLife:{type:"number",description:"Useful life in months (alias for usefulLifeMonths)"},usefulLifeMonths:{type:"number",description:"Useful life in months (synonym of effectiveLife)"},depreciationMethod:{type:"string",description:"e.g., STRAIGHT_LINE, DOUBLE_DECLINING_BALANCE"},purchaseAssetAccountResourceId:{type:"string",description:"Asset (PPE) account UUID \u2014 must be valid UUIDv4"},depreciationExpenseAccountResourceId:{type:"string",description:"Depreciation expense account UUID \u2014 must be valid UUIDv4"},accumulatedDepreciationAccountResourceId:{type:"string",description:"Accumulated depreciation account UUID"},internalNotes:{type:"string"},tags:{type:"array",items:{type:"string"}}}}}},required:["fixedAssets"],group:"fixed_assets",readOnly:!1,searchHint:"bulk fixed assets ppe register upsert import migrate",execute:async(e,t)=>{Gr(t.fixedAssets,"fixedAssets",500,"fixed assets");let r=t.fixedAssets;return no(r,["valueDate"]),e_(e.client,r)}},{name:"quick_reconcile",description:"Bulk-reconcile bank statement entries against a list of journals (max 500). Reconciliation mode is hardcoded to QUICK_RECON. Async \u2014 returns a jobId. Poll search_background_jobs filtered by resourceId; on PARTIAL_SUCCESS read data[0].errorDetails. Caller provides bankAccountResourceId + journalsForReconciliation[] (each row: bankStatementEntryResourceId, journalReference, journalAccountResourceId).",params:{bankAccountResourceId:{type:"string",description:"Bank account UUID (the entries belong to this account)"},journalsForReconciliation:{type:"array",description:"Per-row reconciliation instructions (max 500).",items:{type:"object",properties:{bankStatementEntryResourceId:{type:"string",description:"Bank entry UUID \u2014 required"},journalReference:{type:"string",description:"Journal reference text \u2014 required"},journalAccountResourceId:{type:"string",description:"Offsetting account UUID (revenue for cash-in, expense for cash-out) \u2014 required"},contactResourceId:{type:"string",description:"Contact UUID"},capsuleResourceId:{type:"string",description:"Capsule UUID"},taxProfileResourceId:{type:"string",description:"Tax profile UUID"},internalNotes:{type:"string"},journalEntryDescription:{type:"string"},tags:{type:"array",items:{type:"string"}},rowIndex:{type:"string",description:"Optional caller-supplied index for error correlation"}}}}},required:["bankAccountResourceId","journalsForReconciliation"],group:"reconciliations",readOnly:!1,searchHint:"bulk reconcile bank statement journals match",execute:async(e,t)=>(Gr(t.journalsForReconciliation,"journalsForReconciliation",500,"journals"),N_(e.client,t))},{name:"apply_bank_rule",description:"Apply a pre-configured bank rule (action shortcut) to a batch of bank statement entries (max 500). Async \u2014 returns a jobId. Poll search_background_jobs filtered by resourceId. The rule executes its configured action (e.g. RECONCILE_WITH_DIRECT_CASH_ENTRY) on each entry.",params:{actionShortcutResourceId:{type:"string",description:"Bank rule UUID \u2014 required"},businessTransactionResourceIds:{type:"array",description:"Bank statement entry UUIDs to apply the rule to (max 500). Note: the field is named businessTransactionResourceIds for legacy reasons but accepts bank entry IDs.",items:{type:"string"}}},required:["actionShortcutResourceId","businessTransactionResourceIds"],group:"reconciliations",readOnly:!1,searchHint:"bank rule apply action shortcut bulk reconcile",execute:async(e,t)=>(Gr(t.businessTransactionResourceIds,"businessTransactionResourceIds",500,"entries"),R_(e.client,t))},{name:"reconcile_direct_cash_entry",description:"Reconcile a bank statement entry with a single cash-in / cash-out line. Direction (cash-in vs cash-out) is INFERRED from the bank entry sign. Sync \u2014 returns the reconciled entry status. NOT idempotent: calling twice on the same bankStatementEntryResourceId creates duplicate journals. Confirm reconciled-state via view_auto_reconciliation before retrying.",params:{bankStatementEntryResourceId:{type:"string",description:"Bank entry UUID \u2014 required"},bankAccountResourceId:{type:"string",description:"Bank account UUID (used to look up the entry) \u2014 required"},reference:{type:"string",description:"Reference for the cash entry \u2014 required"},accountResourceId:{type:"string",description:"Offsetting account UUID (revenue for cash-in, expense for cash-out) \u2014 required"},amount:{type:"number",description:"Amount in source currency. Defaults to bank entry amount if omitted."},description:{type:"string"},contactResourceId:{type:"string"},taxProfileResourceId:{type:"string"},internalNotes:{type:"string"},bankAccountJournalEntryDescription:{type:"string",description:"Description for the bank-side journal entry"},tags:{type:"array",items:{type:"string"}},taxVatApplicable:{type:"boolean"},taxInclusion:{type:"boolean"},capsuleResourceId:{type:"string"}},required:["bankStatementEntryResourceId","bankAccountResourceId","reference","accountResourceId"],group:"reconciliations",readOnly:!1,searchHint:"reconcile bank entry direct cash in out single line",execute:async(e,t)=>k_(e.client,t)},{name:"reconcile_cash_journal",description:"Reconcile a bank statement entry with a multi-line cashflow journal (multiple cash splits, max 200 lines). Sync \u2014 returns the reconciled entry status. NOT idempotent \u2014 confirm reconciled-state before retrying.",params:{bankStatementEntryResourceId:{type:"string",description:"Bank entry UUID \u2014 required"},bankAccountResourceId:{type:"string",description:"Bank account UUID \u2014 required"},reference:{type:"string",description:"Journal reference \u2014 required"},journalEntries:{type:"array",description:"Cash journal lines (max 200). Each row is one debit OR credit against an account.",items:{type:"object",properties:{accountResourceId:{type:"string",description:"Account UUID \u2014 required"},amount:{type:"number",description:"Amount in source currency \u2014 required (>0)"},description:{type:"string"},taxProfileResourceId:{type:"string"}}}},contactResourceId:{type:"string"},bankAccountJournalEntryDescription:{type:"string"},internalNotes:{type:"string"},tags:{type:"array",items:{type:"string"}},taxVatApplicable:{type:"boolean"},taxInclusion:{type:"boolean"},capsuleResourceId:{type:"string"}},required:["bankStatementEntryResourceId","bankAccountResourceId","reference","journalEntries"],group:"reconciliations",readOnly:!1,searchHint:"reconcile bank entry multi line cash journal splits",execute:async(e,t)=>(Gr(t.journalEntries,"journalEntries",200,"entries"),F_(e.client,t))},{name:"reconcile_manual_journal",description:'\u26A0\uFE0F CALLER PROVIDES ONLY THE OFFSET LEG(S) \u2014 backend AUTO-ADDS the bank-side leg from the statement entry. Sending both debit AND credit legs \u2192 422 "sum of debit and credit amounts are not equal" (your sides duplicate after the auto-add). Reconcile a bank statement entry with a double-entry manual journal. Sync \u2014 returns the reconciled entry status. valueDate prefills from bank entry if omitted. NOT idempotent.',params:{bankStatementEntryResourceId:{type:"string",description:"Bank entry UUID \u2014 required"},bankAccountResourceId:{type:"string",description:"Bank account UUID \u2014 required"},status:{type:"string",enum:["DRAFT","ACTIVE"],description:"Journal status \u2014 required"},journalEntries:{type:"array",description:"Offset-side journal entries only (max 200). The bank-side leg is auto-added by the API.",items:{type:"object",properties:{accountResourceId:{type:"string",description:"Account UUID \u2014 required"},type:{type:"string",enum:["DEBIT","CREDIT"]},amount:{type:"number",description:"Amount \u2014 required"},description:{type:"string"},contactResourceId:{type:"string"},taxProfileResourceId:{type:"string"}}}},reference:{type:"string"},valueDate:{type:"string",description:"YYYY-MM-DD. Defaults to bank entry value date."},contactResourceId:{type:"string"},internalNotes:{type:"string"},bankAccountJournalEntryDescription:{type:"string"},taxVatApplicable:{type:"boolean"},taxInclusion:{type:"boolean"},tags:{type:"array",items:{type:"string"}},capsuleResourceId:{type:"string"}},required:["bankStatementEntryResourceId","bankAccountResourceId","status","journalEntries"],group:"reconciliations",readOnly:!1,searchHint:"reconcile bank entry manual journal double entry",execute:async(e,t)=>(Gr(t.journalEntries,"journalEntries",200,"entries"),P_(e.client,t))},{name:"reconcile_cash_transfer",description:"Reconcile a bank statement entry with an inter-account transfer. Sync \u2014 returns the reconciled entry status. amount is required only when the counterparty account is in a non-functional currency. NOT idempotent.",params:{bankStatementEntryResourceId:{type:"string",description:"Bank entry UUID \u2014 required"},bankAccountResourceId:{type:"string",description:"Bank account UUID \u2014 required"},accountResourceId:{type:"string",description:"Counterparty cash account UUID \u2014 required"},reference:{type:"string",description:"Transfer reference \u2014 required"},amount:{type:"number",description:"Amount in source currency. Required only for cross-currency transfers."},contactResourceId:{type:"string"},internalNotes:{type:"string"},tags:{type:"array",items:{type:"string"}},capsuleResourceId:{type:"string"}},required:["bankStatementEntryResourceId","bankAccountResourceId","accountResourceId","reference"],group:"reconciliations",readOnly:!1,searchHint:"reconcile bank entry transfer between accounts",execute:async(e,t)=>L_(e.client,t)},{name:"reconcile_invoice_receipt",description:'\u26A0\uFE0F BSE must have `paymentDirection: PAYIN` (money in \u2014 AR). Produce via `bank add-records` with a POSITIVE amount (creates `credit_amount > 0` \u2192 PAYIN). Statement-imported BSEs from `bank import` also work. The error code "Invalid business transaction type" (422) is misleadingly named \u2014 the actual gate is direction, not entry type. Create an invoice and auto-reconcile it to a bank statement entry (AR). Sync \u2014 returns the reconciled entry status. valueDate / dueDate / payment amount prefill from the bank entry if omitted. NOT idempotent.',params:{bankStatementEntryResourceId:{type:"string",description:"Bank entry UUID \u2014 required"},bankAccountResourceId:{type:"string",description:"Bank account UUID \u2014 required"},invoiceDetails:{type:"object",description:"The invoice to create. Required.",properties:{reference:{type:"string",description:"Invoice reference \u2014 required"},contactResourceId:{type:"string",description:"Customer UUID"},valueDate:{type:"string",description:"YYYY-MM-DD. Defaults to bank entry value date."},dueDate:{type:"string",description:"YYYY-MM-DD. Defaults to value date."},taxInclusion:{type:"boolean"},isTaxVATApplicable:{type:"boolean"},lineItems:{type:"array",description:"Invoice line items (max 500) \u2014 required",items:{type:"object",properties:{name:{type:"string",description:"Line description \u2014 required"},quantity:{type:"number"},unit:{type:"string"},unitPrice:{type:"number"},organizationAccountResourceId:{type:"string",description:"Revenue account UUID"},itemResourceId:{type:"string"},taxProfileResourceId:{type:"string"}}}},recordedPayment:{type:"object",description:"Optional. The matching payment record \u2014 auto-built from the bank entry if omitted.",properties:{reference:{type:"string"},valueDate:{type:"string",description:"YYYY-MM-DD. Defaults to bank entry value date."},organizationAccountResourceId:{type:"string"},paymentAmount:{type:"number"},transactionAmount:{type:"number"},paymentMethod:{type:"string",description:"Defaults to BANK_TRANSFER"}}},capsuleResourceId:{type:"string"}}}},required:["bankStatementEntryResourceId","bankAccountResourceId","invoiceDetails"],group:"reconciliations",readOnly:!1,searchHint:"reconcile bank entry invoice receipt AR sale",execute:async(e,t)=>(A$(t.invoiceDetails,"invoiceDetails"),j_(e.client,t))},{name:"reconcile_bill_receipt",description:'\u26A0\uFE0F BSE must have `paymentDirection: PAYOUT` (money out \u2014 AP). Produce via `bank add-records` with a NEGATIVE amount (creates `debit_amount > 0` \u2192 PAYOUT). Statement-imported BSEs from `bank import` also work. The error code "Invalid business transaction type" (422) is misleadingly named \u2014 the actual gate is direction, not entry type. Create a bill and auto-reconcile it to a bank statement entry (AP). Sync \u2014 returns the reconciled entry status. valueDate / dueDate / payment amount prefill from the bank entry if omitted. NOT idempotent.',params:{bankStatementEntryResourceId:{type:"string",description:"Bank entry UUID \u2014 required"},bankAccountResourceId:{type:"string",description:"Bank account UUID \u2014 required"},billDetails:{type:"object",description:"The bill to create. Required.",properties:{reference:{type:"string",description:"Bill reference \u2014 required"},contactResourceId:{type:"string",description:"Supplier UUID"},valueDate:{type:"string",description:"YYYY-MM-DD. Defaults to bank entry value date."},dueDate:{type:"string",description:"YYYY-MM-DD. Defaults to value date."},taxInclusion:{type:"boolean"},isTaxVATApplicable:{type:"boolean"},lineItems:{type:"array",description:"Bill line items (max 500) \u2014 required",items:{type:"object",properties:{name:{type:"string",description:"Line description \u2014 required"},quantity:{type:"number"},unit:{type:"string"},unitPrice:{type:"number"},organizationAccountResourceId:{type:"string",description:"Expense account UUID"},itemResourceId:{type:"string"},taxProfileResourceId:{type:"string"}}}},recordedPayment:{type:"object",description:"Optional. The matching payment record \u2014 auto-built from the bank entry if omitted.",properties:{reference:{type:"string"},valueDate:{type:"string",description:"YYYY-MM-DD"},organizationAccountResourceId:{type:"string"},paymentAmount:{type:"number"},transactionAmount:{type:"number"},paymentMethod:{type:"string",description:"Defaults to BANK_TRANSFER"}}},capsuleResourceId:{type:"string"}}}},required:["bankStatementEntryResourceId","bankAccountResourceId","billDetails"],group:"reconciliations",readOnly:!1,searchHint:"reconcile bank entry bill receipt AP purchase",execute:async(e,t)=>(A$(t.billDetails,"billDetails"),M_(e.client,t))},{name:"validate_drafts",description:"BULK validate \u2014 process up to 500 draft business transactions in ONE call, mixing any combination of invoices, bills, customer credit notes, and supplier credit notes (no per-type tools needed). SYNC: returns per-item errors and display data inline; no state change. Use this before convert_drafts_to_active to surface eligibility issues client-side. btType enum: SALE = invoice, PURCHASE = bill, SALE_CREDIT_NOTE = customer CN, PURCHASE_CREDIT_NOTE = supplier CN. Journals are NOT in this enum.",params:{items:{type:"array",description:"Draft business transaction references (max 500). Mix any btType freely.",items:{type:"object",properties:{btResourceId:{type:"string",description:"Draft BT resource ID (UUID) \u2014 required"},btType:{type:"string",enum:["SALE","PURCHASE","SALE_CREDIT_NOTE","PURCHASE_CREDIT_NOTE"],description:"Required"}}}}},required:["items"],group:"drafts",readOnly:!0,isConcurrencySafe:!0,searchHint:"validate drafts eligibility check before convert promote",execute:async(e,t)=>(ml(t.items),T_(e.client,t.items))},{name:"convert_drafts_to_active",description:"BULK promote \u2014 finalize up to 500 draft business transactions to ACTIVE in ONE call, mixing any combination of invoices, bills, and credit notes (no per-type tools needed). ASYNC: returns a jobId \u2014 poll search_background_jobs filtered by resourceId; on PARTIAL_SUCCESS read data[0].errorDetails for per-row failures. NOT idempotent: a second call on already-promoted drafts returns 422. Filter the draft list by status: DRAFT before submitting. Pair with validate_drafts for a pre-flight check on large batches.",params:{items:{type:"array",description:"Draft BT references (max 500). Mix any btType.",items:{type:"object",properties:{btResourceId:{type:"string",description:"Draft BT resource ID (UUID) \u2014 required"},btType:{type:"string",enum:["SALE","PURCHASE","SALE_CREDIT_NOTE","PURCHASE_CREDIT_NOTE"],description:"Required"}}}}},required:["items"],group:"drafts",readOnly:!1,searchHint:"convert drafts to active promote finalize bulk",execute:async(e,t)=>(ml(t.items),O_(e.client,t.items))},{name:"submit_drafts_for_approval",description:"BULK submit \u2014 route up to 500 draft business transactions into the approval workflow in ONE call, mixing any combination of invoices, bills, and credit notes. ASYNC: returns a jobId \u2014 poll search_background_jobs filtered by resourceId; on PARTIAL_SUCCESS read data[0].errorDetails for per-row failures. NOT idempotent on drafts that already have an in-flight approval request.",params:{items:{type:"array",description:"Draft BT references (max 500). Mix any btType.",items:{type:"object",properties:{btResourceId:{type:"string",description:"Draft BT resource ID (UUID) \u2014 required"},btType:{type:"string",enum:["SALE","PURCHASE","SALE_CREDIT_NOTE","PURCHASE_CREDIT_NOTE"],description:"Required"}}}}},required:["items"],group:"drafts",readOnly:!1,searchHint:"submit drafts for approval workflow review bulk",execute:async(e,t)=>(ml(t.items),$_(e.client,t.items))},{name:"search_help_center",description:`Search the Jaz help center for how-to articles, feature guides, and accounting concepts. Use this for "how do I..." or "what is..." questions about Jaz: bank reconciliation, GST/VAT filing, multi-currency, fixed assets, custom fields, integrations, and so on. Returns top matching articles with title, section, snippet, and source URL.
|
|
861
|
+
Response: { updated: string[], failed: [{ resourceId, error, errorCode }] }. On partial failure (HTTP 207), check failed.length.`,params:{entity:{type:"string",enum:[...fl],description:"Transaction type"},lineItemResourceIds:{type:"array",items:{type:"string"},description:"Line item resourceIds to update (ARAP + accounting entities)"},attributes:{type:"object",description:"Fields to update on all specified line items"},schedulerUpdates:{type:"array",items:{type:"object"},description:"Per-scheduler updates: [{ schedulerResourceId, lineItemUpdates: [{ arrayIndex, ...fields }] }]. EXCEPTION: journal-schedules use lineItemResourceId (UUID) instead of arrayIndex."}},required:["entity"],group:"quick_fix",readOnly:!1,searchHint:"bulk update line item accounts tax profiles",execute:async(e,t)=>{let r=t.entity,n=["sale-schedules","purchase-schedules","subscription-schedules","journal-schedules"].includes(r),o={};if(n){if(!t.schedulerUpdates)throw new Error("schedulerUpdates is required for scheduler entities (sale-schedules, purchase-schedules, subscription-schedules, journal-schedules)");o.schedulerUpdates=t.schedulerUpdates}else{if(!t.lineItemResourceIds)throw new Error("lineItemResourceIds is required for non-scheduler entities");o.lineItemResourceIds=t.lineItemResourceIds,o.attributes=t.attributes??{}}return Zm(e.client,r,o)}},yt("list_nano_classifiers","List nano classifiers (tracking categories). Paginated. Nano classifiers tag line items with structured categories.","nano_classifiers",(e,t,r)=>__(e,{limit:r,offset:t}),"list nano classifiers tracking categories types"),Hn("get_nano_classifier","Get a nano classifier by resourceId. Returns type and all classes.","nano_classifiers",(e,t)=>E_(e,t),"get nano classifier tracking category details"),Nt({name:"search_nano_classifiers",description:"Search nano classifiers (tracking categories) by type name.",group:"nano_classifiers",fields:_f,defaults:Ef,fetcher:C_,searchHint:"find nano classifiers tracking categories by type"}),{name:"create_nano_classifier",description:"Create a nano classifier (tracking category). Provide a type name and list of class names. printable defaults to true (NOTE: printable: false is currently rejected by a server bug \u2014 always use true).",params:{type:{type:"string",description:'Classifier type name (e.g., "Department", "Project")'},classes:{type:"array",items:{type:"string"},description:'Class names: ["Sales", "Marketing", "Engineering"]'},printable:{type:"boolean",description:"Show on printed documents (default: true). NOTE: false is rejected by a server bug."}},required:["type","classes"],group:"nano_classifiers",readOnly:!1,searchHint:"create new nano classifier tracking category",execute:async(e,t)=>Km(e.client,{type:t.type,classes:t.classes,printable:t.printable??!0})},{name:"update_nano_classifier",description:"Update a nano classifier \u2014 change type name, modify classes, or toggle printable.",params:{resourceId:{type:"string",description:"Nano classifier resourceId"},type:{type:"string",description:"New type name"},classes:{type:"array",items:{type:"string"},description:'Updated class names: ["Sales", "Marketing"]'},printable:{type:"boolean",description:"Show on printed documents"}},required:["resourceId"],group:"nano_classifiers",readOnly:!1,searchHint:"update nano classifier classes and settings",execute:async(e,t)=>{let r={};return t.type&&(r.type=t.type),t.classes&&(r.classes=t.classes),t.printable!==void 0&&(r.printable=t.printable),Xm(e.client,t.resourceId,r)}},mn("delete_nano_classifier","Delete a nano classifier.","nano_classifiers",(e,t)=>I_(e,t),"permanently delete a nano classifier type"),{name:"list_invoice_payments",description:"List all payments recorded against an invoice. Returns payment records with amounts, dates, and methods.",params:{resourceId:{type:"string",description:"Invoice resourceId"}},required:["resourceId"],group:"payments",readOnly:!0,searchHint:"list payment records on an invoice",isConcurrencySafe:!0,maxResultSizeChars:5e4,execute:async(e,t)=>Bb(e.client,t.resourceId)},{name:"list_invoice_credits",description:"List all credit notes applied to an invoice.",params:{resourceId:{type:"string",description:"Invoice resourceId"}},required:["resourceId"],group:"payments",readOnly:!0,searchHint:"list credit applications on an invoice",isConcurrencySafe:!0,maxResultSizeChars:5e4,execute:async(e,t)=>Ub(e.client,t.resourceId)},{name:"reverse_invoice_credit",description:"Reverse (unapply) a credit note from an invoice. The credit note becomes UNAPPLIED again.",params:{resourceId:{type:"string",description:"Invoice resourceId"},creditResourceId:{type:"string",description:"Credit application resourceId to reverse"}},required:["resourceId","creditResourceId"],group:"payments",readOnly:!1,searchHint:"reverse a credit note application on invoice",isDestructive:!0,execute:async(e,t)=>(await qb(e.client,t.resourceId,t.creditResourceId),{reversed:!0,invoiceId:t.resourceId,creditId:t.creditResourceId})},{name:"list_bill_payments",description:"List all payments recorded against a bill. Returns payment records with amounts, dates, and methods.",params:{resourceId:{type:"string",description:"Bill resourceId"}},required:["resourceId"],group:"payments",readOnly:!0,searchHint:"list payment records on a bill",isConcurrencySafe:!0,maxResultSizeChars:5e4,execute:async(e,t)=>Oy(e.client,t.resourceId)},{name:"list_bill_credits",description:"List all credit notes applied to a bill.",params:{resourceId:{type:"string",description:"Bill resourceId"}},required:["resourceId"],group:"payments",readOnly:!0,searchHint:"list credit applications on a bill",isConcurrencySafe:!0,maxResultSizeChars:5e4,execute:async(e,t)=>$y(e.client,t.resourceId)},{name:"reverse_bill_credit",description:"Reverse (unapply) a supplier credit note from a bill. The credit note becomes UNAPPLIED again.",params:{resourceId:{type:"string",description:"Bill resourceId"},creditResourceId:{type:"string",description:"Credit application resourceId to reverse"}},required:["resourceId","creditResourceId"],group:"payments",readOnly:!1,searchHint:"reverse a credit note application on bill",isDestructive:!0,execute:async(e,t)=>(await Ny(e.client,t.resourceId,t.creditResourceId),{reversed:!0,billId:t.resourceId,creditId:t.creditResourceId})},Hn("get_scheduled_invoice","Get a scheduled (recurring) invoice by resourceId.","schedulers",(e,t)=>uv(e,t),"get scheduled recurring invoice details"),{name:"update_scheduled_invoice",description:"Update a scheduled invoice \u2014 change schedule settings and/or the invoice template.",params:{resourceId:{type:"string",description:"Scheduled invoice resourceId"},repeat:{type:"string",description:"Recurrence: WEEKLY, MONTHLY, QUARTERLY, YEARLY"},startDate:{type:"string",description:"First occurrence date (YYYY-MM-DD)"},endDate:{type:"string",description:"Last occurrence date (YYYY-MM-DD)"},status:{type:"string",description:"Status: ACTIVE or PAUSED"},invoice:{type:"object",description:"Invoice template: { reference, valueDate, dueDate, contactResourceId, lineItems, currency, tag, saveAsDraft }"}},required:["resourceId"],group:"schedulers",readOnly:!1,searchHint:"update recurring scheduled invoice settings",execute:async(e,t)=>{let r={};return t.repeat&&(r.repeat=t.repeat),t.startDate&&(r.startDate=t.startDate),t.endDate&&(r.endDate=t.endDate),t.status&&(r.status=t.status),t.invoice&&(r.invoice=t.invoice),lv(e.client,t.resourceId,r)}},mn("delete_scheduled_invoice","Delete a scheduled (recurring) invoice.","schedulers",(e,t)=>dv(e,t),"delete a recurring scheduled invoice"),Hn("get_scheduled_bill","Get a scheduled (recurring) bill by resourceId.","schedulers",(e,t)=>pv(e,t),"get scheduled recurring bill details"),{name:"update_scheduled_bill",description:"Update a scheduled bill \u2014 change schedule settings and/or the bill template.",params:{resourceId:{type:"string",description:"Scheduled bill resourceId"},repeat:{type:"string",description:"Recurrence: WEEKLY, MONTHLY, QUARTERLY, YEARLY"},startDate:{type:"string",description:"First occurrence date (YYYY-MM-DD)"},endDate:{type:"string",description:"Last occurrence date (YYYY-MM-DD)"},status:{type:"string",description:"Status: ACTIVE or PAUSED"},bill:{type:"object",description:"Bill template: { reference, valueDate, dueDate, contactResourceId, lineItems, currency, tag, saveAsDraft }"}},required:["resourceId"],group:"schedulers",readOnly:!1,searchHint:"update recurring scheduled bill settings",execute:async(e,t)=>{let r={};return t.repeat&&(r.repeat=t.repeat),t.startDate&&(r.startDate=t.startDate),t.endDate&&(r.endDate=t.endDate),t.status&&(r.status=t.status),t.bill&&(r.bill=t.bill),fv(e.client,t.resourceId,r)}},mn("delete_scheduled_bill","Delete a scheduled (recurring) bill.","schedulers",(e,t)=>mv(e,t),"delete a recurring scheduled bill"),Hn("get_scheduled_journal","Get a scheduled (recurring) journal by resourceId.","schedulers",(e,t)=>hv(e,t),"get scheduled recurring journal details"),{name:"update_scheduled_journal",description:"Update a scheduled journal \u2014 change schedule settings and/or the journal template.",params:{resourceId:{type:"string",description:"Scheduled journal resourceId"},repeat:{type:"string",description:"Recurrence: WEEKLY, MONTHLY, QUARTERLY, YEARLY"},startDate:{type:"string",description:"First occurrence date (YYYY-MM-DD)"},endDate:{type:"string",description:"Last occurrence date (YYYY-MM-DD)"},status:{type:"string",description:"Status: ACTIVE or PAUSED"},valueDate:{type:"string",description:"Journal date (YYYY-MM-DD)"},schedulerEntries:{type:"array",items:{type:"object"},description:"Journal entries: [{ accountResourceId, type: CREDIT|DEBIT, amount, ... }]"},reference:{type:"string",description:"Journal reference"},notes:{type:"string",description:"Journal notes"}},required:["resourceId"],group:"schedulers",readOnly:!1,searchHint:"update recurring scheduled journal settings",execute:async(e,t)=>{let r={};return t.repeat&&(r.repeat=t.repeat),t.startDate&&(r.startDate=t.startDate),t.endDate&&(r.endDate=t.endDate),t.status&&(r.status=t.status),t.valueDate&&(r.valueDate=t.valueDate),t.schedulerEntries&&(r.schedulerEntries=t.schedulerEntries),t.reference&&(r.reference=t.reference),t.notes&&(r.notes=t.notes),gv(e.client,t.resourceId,r)}},mn("delete_scheduled_journal","Delete a scheduled (recurring) journal.","schedulers",(e,t)=>yv(e,t),"delete a recurring scheduled journal"),Hn("get_payment","Get a specific payment record by resourceId. Returns payment amount, method, date, and reference.","payments",(e,t)=>d0(e,t),"get payment record details by id"),{name:"update_payment",description:"Update a payment record \u2014 correct amount, reference, date, method, or account.",params:{resourceId:{type:"string",description:"Payment resourceId (from invoice/bill paymentRecords)"},paymentAmount:{type:"number",description:"Corrected payment amount (bank currency)"},reference:{type:"string",description:"Payment reference"},valueDate:{type:"string",description:"Payment date (YYYY-MM-DD)"},paymentMethod:th,accountResourceId:{type:"string",description:"Bank/cash account resourceId"},transactionFee:{type:"number",description:"Transaction fee amount"}},required:["resourceId"],group:"payments",readOnly:!1,searchHint:"update payment amount reference date method",execute:async(e,t)=>{let r={};return t.paymentAmount!==void 0&&(r.paymentAmount=t.paymentAmount),t.reference&&(r.reference=t.reference),t.valueDate&&(r.valueDate=t.valueDate),t.paymentMethod&&(r.paymentMethod=t.paymentMethod),t.accountResourceId&&(r.accountResourceId=t.accountResourceId),t.transactionFee!==void 0&&(r.transactionFee=t.transactionFee),p0(e.client,t.resourceId,r)}},mn("delete_payment","Delete (void) a payment record. The associated invoice/bill balance is restored.","payments",(e,t)=>f0(e,t),"delete void a payment record restore balance"),{name:"get_export_columns",description:"List all exportable columns for an entity type, including their paths and data types. Use paths from this response to build custom column sets for export_records or preview_export_records.",params:{entityType:T$},required:["entityType"],group:"export_records",readOnly:!0,isConcurrencySafe:!0,searchHint:"list export columns fields for entity type",execute:async(e,t)=>w_(e.client,t.entityType)},{name:"preview_export_records",description:"Preview an export before generating the file. Returns totalRecords, up to 10 sample rows, resolved column definitions, and a human-readable filterDescription. Use this to confirm scope before calling export_records. Pass either query OR filter, never both.",params:{entityType:T$,query:aG,filter:cG,columns:uG,sort:lG},required:["entityType"],group:"export_records",readOnly:!0,isConcurrencySafe:!0,searchHint:"preview export records count sample rows filter",execute:async(e,t)=>x_(e.client,{entityType:t.entityType,outputFormat:"XLSX",query:t.query,filter:t.filter,columns:t.columns,sort:t.sort})},{name:"export_records",description:`Generate a raw entity-row XLSX export for one entity type (a list of invoices, bills, contacts, items, journals, bank records, cashflow, fixed assets, etc. \u2014 one row per record, with column selection). Returns a pre-signed download URL (~5 min), file name, and total record count. Pass either query OR filter, never both. Use preview_export_records first to confirm scope.
|
|
862
|
+
|
|
863
|
+
DO NOT use this tool for analytical or audit reports (anomalous invoices, anomalous bills, cashflow anomalies, GL journal audit, exchange rate audit, receivables customer risk, cash expense health), financial statements (trial balance, P&L, balance sheet, cashflow, general ledger), aging (AR/AP report), summary reports (sales-summary, purchase-summary, etc.), or statement of account. Those go through download_export.`,params:{entityType:T$,query:aG,filter:cG,columns:uG,sort:lG},required:["entityType"],group:"export_records",readOnly:!0,isConcurrencySafe:!0,searchHint:"export records download xlsx file url",execute:async(e,t)=>A_(e.client,{entityType:t.entityType,outputFormat:"XLSX",query:t.query,filter:t.filter,columns:t.columns,sort:t.sort})},Nt({name:"search_background_jobs",description:"Search and poll background jobs. ANY operation that returns a jobId (bulk_upsert_contacts, bulk_upsert_items, bank statement import, magic file processing, etc.) can be tracked here. Filter by resourceId (the jobId value) to poll a specific job. Poll until status is SUCCESS, FAILED, or PARTIAL_SUCCESS. Use processedCount/failedCount/totalRecords for progress. IMPORTANT: filter by resourceId field, NOT jobId \u2014 they differ.",group:"background_jobs",fields:nf,defaults:of,fetcher:Qm,searchHint:"poll background job status by jobId type status"}),{name:"bulk_upsert_contacts",description:"Create or update contacts in bulk (max 500 per call). Provide resourceId per contact to update (partial \u2014 only changed fields needed). Omit resourceId to create new contacts. Returns a jobId \u2014 this is async. Poll search_background_jobs with filter {resourceId:{eq:jobId}} until status is SUCCESS, FAILED, or PARTIAL_SUCCESS. NOTE: unlike bulk_upsert_items (sync), contacts bulk-upsert is async.",params:{contacts:{type:"array",description:"Array of contacts to create or update (max 500)",items:{type:"object",properties:{resourceId:{type:"string",description:"Contact resourceId (omit for create, provide UUID for update)"},billingName:{type:"string",description:"Billing name (required for create)"},name:{type:"string",description:"Display name (defaults to billingName)"},emails:{type:"array",items:{type:"string"},description:"Email addresses"},customer:{type:"boolean",description:"Mark as customer"},supplier:{type:"boolean",description:"Mark as supplier"},taxId:{type:"string",description:"Tax ID / GST registration number"},taxIdType:{type:"string",description:"Tax ID type (e.g., GST, VAT)"},registrationNumber:{type:"string",description:"Business registration number"},currencyCode:{type:"string",description:"Default currency code (e.g., SGD)"},status:{type:"string",enum:["ACTIVE","INACTIVE"],description:"Contact status"},paymentTerms:{type:"number",description:"Payment terms in days (e.g., 30 for Net 30)"},notes:{type:"string",description:"Internal notes"},billingAddress:{type:"object",description:"Billing address",properties:{address:{type:"string"},city:{type:"string"},state:{type:"string"},postalCode:{type:"string"},country:{type:"string"}}},shippingAddress:{type:"object",description:"Shipping address",properties:{address:{type:"string"},city:{type:"string"},state:{type:"string"},postalCode:{type:"string"},country:{type:"string"}}}}}}},required:["contacts"],group:"contacts",readOnly:!1,searchHint:"bulk create update contacts upsert",execute:async(e,t)=>(Gr(t.contacts,"contacts"),Ly(e.client,t.contacts))},{name:"bulk_upsert_invoices",description:"Create or update invoices in bulk (max 500 per call). FLAT shape: ONE line per invoice via `itemDescription` + `totalAmount` + `invoiceAccountResourceId` at row level. For multi-line invoices use `bulk_upsert_invoice_line_items` instead \u2014 that variant takes nested `lineItems[]`. Natural key: `invoiceReference` (rows sharing one within a batch are MERGED \u2014 last wins). Provide resourceId per invoice to update via UUID; or omit and rely on invoiceReference for upsert. Async \u2014 returns a jobId. Poll search_background_jobs with filter {resourceId:{eq:jobId}} until SUCCESS / FAILED / PARTIAL_SUCCESS; on PARTIAL_SUCCESS read data[0].errorDetails on the same response for per-row failures. Dates are ISO 8601 (YYYY-MM-DD) only \u2014 the dateFormat field was removed.",params:{invoices:{type:"array",description:"Array of invoices to create or update (max 500). Each row needs at least: invoiceReference, contactResourceId, valueDate, totalAmount, invoiceAccountResourceId.",items:{type:"object",properties:{rowIndex:{type:"string",description:"Optional caller-supplied row index for error reporting"},resourceId:{type:"string",description:"Invoice resourceId (UUID) \u2014 provide to update by ID"},invoiceReference:{type:"string",description:"Natural key (e.g., INV-2025-001) \u2014 required"},contactResourceId:{type:"string",description:"Customer contact UUID \u2014 required"},valueDate:{type:"string",description:"Invoice date YYYY-MM-DD \u2014 required"},dueDate:{type:"string",description:"Due date YYYY-MM-DD"},totalAmount:{type:"number",description:"Total amount (BigDecimal)"},currencyCode:{type:"string",description:"Currency (e.g., SGD)"},invoiceAccountResourceId:{type:"string",description:"Revenue account UUID"},itemDescription:{type:"string",description:"Single-line item description"},internalNotes:{type:"string",description:"Internal notes"},tags:{type:"array",items:{type:"string"},description:"Tag resourceIds"}}}}},required:["invoices"],group:"invoices",readOnly:!1,searchHint:"bulk create update invoices upsert import migrate",execute:async(e,t)=>{Gr(t.invoices,"invoices");let r=t.invoices;return no(r,["valueDate","dueDate"]),zb(e.client,r)}},{name:"bulk_upsert_invoice_line_items",description:"Create or update invoices with nested line items in bulk (max 500 invoices per call). Each row carries lineItems[] under its parent invoice (scoped by invoiceReference). Async \u2014 returns a jobId. Poll search_background_jobs filtered by resourceId; on PARTIAL_SUCCESS read data[0].errorDetails for per-row failures. Dates are ISO 8601 only.",params:{invoices:{type:"array",description:"Array of invoices with line items (max 500). Each invoice row has lineItems[].",items:{type:"object",properties:{rowIndex:{type:"string"},resourceId:{type:"string",description:"Invoice resourceId \u2014 provide to update by ID"},invoiceReference:{type:"string",description:"Natural key \u2014 required"},contactResourceId:{type:"string",description:"Customer UUID \u2014 required"},valueDate:{type:"string",description:"YYYY-MM-DD \u2014 required"},dueDate:{type:"string",description:"YYYY-MM-DD"},currencyCode:{type:"string"},internalNotes:{type:"string"},tags:{type:"array",items:{type:"string"}},lineItems:{type:"array",description:"Line items belonging to this invoice",items:{type:"object",properties:{itemDescription:{type:"string",description:"Line description \u2014 required"},quantity:{type:"number"},unit:{type:"string",description:"Unit of measure (pcs, kg, etc.)"},unitPrice:{type:"number"},accountResourceId:{type:"string",description:"Revenue account UUID"},taxProfileResourceId:{type:"string"}}}}}}}},required:["invoices"],group:"invoices",readOnly:!1,searchHint:"bulk invoices line items multi-line upsert import",execute:async(e,t)=>{Gr(t.invoices,"invoices");let r=t.invoices;return no(r,["valueDate","dueDate"]),Yb(e.client,r)}},{name:"bulk_upsert_bills",description:"Create or update bills in bulk (max 500 per call). FLAT shape: ONE line per bill via `itemDescription` + `totalAmount` + `billAccountResourceId` at row level. For multi-line bills use `bulk_upsert_bill_line_items` instead \u2014 that variant takes nested `lineItems[]`. Natural key: `billReference` (rows sharing one within a batch are MERGED \u2014 last wins). Async \u2014 returns a jobId. Poll search_background_jobs filtered by resourceId; on PARTIAL_SUCCESS read data[0].errorDetails for per-row failures. Dates are ISO 8601 only \u2014 dateFormat field was removed.",params:{bills:{type:"array",description:"Array of bills to create or update (max 500). Each row needs at least: billReference, contactResourceId, valueDate, totalAmount, billAccountResourceId.",items:{type:"object",properties:{rowIndex:{type:"string"},resourceId:{type:"string"},billReference:{type:"string",description:"Natural key \u2014 required"},contactResourceId:{type:"string",description:"Supplier UUID \u2014 required"},valueDate:{type:"string",description:"YYYY-MM-DD \u2014 required"},dueDate:{type:"string"},totalAmount:{type:"number"},currencyCode:{type:"string"},billAccountResourceId:{type:"string",description:"Expense account UUID"},itemDescription:{type:"string"},internalNotes:{type:"string"},tags:{type:"array",items:{type:"string"}}}}}},required:["bills"],group:"bills",readOnly:!1,searchHint:"bulk create update bills upsert import migrate",execute:async(e,t)=>{Gr(t.bills,"bills");let r=t.bills;return no(r,["valueDate","dueDate"]),Ry(e.client,r)}},{name:"bulk_upsert_bill_line_items",description:"Create or update bills with nested line items in bulk (max 500 bills per call). Each row carries lineItems[] under its parent bill (scoped by billReference). Async \u2014 returns a jobId. Poll search_background_jobs filtered by resourceId; on PARTIAL_SUCCESS read data[0].errorDetails for per-row failures.",params:{bills:{type:"array",description:"Array of bills with line items (max 500). Each bill row has lineItems[].",items:{type:"object",properties:{rowIndex:{type:"string"},resourceId:{type:"string"},billReference:{type:"string",description:"Natural key \u2014 required"},contactResourceId:{type:"string",description:"Supplier UUID \u2014 required"},valueDate:{type:"string",description:"YYYY-MM-DD \u2014 required"},dueDate:{type:"string"},currencyCode:{type:"string"},internalNotes:{type:"string"},tags:{type:"array",items:{type:"string"}},lineItems:{type:"array",items:{type:"object",properties:{itemDescription:{type:"string",description:"Required"},quantity:{type:"number"},unit:{type:"string"},unitPrice:{type:"number"},accountResourceId:{type:"string",description:"Expense account UUID"},taxProfileResourceId:{type:"string"}}}}}}}},required:["bills"],group:"bills",readOnly:!1,searchHint:"bulk bills line items multi-line upsert import",execute:async(e,t)=>{Gr(t.bills,"bills");let r=t.bills;return no(r,["valueDate","dueDate"]),ky(e.client,r)}},{name:"bulk_upsert_customer_credit_notes",description:"Create or update customer credit notes in bulk (max 500 per call). Natural key: creditNoteReference. Async \u2014 returns a jobId. Poll search_background_jobs filtered by resourceId; on PARTIAL_SUCCESS read data[0].errorDetails for per-row failures. Dates are ISO 8601 only.",params:{customerCreditNotes:{type:"array",description:"Array of customer credit notes (max 500).",items:{type:"object",properties:{rowIndex:{type:"string"},resourceId:{type:"string"},creditNoteReference:{type:"string",description:"Natural key \u2014 required"},contactResourceId:{type:"string",description:"Customer UUID \u2014 required"},valueDate:{type:"string",description:"YYYY-MM-DD \u2014 required"},currencyCode:{type:"string"},internalNotes:{type:"string"},tags:{type:"array",items:{type:"string"}},lineItems:{type:"array",items:{type:"object",properties:{itemDescription:{type:"string",description:"Required"},quantity:{type:"number"},unitPrice:{type:"number"},accountResourceId:{type:"string"},taxProfileResourceId:{type:"string"}}}}}}}},required:["customerCreditNotes"],group:"customer_credit_notes",readOnly:!1,searchHint:"bulk customer credit notes refund upsert import",execute:async(e,t)=>{Gr(t.customerCreditNotes,"customerCreditNotes",500,"customer credit notes");let r=t.customerCreditNotes;return no(r,["valueDate"]),L0(e.client,r)}},{name:"bulk_upsert_supplier_credit_notes",description:"Create or update supplier credit notes in bulk (max 500 per call). Natural key: creditNoteReference. Async \u2014 returns a jobId. Poll search_background_jobs filtered by resourceId; on PARTIAL_SUCCESS read data[0].errorDetails for per-row failures. Dates are ISO 8601 only.",params:{supplierCreditNotes:{type:"array",description:"Array of supplier credit notes (max 500).",items:{type:"object",properties:{rowIndex:{type:"string"},resourceId:{type:"string"},creditNoteReference:{type:"string",description:"Natural key \u2014 required"},contactResourceId:{type:"string",description:"Supplier UUID \u2014 required"},valueDate:{type:"string",description:"YYYY-MM-DD \u2014 required"},currencyCode:{type:"string"},internalNotes:{type:"string"},tags:{type:"array",items:{type:"string"}},lineItems:{type:"array",items:{type:"object",properties:{itemDescription:{type:"string",description:"Required"},quantity:{type:"number"},unitPrice:{type:"number"},accountResourceId:{type:"string"},taxProfileResourceId:{type:"string"}}}}}}}},required:["supplierCreditNotes"],group:"supplier_credit_notes",readOnly:!1,searchHint:"bulk supplier credit notes refund upsert import",execute:async(e,t)=>{Gr(t.supplierCreditNotes,"supplierCreditNotes",500,"supplier credit notes");let r=t.supplierCreditNotes;return no(r,["valueDate"]),q0(e.client,r)}},{name:"bulk_upsert_journals",description:"Create or update manual journals in bulk (max 500 per call). NATURAL KEY: `journalReference` (NOT `reference` \u2014 every other bulk-upsert uses entityReference, this one is asymmetric). LEGS field: `journalEntries[]` (NOT `entries[]` \u2014 different from `clio journals create` which uses entries). Each leg has `accountResourceId` + `debitAmount` + `creditAmount` (debit + credit must balance per row). Async \u2014 returns a jobId. Poll search_background_jobs filtered by resourceId; on PARTIAL_SUCCESS read data[0].errorDetails for per-row failures. Dates are ISO 8601 (YYYY-MM-DD) only \u2014 dateFormat field was removed.",params:{journals:{type:"array",description:"Array of journals to create or update (max 500). Each row has entries[] (debit/credit legs).",items:{type:"object",properties:{rowIndex:{type:"string"},resourceId:{type:"string"},journalReference:{type:"string",description:"Natural key \u2014 required (NOTE: field is `journalReference`, not `reference`)"},valueDate:{type:"string",description:"YYYY-MM-DD \u2014 required"},currencyCode:{type:"string"},internalNotes:{type:"string"},tags:{type:"array",items:{type:"string"}},journalEntries:{type:"array",description:"Journal legs (debit + credit amounts must balance) \u2014 field is `journalEntries`, NOT `entries`",items:{type:"object",properties:{accountResourceId:{type:"string",description:"Required"},description:{type:"string"},debitAmount:{type:"number"},creditAmount:{type:"number"},contactResourceId:{type:"string"},taxProfileResourceId:{type:"string"}}}}}}}},required:["journals"],group:"journals",readOnly:!1,searchHint:"bulk manual journals upsert import migration",execute:async(e,t)=>{Gr(t.journals,"journals");let r=t.journals;return no(r,["valueDate"]),Kb(e.client,r)}},{name:"bulk_upsert_fixed_assets",description:'\u26A0\uFE0F DATE FIELD MISMATCH: bulk-upsert REQUEST uses `valueDate` (not `purchaseDate`); the GET response uses `purchaseDate`. Sending `purchaseDate` returns a cryptic 400 "Invalid request body" with no field detail. Create or update fixed assets in bulk (max 500 per call). Natural key: `reference`. Each row REQUIRED: `reference`, `registrationType` (NEW | TRANSFER). Recommended: `typeCode`, `typeName`, `category` (TANGIBLE | INTANGIBLE), `cost` (or synonym `purchaseAmount`), `valueDate`, `depreciationStartDate`, `effectiveLife` (or synonym `usefulLifeMonths`), `depreciationMethod`, `purchaseAssetAccountResourceId`, `depreciationExpenseAccountResourceId`, `accumulatedDepreciationAccountResourceId`. Account fields must be valid UUIDv4. Async \u2014 returns a jobId. Poll search_background_jobs filtered by resourceId; on PARTIAL_SUCCESS read data[0].errorDetails for per-row failures. Dates are ISO 8601 (YYYY-MM-DD) only.',params:{fixedAssets:{type:"array",description:"Array of fixed assets to create or update (max 500).",items:{type:"object",properties:{rowIndex:{type:"string"},resourceId:{type:"string"},reference:{type:"string",description:"Natural key \u2014 required"},registrationType:{type:"string",enum:["NEW","TRANSFER"],description:"NEW = newly acquired, TRANSFER = inherited from prior system \u2014 required"},typeCode:{type:"string",description:"Asset class code (e.g., FURNITURE_AND_FIXTURE)"},typeName:{type:"string",description:'Human label for the typeCode (e.g., "Furniture and Fixtures")'},category:{type:"string",description:"TANGIBLE | INTANGIBLE"},name:{type:"string",description:"Asset name"},valueDate:{type:"string",description:"Acquisition date YYYY-MM-DD (NOTE: bulk uses `valueDate`, the GET response uses `purchaseDate` \u2014 different fields)"},cost:{type:"number",description:"Cost basis (alias for purchaseAmount on the bulk endpoint)"},purchaseAmount:{type:"number",description:"Cost basis (synonym of `cost`)"},currencyCode:{type:"string"},depreciationStartDate:{type:"number",description:'Epoch milliseconds (NOT YYYY-MM-DD \u2014 inconsistent with valueDate which IS YYYY-MM-DD on this same endpoint). Sending YYYY-MM-DD returns generic 400 "Invalid request body" with no detail. Omit to default to valueDate.'},effectiveLife:{type:"number",description:"Useful life in months (alias for usefulLifeMonths)"},usefulLifeMonths:{type:"number",description:"Useful life in months (synonym of effectiveLife)"},depreciationMethod:{type:"string",description:"e.g., STRAIGHT_LINE, DOUBLE_DECLINING_BALANCE"},purchaseAssetAccountResourceId:{type:"string",description:"Asset (PPE) account UUID \u2014 must be valid UUIDv4"},depreciationExpenseAccountResourceId:{type:"string",description:"Depreciation expense account UUID \u2014 must be valid UUIDv4"},accumulatedDepreciationAccountResourceId:{type:"string",description:"Accumulated depreciation account UUID"},internalNotes:{type:"string"},tags:{type:"array",items:{type:"string"}}}}}},required:["fixedAssets"],group:"fixed_assets",readOnly:!1,searchHint:"bulk fixed assets ppe register upsert import migrate",execute:async(e,t)=>{Gr(t.fixedAssets,"fixedAssets",500,"fixed assets");let r=t.fixedAssets;return no(r,["valueDate"]),e_(e.client,r)}},{name:"quick_reconcile",description:"Bulk-reconcile bank statement entries against a list of journals (max 500). Reconciliation mode is hardcoded to QUICK_RECON. Async \u2014 returns a jobId. Poll search_background_jobs filtered by resourceId; on PARTIAL_SUCCESS read data[0].errorDetails. Caller provides bankAccountResourceId + journalsForReconciliation[] (each row: bankStatementEntryResourceId, journalReference, journalAccountResourceId).",params:{bankAccountResourceId:{type:"string",description:"Bank account UUID (the entries belong to this account)"},journalsForReconciliation:{type:"array",description:"Per-row reconciliation instructions (max 500).",items:{type:"object",properties:{bankStatementEntryResourceId:{type:"string",description:"Bank entry UUID \u2014 required"},journalReference:{type:"string",description:"Journal reference text \u2014 required"},journalAccountResourceId:{type:"string",description:"Offsetting account UUID (revenue for cash-in, expense for cash-out) \u2014 required"},contactResourceId:{type:"string",description:"Contact UUID"},capsuleResourceId:{type:"string",description:"Capsule UUID"},taxProfileResourceId:{type:"string",description:"Tax profile UUID"},internalNotes:{type:"string"},journalEntryDescription:{type:"string"},tags:{type:"array",items:{type:"string"}},rowIndex:{type:"string",description:"Optional caller-supplied index for error correlation"}}}}},required:["bankAccountResourceId","journalsForReconciliation"],group:"reconciliations",readOnly:!1,searchHint:"bulk reconcile bank statement journals match",execute:async(e,t)=>(Gr(t.journalsForReconciliation,"journalsForReconciliation",500,"journals"),N_(e.client,t))},{name:"apply_bank_rule",description:"Apply a pre-configured bank rule (action shortcut) to a batch of bank statement entries (max 500). Async \u2014 returns a jobId. Poll search_background_jobs filtered by resourceId. The rule executes its configured action (e.g. RECONCILE_WITH_DIRECT_CASH_ENTRY) on each entry.",params:{actionShortcutResourceId:{type:"string",description:"Bank rule UUID \u2014 required"},businessTransactionResourceIds:{type:"array",description:"Bank statement entry UUIDs to apply the rule to (max 500). Note: the field is named businessTransactionResourceIds for legacy reasons but accepts bank entry IDs.",items:{type:"string"}}},required:["actionShortcutResourceId","businessTransactionResourceIds"],group:"reconciliations",readOnly:!1,searchHint:"bank rule apply action shortcut bulk reconcile",execute:async(e,t)=>(Gr(t.businessTransactionResourceIds,"businessTransactionResourceIds",500,"entries"),R_(e.client,t))},{name:"reconcile_direct_cash_entry",description:"Reconcile a bank statement entry with a single cash-in / cash-out line. Direction (cash-in vs cash-out) is INFERRED from the bank entry sign. Sync \u2014 returns the reconciled entry status. NOT idempotent: calling twice on the same bankStatementEntryResourceId creates duplicate journals. Confirm reconciled-state via view_auto_reconciliation before retrying.",params:{bankStatementEntryResourceId:{type:"string",description:"Bank entry UUID \u2014 required"},bankAccountResourceId:{type:"string",description:"Bank account UUID (used to look up the entry) \u2014 required"},reference:{type:"string",description:"Reference for the cash entry \u2014 required"},accountResourceId:{type:"string",description:"Offsetting account UUID (revenue for cash-in, expense for cash-out) \u2014 required"},amount:{type:"number",description:"Amount in source currency. Defaults to bank entry amount if omitted."},description:{type:"string"},contactResourceId:{type:"string"},taxProfileResourceId:{type:"string"},internalNotes:{type:"string"},bankAccountJournalEntryDescription:{type:"string",description:"Description for the bank-side journal entry"},tags:{type:"array",items:{type:"string"}},taxVatApplicable:{type:"boolean"},taxInclusion:{type:"boolean"},capsuleResourceId:{type:"string"}},required:["bankStatementEntryResourceId","bankAccountResourceId","reference","accountResourceId"],group:"reconciliations",readOnly:!1,searchHint:"reconcile bank entry direct cash in out single line",execute:async(e,t)=>k_(e.client,t)},{name:"reconcile_cash_journal",description:"Reconcile a bank statement entry with a multi-line cashflow journal (multiple cash splits, max 200 lines). Sync \u2014 returns the reconciled entry status. NOT idempotent \u2014 confirm reconciled-state before retrying.",params:{bankStatementEntryResourceId:{type:"string",description:"Bank entry UUID \u2014 required"},bankAccountResourceId:{type:"string",description:"Bank account UUID \u2014 required"},reference:{type:"string",description:"Journal reference \u2014 required"},journalEntries:{type:"array",description:"Cash journal lines (max 200). Each row is one debit OR credit against an account.",items:{type:"object",properties:{accountResourceId:{type:"string",description:"Account UUID \u2014 required"},amount:{type:"number",description:"Amount in source currency \u2014 required (>0)"},description:{type:"string"},taxProfileResourceId:{type:"string"}}}},contactResourceId:{type:"string"},bankAccountJournalEntryDescription:{type:"string"},internalNotes:{type:"string"},tags:{type:"array",items:{type:"string"}},taxVatApplicable:{type:"boolean"},taxInclusion:{type:"boolean"},capsuleResourceId:{type:"string"}},required:["bankStatementEntryResourceId","bankAccountResourceId","reference","journalEntries"],group:"reconciliations",readOnly:!1,searchHint:"reconcile bank entry multi line cash journal splits",execute:async(e,t)=>(Gr(t.journalEntries,"journalEntries",200,"entries"),F_(e.client,t))},{name:"reconcile_manual_journal",description:'\u26A0\uFE0F CALLER PROVIDES ONLY THE OFFSET LEG(S) \u2014 backend AUTO-ADDS the bank-side leg from the statement entry. Sending both debit AND credit legs \u2192 422 "sum of debit and credit amounts are not equal" (your sides duplicate after the auto-add). Reconcile a bank statement entry with a double-entry manual journal. Sync \u2014 returns the reconciled entry status. valueDate prefills from bank entry if omitted. NOT idempotent.',params:{bankStatementEntryResourceId:{type:"string",description:"Bank entry UUID \u2014 required"},bankAccountResourceId:{type:"string",description:"Bank account UUID \u2014 required"},status:{type:"string",enum:["DRAFT","ACTIVE"],description:"Journal status \u2014 required"},journalEntries:{type:"array",description:"Offset-side journal entries only (max 200). The bank-side leg is auto-added by the API.",items:{type:"object",properties:{accountResourceId:{type:"string",description:"Account UUID \u2014 required"},type:{type:"string",enum:["DEBIT","CREDIT"]},amount:{type:"number",description:"Amount \u2014 required"},description:{type:"string"},contactResourceId:{type:"string"},taxProfileResourceId:{type:"string"}}}},reference:{type:"string"},valueDate:{type:"string",description:"YYYY-MM-DD. Defaults to bank entry value date."},contactResourceId:{type:"string"},internalNotes:{type:"string"},bankAccountJournalEntryDescription:{type:"string"},taxVatApplicable:{type:"boolean"},taxInclusion:{type:"boolean"},tags:{type:"array",items:{type:"string"}},capsuleResourceId:{type:"string"}},required:["bankStatementEntryResourceId","bankAccountResourceId","status","journalEntries"],group:"reconciliations",readOnly:!1,searchHint:"reconcile bank entry manual journal double entry",execute:async(e,t)=>(Gr(t.journalEntries,"journalEntries",200,"entries"),P_(e.client,t))},{name:"reconcile_cash_transfer",description:"Reconcile a bank statement entry with an inter-account transfer. Sync \u2014 returns the reconciled entry status. amount is required only when the counterparty account is in a non-functional currency. NOT idempotent.",params:{bankStatementEntryResourceId:{type:"string",description:"Bank entry UUID \u2014 required"},bankAccountResourceId:{type:"string",description:"Bank account UUID \u2014 required"},accountResourceId:{type:"string",description:"Counterparty cash account UUID \u2014 required"},reference:{type:"string",description:"Transfer reference \u2014 required"},amount:{type:"number",description:"Amount in source currency. Required only for cross-currency transfers."},contactResourceId:{type:"string"},internalNotes:{type:"string"},tags:{type:"array",items:{type:"string"}},capsuleResourceId:{type:"string"}},required:["bankStatementEntryResourceId","bankAccountResourceId","accountResourceId","reference"],group:"reconciliations",readOnly:!1,searchHint:"reconcile bank entry transfer between accounts",execute:async(e,t)=>L_(e.client,t)},{name:"reconcile_invoice_receipt",description:'\u26A0\uFE0F BSE must have `paymentDirection: PAYIN` (money in \u2014 AR). Produce via `bank add-records` with a POSITIVE amount (creates `credit_amount > 0` \u2192 PAYIN). Statement-imported BSEs from `bank import` also work. The error code "Invalid business transaction type" (422) is misleadingly named \u2014 the actual gate is direction, not entry type. Create an invoice and auto-reconcile it to a bank statement entry (AR). Sync \u2014 returns the reconciled entry status. valueDate / dueDate / payment amount prefill from the bank entry if omitted. NOT idempotent.',params:{bankStatementEntryResourceId:{type:"string",description:"Bank entry UUID \u2014 required"},bankAccountResourceId:{type:"string",description:"Bank account UUID \u2014 required"},invoiceDetails:{type:"object",description:"The invoice to create. Required.",properties:{reference:{type:"string",description:"Invoice reference \u2014 required"},contactResourceId:{type:"string",description:"Customer UUID"},valueDate:{type:"string",description:"YYYY-MM-DD. Defaults to bank entry value date."},dueDate:{type:"string",description:"YYYY-MM-DD. Defaults to value date."},taxInclusion:{type:"boolean"},isTaxVATApplicable:{type:"boolean"},lineItems:{type:"array",description:"Invoice line items (max 500) \u2014 required",items:{type:"object",properties:{name:{type:"string",description:"Line description \u2014 required"},quantity:{type:"number"},unit:{type:"string"},unitPrice:{type:"number"},organizationAccountResourceId:{type:"string",description:"Revenue account UUID"},itemResourceId:{type:"string"},taxProfileResourceId:{type:"string"}}}},recordedPayment:{type:"object",description:"Optional. The matching payment record \u2014 auto-built from the bank entry if omitted.",properties:{reference:{type:"string"},valueDate:{type:"string",description:"YYYY-MM-DD. Defaults to bank entry value date."},organizationAccountResourceId:{type:"string"},paymentAmount:{type:"number"},transactionAmount:{type:"number"},paymentMethod:{type:"string",description:"Defaults to BANK_TRANSFER"}}},capsuleResourceId:{type:"string"}}}},required:["bankStatementEntryResourceId","bankAccountResourceId","invoiceDetails"],group:"reconciliations",readOnly:!1,searchHint:"reconcile bank entry invoice receipt AR sale",execute:async(e,t)=>(A$(t.invoiceDetails,"invoiceDetails"),j_(e.client,t))},{name:"reconcile_bill_receipt",description:'\u26A0\uFE0F BSE must have `paymentDirection: PAYOUT` (money out \u2014 AP). Produce via `bank add-records` with a NEGATIVE amount (creates `debit_amount > 0` \u2192 PAYOUT). Statement-imported BSEs from `bank import` also work. The error code "Invalid business transaction type" (422) is misleadingly named \u2014 the actual gate is direction, not entry type. Create a bill and auto-reconcile it to a bank statement entry (AP). Sync \u2014 returns the reconciled entry status. valueDate / dueDate / payment amount prefill from the bank entry if omitted. NOT idempotent.',params:{bankStatementEntryResourceId:{type:"string",description:"Bank entry UUID \u2014 required"},bankAccountResourceId:{type:"string",description:"Bank account UUID \u2014 required"},billDetails:{type:"object",description:"The bill to create. Required.",properties:{reference:{type:"string",description:"Bill reference \u2014 required"},contactResourceId:{type:"string",description:"Supplier UUID"},valueDate:{type:"string",description:"YYYY-MM-DD. Defaults to bank entry value date."},dueDate:{type:"string",description:"YYYY-MM-DD. Defaults to value date."},taxInclusion:{type:"boolean"},isTaxVATApplicable:{type:"boolean"},lineItems:{type:"array",description:"Bill line items (max 500) \u2014 required",items:{type:"object",properties:{name:{type:"string",description:"Line description \u2014 required"},quantity:{type:"number"},unit:{type:"string"},unitPrice:{type:"number"},organizationAccountResourceId:{type:"string",description:"Expense account UUID"},itemResourceId:{type:"string"},taxProfileResourceId:{type:"string"}}}},recordedPayment:{type:"object",description:"Optional. The matching payment record \u2014 auto-built from the bank entry if omitted.",properties:{reference:{type:"string"},valueDate:{type:"string",description:"YYYY-MM-DD"},organizationAccountResourceId:{type:"string"},paymentAmount:{type:"number"},transactionAmount:{type:"number"},paymentMethod:{type:"string",description:"Defaults to BANK_TRANSFER"}}},capsuleResourceId:{type:"string"}}}},required:["bankStatementEntryResourceId","bankAccountResourceId","billDetails"],group:"reconciliations",readOnly:!1,searchHint:"reconcile bank entry bill receipt AP purchase",execute:async(e,t)=>(A$(t.billDetails,"billDetails"),M_(e.client,t))},{name:"validate_drafts",description:"BULK validate \u2014 process up to 500 draft business transactions in ONE call, mixing any combination of invoices, bills, customer credit notes, and supplier credit notes (no per-type tools needed). SYNC: returns per-item errors and display data inline; no state change. Use this before convert_drafts_to_active to surface eligibility issues client-side. btType enum: SALE = invoice, PURCHASE = bill, SALE_CREDIT_NOTE = customer CN, PURCHASE_CREDIT_NOTE = supplier CN. Journals are NOT in this enum.",params:{items:{type:"array",description:"Draft business transaction references (max 500). Mix any btType freely.",items:{type:"object",properties:{btResourceId:{type:"string",description:"Draft BT resource ID (UUID) \u2014 required"},btType:{type:"string",enum:["SALE","PURCHASE","SALE_CREDIT_NOTE","PURCHASE_CREDIT_NOTE"],description:"Required"}}}}},required:["items"],group:"drafts",readOnly:!0,isConcurrencySafe:!0,searchHint:"validate drafts eligibility check before convert promote",execute:async(e,t)=>(ml(t.items),T_(e.client,t.items))},{name:"convert_drafts_to_active",description:"BULK promote \u2014 finalize up to 500 draft business transactions to ACTIVE in ONE call, mixing any combination of invoices, bills, and credit notes (no per-type tools needed). ASYNC: returns a jobId \u2014 poll search_background_jobs filtered by resourceId; on PARTIAL_SUCCESS read data[0].errorDetails for per-row failures. NOT idempotent: a second call on already-promoted drafts returns 422. Filter the draft list by status: DRAFT before submitting. Pair with validate_drafts for a pre-flight check on large batches.",params:{items:{type:"array",description:"Draft BT references (max 500). Mix any btType.",items:{type:"object",properties:{btResourceId:{type:"string",description:"Draft BT resource ID (UUID) \u2014 required"},btType:{type:"string",enum:["SALE","PURCHASE","SALE_CREDIT_NOTE","PURCHASE_CREDIT_NOTE"],description:"Required"}}}}},required:["items"],group:"drafts",readOnly:!1,searchHint:"convert drafts to active promote finalize bulk",execute:async(e,t)=>(ml(t.items),O_(e.client,t.items))},{name:"submit_drafts_for_approval",description:"BULK submit \u2014 route up to 500 draft business transactions into the approval workflow in ONE call, mixing any combination of invoices, bills, and credit notes. ASYNC: returns a jobId \u2014 poll search_background_jobs filtered by resourceId; on PARTIAL_SUCCESS read data[0].errorDetails for per-row failures. NOT idempotent on drafts that already have an in-flight approval request.",params:{items:{type:"array",description:"Draft BT references (max 500). Mix any btType.",items:{type:"object",properties:{btResourceId:{type:"string",description:"Draft BT resource ID (UUID) \u2014 required"},btType:{type:"string",enum:["SALE","PURCHASE","SALE_CREDIT_NOTE","PURCHASE_CREDIT_NOTE"],description:"Required"}}}}},required:["items"],group:"drafts",readOnly:!1,searchHint:"submit drafts for approval workflow review bulk",execute:async(e,t)=>(ml(t.items),$_(e.client,t.items))},{name:"search_help_center",description:`Search the Jaz help center for how-to articles, feature guides, and accounting concepts. Use this for "how do I..." or "what is..." questions about Jaz: bank reconciliation, GST/VAT filing, multi-currency, fixed assets, custom fields, integrations, and so on. Returns top matching articles with title, section, snippet, and source URL.
|
|
849
864
|
|
|
850
865
|
Works without an API key \u2014 bundle ships the help center corpus locally.`,params:{query:{type:"string",description:'Natural-language question or keywords (e.g. "how do I reconcile a bank statement", "set up GST", "multi-currency invoice").'},limit:{type:"number",description:"Maximum number of articles to return (default 3, max 10)."},section:{type:"string",description:'Optional: restrict to a single help-center section slug (e.g. "bank-reconciliations", "invoices").'}},required:["query"],group:"help_center",readOnly:!0,searchHint:"help center docs how to guide article search question",isConcurrencySafe:!0,maxResultSizeChars:2e4,execute:async(e,t)=>{let r=String(t.query??"").trim();if(!r)return{error:"Query is required.",hint:"Pass a natural-language question or keywords."};let n=typeof t.limit=="number"&&!Number.isNaN(t.limit)?t.limit:3,o=Math.max(1,Math.min(10,Math.floor(n))),i=typeof t.section=="string"?t.section:void 0;try{let s=Jf();if(i&&!s.sections.some(c=>c.slug===i))return{error:`Unknown section: "${i}".`,available:s.sections.map(c=>c.slug),hint:"Omit the section parameter to search every section, or pick a slug from the available list."};let a=Li(s,r,{limit:o,section:i});return a.length===0?{results:[],hint:"No matching articles. Try broader keywords or rephrase the question."}:{results:a.map(c=>({title:c.article.title,section:c.section.name,sectionSlug:c.section.slug,snippet:c.article.snippet,url:c.article.sourceUrl,score:Math.round(c.score*1e3)/1e3,matchedTerms:c.matchedTerms})),totalArticles:s.articleCount,searchedSections:i?[i]:void 0}}catch(s){return{error:"Help center search failed.",detail:s instanceof Error?s.message:String(s),hint:"The bundled help-center index may be missing or corrupt."}}}},{name:"practice_init",description:"Scaffold the practitioner workspace at ~/Documents/Jaz Practice (or PRACTICE_HOME env override). Creates clients/, templates/, and a starter PRACTICE.md from the firm name. Idempotent on re-run. Filesystem-only. Run once before practice_onboard_client.",params:{firmName:{type:"string",description:"Display name shown on outputs."},defaultBaseCurrency:{type:"string",description:'Default currency for new clients (e.g., "SGD"). Defaults to SGD.'},defaultJurisdiction:{type:"string",description:'ISO-3166 alpha-2 (e.g., "SG"). Defaults to SG.'},defaultJazApiKey:{type:"string",description:"Optional default JAZ_API_KEY for all clients (last in resolution chain after CLIENT.md override and env)."},practiceHome:{type:"string",description:"Optional override for the practice home dir. Defaults to ~/Documents/Jaz Practice or PRACTICE_HOME env."}},required:["firmName"],group:"practice",readOnly:!1,searchHint:"practice init firm setup workspace scaffold",isConcurrencySafe:!1,maxResultSizeChars:5e3,execute:async(e,t)=>{let r=cn(t.practiceHome);La(r);let n=ja(r),o=n??{v:1,firm_name:String(t.firmName),default_jaz_api_key:t.defaultJazApiKey,default_base_currency:t.defaultBaseCurrency??"SGD",default_jurisdiction:t.defaultJurisdiction??"SG",materiality_default:1e3,body:"Firm-level defaults that flow into every new client. Changes here apply to NEW clients only."};return n&&(t.firmName&&(o.firm_name=String(t.firmName)),t.defaultBaseCurrency&&(o.default_base_currency=String(t.defaultBaseCurrency)),t.defaultJurisdiction&&(o.default_jurisdiction=String(t.defaultJurisdiction)),t.defaultJazApiKey&&(o.default_jaz_api_key=String(t.defaultJazApiKey))),_p(r,o),{practiceHome:r,firmName:o.firm_name,defaultBaseCurrency:o.default_base_currency,defaultJurisdiction:o.default_jurisdiction,clientsDir:`${r}/clients`,wasExisting:n!==null}}},{name:"practice_list_clients",description:"List all clients in the practitioner workspace. Returns slugs and last-active engagement per client. Filesystem-only. Use as a dashboard entry point before practice_load_client.",params:{practiceHome:{type:"string",description:"Optional override; defaults to ~/Documents/Jaz Practice."}},required:[],group:"practice",readOnly:!0,searchHint:"practice list clients dashboard",isConcurrencySafe:!0,maxResultSizeChars:2e4,execute:async(e,t)=>{let r=cn(t.practiceHome),o=Ap(r).map(i=>{let s=Ri(r,i),a=Ua(r,i);return{slug:i,legalEntityName:s?.legal_entity_name??i,fyEnd:s?.fy_end,baseCurrency:s?.base_currency,gstScheme:s?.gst_scheme,hasJazApiKeyOverride:!!s?.jaz_api_key_override,activeEngagements:a}});return{practiceHome:r,total:o.length,clients:o}}},{name:"practice_load_client",description:"Read a client's CLIENT.md master file. Returns the full record (legal entity, FY, COA mapping notes, banks, recurring accruals, recurring engagements, etc.) plus the list of active engagements. Filesystem-only. Use this to give the agent client context before invoking jaz-jobs blueprints or jaz-recipes recipes.",params:{slug:{type:"string",description:'Client slug (lowercase, hyphenated; e.g., "acme-pte-ltd").'},practiceHome:{type:"string",description:"Optional override."}},required:["slug"],group:"practice",readOnly:!0,searchHint:"practice load client read context CLIENT.md",isConcurrencySafe:!0,maxResultSizeChars:3e4,execute:async(e,t)=>{let r=cn(t.practiceHome),n=String(t.slug);try{Cn(n,"client slug")}catch(s){return{error:s instanceof Error?s.message:String(s)}}let o=Ri(r,n);if(!o)return{error:`Client not found: ${n}`,hint:"Run practice_list_clients to see available slugs, or practice_onboard_client to create a new one."};let i=Ua(r,n).map(s=>{let a=qa(r,n,s);return a?{slug:s,type:a.type,period:a.period,status:a.status,scope:a.scope_summary}:null}).filter(Boolean);return{client:Cp(o),engagements:i}}},{name:"practice_onboard_client",description:"Scaffold a new client folder and write the initial CLIENT.md. Captures legal entity, FY end, GST scheme, banks, recurring accruals, recurring engagements. Optionally sets a per-client JAZ_API_KEY override for multi-org agencies. Filesystem-only. After this, call practice_create_engagement for the first period.",params:{legalEntityName:{type:"string",description:"Full legal name as registered with ACRA / equivalent."},uen:{type:"string",description:"Singapore UEN if applicable."},registeredAddress:{type:"string",description:"ACRA-registered address."},country:{type:"string",description:"ISO-3166 alpha-2; defaults to PRACTICE.md.default_jurisdiction."},baseCurrency:{type:"string",description:"ISO-4217; defaults to PRACTICE.md.default_base_currency."},fyEnd:{type:"string",description:'MM-DD format (e.g., "12-31"). Drives annual-statutory engagement period boundaries.'},gstScheme:{type:"string",enum:["quarterly","monthly","not-registered"],description:"GST registration cadence; drives quarterly-gst engagement scheduling."},gstRegistrationNumber:{type:"string",description:"Required when gstScheme != not-registered."},corporateTaxBracket:{type:"string",enum:["standard","startup_exemption","partial_exemption"],description:"Drives Form C-S computation path during annual-statutory."},jazApiKeyOverride:{type:"string",description:"Optional per-client API key. Resolution: this override -> PRACTICE.md.default_jaz_api_key -> JAZ_API_KEY env."},jazOrgId:{type:"string",description:"Optional Jaz org UUID. Pinned for tool invocations against this client."},materialityThreshold:{type:"number",description:"In base currency. Defaults to PRACTICE.md.materiality_default."},bankAccounts:{type:"array",description:"Array of {name, currency, account_number_ref?, jaz_resource_id?}. Read by monthly-close before search_bank_records.",items:{type:"object"}},recurringAccruals:{type:"array",description:'Array of {name, gl_account, vendor?, estimation_method?, fixed_amount?}. Drives plan_recipe(name: "accrued-expense") in monthly-close.',items:{type:"object"}},recurringEngagements:{type:"array",description:'Array of {type, cadence}. e.g. [{type: "monthly-close", cadence: "monthly"}]. Drives engagement scheduling.',items:{type:"object"}},keyContacts:{type:"array",description:"Array of {name, role, email?}.",items:{type:"object"}},practiceHome:{type:"string",description:"Optional override."}},required:["legalEntityName","fyEnd","gstScheme"],group:"practice",readOnly:!1,searchHint:"practice onboard new client setup CLIENT.md",isConcurrencySafe:!1,maxResultSizeChars:5e3,execute:async(e,t)=>{let r=cn(t.practiceHome);La(r);let n=ja(r);try{let o=xp(r,{legal_entity_name:String(t.legalEntityName),uen:t.uen,registered_address:t.registeredAddress,country:t.country,base_currency:t.baseCurrency,fy_end:String(t.fyEnd),gst_scheme:t.gstScheme,gst_registration_number:t.gstRegistrationNumber,corporate_tax_bracket:t.corporateTaxBracket,jaz_api_key_override:t.jazApiKeyOverride,jaz_org_id:t.jazOrgId,materiality_threshold:t.materialityThreshold,bank_accounts:t.bankAccounts,recurring_accruals:t.recurringAccruals,recurring_engagements:t.recurringEngagements,key_contacts:t.keyContacts},n);return{slug:o.slug,path:o.path,nextStep:"Call practice_create_engagement to scaffold the first engagement (e.g., type: monthly-close for the current period)."}}catch(o){return{error:o instanceof Error?o.message:String(o),hint:"If the slug already exists, choose a different legal_entity_name or remove the existing folder."}}}},{name:"practice_create_engagement",description:"Scaffold a new engagement folder under a client. Creates ENGAGEMENT.md from the type-specific template plus inputs/, workpapers/, deliverables/ subdirs. Filesystem-only. Engagement type drives which jaz-jobs blueprint and jaz-recipes recipes the agent should invoke. period is REQUIRED for monthly-close (YYYY-MM), quarterly-gst (YYYY-QN), and annual-statutory (YYYY) \u2014 only onboarding and adhoc accept free-text or omitted period.",params:{clientSlug:{type:"string",description:"Existing client slug."},type:{type:"string",enum:["monthly-close","quarterly-gst","annual-statutory","onboarding","adhoc"],description:"Engagement type. monthly-close uses generate_month_end_blueprint; quarterly-gst uses generate_gst_vat_blueprint; annual-statutory uses generate_year_end_blueprint + generate_audit_prep_blueprint + generate_statutory_filing_blueprint."},period:{type:"string",description:"Period in the format the type expects. REQUIRED for monthly-close (YYYY-MM, e.g. 2026-03), quarterly-gst (YYYY-QN, e.g. 2026-Q1), annual-statutory (YYYY, e.g. 2026). Free-text or omitted accepted only for onboarding and adhoc. Validated server-side; malformed periods rejected before scaffolding to prevent audit-trail gaps."},scopeSummary:{type:"string",description:"One sentence describing what this engagement produces."},targetCompletionDate:{type:"string",description:"YYYY-MM-DD. Used by practice_list_clients to flag overdue work."},practiceHome:{type:"string",description:"Optional override."}},required:["clientSlug","type"],group:"practice",readOnly:!1,searchHint:"practice create engagement scaffold ENGAGEMENT.md monthly close gst statutory",isConcurrencySafe:!1,maxResultSizeChars:5e3,execute:async(e,t)=>{let r=cn(t.practiceHome),n=String(t.clientSlug);try{Cn(n,"client slug")}catch(s){return{error:s instanceof Error?s.message:String(s)}}let o=Ri(r,n);if(!o)return{error:`Client not found: ${n}`,hint:"Run practice_list_clients or practice_onboard_client first."};let i=t.type;try{xu(i,t.period)}catch(s){return{error:s instanceof Error?s.message:String(s),hint:"Recurring/statutory engagements require a period: monthly-close=YYYY-MM, quarterly-gst=YYYY-QN, annual-statutory=YYYY."}}try{let s=Tp(r,n,{type:i,period:t.period,scope_summary:t.scopeSummary,target_completion_date:t.targetCompletionDate},o.jaz_org_id);return{slug:s.slug,path:s.path,nextStep:"Open ENGAGEMENT.md and follow the type-specific playbook in jaz-practice/references/<type>.md."}}catch(s){return{error:s instanceof Error?s.message:String(s),hint:"If the engagement folder already exists, pick a different period or load the existing one with practice_load_engagement."}}}},{name:"practice_load_engagement",description:"Read an engagement's ENGAGEMENT.md file. Returns scope, status, period, queries, decisions log. Pair with practice_load_client to get full context before driving jaz-jobs / jaz-recipes work.",params:{clientSlug:{type:"string",description:"Client slug."},engagementSlug:{type:"string",description:'Engagement slug (e.g., "monthly-close-2026-03").'},practiceHome:{type:"string",description:"Optional override."}},required:["clientSlug","engagementSlug"],group:"practice",readOnly:!0,searchHint:"practice load engagement read ENGAGEMENT.md context",isConcurrencySafe:!0,maxResultSizeChars:2e4,execute:async(e,t)=>{let r=cn(t.practiceHome),n=String(t.clientSlug),o=String(t.engagementSlug);try{Cn(n,"client slug"),Cn(o,"engagement slug")}catch(s){return{error:s instanceof Error?s.message:String(s)}}let i=qa(r,n,o);return i?{engagement:i}:{error:`Engagement not found: ${n}/${o}`,hint:"Run practice_load_client to see active engagement slugs."}}}];var B_=null;function r_e(){if(!B_){B_=new Map;for(let e of gl)B_.set(e.name,e)}return B_}function U_(e){return r_e().get(e)}function $$(){return gl}function yl(e){return $$().filter(t=>t.group===e)}ts();function n_e(e){switch(e){case 401:return"Invalid or missing API key. Run `clio auth add` or set JAZ_API_KEY.";case 403:return"Insufficient permissions for this operation.";case 404:return"Resource not found \u2014 check the resourceId. Use a search/list tool to look it up.";case 409:return"Conflict \u2014 resource may have been modified. Re-fetch and retry.";case 422:return"Validation error \u2014 check field values against the tool description.";case 429:return"Rate limited \u2014 wait a moment and retry.";default:return""}}function mG(e){if(e instanceof es){let r=n_e(e.status);return{error:e.message,status:e.status,endpoint:e.endpoint,...r?{hint:r}:{}}}return{error:e instanceof Error?e.message:String(e)}}function hG(e,t){if(e.readOnly)return{valid:!0,errors:[]};let r=[];for(let n of e.required){let o=t[n];if(o==null){r.push(`Missing required field: ${n}`);continue}typeof o=="string"&&o.trim()===""&&r.push(`Required field "${n}" is empty`)}for(let[n,o]of Object.entries(t)){if(o==null)continue;let i=e.params[n];if(!i)continue;let s=o_e(n,o,i);s&&r.push(s),i.enum&&typeof o=="string"&&(i.enum.includes(o)||r.push(`Field "${n}" value "${o}" not in allowed values: ${i.enum.join(", ")}`))}return{valid:r.length===0,errors:r}}function o_e(e,t,r){switch(r.type){case"string":if(typeof t!="string")return`Field "${e}" expected string, got ${typeof t}`;break;case"number":if(typeof t!="number"||!Number.isFinite(t))return`Field "${e}" expected finite number, got ${typeof t=="number"?"non-finite":typeof t}`;break;case"boolean":if(typeof t!="boolean")return`Field "${e}" expected boolean, got ${typeof t}`;break;case"array":if(!Array.isArray(t))return`Field "${e}" expected array, got ${typeof t}`;break;case"object":if(typeof t!="object"||Array.isArray(t))return`Field "${e}" expected object, got ${Array.isArray(t)?"array":typeof t}`;break}return null}var Dl=[{name:"invoices",description:"Sales invoices (INV/SI). Create, search, get, update, delete, pay, finalize, apply credits, download PDF. Also: receivables, AR, billing, overdue invoices.",groups:["invoices"]},{name:"customer_credit_notes",description:"Customer credit notes (CN). Create, search, update, delete, finalize, refund, download PDF. Also: sales returns, customer CN.",groups:["customer_credit_notes"]},{name:"bills",description:"Purchase bills (PO/PI). Create, search, get, update, delete, pay, finalize, apply credits. Also: payables, AP, vendor invoices, supplier bills.",groups:["bills"]},{name:"supplier_credit_notes",description:"Supplier credit notes. Create, search, update, delete, finalize, refund. Also: purchase returns, debit notes, supplier CN.",groups:["supplier_credit_notes"]},{name:"journals",description:"Journal entries (JE). Create, search, update, delete manual journals. Also: adjusting entries, accruals, reclassifications, corrections.",groups:["journals"]},{name:"cash_entries",description:"Cash-in receipts and cash-out disbursements for external cash movements. WHEN TO USE: money received from customers/external \u2192 cash-in. Money paid to suppliers/external \u2192 cash-out. For internal account-to-account transfers, use cash_transfers namespace.",groups:["cash_entries"]},{name:"cash_transfers",description:"Cash transfers between your own bank/cash accounts and cashflow transaction search. WHEN TO USE: moving funds between own accounts (main bank \u2192 petty cash, USD \u2192 SGD). For external receipts/payments, use cash_entries namespace.",groups:["cash_transfers"]},{name:"bank_accounts",description:"Bank accounts, bank statement imports (CSV/OFX), bank records search, auto-reconciliation. For unreconciled queries: ALWAYS search bank records with status UNRECONCILED after listing accounts. Also: bank feeds, bank balance.",groups:["bank"]},{name:"bank_rules",description:"Bank reconciliation rules (action shortcuts). Create, search, update, delete bank rules. Configure auto-matching rules for bank records.",groups:["bank_rules"]},{name:"reconciliations",description:"Apply a reconciliation decision to a bank statement entry \u2014 write side. Distinct from bank_accounts/bank_rules (which configure auto-reconciliation) and view_auto_reconciliation (which queries suggestions). Eight endpoints: quick_reconcile + apply_bank_rule (async, bulk), and direct_cash_entry / cash_journal / manual_journal / cash_transfer / invoice_receipt / bill_receipt (sync, per-entry). Most fields prefill from the bank entry when omitted.",groups:["reconciliations"]},{name:"financial_reports",description:"Core financial statements: trial balance (TB), balance sheet (BS/B/S), profit & loss (PnL/P&L/income statement), cash flow, general ledger (GL), cash balance/position, equity movement, VAT/GST ledger. Also: how profitable, what is the balance.",groups:["financial_reports"]},{name:"operational_reports",description:"Aging and operational reports: aged receivables (AR aging), aged payables (AP aging), AR report, bank balance summary, bank reconciliation reports, fixed asset (FA) summary, FA reconciliation. Data exports (CSV/Excel/XLSX). Anomaly detection and audit analysis: anomalous invoices, anomalous bills, cashflow anomalies, GL journal audit, exchange rate audit, receivables customer risk, cash expense health. Also: overdue analysis, how much owed, suspicious transactions, audit trail.",groups:["operational_reports","exports"]},{name:"contacts",description:"Contacts (customers/suppliers/vendors), contact groups. Create, search, get, update, delete contacts. Bulk upsert contacts (async \u2014 returns jobId, poll background_jobs). List/create contact groups.",groups:["contacts","contact_groups"]},{name:"items_and_inventory",description:"Products, services, inventory items. Create, search, get, update, delete items. Check inventory balance. Also: SKU, catalog, stock.",groups:["items","inventory"]},{name:"tags_and_custom_fields",description:"Tags for categorizing transactions. Custom fields for adding metadata (text, date, dropdown). Create, search, delete tags and custom fields.",groups:["tags","custom_fields"]},{name:"nano_classifiers",description:"Nano classifiers (tracking categories/dimensions). List, search, create, update, delete classifiers and their classes. Used for line-item tagging and dimensional reporting. Also: tracking categories, cost centers, departments, projects.",groups:["nano_classifiers"]},{name:"chart_of_accounts",description:"Chart of accounts (COA/GL accounts). Create, search, update accounts. Bookmarks (favorites/shortcuts). Also: ledger codes, account types.",groups:["accounts","bookmarks"]},{name:"currencies",description:"Currencies, exchange rates (FX/forex). List/add org currencies. Set, update, import currency rates. Also: multi-currency, FX rates.",groups:["currencies"]},{name:"tax_profiles",description:"Tax profiles (GST/VAT/sales tax), withholding tax codes (WHT/ATC). Search, create, update tax profiles. List WHT codes.",groups:["tax_profiles"]},{name:"capsules_and_recipes",description:"Capsules (transaction groupings/capsule types). Financial recipes: amortization, depreciation, deferred revenue, IFRS 16 leases, hire purchase, fixed deposits, FX revaluation, loan schedules, ECL/expected credit loss, IAS 37 provisions, asset disposal. Plan and execute recipes. Keywords: calculate, provision, schedule, expected credit loss, revaluation.",groups:["capsules","recipes"]},{name:"scheduled_transactions",description:"Scheduled/recurring invoices, bills, journals. Create scheduled invoices/bills/journals, search scheduled transactions. Also: recurring, auto-generate.",groups:["schedulers"]},{name:"subscriptions",description:"Subscriptions (recurring billing/payment plans). Create, update, cancel, search subscriptions. Also: recurring charges, subscription schedules.",groups:["subscriptions"]},{name:"organization",description:"Organization info (name, currency, country, fiscal year). User management: invite, update, remove, search org users. Bulk invite.",groups:["organization","org_users"]},{name:"document_ai",description:"File attachments, AI document extraction (magic/OCR). Upload/list attachments. Create transactions from PDFs/images (invoice scanning, bill extraction). Track extraction workflows.",groups:["attachments","magic"]},{name:"fixed_assets",description:"Fixed assets (PP&E/property, plant, equipment). Search, create, update, discard, sell, transfer, undo disposal. Also: depreciation, asset register.",groups:["fixed_assets"]},{name:"payments_and_search",description:"Payment records: get, update, delete individual payments. List payments/credits on invoices and bills. Reverse credit applications. Cashflow transaction search. Universal cross-entity search. Also: void payment, payment history, credit note applications.",groups:["payments","cashflow","search"]},{name:"quick_fix",description:"Quick Fix: bulk-update multiple transactions or line items in one call. Change dates, contacts, tags, accounts, tax profiles, custom fields across many invoices/bills/journals/credit-notes/cash-entries/schedulers at once. Also: batch update, mass edit.",groups:["quick_fix"]},{name:"export_records",description:"Export records to XLSX. List available columns, preview export scope (row count + sample), generate export file with pre-signed download URL. Supports any entity type: invoices, bills, contacts, items, journals, bank records, cashflow, fixed assets, etc. Pass query (structured search syntax) or filter (JSON), never both.",groups:["export_records"]},{name:"background_jobs",description:"Background job tracking. Poll any async operation by jobId (contacts bulk-upsert, items bulk-upsert, bank import, magic file processing, etc.). Filter by resourceId field to look up a specific job. Poll until status is SUCCESS, FAILED, or PARTIAL_SUCCESS.",groups:["background_jobs"]},{name:"drafts",description:"Draft business transactions \u2014 both local payload validation (invoices, bills, journals, credit notes) AND BULK-FRIENDLY server-side lifecycle: validate_drafts (sync eligibility check), convert_drafts_to_active (async promote to ACTIVE), submit_drafts_for_approval (async route to approval). The lifecycle tools are GENERIC and BULK \u2014 one call accepts up to 500 items mixing any combination of {btResourceId, btType: SALE|PURCHASE|SALE_CREDIT_NOTE|PURCHASE_CREDIT_NOTE}. No need for per-entity tools when promoting/submitting drafts at scale. NOT idempotent on already-promoted drafts.",groups:["drafts"]},{name:"close_procedures",description:"Period-end close checklists: month-end, quarter-end, year-end close. Bank reconciliation job. GST/VAT filing job. Audit preparation. Returns structured blueprints.",groups:["close_jobs"]},{name:"operational_jobs",description:"Operational job checklists: payment runs, credit control/collections, supplier reconciliation, fixed asset review, document collection, statutory filing. Returns structured blueprints.",groups:["operational_jobs"]},{name:"help_center",description:"Search the Jaz help center for how-to articles, feature guides, accounting concepts, and troubleshooting. Returns top matches with title, section, snippet, and source URL. Works without an API key.",groups:["help_center"]},{name:"practice",description:"Practitioner workspace scaffolding: per-client folders, per-engagement files, schemas. Use to onboard new clients (capture legal entity / FY / GST scheme / banks / recurring accruals into CLIENT.md), list active engagements, scaffold a monthly-close / quarterly-gst / annual-statutory engagement, and load client/engagement context before driving accounting work via jaz-jobs blueprints + jaz-recipes. All filesystem-only, offline. Pair with jaz-practice skill for the canonical playbooks.",groups:["practice"]}];function gG(e,t=5){let r=e.trim().toLowerCase();if(!r)return[];let n=r.split(/[\s_-]+/).filter(i=>i.length>=2);return n.length===0?[]:Dl.map(i=>{let s=0,a=i.name.toLowerCase(),c=i.description.toLowerCase();(a===r||a===r.replace(/\s+/g,"_"))&&(s+=5),a.includes(r)&&(s+=3),c.includes(r)&&(s+=1);for(let u of n)a.includes(u)&&(s+=2),c.includes(u)&&(s+=1);return{ns:i,score:s}}).filter(i=>i.score>0).sort((i,s)=>s.score-i.score).slice(0,t).map(i=>i.ns)}function q_(e){let t={type:e.type};if(e.description&&(t.description=e.description),e.enum&&(t.enum=e.enum),e.type==="array"&&e.items&&(t.items=q_(e.items)),e.type==="object"&&e.properties){let r={};for(let[n,o]of Object.entries(e.properties))r[n]=q_(o);t.properties=r,e.required?.length&&(t.required=e.required)}return t}function cc(e,t){let r={};for(let[n,o]of Object.entries(e))r[n]=q_(o);return{type:"object",properties:r,...t.length>0?{required:t}:{}}}function yG(e){return{name:e.name,description:e.description,input_schema:cc(e.params,e.required),...e.searchHint?{searchHint:e.searchHint}:{}}}function i_e(e){if(typeof e!="string")return e.isDestructive??!1;let t=e;return t.startsWith("delete_")||t.startsWith("pay_")||t.startsWith("finalize_")||t.includes("refund")||t==="remove_org_user"}function DG(e){if(!e.trim())return{namespaces:Dl.map(o=>{let i=o.groups.flatMap(s=>yl(s));return{name:o.name,description:o.description,toolCount:i.length,tools:i.map(s=>s.name)}}),hint:"Call describe_tools with specific tool names to get full schemas before executing."};let t=gG(e,5);if(t.length===0)return{matches:[],hint:`No tools match "${e}". Try broader terms or call search_tools with empty query to see all namespaces.`};let n=e.toLowerCase().split(/\s+/).filter(Boolean);return{matches:t.map(o=>{let s=o.groups.flatMap(a=>yl(a)).map(a=>{let c=`${a.name} ${a.searchHint??""} ${a.description}`.toLowerCase(),u=n.filter(l=>c.includes(l)).length;return{tool:a,score:u}}).sort((a,c)=>c.score-a.score);return{namespace:o.name,description:o.description,tools:s.map(a=>({name:a.tool.name,description:a.tool.description.split(`
|
|
851
866
|
`)[0],...a.tool.searchHint?{searchHint:a.tool.searchHint}:{}}))}}),hint:"Call describe_tools with the tool names you need, then execute_tool to run them."}}var s_e={name:"search_tools",description:"Search for available Jaz accounting tools by keyword. Returns matching tool namespaces with tool names and descriptions. Call with empty query to list all namespaces. ALWAYS call this first to discover what tools are available.",inputSchema:cc({query:{type:"string",description:'Search keyword (e.g. "invoice", "bank recon", "depreciation"). Empty string lists all namespaces.'}},[])};function bG(e){if(!Array.isArray(e)||!e.every(n=>typeof n=="string"))return{error:"Invalid `tools` parameter. Expected string[]."};if(e.length===0)return{error:"Provide at least one tool name. Use search_tools first to discover tool names."};let t=[],r=[];for(let n of e){let o=U_(n);if(!o){r.push(n);continue}t.push({...yG(o),readOnly:o.readOnly,isDestructive:o.isDestructive??!1,isConcurrencySafe:o.isConcurrencySafe??!1,destructiveHint:!o.readOnly&&i_e(o),group:o.group})}return{tools:t,...r.length>0?{notFound:r,hint:`Tools not found: ${r.join(", ")}. Use search_tools to find correct names.`}:{}}}var a_e={name:"describe_tools",description:"Get full JSON Schema (parameters, types, required fields) for specific tools. Call this after search_tools to get the exact input format before calling execute_tool.",inputSchema:cc({tools:{type:"array",items:{type:"string"},description:'Tool names to describe (e.g. ["create_invoice", "search_contacts"])'}},["tools"])},c_e={name:"execute_tool",description:"Execute a Jaz accounting tool. Call describe_tools first to get the required parameters. Pass the tool name and its arguments.",inputSchema:cc({tool:{type:"string",description:'Tool name (e.g. "create_invoice")'},arguments:{type:"object",description:"Tool arguments (see describe_tools for schema)"},org_id:{type:"string",description:"Organization ID (UUID). Required in multi-org mode (PAT or multiple API keys). Call list_organizations to get available IDs."}},["tool"])},vG={name:"list_organizations",description:"List organizations available to the current authentication. Returns org names and resource IDs for use as org_id in execute_tool calls.",inputSchema:cc({},[])},N$=[s_e,a_e,c_e];Kc();ts();import{readFileSync as u_e,readdirSync as l_e,statSync as d_e}from"node:fs";import{dirname as _G,join as Us,relative as p_e}from"node:path";import{fileURLToPath as EG}from"node:url";function f_e(e,t){let r;try{r=d_e(e)}catch{return[]}if(!r.isDirectory())return[];let n=[],o=20,i=(s,a)=>{if(a>o)return;let c;try{c=l_e(s,{withFileTypes:!0})}catch{return}for(let u of c){let l=Us(s,u.name);if(u.isDirectory())i(l,a+1);else if(u.isFile()&&u.name.endsWith(".md")){let d=p_e(e,l).split(/[\\/]/).join("/");(!t||!t(d))&&n.push(d)}}};return i(e,0),n.sort()}function SG(e){let t=e.fileFilter??(()=>!0);return f_e(e.rootDir,n=>!t(n)).map(n=>{let o=e.uriPathBuilder?e.uriPathBuilder(n):n.replace(/\.md$/,"");return{uri:`${e.uriPrefix}/${o}`,name:e.nameBuilder(n),description:e.descriptionBuilder?.(n),mimeType:"text/markdown",filePath:Us(e.rootDir,n)}})}function m_e(){let e=EG(import.meta.url),t=_G(e);return g1([Us(t,"..","..","..","assets","skills"),Us(t,"..","..","..","..","assets","skills"),Us(t,"skills")])}function h_e(){let e=EG(import.meta.url),t=_G(e);return g1([Us(t,"..","..","..","help-center-mirror"),Us(t,"..","..","..","assets","skills","api","help-center-mirror"),Us(t,"help-center-mirror")])}var g_e=["api","cli","conversion","jobs","transaction-recipes"],y_e={api:"Jaz REST API rules: every endpoint, field name, error code, production gotchas.",cli:"Jaz CLI commands, auth, calculators, jobs.",conversion:"Migration from Xero, QuickBooks, Sage, MYOB, or Excel exports into Jaz.",jobs:"12 recurring accounting workflow playbooks (close, reconciliation, GST/VAT, etc.).","transaction-recipes":"16 IFRS-compliant transaction recipes plus 13 financial calculators."};function D_e(e){if(e.includes("/help-center-mirror/"))return!1;let t=e.split("/")[0];return g_e.includes(t)}function b_e(e){let t=e.split("/"),r=t[0];if(t.length===2&&t[1]==="SKILL.md")return`Jaz ${r} skill`;if(t[1]==="references"){let n=t.slice(2).join("/").replace(/\.md$/,"");return`Jaz ${r} reference: ${n}`}return`Jaz ${r}: ${e}`}function v_e(e){let t=e.split("/")[0];return y_e[t]}function S_e(e){return!e.includes("/")}function __e(e){return`Jaz help center: ${e.replace(/\.md$/,"").split("-").map(n=>n[0]?.toUpperCase()+n.slice(1)).join(" ")}`}var R$=null,k$=null;function F$(){if(R$)return R$;let e=m_e(),t=h_e(),r=[];return e&&r.push(...SG({rootDir:e,uriPrefix:"jaz://skill",fileFilter:D_e,nameBuilder:b_e,descriptionBuilder:v_e,uriPathBuilder:n=>{let o=n.split("/");return o.length===2&&o[1]==="SKILL.md"?o[0]:n.replace(/\.md$/,"")}})),t&&r.push(...SG({rootDir:t,uriPrefix:"jaz://help-center",fileFilter:S_e,nameBuilder:__e,descriptionBuilder:()=>"Jaz help center article. Same corpus search_help_center indexes."})),R$=r,k$=new Map(r.map(n=>[n.uri,n])),r}function CG(e){k$||F$();let t=k$.get(e);if(!t)throw new Error(`Resource not found: ${e}`);let r=u_e(t.filePath,"utf-8");return{mimeType:t.mimeType,text:r}}var E_e=new Set(["close_jobs","operational_jobs","help_center"]),IG="Calculators, blueprints, and help center search work without an account.",AG="Get an API key or token from jaz.ai";function P$(e,t){return!!(E_e.has(e)||e==="recipes"&&t==="plan_recipe")}function C_e(e,t){return new qr({mode:"pat",token:e,orgId:t})}async function xG(e,t=5e3){let r=new Map,n=[],o=a=>Promise.race([a,new Promise(c=>setTimeout(()=>c(null),t))]),i=e.map(a=>({auth:a,client:new qr(a)})),s=i[0]?.client??null;return await Promise.all(i.map(async({auth:a,client:c})=>{try{let u=await o(Mn(c));if(u)r.set(u.resourceId,{name:u.name,resourceId:u.resourceId,currency:u.currency,client:c});else{let l=a.mode==="direct"?"api-key":a.mode;n.push(`Org lookup returned empty (${l}).`)}}catch(u){let l=a.mode==="direct"?"api-key":a.mode;n.push(`Org lookup failed (${l}): ${u instanceof Error?u.message:"unknown"}`)}})),{orgMap:r,primaryClient:s,errors:n}}function wG(e){e.command("mcp").description("Start MCP stdio server for Claude Code / Cowork").option("--api-key <key>","API key, PAT, or comma-separated keys (overrides stored/env)").action(async t=>{let r=[];try{r=KI(t.apiKey)}catch(b){let S=b instanceof Error?b.message:String(b);process.stderr.write(`jaz-ai: ${S} (continuing in offline mode)
|