jaz-clio 5.47.8 → 5.47.9

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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: jaz-api
3
- version: 5.47.8
3
+ version: 5.47.9
4
4
  description: >-
5
5
  Use this skill whenever you call, debug, or review code that touches the Jaz
6
6
  REST API. Covers field names, response shapes, 159 production gotchas, error
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: jaz-cli
3
- version: 5.47.8
3
+ version: 5.47.9
4
4
  description: >-
5
5
  Use this skill when running Clio CLI commands, building shell scripts with
6
6
  Clio, debugging auth issues, understanding --json output, paginating results,
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: jaz-conversion
3
- version: 5.47.8
3
+ version: 5.47.9
4
4
  description: >-
5
5
  Use this skill when migrating accounting data into Jaz — importing from Xero,
6
6
  QuickBooks, Sage, MYOB, or Excel exports. Covers the full conversion pipeline:
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: jaz-kit
3
- version: 5.47.8
3
+ version: 5.47.9
4
4
  description: >-
5
5
  Use this skill when an accountant, bookkeeper, or owner is running real books
6
6
  in Jaz across one or more organizations from the terminal — setting up a
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: jaz-pseudo-sql
3
- version: 5.47.8
3
+ version: 5.47.9
4
4
  description: >-
5
5
  Use this skill when answering ad-hoc data questions that aren't covered by
6
6
  download_export (canonical reports — anomaly, audit, aging, P&L, BS, GL,
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: jaz-jobs
3
- version: 5.47.8
3
+ version: 5.47.9
4
4
  description: >-
5
5
  Use this skill for recurring accounting workflows — month/quarter/year-end
6
6
  close, bank reconciliation, GST/VAT filing, payment runs, credit control,
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: jaz-recipes
3
- version: 5.47.8
3
+ version: 5.47.9
4
4
  description: >-
5
5
  Use this skill when modeling complex multi-step accounting transactions —
6
6
  anything that spans multiple periods, involves changing amounts, or requires
package/cli.mjs CHANGED
@@ -687,7 +687,7 @@ Call with { operation, arguments${o?`, ${Zl}`:""}${a.length?", file":""}${t?", o
687
687
  `+r.map(Gv).join(`
688
688
  `)+(t?`
689
689
 
690
- Multiple organizations are accessible: pass org_id (from list_organizations) to target one. Confirm the organization with the user before any create/update/delete.`:""),u={operation:{type:"string",enum:n,description:`The ${e.name} operation to run.`},arguments:{type:"object",description:"Parameters for the chosen operation (see the operation list above). Validated by the Jaz API.",additionalProperties:!0}};return o&&(u[Zl]={type:"string",description:Uot}),a.length&&(u.file={type:"object",description:`A file from the conversation, when the client supports passing one. Accepted by: ${a.join(", ")}. The content is fetched server-side \u2014 leave source arguments out of \`arguments\`.`,properties:{download_url:{type:"string",description:"URL the file content can be fetched from (may be temporary)."},file_id:{type:"string",description:"Host-side file identifier."},mime_type:{type:"string"},file_name:{type:"string"}},required:["download_url"]}),t&&(u.org_id={type:"string",description:"The organization (resourceId from list_organizations) to run this operation against. Required when more than one organization is accessible."}),{name:e.name,description:c,inputSchema:{type:"object",properties:u,required:["operation"],additionalProperties:!1},...a.length?{_meta:{"openai/fileParams":["file"]}}:{},annotations:{title:`${e.title??lwr(e.name)} \xB7 ${r.length} operation${r.length===1?"":"s"}`,readOnlyHint:i,destructiveHint:!i&&s,idempotentHint:i,openWorldHint:!1}}})}function jot(t){return uwr.has(t)}function bfe(t,e){let r=Ti.find(o=>o.name===t);if(!r)return{error:`Unknown namespace: ${t}.`};let n=qot(r.groups),i=n.find(o=>o.name===e||o.aliases?.includes(e));return i?{tool:i}:{error:`Unknown operation "${e}" for the ${t} tool.`,operations:n.map(o=>o.name)}}var uwr,FB=X(()=>{"use strict";rd();nd();zv();r3();uwr=new Set(Ti.map(t=>t.name))});var Yot={};bs(Yot,{loadAgentSuiteContent:()=>Awr});import{readFileSync as dwr}from"node:fs";import{dirname as fwr,join as pwr}from"node:path";import{fileURLToPath as hwr}from"node:url";function Awr(){return Cfe||(Cfe=JSON.parse(dwr(pwr(mwr,"agent-suite-content.json"),"utf8"))),Cfe}var mwr,Cfe,Hot=X(()=>{"use strict";mwr=fwr(hwr(import.meta.url)),Cfe=null});var zot={};bs(zot,{buildCapabilityMap:()=>ywr});async function gwr(){try{let{loadAgentSuiteContent:t}=await Promise.resolve().then(()=>(Hot(),Yot)),e=t().counts;return{cli_command_groups:e.commands,api_rules:e.apiRules,skills:e.skills,ifrs_recipes:e.recipes,calculators:e.calculators,job_playbooks:e.jobs}}catch{return}}async function ywr(t={}){if(t.query&&t.query.trim())return K8(t.query);if(t.namespace){let r=Ti.find(i=>i.name===t.namespace);if(!r)return{error:`Unknown namespace "${t.namespace}".`,namespaces:Ti.map(i=>i.name),hint:"Call with no arguments for the full map, or pass `query` to rank operations by keyword."};let n=jv(r.groups);return{namespace:r.name,description:r.description,operations:n.length,operation_list:n.map(Gv),hint:"Call the namespace tool with { operation, arguments }, or execute_tool with the operation name on a meta-tool surface."}}let e=ky(t.surface,t.multiOrg);return{...e,map:t.full?NB().map(r=>({...r,operation_list:jv(Ti.find(n=>n.name===r.namespace).groups).map(Gv)})):e.map,beyond_mcp:await gwr()}}var Got=X(()=>{"use strict";rd();FB();zv();W8()});import{randomUUID as Ewr}from"node:crypto";function ost(t,e,r){return{type:"object",description:`The ${t.toLowerCase()} to create. Required.`,properties:{reference:{type:"string",description:`${t} reference`},contactResourceId:{type:"string",description:`${e} 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:`${t} line items (max 500)`,items:{type:"object",properties:{name:{type:"string",description:"Line description"},quantity:{type:"number"},unit:{type:"string"},unitPrice:{type:"number"},organizationAccountResourceId:{type:"string",description:`${r} account UUID`},itemResourceId:{type:"string"},taxProfileResourceId:{type:"string"}},required:["name"]}},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:Vv,adjustment:Wv}},capsuleResourceId:{type:"string"}},required:["reference","lineItems"]}}function Est(t){let e=t.limit,r=t.offset;return{limit:e,offset:r,sortBy:void 0,sortOrder:void 0}}function hr(t,e,r,n,i,o){let s={...Tfe};return o?.leanView&&(s.view={type:"string",enum:["lean","full"],description:"Payload tier: 'lean' (default) = summary row (id + key scalars); 'full' = whole entity per row (heavier). List lean, then drill in with get_*."}),{name:t,description:e,params:s,required:[],group:r,readOnly:!0,isConcurrencySafe:!0,maxResultSizeChars:5e4,...i?{searchHint:i}:{},execute:async(a,c)=>{let{limit:u,offset:d}=Est(c),f=o?.leanView?c.view==="full"?"full":"lean":void 0;return eS((h,m)=>n(a.client,h,m,f),u,d,f==="lean"?50:20)}}}function Bi(t,e,r,n,i,o){return{name:t,description:e,params:{resourceId:{type:"string",description:o?.paramDescription??"Resource ID (UUID)"}},required:["resourceId"],group:r,readOnly:!0,isConcurrencySafe:!0,maxResultSizeChars:2e4,...i?{searchHint:i}:{},execute:async(s,a)=>n(s.client,a.resourceId)}}function bst(t){if(!t||typeof t!="object"||Array.isArray(t))return{};let e=t.data;return e&&typeof e=="object"&&!Array.isArray(e)?e:t}function Cst(t,e,r,n){return{[e]:!0,...bst(t),[r]:n}}function MB(t){return`Deletes a DRAFT ${t}; VOIDs an active one and KEEPS it. force: true hard-deletes either.`}function Rwr(t,e,r){let n=bst(t);return{outcome:(typeof n.status=="string"?Swr[n.status]:void 0)??(r?"DELETED":"DELETED_IF_DRAFT_VOIDED_IF_ACTIVE"),...n,resourceId:e}}function Wr(t,e,r,n,i,o){let s=o?.verb??"deleted";return{name:t,description:e,params:{resourceId:{type:"string",description:o?.paramDescription??"Resource ID (UUID)"},...o?.voidable?Dwr:{}},required:["resourceId"],group:r,readOnly:!1,isDestructive:!0,...i?{searchHint:i}:{},execute:async(a,c)=>{let u=c.resourceId;ts(u,"resourceId",`Nothing was deleted. Source a real resourceId from a search_* or list_* result before calling ${t}.`);let d=c.force,f=await n(a.client,u,{force:d,internalNotes:c.internalNotes});return o?.voidable?Rwr(f,u,d):Cst(f,s,"resourceId",u)}}}function PB(t,e,r,n){return{name:t,description:`Download ${/^[aeiou]/i.test(e)?"an":"a"} ${e} as PDF. Returns { fileUrl } (may be pending/empty if the document is not yet rendered).`,params:{resourceId:{type:"string",description:`${e[0].toUpperCase()}${e.slice(1)} resourceId`}},required:["resourceId"],group:r,readOnly:!0,searchHint:`download ${e} as PDF document file`,isConcurrencySafe:!0,execute:async(i,o)=>n(i.client,o.resourceId)}}function xfe(t,e,r,n,i){return{name:t,description:e,params:{resourceId:{type:"string",description:"Resource ID (UUID)"}},required:["resourceId"],group:r,readOnly:!1,...i?.destructive?{isDestructive:!0}:{},...i?.searchHint?{searchHint:i.searchHint}:{},execute:async(o,s)=>n(o.client,s.resourceId)}}function ust(t){if(typeof t!="string"||/^\d{4}-\d{2}-\d{2}$/.test(t))return t;let e=/^(\d{4}-\d{2}-\d{2})T/.exec(t);return e?e[1]:t}function Fwr(t){return Array.isArray(t)?t.map(e=>{let r={};for(let[n,i]of Object.entries(e)){if(i==null)continue;let o=RX.get(n);if(o)r[o]=i;else if(n==="taxProfile"&&typeof i=="object"&&i!==null){let s=i.resourceId;s&&(r.taxProfileResourceId=s)}else if(n==="discount"&&typeof i=="object"&&i!==null){let s=i.rateValue;s&&Number(s)!==0&&(r.discount=i)}else Owr.has(n)&&(r[n]=i)}return r}):t}async function UB(t,e,r,n){let s=(await(e==="invoice"?Qs:e==="bill"?xs:e==="customer_credit_note"?Ol:Fl)(t,r)).data,a=Nwr[e],c={};for(let[p,h]of Object.entries(s))a.has(p)&&h!==null&&h!==void 0&&(c[p]=h);c.valueDate&&(c.valueDate=ust(c.valueDate)),c.dueDate&&(c.dueDate=ust(c.dueDate)),c.lineItems&&(c.lineItems=Fwr(c.lineItems));for(let[p,h]of Object.entries(n))h!==void 0&&(c[p]=h);let u=e==="invoice"?Vc:e==="bill"?ma:oo,{missingFields:d,ready:f}=Ys(c,u);if(!f)throw new Error(`Cannot finalize: missing ${d.join(", ")}. Use search_accounts (filter by accountType) and search_contacts to resolve, then pass the missing fields to this tool.`);return c}async function dst(t,e,r,n){if((await t(e,r)).data.status==="DRAFT")throw new Error(`Cannot pay a DRAFT ${n}. Finalize it first with finalize_${n}.`)}function a3(t,e,r){if(!(typeof t=="string"&&e.includes(t)))return{error:`Unknown documentType ${JSON.stringify(t)}.`,status:422,hint:`Use one of: ${e.join(", ")}.`,repair:{tool:r,arguments:{},reason:"Pass a supported documentType."}}}function hst(t,e,r){let n=pst[t];if(!n)return{error:`Unknown documentType "${t}".`,status:422,hint:`Valid document types: ${Object.keys(pst).join(", ")}.`,repair:{tool:r,arguments:{},reason:"Pass a supported documentType."}};if(!n.includes(e)){let i=n.includes("ACCEPT")?"ACCEPT":"CONFIRM";return{error:`Action "${e}" is not valid for ${t}. Valid actions: ${n.join(", ")}.`,status:422,hint:`${t} advances its lifecycle with ${i}, not ${e}.`,repair:{tool:r,arguments:{documentType:t,action:i},reason:`${t} is advanced with ${i}.`}}}}async function mst(t,e,r,n,i,o,s){let a;try{a=(await e(t,r)).data?.status}catch{return}if(a==="DRAFT"||a==="VOID"){let c=a==="DRAFT"?`A DRAFT ${n} can't be linked or accepted \u2014 issue it by creating the ${n} with saveAsDraft:false (status ${s}), then link the order to that one.`:`A VOID ${n} can't be used \u2014 create a fresh ${n} (saveAsDraft:false) and link to it.`;return{error:`Cannot create an order linked to a ${a} ${n} (${r}).`,status:422,hint:`Pre-flight guard \u2014 request never hit the API. ${c}`,repair:{tool:o,arguments:{documentType:i,saveAsDraft:!1},reason:c}}}}async function Ast(t,e,r,n,i,o){let s;try{s=(await e(t,r)).data?.status}catch{return}if(s==="VOID")return{error:`Cannot convert a VOID ${n} (${r}) into a ${i}.`,status:422,hint:`Pre-flight guard \u2014 request never hit the API. Convert a non-VOID ${n}.`,repair:{tool:o,arguments:{},reason:`The source ${n} is VOID.`}}}async function gst(t,e,r,n,i){let o;try{o=(await e(t,r,n)).data?.status}catch{return}if(o&&o!=="DRAFT")return{error:`Cannot DELETE a ${o} ${r} \u2014 delete is only allowed on DRAFT records.`,status:422,hint:"Use action VOID to cancel a non-draft quote/request/order.",repair:{tool:i,arguments:{documentType:r,resourceId:n,action:"VOID"},reason:`${r} is ${o}; void it instead of deleting.`}}}var bwr,Za,Io,Xl,vo,di,id,i3,Oy,Jot,Cwr,Vot,Wot,Ife,vfe,Jv,QB,Iwr,vwr,wfe,Zot,Xot,_fe,Tfe,Am,Dfe,Kot,est,tst,rst,Qi,nst,LB,wwr,Sfe,o3,Aa,ist,yst,od,Vv,Wv,_wr,Dwr,Swr,Ist,xwr,sst,ast,cst,Twr,Bwr,Rfe,lst,kwr,Nwr,Owr,$B,qB,s3,fst,pst,Tf,c3=X(()=>{"use strict";gP();yC();xX();dMe();gMe();ZD();Sa();fr();An();fA();cA();TE();APe();bPe();Xf();ng();_d();YX();HX();og();zX();vp();xF();zF();Qw();GX();UPe();eU();aU();pU();ait();Mw();XF();jw();LH();zw();VP();zH();bde();Cde();az();Ide();Bde();Fde();Mit();vp();gB();Qde();Lde();Ez();Zit();Hde();zde();Gde();tot();Wde();hm();Uz();oD();Zde();Xde();Gw();i7();iot();uot();fot();NX();pot();tfe();o8();rfe();nfe();ife();ofe();sfe();afe();cfe();lfe();Xf();ng();Iot();og();xot();_d();eU();aU();og();o8();mn();ffe();hfe();fr();gfe();Qot();bwr=xP.join(" | "),Za={type:"string",description:"Resource ID of the record"},Io={type:"string",description:"Transaction date (YYYY-MM-DD)"},Xl={type:"string",description:"Due date (YYYY-MM-DD)"},vo={type:"string",description:"Reference number"},di={type:"string",description:"Notes or memo text"},id={type:"string",description:"Tag name for categorization"},i3={type:"boolean",description:"Save as draft (default true). Set false to finalize immediately."},Oy={type:"boolean",description:"Return full entity (default: minimal {resourceId} only). Saves a follow-up get_* round trip."},Jot={recipe:{type:"string",enum:[...xy],description:"Recipe type"},amount:{type:"number",description:"Amount (for amortization, accrued-expense, dividend, ecl, provision, fx-reval)"},principal:{type:"number",description:"Principal (for loan, fixed-deposit)"},startDate:{type:"string",description:"Start date YYYY-MM-DD (REQUIRED for blueprint generation \u2014 default to today if user does not specify)"},currency:{type:"string",description:"Currency code (e.g. SGD, USD)"},periods:{type:"number",description:"Number of periods (for amortization, accrued-expense, leave-accrual)"},frequency:{type:"string",enum:["monthly","quarterly","annual"],description:"Frequency (for depreciation, amortization, accrued-expense)"},annualRate:{type:"number",description:"Annual interest/discount rate %"},termMonths:{type:"number"},monthlyPayment:{type:"number",description:"Monthly lease payment (for lease)"},usefulLifeMonths:{type:"number",description:"Asset useful life in months (hire purchase)"},cost:{type:"number",description:"Asset cost"},salvageValue:{type:"number"},usefulLifeYears:{type:"number"},method:{type:"string",enum:["sl","ddb","150db"],description:"Depreciation method"},acquisitionDate:{type:"string",description:"Acquisition date YYYY-MM-DD"},disposalDate:{type:"string",description:"Disposal date YYYY-MM-DD"},proceeds:{type:"number",description:"Disposal proceeds"},bookRate:{type:"number",description:"Original booking rate. Declare which way it reads via rateDirection (REQUIRED for fx-reval)."},closingRate:{type:"number",description:"Period-end closing rate. Same direction as bookRate."},rateDirection:{type:"string",enum:["FUNCTIONAL_TO_SOURCE","SOURCE_TO_FUNCTIONAL"],description:"REQUIRED for fx-reval. FUNCTIONAL_TO_SOURCE = 1 base unit = N foreign, what list_currency_rates returns. SOURCE_TO_FUNCTIONAL = 1 foreign unit = N base, the everyday quote."},position:{type:"string",enum:["ASSET","LIABILITY"],description:"Balance-sheet side: ASSET (receivable/deposit, default) or LIABILITY (payable/provision). A rising base value is a gain on an asset and a loss on a liability."},baseCurrency:{type:"string",description:"Base (functional) currency"},buckets:{type:"array",items:{type:"object",properties:{name:{type:"string"},balance:{type:"number"},rate:{type:"number"}},required:["name","balance","rate"]},description:"ECL aging buckets"},existingProvision:{type:"number",description:"Existing ECL provision balance"},compounding:{type:"string",enum:["none","monthly","quarterly","annually"]},employees:{type:"number"},daysPerYear:{type:"number",description:"Leave days per employee per year"},dailyRate:{type:"number",description:"Average daily rate"},declarationDate:{type:"string",description:"Board resolution date YYYY-MM-DD"},paymentDate:{type:"string",description:"Settlement date YYYY-MM-DD"},withholdingRate:{type:"number",description:"Withholding tax rate %"}},Cwr={type:"boolean",description:"Retry-only: set true after the duplicate guard surfaced a candidate and the user confirmed this is a separate document. Never on a first attempt."},Vot={type:"string",enum:[...kX],description:"CUSTOM (default) = free text; ALL_* = a picklist of that population. Datatype is derived, not chosen."},Wot={type:"object",properties:{address:{type:"string",description:"Street address \u2014 sent as addressLine1"},city:{type:"string"},state:{type:"string"},postalCode:{type:"string"},country:{type:"string"}},required:["address","country"]},Ife={type:"string",description:"Contact resourceId (customer or supplier)"},vfe={type:"array",description:"Draft BT references (max 500). Mix any btType.",items:{type:"object",properties:{btResourceId:{type:"string",description:"Draft BT resource ID (UUID)"},btType:{type:"string",enum:["SALE","PURCHASE","SALE_CREDIT_NOTE","PURCHASE_CREDIT_NOTE"],description:"Draft entity type"}},required:["btResourceId","btType"]}},Jv={type:"string",description:"Chart-of-accounts account the line posts to (revenue on a sale, expense on a purchase)"},QB={type:"string",description:"Account the payment posts to. For paymentMethod BANK_TRANSFER/CASH/CHEQUE this MUST be a bank or cash account. Any other method accepts any org account \u2014 that is how a deposit drawdown works (paymentMethod OTHER + the deposit account)."},Iwr={type:"number",description:"Payment amount (in bank currency)"},vwr={type:"string",description:"Period start date (YYYY-MM-DD)"},wfe={type:"string",description:"Period end date (YYYY-MM-DD)"},Zot={type:"string",enum:["full","aggregate"],description:`Output detail (default 'full'). 'aggregate' returns a compact aging-bucket summary (current, <1 month, 1/2/3 months, older + total outstanding + contact count). Prefer 'aggregate' for a general or unqualified report request (e.g. "show me my aged receivables", "my AR report") \u2014 it's the at-a-glance overview a chat user expects and it won't truncate on large orgs. Use 'full' only when the user explicitly asks for the per-contact (customer/supplier) breakdown for deeper analysis.`},Xot={type:"string",description:"Currency code (e.g. SGD, USD)"},_fe={type:"string",description:"Display name"},Tfe={limit:{type:"number",description:"Max results per page (\u22641000)."},offset:{type:"number",description:"Page offset (0-indexed). Use with limit to paginate."}},Am={type:"object",required:["sourceCurrency"],properties:{sourceCurrency:{type:"string",description:"Foreign currency code (ISO 4217)."},exchangeRate:{type:"number",description:'Base\u2192source: N where 1 org-base unit = N sourceCurrency. Invert ONLY if your quote reads "1 source = X base" (send 1/X), or declare rateDirection and skip the arithmetic. Omit for the org/platform rate.'},rateDirection:{type:"string",enum:["FUNCTIONAL_TO_SOURCE","SOURCE_TO_FUNCTIONAL"],description:"How exchangeRate reads. SOURCE_TO_FUNCTIONAL accepts a bank quote verbatim. Default FUNCTIONAL_TO_SOURCE."}}},Dfe={type:"string",enum:[...Hd],description:"Entity type to export"},Kot={type:"string",description:'Structured search query using dashboard syntax (e.g., "status:unpaid $500+ date:this month"). Mutually exclusive with filter \u2014 pass one or the other, never both.'},est={type:"object",description:'Raw JSON filter object (e.g., {"status":{"in":["UNPAID"]}}). Mutually exclusive with query \u2014 pass one or the other, never both.'},tst={type:"array",items:{type:"object",properties:{path:{type:"string",description:"Column path from get_export_columns (e.g., s.reference)"},header:{type:"string",description:"Column header label in the export file"},type:{type:"string",enum:["STRING","NUMBER","CURRENCY","DATE","BOOLEAN"],description:"Column data type (optional)"}},required:["path","header"]},description:"Custom column definitions. Omit to use default columns. Use get_export_columns to discover available paths."},rst={type:"object",properties:{field:{type:"string",description:"Column path to sort by (e.g., s.total_amount)"},direction:{type:"string",enum:["ASC","DESC"],description:"Sort direction"}},required:["field"],description:"Sort results by a column path."},Qi={type:"array",items:{type:"object",properties:{customFieldName:{type:"string"},actualValue:{type:"string"}}},description:'Custom field values: [{ customFieldName: "PO Number", actualValue: "PO-123" }]'},nst={type:"array",description:"Full replacement line-item set \u2014 non-empty REPLACES all lines, [] clears, omit = no change. claimTypeResourceId + name + unitPrice + quantity are required at submit time.",items:{type:"object",properties:{resourceId:{type:"string",description:"Existing line resourceId (omit to add a new line)"},claimTypeResourceId:{type:"string",description:"Claim type resourceId"},name:{type:"string",description:"Line name"},description:{type:"string",description:"Line description"},unitPrice:{type:"number",description:"Unit price"},quantity:{type:"number",description:"Quantity"},currency:{type:"string",description:"Line currency (ISO 4217; falls back to header)"},itemSubTotal:{type:"number",description:"Line subtotal (unitPrice \xD7 quantity)"}}}},LB={type:"array",items:{type:"string"},description:"Claim resourceIds (1-500)"},wwr={type:"array",items:{type:"object",required:["resourceId","type","selectedClasses","printable"],properties:{resourceId:{type:"string",description:"Capsule type resourceId"},type:{type:"string",enum:["invoice","bill"],description:"Resource type"},selectedClasses:{type:"array",items:{type:"object",required:["className"],properties:{className:{type:"string"},resourceId:Za}}},printable:{type:"boolean"}}},description:"Nano classifier config for line items. Each entry links a capsule type with selected classes."},Sfe={type:"array",items:{type:"object",properties:{accountResourceId:{type:"string",description:"Account resourceId"},type:{type:"string",enum:["DEBIT","CREDIT"],description:"Debit or credit"},amount:{type:"number",description:"Amount"},description:{type:"string",description:"Line description"}},required:["accountResourceId","type","amount"]},description:"Journal entries (debit/credit lines with accountResourceId, type, amount)"},o3={type:"array",items:{type:"object",properties:{accountResourceId:{type:"string",description:"Offset account resourceId"},amount:{type:"number",description:"Amount (positive; direction comes from the endpoint)"},description:{type:"string",description:"Line description"},taxProfileResourceId:{type:"string",description:"Tax profile resourceId"}},required:["accountResourceId","amount"]},description:"Offset lines. No `type` \u2014 cash-in credits these and cash-out debits them, decided by the endpoint."},Aa={type:"array",items:{type:"object",properties:{name:{type:"string",description:"Line item description/name"},quantity:{type:"number"},unitPrice:{type:"number"},accountResourceId:Jv,taxProfileResourceId:{type:"string"},classifierConfig:wwr},required:["name","quantity","unitPrice"]},description:"Line items \u2014 include accountResourceId on each line when finalizing (saveAsDraft: false)"},ist={type:"array",items:{type:"object",properties:{itemName:{type:"string",description:"Display name of the catalog item"},itemResourceId:{type:"string",description:"Underlying item resourceId (from search_items)"},price:{type:"number",description:"Default unit price (0-1e9)"},unit:{type:"string",description:"Unit of measure"},quantityDefault:{type:"number",description:"Default quantity when added to a document (0-100)"},discountDefault:{type:"number",description:"Default discount % when added to a document (0-100)"},uiIndex:{type:"number",description:"Display position in the catalog (integer, min 0)"},classifiers:{type:"array",items:{type:"object"},description:"Classifier assignments. Same shape as classifierConfig on invoice/bill line items."}},required:["itemName","itemResourceId","price"]},description:"Catalog item rows. itemName, itemResourceId and price are required on every row."},yst={type:"array",items:{type:"object",properties:{slotKey:{type:"string",description:"Slot from get_capsule_recipe templateSlots[]."},template:{type:"string",description:"Text with {{vars}} for that slot; empty string clears a nullable slot. Max 2000."}},required:["slotKey"]},description:"Optional. Customize recipe-generated text via published slots (see get_capsule_recipe)."},od={type:"object",description:"Optional IFRS recipe trigger. Mutex with capsuleResourceId. Silent-null on failure \u2014 preview_capsule_recipe first. Rule 143.",properties:{recipeName:{type:"string",enum:["LOAN_AMORTIZATION","ACCRUAL_REVERSAL","PREPAID_AMORTIZATION","DEFERRED_REVENUE","IFRS16_LEASE"],description:"Must match mutation's allowedBaseTransactionTypes (see list_capsule_recipes)."},recipeVersion:{type:"number",description:"Optional version pin."},inputs:{type:"object",description:"Schema at versions[0].inputSchema. Single-currency; *AccountResourceId x-accountClass-locked."},templateOverrides:yst},required:["recipeName","inputs"]},Vv={type:"string",enum:[...qMe],description:"Payment method (default BANK_TRANSFER)"},Wv={type:"object",description:"Cash-leg adjustment (overpayment/rounding). Bank leg only, never AR/AP. Not with DEBT_WRITE_OFF/CLEARING_SETTLEMENT/INTER_COMPANY/WITHHOLDING_TAX_CERTIFICATE. See rule 160.",properties:{adjustmentValue:{type:"number",description:"Signed, non-zero, max 2dp"},adjustmentAccountResourceId:{type:"string",description:"Non-controlled account, not bank/cash"},adjustmentDescription:{type:"string",description:"Optional"}},required:["adjustmentValue","adjustmentAccountResourceId"]},_wr={...Wv,description:"Adding or changing an adjustment applies here. REMOVING does not: 0 is rejected and null reads as omitted, so both leave the stored value unchanged. To remove one, delete the payment and record it again. A change is rejected if the payment is reconciled or lock-dated, and amount, account and description are all compared, so resend all three unchanged if you are not editing it. See rule 160."};Dwr={force:{type:"boolean",description:"Hard-delete instead of voiding."},internalNotes:{type:"string",description:"Note recorded with the void."}},Swr={VOID:"VOIDED",SUCCEEDED:"DELETED"};Ist=["invoices","bills","customer-credit-notes","supplier-credit-notes"],xwr=[...Ist,"purchase-orders","purchase-requests","sale-orders","sale-quotes","claims"],sst={type:"string",description:"Document family",enum:Ist},ast={type:"string",description:"Document family",enum:xwr},cst={type:"string",description:"Why it is sent back. Opens a thread; the only record of the reason."},Twr=[{name:"approve_documents",description:"Approve one document awaiting approval. Posts its ledger entries and makes it live. One-shot, and the refusal channel differs by entity: invoices/bills THROW 422; credit notes return 200 with isSuccess:false and a STALE approvalStatus of APPROVED. Check isSuccess and catch the throw \u2014 approvalStatus alone cannot tell refusal from success.",params:{entity:sst,resourceId:{type:"string",description:"Document resourceId"}},required:["entity","resourceId"],group:"approvals",readOnly:!1,searchHint:"approve pending invoice bill credit note post ledger",execute:async(t,e)=>got(t.client,e.entity,e.resourceId)},{name:"bulk_approve_documents",description:"Approve up to 100 documents awaiting approval. Async \u2014 returns a jobId; poll search_background_jobs. Each approval posts a ledger.",params:{entity:sst,resourceIds:{type:"array",items:{type:"string"},description:"resourceIds (1-100)"}},required:["entity","resourceIds"],group:"approvals",readOnly:!1,searchHint:"bulk approve many pending documents at once",execute:async(t,e)=>yot(t.client,e.entity,e.resourceIds)},{name:"request_document_changes",description:"Send one document back for changes instead of approving it. Also covers orders, quotes, requests and claims.",params:{entity:ast,resourceId:{type:"string",description:"Document resourceId"},message:cst},required:["entity","resourceId","message"],group:"approvals",readOnly:!1,searchHint:"request changes reject send back document for revision",execute:async(t,e)=>Eot(t.client,e.entity,e.resourceId,e.message)},{name:"bulk_request_document_changes",description:"Send up to 500 documents back for changes with one message. Async \u2014 returns a jobId; poll search_background_jobs.",params:{entity:ast,resourceIds:{type:"array",items:{type:"string"},description:"resourceIds (1-500)"},message:cst},required:["entity","resourceIds","message"],group:"approvals",readOnly:!1,searchHint:"bulk request changes send back many documents",execute:async(t,e)=>bot(t.client,e.entity,e.resourceIds,e.message)}],Bwr=["journals","purchases","sales","purchase-credit-notes","sale-credit-notes"],Rfe={type:"string",description:"Document family",enum:Bwr},lst={type:"string",description:"Version id from get_document_version_history"},kwr=[{name:"get_document_version_history",description:"The stored versions of a document, newest first. Not paginated. Use before restoring to pick a version id.",params:{entity:Rfe,resourceId:{type:"string",description:"Document resourceId"}},required:["entity","resourceId"],group:"versions",readOnly:!0,searchHint:"list document version history revisions audit trail",isConcurrencySafe:!0,execute:async(t,e)=>_ot(t.client,e.entity,e.resourceId)},{name:"get_document_version",description:"Read one stored version of a document. An unknown resourceId/version pair returns 422.",params:{entity:Rfe,resourceId:{type:"string",description:"Document resourceId"},version:lst},required:["entity","resourceId","version"],group:"versions",readOnly:!0,searchHint:"get read one document version snapshot",isConcurrencySafe:!0,execute:async(t,e)=>Dot(t.client,e.entity,e.resourceId,e.version)},{name:"rollback_document_version",description:"Restore a document to a stored version. REPLACES current state \u2014 read the version first with get_document_version.",params:{entity:Rfe,resourceId:{type:"string",description:"Document resourceId"},version:lst},required:["entity","resourceId","version"],group:"versions",readOnly:!1,searchHint:"restore rollback document to previous version undo changes",isDestructive:!0,execute:async(t,e)=>Sot(t.client,e.entity,e.resourceId,e.version)},{name:"get_currency_effective_rate",description:"The organization effective rate for a currency on a date: its own custom rate when set, else the platform daily rate. Defaults to today.",params:{currencyCode:{type:"string",description:"ISO 4217 code, e.g. USD (not a resourceId)"},date:{type:"string",description:"YYYY-MM-DD (optional, defaults to today)"}},required:["currencyCode"],group:"currencies",readOnly:!0,searchHint:"currency effective exchange rate for a date custom or platform",isConcurrencySafe:!0,execute:async(t,e)=>Rot(t.client,e.currencyCode,e.date)}];Nwr={invoice:new Set(["reference","valueDate","dueDate","contactResourceId","lineItems","notes","invoiceNotes","internalNotes","tag","tags","isTaxVatApplicable","isTaxVATApplicable","taxInclusion","terms","currency","customFields","capsuleResourceId","capsuleRecipe","taxProfileResourceId","customerPaymentProfileResourceId"]),bill:new Set(["reference","valueDate","dueDate","contactResourceId","lineItems","invoiceNotes","internalNotes","tag","tags","isTaxVatApplicable","isTaxVATApplicable","taxInclusion","terms","currency","customFields","capsuleResourceId","capsuleRecipe","taxProfileResourceId"]),customer_credit_note:new Set(["reference","valueDate","contactResourceId","lineItems","invoiceNotes","tag","tags","isTaxVatApplicable","isTaxVATApplicable","taxInclusion","currency","customFields","capsuleResourceId","taxProfileResourceId"]),supplier_credit_note:new Set(["reference","valueDate","contactResourceId","lineItems","invoiceNotes","tag","tags","isTaxVatApplicable","isTaxVATApplicable","taxInclusion","currency","customFields","capsuleResourceId","taxProfileResourceId"])};Owr=new Set(["name","quantity","unitPrice","unit","accountResourceId","taxProfileResourceId","description","classifierConfig","itemResourceId","discount"]);$B={type:"string",enum:["SALE_QUOTE","SALE_ORDER"],description:"Which sales document: SALE_QUOTE (estimate) or SALE_ORDER."},qB={type:"string",enum:["PURCHASE_REQUEST","PURCHASE_ORDER"],description:"Which purchase document: PURCHASE_REQUEST (requisition) or PURCHASE_ORDER."},s3={type:"number",description:"Payment terms in days (one of 0, 7, 15, 30, 45, 60)."},fst={type:"string",enum:["ACCEPT","CONFIRM","VOID","DELETE"],description:"Lifecycle action. ACCEPT=quote/request only; CONFIRM=order only; VOID=any non-draft; DELETE=draft only."},pst={SALE_QUOTE:["ACCEPT","VOID","DELETE"],SALE_ORDER:["CONFIRM","VOID","DELETE"],PURCHASE_REQUEST:["ACCEPT","VOID","DELETE"],PURCHASE_ORDER:["CONFIRM","VOID","DELETE"]};Tf=[{name:"get_organization",description:"Get organization details: name, base currency, country, and financial year end.",params:{},required:[],group:"organization",readOnly:!0,searchHint:"get organization details currency country fiscal year",isConcurrencySafe:!0,maxResultSizeChars:2e4,execute:async t=>Ra(t.client)},{name:"get_my_context",description:"Resolve the CALLER's own context \u2014 identity, the employee bound to their login (if any), and per-module access (moduleRoles). Use to route a receipt (bill if PURCHASES access, expense claim if EMPLOYEE_CLAIMS access). A service api-key usually has no bound employee. Magic claim drafts auto-bind the uploader server-side \u2014 no need to read employee.resourceId to bind one.",params:{},required:[],group:"organization",readOnly:!0,searchHint:"who am i my employee my permissions module roles what can i do self caller capabilities bills claims",isConcurrencySafe:!0,maxResultSizeChars:2e4,execute:async t=>t0e(t.client)},hr("list_accounts","List chart of accounts. Returns account name, code, type, class, status. Paginated \u2014 response includes totalElements. Use limit/offset to page.","accounts",(t,e,r)=>Dd(t,{limit:r,offset:e}),"list chart of accounts with code type class status"),Wt({name:"search_accounts",description:'Search chart of accounts. For OR (name or code), use filter: {"or":{"name":{"contains":"X"},"code":{"contains":"X"}}}.',group:"accounts",fields:US,defaults:$S,fetcher:xE,searchHint:"find accounts chart of accounts CoA by name code type class status OR search"}),{name:"create_account",description:"Create a new chart of accounts entry. Auto-checks for duplicates by name \u2014 returns existing account if found. Code must be unique. Account class is inferred from accountType.",params:{name:{type:"string",description:"Account name"},code:{type:"string",description:"Account code (unique)"},accountType:{type:"string",description:`Exact API string: ${bwr}. COGS = "Direct Costs". Common variants normalized client-side. "interest expense"/"interest income" is NOT auto-classified \u2014 ask, do not infer: Finance/Financing, Investing or Operating by main business activity.`},currencyCode:{type:"string",description:'Currency code (e.g., "SGD")'},lockDate:{type:"string",description:"Period lock date (YYYY-MM-DD, org timezone). Blocks recording or modifying any GL transaction on this account on or before this date."}},required:["name","code","accountType"],group:"accounts",readOnly:!1,searchHint:"create new chart of accounts entry with type code lock date",execute:async(t,e)=>{let r=e.name,n=await E1(t.client,r);if(n)return{_guard:"duplicate_skipped",message:`Account "${r}" already exists.`,existing:n};let i=BE(e.accountType);return Nw(t.client,{code:e.code,name:r,accountType:i,currencyCode:e.currencyCode,lockDate:e.lockDate})}},{name:"update_account",description:"Update a chart of accounts entry \u2014 rename, re-code, set its period lock date, or remove an existing lock date. Setting lockDate (YYYY-MM-DD) is how an individual ledger account is locked for a period: it blocks recording or editing any transaction on that account dated on or before the lock date. Pass clearLockDate to remove (unlock) an existing lock.",params:{resourceId:{type:"string",description:"Account resourceId"},name:{type:"string",description:"New account name"},code:{type:"string",description:"New account code"},lockDate:{type:"string",description:"Period lock date (YYYY-MM-DD, org timezone). Blocks recording or modifying any GL transaction on this account on or before this date."},clearLockDate:{type:"boolean",description:"Set true to remove an existing period lock date (unlock the period). Use when the user asks to remove, delete, clear, lift, or unset the lock. Do not also pass lockDate."}},required:["resourceId"],group:"accounts",readOnly:!1,searchHint:"update rename chart of accounts entry name code lock date unlock remove clear lock",execute:async(t,e)=>{let r=e.resourceId,n=(await TF(t.client,r)).data,o=Object.fromEntries(["name","code","classificationType","taxProfileResourceId","currency","description"].filter(a=>n[a]!==void 0&&n[a]!==null).map(a=>[a,n[a]]));!o.classificationType&&n.accountType&&(o.classificationType=n.accountType);let s=e.clearLockDate===!0;if(s&&e.lockDate!==void 0)throw new Error("clearLockDate and lockDate are mutually exclusive \u2014 pass one or the other.");return!s&&typeof n.accountLockDate=="string"&&n.accountLockDate&&(o.lockDate=n.accountLockDate.slice(0,10)),e.name!==void 0&&(o.name=e.name),e.code!==void 0&&(o.code=e.code),!s&&e.lockDate!==void 0&&(o.lockDate=e.lockDate),F0e(t.client,r,o)}},{name:"bulk_upsert_chart_of_accounts",description:`Bulk create/update CoA entries (max 500). SYNC: returns { resourceIds, failedRows: [{rowIndex, columnName, columnValue, errorCode, errorMessage}], failedCount } \u2014 no jobId polling. PARTIAL_SUCCESS: failed rows surface in failedRows[]; others still succeed.
690
+ Multiple organizations are accessible: pass org_id (from list_organizations) to target one. Confirm the organization with the user before any create/update/delete.`:""),u={operation:{type:"string",enum:n,description:`The ${e.name} operation to run.`},arguments:{type:"object",description:"Parameters for the chosen operation (see the operation list above). Validated by the Jaz API.",additionalProperties:!0}};return o&&(u[Zl]={type:"string",description:Uot}),a.length&&(u.file={type:"object",description:`A file from the conversation, when the client supports passing one. Accepted by: ${a.join(", ")}. The content is fetched server-side \u2014 leave source arguments out of \`arguments\`.`,properties:{download_url:{type:"string",description:"URL the file content can be fetched from (may be temporary)."},file_id:{type:"string",description:"Host-side file identifier."},mime_type:{type:"string"},file_name:{type:"string"}},required:["download_url"]}),t&&(u.org_id={type:"string",description:"The organization (resourceId from list_organizations) to run this operation against. Required when more than one organization is accessible."}),{name:e.name,description:c,inputSchema:{type:"object",properties:u,required:["operation"],additionalProperties:!1},...a.length?{_meta:{"openai/fileParams":["file"]}}:{},annotations:{title:`${e.title??lwr(e.name)} \xB7 ${r.length} operation${r.length===1?"":"s"}`,readOnlyHint:i,destructiveHint:!i&&s,idempotentHint:i,openWorldHint:!1}}})}function jot(t){return uwr.has(t)}function bfe(t,e){let r=Ti.find(o=>o.name===t);if(!r)return{error:`Unknown namespace: ${t}.`};let n=qot(r.groups),i=n.find(o=>o.name===e||o.aliases?.includes(e));return i?{tool:i}:{error:`Unknown operation "${e}" for the ${t} tool.`,operations:n.map(o=>o.name)}}var uwr,FB=X(()=>{"use strict";rd();nd();zv();r3();uwr=new Set(Ti.map(t=>t.name))});var Yot={};bs(Yot,{loadAgentSuiteContent:()=>Awr});import{readFileSync as dwr}from"node:fs";import{dirname as fwr,join as pwr}from"node:path";import{fileURLToPath as hwr}from"node:url";function Awr(){return Cfe||(Cfe=JSON.parse(dwr(pwr(mwr,"agent-suite-content.json"),"utf8"))),Cfe}var mwr,Cfe,Hot=X(()=>{"use strict";mwr=fwr(hwr(import.meta.url)),Cfe=null});var zot={};bs(zot,{buildCapabilityMap:()=>ywr});async function gwr(){try{let{loadAgentSuiteContent:t}=await Promise.resolve().then(()=>(Hot(),Yot)),e=t().counts;return{cli_command_groups:e.commands,api_rules:e.apiRules,skills:e.skills,ifrs_recipes:e.recipes,calculators:e.calculators,job_playbooks:e.jobs}}catch{return}}async function ywr(t={}){if(t.query&&t.query.trim())return K8(t.query);if(t.namespace){let r=Ti.find(i=>i.name===t.namespace);if(!r)return{error:`Unknown namespace "${t.namespace}".`,namespaces:Ti.map(i=>i.name),hint:"Call with no arguments for the full map, or pass `query` to rank operations by keyword."};let n=jv(r.groups);return{namespace:r.name,description:r.description,operations:n.length,operation_list:n.map(Gv),hint:"Call the namespace tool with { operation, arguments }, or execute_tool with the operation name on a meta-tool surface."}}let e=ky(t.surface,t.multiOrg);return{...e,map:t.full?NB().map(r=>({...r,operation_list:jv(Ti.find(n=>n.name===r.namespace).groups).map(Gv)})):e.map,beyond_mcp:await gwr()}}var Got=X(()=>{"use strict";rd();FB();zv();W8()});import{randomUUID as Ewr}from"node:crypto";function ost(t,e,r){return{type:"object",description:`The ${t.toLowerCase()} to create. Required.`,properties:{reference:{type:"string",description:`${t} reference`},contactResourceId:{type:"string",description:`${e} 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:`${t} line items (max 500)`,items:{type:"object",properties:{name:{type:"string",description:"Line description"},quantity:{type:"number"},unit:{type:"string"},unitPrice:{type:"number"},organizationAccountResourceId:{type:"string",description:`${r} account UUID`},itemResourceId:{type:"string"},taxProfileResourceId:{type:"string"}},required:["name"]}},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:Vv,adjustment:Wv}},capsuleResourceId:{type:"string"}},required:["reference","lineItems"]}}function Est(t){let e=t.limit,r=t.offset;return{limit:e,offset:r,sortBy:void 0,sortOrder:void 0}}function hr(t,e,r,n,i,o){let s={...Tfe};return o?.leanView&&(s.view={type:"string",enum:["lean","full"],description:"Payload tier: 'lean' (default) = summary row (id + key scalars); 'full' = whole entity per row (heavier). List lean, then drill in with get_*."}),{name:t,description:e,params:s,required:[],group:r,readOnly:!0,isConcurrencySafe:!0,maxResultSizeChars:5e4,...i?{searchHint:i}:{},execute:async(a,c)=>{let{limit:u,offset:d}=Est(c),f=o?.leanView?c.view==="full"?"full":"lean":void 0;return eS((h,m)=>n(a.client,h,m,f),u,d,f==="lean"?50:20)}}}function Bi(t,e,r,n,i,o){return{name:t,description:e,params:{resourceId:{type:"string",description:o?.paramDescription??"Resource ID (UUID)"}},required:["resourceId"],group:r,readOnly:!0,isConcurrencySafe:!0,maxResultSizeChars:2e4,...i?{searchHint:i}:{},execute:async(s,a)=>n(s.client,a.resourceId)}}function bst(t){if(!t||typeof t!="object"||Array.isArray(t))return{};let e=t.data;return e&&typeof e=="object"&&!Array.isArray(e)?e:t}function Cst(t,e,r,n){return{[e]:!0,...bst(t),[r]:n}}function MB(t){return`Deletes a DRAFT ${t}; VOIDs an active one and KEEPS it. force: true hard-deletes either.`}function Rwr(t,e,r){let n=bst(t);return{outcome:(typeof n.status=="string"?Swr[n.status]:void 0)??(r?"DELETED":"DELETED_IF_DRAFT_VOIDED_IF_ACTIVE"),...n,resourceId:e}}function Wr(t,e,r,n,i,o){let s=o?.verb??"deleted";return{name:t,description:e,params:{resourceId:{type:"string",description:o?.paramDescription??"Resource ID (UUID)"},...o?.voidable?Dwr:{}},required:["resourceId"],group:r,readOnly:!1,isDestructive:!0,...i?{searchHint:i}:{},execute:async(a,c)=>{let u=c.resourceId;ts(u,"resourceId",`Nothing was deleted. Source a real resourceId from a search_* or list_* result before calling ${t}.`);let d=c.force,f=await n(a.client,u,{force:d,internalNotes:c.internalNotes});return o?.voidable?Rwr(f,u,d):Cst(f,s,"resourceId",u)}}}function PB(t,e,r,n){return{name:t,description:`Download ${/^[aeiou]/i.test(e)?"an":"a"} ${e} as PDF. Returns { fileUrl } (may be pending/empty if the document is not yet rendered).`,params:{resourceId:{type:"string",description:`${e[0].toUpperCase()}${e.slice(1)} resourceId`}},required:["resourceId"],group:r,readOnly:!0,searchHint:`download ${e} as PDF document file`,isConcurrencySafe:!0,execute:async(i,o)=>n(i.client,o.resourceId)}}function xfe(t,e,r,n,i){return{name:t,description:e,params:{resourceId:{type:"string",description:"Resource ID (UUID)"}},required:["resourceId"],group:r,readOnly:!1,...i?.destructive?{isDestructive:!0}:{},...i?.searchHint?{searchHint:i.searchHint}:{},execute:async(o,s)=>n(o.client,s.resourceId)}}function ust(t){if(typeof t!="string"||/^\d{4}-\d{2}-\d{2}$/.test(t))return t;let e=/^(\d{4}-\d{2}-\d{2})T/.exec(t);return e?e[1]:t}function Fwr(t){return Array.isArray(t)?t.map(e=>{let r={};for(let[n,i]of Object.entries(e)){if(i==null)continue;let o=RX.get(n);if(o)r[o]=i;else if(n==="taxProfile"&&typeof i=="object"&&i!==null){let s=i.resourceId;s&&(r.taxProfileResourceId=s)}else if(n==="discount"&&typeof i=="object"&&i!==null){let s=i.rateValue;s&&Number(s)!==0&&(r.discount=i)}else Owr.has(n)&&(r[n]=i)}return r}):t}async function UB(t,e,r,n){let s=(await(e==="invoice"?Qs:e==="bill"?xs:e==="customer_credit_note"?Ol:Fl)(t,r)).data,a=Nwr[e],c={};for(let[p,h]of Object.entries(s))a.has(p)&&h!==null&&h!==void 0&&(c[p]=h);c.valueDate&&(c.valueDate=ust(c.valueDate)),c.dueDate&&(c.dueDate=ust(c.dueDate)),c.lineItems&&(c.lineItems=Fwr(c.lineItems));for(let[p,h]of Object.entries(n))h!==void 0&&(c[p]=h);let u=e==="invoice"?Vc:e==="bill"?ma:oo,{missingFields:d,ready:f}=Ys(c,u);if(!f)throw new Error(`Cannot finalize: missing ${d.join(", ")}. Use search_accounts (filter by accountType) and search_contacts to resolve, then pass the missing fields to this tool.`);return c}async function dst(t,e,r,n){if((await t(e,r)).data.status==="DRAFT")throw new Error(`Cannot pay a DRAFT ${n}. Finalize it first with finalize_${n}.`)}function a3(t,e,r){if(!(typeof t=="string"&&e.includes(t)))return{error:`Unknown documentType ${JSON.stringify(t)}.`,status:422,hint:`Use one of: ${e.join(", ")}.`,repair:{tool:r,arguments:{},reason:"Pass a supported documentType."}}}function hst(t,e,r){let n=pst[t];if(!n)return{error:`Unknown documentType "${t}".`,status:422,hint:`Valid document types: ${Object.keys(pst).join(", ")}.`,repair:{tool:r,arguments:{},reason:"Pass a supported documentType."}};if(!n.includes(e)){let i=n.includes("ACCEPT")?"ACCEPT":"CONFIRM";return{error:`Action "${e}" is not valid for ${t}. Valid actions: ${n.join(", ")}.`,status:422,hint:`${t} advances its lifecycle with ${i}, not ${e}.`,repair:{tool:r,arguments:{documentType:t,action:i},reason:`${t} is advanced with ${i}.`}}}}async function mst(t,e,r,n,i,o,s){let a;try{a=(await e(t,r)).data?.status}catch{return}if(a==="DRAFT"||a==="VOID"){let c=a==="DRAFT"?`A DRAFT ${n} can't be linked or accepted \u2014 issue it by creating the ${n} with saveAsDraft:false (status ${s}), then link the order to that one.`:`A VOID ${n} can't be used \u2014 create a fresh ${n} (saveAsDraft:false) and link to it.`;return{error:`Cannot create an order linked to a ${a} ${n} (${r}).`,status:422,hint:`Pre-flight guard \u2014 request never hit the API. ${c}`,repair:{tool:o,arguments:{documentType:i,saveAsDraft:!1},reason:c}}}}async function Ast(t,e,r,n,i,o){let s;try{s=(await e(t,r)).data?.status}catch{return}if(s==="VOID")return{error:`Cannot convert a VOID ${n} (${r}) into a ${i}.`,status:422,hint:`Pre-flight guard \u2014 request never hit the API. Convert a non-VOID ${n}.`,repair:{tool:o,arguments:{},reason:`The source ${n} is VOID.`}}}async function gst(t,e,r,n,i){let o;try{o=(await e(t,r,n)).data?.status}catch{return}if(o&&o!=="DRAFT")return{error:`Cannot DELETE a ${o} ${r} \u2014 delete is only allowed on DRAFT records.`,status:422,hint:"Use action VOID to cancel a non-draft quote/request/order.",repair:{tool:i,arguments:{documentType:r,resourceId:n,action:"VOID"},reason:`${r} is ${o}; void it instead of deleting.`}}}var bwr,Za,Io,Xl,vo,di,id,i3,Oy,Jot,Cwr,Vot,Wot,Ife,vfe,Jv,QB,Iwr,vwr,wfe,Zot,Xot,_fe,Tfe,Am,Dfe,Kot,est,tst,rst,Qi,nst,LB,wwr,Sfe,o3,Aa,ist,yst,od,Vv,Wv,_wr,Dwr,Swr,Ist,xwr,sst,ast,cst,Twr,Bwr,Rfe,lst,kwr,Nwr,Owr,$B,qB,s3,fst,pst,Tf,c3=X(()=>{"use strict";gP();yC();xX();dMe();gMe();ZD();Sa();fr();An();fA();cA();TE();APe();bPe();Xf();ng();_d();YX();HX();og();zX();vp();xF();zF();Qw();GX();UPe();eU();aU();pU();ait();Mw();XF();jw();LH();zw();VP();zH();bde();Cde();az();Ide();Bde();Fde();Mit();vp();gB();Qde();Lde();Ez();Zit();Hde();zde();Gde();tot();Wde();hm();Uz();oD();Zde();Xde();Gw();i7();iot();uot();fot();NX();pot();tfe();o8();rfe();nfe();ife();ofe();sfe();afe();cfe();lfe();Xf();ng();Iot();og();xot();_d();eU();aU();og();o8();mn();ffe();hfe();fr();gfe();Qot();bwr=xP.join(" | "),Za={type:"string",description:"Resource ID of the record"},Io={type:"string",description:"Transaction date (YYYY-MM-DD)"},Xl={type:"string",description:"Due date (YYYY-MM-DD)"},vo={type:"string",description:"Reference number"},di={type:"string",description:"Notes or memo text"},id={type:"string",description:"Tag name for categorization"},i3={type:"boolean",description:"Save as draft (default true). Set false to finalize immediately."},Oy={type:"boolean",description:"Return full entity (default: minimal {resourceId} only). Saves a follow-up get_* round trip."},Jot={recipe:{type:"string",enum:[...xy],description:"Recipe type"},amount:{type:"number",description:"Amount (for amortization, accrued-expense, dividend, ecl, provision, fx-reval)"},principal:{type:"number",description:"Principal (for loan, fixed-deposit)"},startDate:{type:"string",description:"Start date YYYY-MM-DD (REQUIRED for blueprint generation \u2014 default to today if user does not specify)"},currency:{type:"string",description:"Currency code (e.g. SGD, USD)"},periods:{type:"number",description:"Number of periods (for amortization, accrued-expense, leave-accrual)"},frequency:{type:"string",enum:["monthly","quarterly","annual"],description:"Frequency (for depreciation, amortization, accrued-expense)"},annualRate:{type:"number",description:"Annual interest/discount rate %"},termMonths:{type:"number"},monthlyPayment:{type:"number",description:"Monthly lease payment (for lease)"},usefulLifeMonths:{type:"number",description:"Asset useful life in months (hire purchase)"},cost:{type:"number",description:"Asset cost"},salvageValue:{type:"number"},usefulLifeYears:{type:"number"},method:{type:"string",enum:["sl","ddb","150db"],description:"Depreciation method"},acquisitionDate:{type:"string",description:"Acquisition date YYYY-MM-DD"},disposalDate:{type:"string",description:"Disposal date YYYY-MM-DD"},proceeds:{type:"number",description:"Disposal proceeds"},bookRate:{type:"number",description:"Original booking rate. Declare which way it reads via rateDirection (REQUIRED for fx-reval)."},closingRate:{type:"number",description:"Period-end closing rate. Same direction as bookRate."},rateDirection:{type:"string",enum:["FUNCTIONAL_TO_SOURCE","SOURCE_TO_FUNCTIONAL"],description:"REQUIRED for fx-reval. FUNCTIONAL_TO_SOURCE = 1 base unit = N foreign, what list_currency_rates returns. SOURCE_TO_FUNCTIONAL = 1 foreign unit = N base, the everyday quote."},position:{type:"string",enum:["ASSET","LIABILITY"],description:"Balance-sheet side: ASSET (receivable/deposit, default) or LIABILITY (payable/provision). A rising base value is a gain on an asset and a loss on a liability."},baseCurrency:{type:"string",description:"Base (functional) currency"},buckets:{type:"array",items:{type:"object",properties:{name:{type:"string"},balance:{type:"number"},rate:{type:"number"}},required:["name","balance","rate"]},description:"ECL aging buckets"},existingProvision:{type:"number",description:"Existing ECL provision balance"},compounding:{type:"string",enum:["none","monthly","quarterly","annually"]},employees:{type:"number"},daysPerYear:{type:"number",description:"Leave days per employee per year"},dailyRate:{type:"number",description:"Average daily rate"},declarationDate:{type:"string",description:"Board resolution date YYYY-MM-DD"},paymentDate:{type:"string",description:"Settlement date YYYY-MM-DD"},withholdingRate:{type:"number",description:"Withholding tax rate %"}},Cwr={type:"boolean",description:"Retry-only: set true after the duplicate guard surfaced a candidate and the user confirmed this is a separate document. Never on a first attempt."},Vot={type:"string",enum:[...kX],description:"CUSTOM (default) = free text; ALL_* = a picklist of that population. Datatype is derived, not chosen."},Wot={type:"object",properties:{address:{type:"string",description:"Street address \u2014 sent as addressLine1"},city:{type:"string"},state:{type:"string"},postalCode:{type:"string"},country:{type:"string"}},required:["address","country"]},Ife={type:"string",description:"Contact resourceId (customer or supplier)"},vfe={type:"array",description:"Draft BT references (max 500). Mix any btType.",items:{type:"object",properties:{btResourceId:{type:"string",description:"Draft BT resource ID (UUID)"},btType:{type:"string",enum:["SALE","PURCHASE","SALE_CREDIT_NOTE","PURCHASE_CREDIT_NOTE"],description:"Draft entity type"}},required:["btResourceId","btType"]}},Jv={type:"string",description:"Chart-of-accounts account the line posts to (revenue on a sale, expense on a purchase)"},QB={type:"string",description:"Account the payment posts to. For paymentMethod BANK_TRANSFER/CASH/CHEQUE this MUST be a bank or cash account. Any other method accepts any org account \u2014 that is how a deposit drawdown works (paymentMethod OTHER + the deposit account)."},Iwr={type:"number",description:"Payment amount (in bank currency)"},vwr={type:"string",description:"Period start date (YYYY-MM-DD)"},wfe={type:"string",description:"Period end date (YYYY-MM-DD)"},Zot={type:"string",enum:["full","aggregate"],description:`Output detail (default 'full'). 'aggregate' returns a compact aging-bucket summary (current, <1 month, 1/2/3 months, older + total outstanding + contact count). Prefer 'aggregate' for a general or unqualified report request (e.g. "show me my aged receivables", "my AR report") \u2014 it's the at-a-glance overview a chat user expects and it won't truncate on large orgs. Use 'full' only when the user explicitly asks for the per-contact (customer/supplier) breakdown for deeper analysis.`},Xot={type:"string",description:"Currency code (e.g. SGD, USD)"},_fe={type:"string",description:"Display name"},Tfe={limit:{type:"number",description:"Max results per page (\u22641000)."},offset:{type:"number",description:"Page offset (0-indexed). Use with limit to paginate."}},Am={type:"object",required:["sourceCurrency"],properties:{sourceCurrency:{type:"string",description:"Foreign currency code (ISO 4217)."},exchangeRate:{type:"number",description:'Base\u2192source: N where 1 org-base unit = N sourceCurrency. Invert ONLY if your quote reads "1 source = X base" (send 1/X), or declare rateDirection and skip the arithmetic. Omit for the org/platform rate.'},rateDirection:{type:"string",enum:["FUNCTIONAL_TO_SOURCE","SOURCE_TO_FUNCTIONAL"],description:"How exchangeRate reads. SOURCE_TO_FUNCTIONAL accepts a bank quote verbatim. Default FUNCTIONAL_TO_SOURCE."}}},Dfe={type:"string",enum:[...Hd],description:"Entity type to export"},Kot={type:"string",description:'Structured search query using dashboard syntax (e.g., "status:unpaid $500+ date:this month"). Mutually exclusive with filter \u2014 pass one or the other, never both.'},est={type:"object",description:'Raw JSON filter object (e.g., {"status":{"in":["UNPAID"]}}). Mutually exclusive with query \u2014 pass one or the other, never both.'},tst={type:"array",items:{type:"object",properties:{path:{type:"string",description:"Column path from get_export_columns (e.g., s.reference)"},header:{type:"string",description:"Column header label in the export file"},type:{type:"string",enum:["STRING","NUMBER","CURRENCY","DATE","BOOLEAN"],description:"Column data type (optional)"}},required:["path","header"]},description:"Custom column definitions. Omit to use default columns. Use get_export_columns to discover available paths."},rst={type:"object",properties:{field:{type:"string",description:"Column path to sort by (e.g., s.total_amount)"},direction:{type:"string",enum:["ASC","DESC"],description:"Sort direction"}},required:["field"],description:"Sort results by a column path."},Qi={type:"array",items:{type:"object",properties:{customFieldName:{type:"string"},actualValue:{type:"string"}}},description:'Custom field values: [{ customFieldName: "PO Number", actualValue: "PO-123" }]'},nst={type:"array",description:"Full replacement line-item set \u2014 non-empty REPLACES all lines, [] clears, omit = no change. claimTypeResourceId + name + unitPrice + quantity are required at submit time.",items:{type:"object",properties:{resourceId:{type:"string",description:"Existing line resourceId (omit to add a new line)"},claimTypeResourceId:{type:"string",description:"Claim type resourceId"},name:{type:"string",description:"Line name"},description:{type:"string",description:"Line description"},unitPrice:{type:"number",description:"Unit price"},quantity:{type:"number",description:"Quantity"},currency:{type:"string",description:"Line currency (ISO 4217; falls back to header)"},itemSubTotal:{type:"number",description:"Line subtotal (unitPrice \xD7 quantity)"}}}},LB={type:"array",items:{type:"string"},description:"Claim resourceIds (1-500)"},wwr={type:"array",items:{type:"object",required:["resourceId","type","selectedClasses","printable"],properties:{resourceId:{type:"string",description:"Capsule type resourceId"},type:{type:"string",enum:["invoice","bill"],description:"Resource type"},selectedClasses:{type:"array",items:{type:"object",required:["className"],properties:{className:{type:"string"},resourceId:Za}}},printable:{type:"boolean",description:"Show on printed documents."}}},description:"Nano classifier config for line items. Each entry links a capsule type with selected classes."},Sfe={type:"array",items:{type:"object",properties:{accountResourceId:{type:"string",description:"Account resourceId"},type:{type:"string",enum:["DEBIT","CREDIT"],description:"Debit or credit"},amount:{type:"number",description:"Amount"},description:{type:"string",description:"Line description"}},required:["accountResourceId","type","amount"]},description:"Journal entries (debit/credit lines with accountResourceId, type, amount)"},o3={type:"array",items:{type:"object",properties:{accountResourceId:{type:"string",description:"Offset account resourceId"},amount:{type:"number",description:"Amount (positive; direction comes from the endpoint)"},description:{type:"string",description:"Line description"},taxProfileResourceId:{type:"string",description:"Tax profile resourceId"}},required:["accountResourceId","amount"]},description:"Offset lines. No `type` \u2014 cash-in credits these and cash-out debits them, decided by the endpoint."},Aa={type:"array",items:{type:"object",properties:{name:{type:"string",description:"Line item description/name"},quantity:{type:"number"},unitPrice:{type:"number"},accountResourceId:Jv,taxProfileResourceId:{type:"string"},classifierConfig:wwr},required:["name","quantity","unitPrice"]},description:"Line items \u2014 include accountResourceId on each line when finalizing (saveAsDraft: false)"},ist={type:"array",items:{type:"object",properties:{itemName:{type:"string",description:"Display name of the catalog item"},itemResourceId:{type:"string",description:"Underlying item resourceId (from search_items)"},price:{type:"number",description:"Default unit price (0-1e9)"},unit:{type:"string",description:"Unit of measure"},quantityDefault:{type:"number",description:"Default quantity when added to a document (0-100)"},discountDefault:{type:"number",description:"Default discount % when added to a document (0-100)"},uiIndex:{type:"number",description:"Display position in the catalog (integer, min 0)"},classifiers:{type:"array",items:{type:"object"},description:"Classifier assignments. Same shape as classifierConfig on invoice/bill line items."}},required:["itemName","itemResourceId","price"]},description:"Catalog item rows. itemName, itemResourceId and price are required on every row."},yst={type:"array",items:{type:"object",properties:{slotKey:{type:"string",description:"Slot from get_capsule_recipe templateSlots[]."},template:{type:"string",description:"Text with {{vars}} for that slot; empty string clears a nullable slot. Max 2000."}},required:["slotKey"]},description:"Optional. Customize recipe-generated text via published slots (see get_capsule_recipe)."},od={type:"object",description:"Optional IFRS recipe trigger. Mutex with capsuleResourceId. Silent-null on failure \u2014 preview_capsule_recipe first. Rule 143.",properties:{recipeName:{type:"string",enum:["LOAN_AMORTIZATION","ACCRUAL_REVERSAL","PREPAID_AMORTIZATION","DEFERRED_REVENUE","IFRS16_LEASE"],description:"Must match mutation's allowedBaseTransactionTypes (see list_capsule_recipes)."},recipeVersion:{type:"number",description:"Optional version pin."},inputs:{type:"object",description:"Schema at versions[0].inputSchema. Single-currency; *AccountResourceId x-accountClass-locked."},templateOverrides:yst},required:["recipeName","inputs"]},Vv={type:"string",enum:[...qMe],description:"Payment method (default BANK_TRANSFER)"},Wv={type:"object",description:"Cash-leg adjustment (overpayment/rounding). Bank leg only, never AR/AP. Not with DEBT_WRITE_OFF/CLEARING_SETTLEMENT/INTER_COMPANY/WITHHOLDING_TAX_CERTIFICATE. See rule 160.",properties:{adjustmentValue:{type:"number",description:"Signed, non-zero, max 2dp"},adjustmentAccountResourceId:{type:"string",description:"Non-controlled account, not bank/cash"},adjustmentDescription:{type:"string",description:"Optional"}},required:["adjustmentValue","adjustmentAccountResourceId"]},_wr={...Wv,description:"Adding or changing an adjustment applies here. REMOVING does not: 0 is rejected and null reads as omitted, so both leave the stored value unchanged. To remove one, delete the payment and record it again. A change is rejected if the payment is reconciled or lock-dated, and amount, account and description are all compared, so resend all three unchanged if you are not editing it. See rule 160."};Dwr={force:{type:"boolean",description:"Hard-delete instead of voiding."},internalNotes:{type:"string",description:"Note recorded with the void."}},Swr={VOID:"VOIDED",SUCCEEDED:"DELETED"};Ist=["invoices","bills","customer-credit-notes","supplier-credit-notes"],xwr=[...Ist,"purchase-orders","purchase-requests","sale-orders","sale-quotes","claims"],sst={type:"string",description:"Document family",enum:Ist},ast={type:"string",description:"Document family",enum:xwr},cst={type:"string",description:"Why it is sent back. Opens a thread; the only record of the reason."},Twr=[{name:"approve_documents",description:"Approve one document awaiting approval. Posts its ledger entries and makes it live. One-shot, and the refusal channel differs by entity: invoices/bills THROW 422; credit notes return 200 with isSuccess:false and a STALE approvalStatus of APPROVED. Check isSuccess and catch the throw \u2014 approvalStatus alone cannot tell refusal from success.",params:{entity:sst,resourceId:{type:"string",description:"Document resourceId"}},required:["entity","resourceId"],group:"approvals",readOnly:!1,searchHint:"approve pending invoice bill credit note post ledger",execute:async(t,e)=>got(t.client,e.entity,e.resourceId)},{name:"bulk_approve_documents",description:"Approve up to 100 documents awaiting approval. Async \u2014 returns a jobId; poll search_background_jobs. Each approval posts a ledger.",params:{entity:sst,resourceIds:{type:"array",items:{type:"string"},description:"resourceIds (1-100)"}},required:["entity","resourceIds"],group:"approvals",readOnly:!1,searchHint:"bulk approve many pending documents at once",execute:async(t,e)=>yot(t.client,e.entity,e.resourceIds)},{name:"request_document_changes",description:"Send one document back for changes instead of approving it. Also covers orders, quotes, requests and claims.",params:{entity:ast,resourceId:{type:"string",description:"Document resourceId"},message:cst},required:["entity","resourceId","message"],group:"approvals",readOnly:!1,searchHint:"request changes reject send back document for revision",execute:async(t,e)=>Eot(t.client,e.entity,e.resourceId,e.message)},{name:"bulk_request_document_changes",description:"Send up to 500 documents back for changes with one message. Async \u2014 returns a jobId; poll search_background_jobs.",params:{entity:ast,resourceIds:{type:"array",items:{type:"string"},description:"resourceIds (1-500)"},message:cst},required:["entity","resourceIds","message"],group:"approvals",readOnly:!1,searchHint:"bulk request changes send back many documents",execute:async(t,e)=>bot(t.client,e.entity,e.resourceIds,e.message)}],Bwr=["journals","purchases","sales","purchase-credit-notes","sale-credit-notes"],Rfe={type:"string",description:"Document family",enum:Bwr},lst={type:"string",description:"Version id from get_document_version_history"},kwr=[{name:"get_document_version_history",description:"The stored versions of a document, newest first. Not paginated. Use before restoring to pick a version id.",params:{entity:Rfe,resourceId:{type:"string",description:"Document resourceId"}},required:["entity","resourceId"],group:"versions",readOnly:!0,searchHint:"list document version history revisions audit trail",isConcurrencySafe:!0,execute:async(t,e)=>_ot(t.client,e.entity,e.resourceId)},{name:"get_document_version",description:"Read one stored version of a document. An unknown resourceId/version pair returns 422.",params:{entity:Rfe,resourceId:{type:"string",description:"Document resourceId"},version:lst},required:["entity","resourceId","version"],group:"versions",readOnly:!0,searchHint:"get read one document version snapshot",isConcurrencySafe:!0,execute:async(t,e)=>Dot(t.client,e.entity,e.resourceId,e.version)},{name:"rollback_document_version",description:"Restore a document to a stored version. REPLACES current state \u2014 read the version first with get_document_version.",params:{entity:Rfe,resourceId:{type:"string",description:"Document resourceId"},version:lst},required:["entity","resourceId","version"],group:"versions",readOnly:!1,searchHint:"restore rollback document to previous version undo changes",isDestructive:!0,execute:async(t,e)=>Sot(t.client,e.entity,e.resourceId,e.version)},{name:"get_currency_effective_rate",description:"The organization effective rate for a currency on a date: its own custom rate when set, else the platform daily rate. Defaults to today.",params:{currencyCode:{type:"string",description:"ISO 4217 code, e.g. USD (not a resourceId)"},date:{type:"string",description:"YYYY-MM-DD (optional, defaults to today)"}},required:["currencyCode"],group:"currencies",readOnly:!0,searchHint:"currency effective exchange rate for a date custom or platform",isConcurrencySafe:!0,execute:async(t,e)=>Rot(t.client,e.currencyCode,e.date)}];Nwr={invoice:new Set(["reference","valueDate","dueDate","contactResourceId","lineItems","notes","invoiceNotes","internalNotes","tag","tags","isTaxVatApplicable","isTaxVATApplicable","taxInclusion","terms","currency","customFields","capsuleResourceId","capsuleRecipe","taxProfileResourceId","customerPaymentProfileResourceId"]),bill:new Set(["reference","valueDate","dueDate","contactResourceId","lineItems","invoiceNotes","internalNotes","tag","tags","isTaxVatApplicable","isTaxVATApplicable","taxInclusion","terms","currency","customFields","capsuleResourceId","capsuleRecipe","taxProfileResourceId"]),customer_credit_note:new Set(["reference","valueDate","contactResourceId","lineItems","invoiceNotes","tag","tags","isTaxVatApplicable","isTaxVATApplicable","taxInclusion","currency","customFields","capsuleResourceId","taxProfileResourceId"]),supplier_credit_note:new Set(["reference","valueDate","contactResourceId","lineItems","invoiceNotes","tag","tags","isTaxVatApplicable","isTaxVATApplicable","taxInclusion","currency","customFields","capsuleResourceId","taxProfileResourceId"])};Owr=new Set(["name","quantity","unitPrice","unit","accountResourceId","taxProfileResourceId","description","classifierConfig","itemResourceId","discount"]);$B={type:"string",enum:["SALE_QUOTE","SALE_ORDER"],description:"Which sales document: SALE_QUOTE (estimate) or SALE_ORDER."},qB={type:"string",enum:["PURCHASE_REQUEST","PURCHASE_ORDER"],description:"Which purchase document: PURCHASE_REQUEST (requisition) or PURCHASE_ORDER."},s3={type:"number",description:"Payment terms in days (one of 0, 7, 15, 30, 45, 60)."},fst={type:"string",enum:["ACCEPT","CONFIRM","VOID","DELETE"],description:"Lifecycle action. ACCEPT=quote/request only; CONFIRM=order only; VOID=any non-draft; DELETE=draft only."},pst={SALE_QUOTE:["ACCEPT","VOID","DELETE"],SALE_ORDER:["CONFIRM","VOID","DELETE"],PURCHASE_REQUEST:["ACCEPT","VOID","DELETE"],PURCHASE_ORDER:["CONFIRM","VOID","DELETE"]};Tf=[{name:"get_organization",description:"Get organization details: name, base currency, country, and financial year end.",params:{},required:[],group:"organization",readOnly:!0,searchHint:"get organization details currency country fiscal year",isConcurrencySafe:!0,maxResultSizeChars:2e4,execute:async t=>Ra(t.client)},{name:"get_my_context",description:"Resolve the CALLER's own context \u2014 identity, the employee bound to their login (if any), and per-module access (moduleRoles). Use to route a receipt (bill if PURCHASES access, expense claim if EMPLOYEE_CLAIMS access). A service api-key usually has no bound employee. Magic claim drafts auto-bind the uploader server-side \u2014 no need to read employee.resourceId to bind one.",params:{},required:[],group:"organization",readOnly:!0,searchHint:"who am i my employee my permissions module roles what can i do self caller capabilities bills claims",isConcurrencySafe:!0,maxResultSizeChars:2e4,execute:async t=>t0e(t.client)},hr("list_accounts","List chart of accounts. Returns account name, code, type, class, status. Paginated \u2014 response includes totalElements. Use limit/offset to page.","accounts",(t,e,r)=>Dd(t,{limit:r,offset:e}),"list chart of accounts with code type class status"),Wt({name:"search_accounts",description:'Search chart of accounts. For OR (name or code), use filter: {"or":{"name":{"contains":"X"},"code":{"contains":"X"}}}.',group:"accounts",fields:US,defaults:$S,fetcher:xE,searchHint:"find accounts chart of accounts CoA by name code type class status OR search"}),{name:"create_account",description:"Create a new chart of accounts entry. Auto-checks for duplicates by name \u2014 returns existing account if found. Code must be unique. Account class is inferred from accountType.",params:{name:{type:"string",description:"Account name"},code:{type:"string",description:"Account code (unique)"},accountType:{type:"string",description:`Exact API string: ${bwr}. COGS = "Direct Costs". Common variants normalized client-side. "interest expense"/"interest income" is NOT auto-classified \u2014 ask, do not infer: Finance/Financing, Investing or Operating by main business activity.`},currencyCode:{type:"string",description:'Currency code (e.g., "SGD")'},lockDate:{type:"string",description:"Period lock date (YYYY-MM-DD, org timezone). Blocks recording or modifying any GL transaction on this account on or before this date."}},required:["name","code","accountType"],group:"accounts",readOnly:!1,searchHint:"create new chart of accounts entry with type code lock date",execute:async(t,e)=>{let r=e.name,n=await E1(t.client,r);if(n)return{_guard:"duplicate_skipped",message:`Account "${r}" already exists.`,existing:n};let i=BE(e.accountType);return Nw(t.client,{code:e.code,name:r,accountType:i,currencyCode:e.currencyCode,lockDate:e.lockDate})}},{name:"update_account",description:"Update a chart of accounts entry \u2014 rename, re-code, set its period lock date, or remove an existing lock date. Setting lockDate (YYYY-MM-DD) is how an individual ledger account is locked for a period: it blocks recording or editing any transaction on that account dated on or before the lock date. Pass clearLockDate to remove (unlock) an existing lock.",params:{resourceId:{type:"string",description:"Account resourceId"},name:{type:"string",description:"New account name"},code:{type:"string",description:"New account code"},lockDate:{type:"string",description:"Period lock date (YYYY-MM-DD, org timezone). Blocks recording or modifying any GL transaction on this account on or before this date."},clearLockDate:{type:"boolean",description:"Set true to remove an existing period lock date (unlock the period). Use when the user asks to remove, delete, clear, lift, or unset the lock. Do not also pass lockDate."}},required:["resourceId"],group:"accounts",readOnly:!1,searchHint:"update rename chart of accounts entry name code lock date unlock remove clear lock",execute:async(t,e)=>{let r=e.resourceId,n=(await TF(t.client,r)).data,o=Object.fromEntries(["name","code","classificationType","taxProfileResourceId","currency","description"].filter(a=>n[a]!==void 0&&n[a]!==null).map(a=>[a,n[a]]));!o.classificationType&&n.accountType&&(o.classificationType=n.accountType);let s=e.clearLockDate===!0;if(s&&e.lockDate!==void 0)throw new Error("clearLockDate and lockDate are mutually exclusive \u2014 pass one or the other.");return!s&&typeof n.accountLockDate=="string"&&n.accountLockDate&&(o.lockDate=n.accountLockDate.slice(0,10)),e.name!==void 0&&(o.name=e.name),e.code!==void 0&&(o.code=e.code),!s&&e.lockDate!==void 0&&(o.lockDate=e.lockDate),F0e(t.client,r,o)}},{name:"bulk_upsert_chart_of_accounts",description:`Bulk create/update CoA entries (max 500). SYNC: returns { resourceIds, failedRows: [{rowIndex, columnName, columnValue, errorCode, errorMessage}], failedCount } \u2014 no jobId polling. PARTIAL_SUCCESS: failed rows surface in failedRows[]; others still succeed.
691
691
 
692
692
  resourceId per row \u2192 update; omit \u2192 create. Note: dedup is by NAME (not code) \u2014 duplicate name surfaces ORGANIZATION_CHART_OF_ACCOUNT_DUPLICATED per row. Accepts all 23 accountType values (see create_account); common variants normalized via normalizeAccountType.
693
693
 
@@ -740,7 +740,7 @@ Optional capsuleRecipe (JOURNAL_MANUAL base \u2014 ACCRUAL_REVERSAL, IFRS16_LEAS
740
740
  - Line items use "name" for item description.
741
741
  - reference MUST be unique \u2014 generate one with a timestamp if user doesn't specify.`,params:{reference:{type:"string",description:"Credit note reference number"},valueDate:{type:"string",description:"Credit note date (YYYY-MM-DD)"},contactResourceId:{type:"string",description:"Customer contact resourceId"},lineItems:{type:"array",items:{type:"object",properties:{name:{type:"string",description:"Line item description"},quantity:{type:"number"},unitPrice:{type:"number"},accountResourceId:Jv},required:["name","quantity","unitPrice"]},description:"Credit note line items"},currency:Am,saveAsDraft:{type:"boolean",description:"Save as draft (default true)"},notes:di,tag:id,customFields:Qi},required:["valueDate","lineItems"],group:"customer_credit_notes",readOnly:!1,searchHint:"create new customer credit note draft",execute:async(t,e)=>{let r=fl(e);if(r)return r;let{notes:n,tag:i,...o}=e,s={...o,...n!==void 0&&{invoiceNotes:n},...i!==void 0&&{tags:[i]}};s.reference||(s.reference=ui("CCN"));let a=await hR(t.client,s);return Sf(a,Ww(a.appliedRate,e.currency))}},Wr("delete_customer_credit_note",MB("customer credit note"),"customer_credit_notes",W2,"delete draft or void active customer credit note",{paramDescription:"Customer credit note resourceId",voidable:!0}),{name:"update_customer_credit_note",description:'Update a draft customer credit note (change amount, line items, contact, date, notes). Use when the user says "update", "change", "fix", or "correct" a credit note.',params:{resourceId:{type:"string",description:"Customer credit note resourceId"},reference:vo,valueDate:Io,lineItems:Aa,notes:di,tag:id,customFields:Qi},required:["resourceId"],group:"customer_credit_notes",readOnly:!1,searchHint:"update customer credit note lines reference",execute:async(t,e)=>{let{resourceId:r,notes:n,tag:i,...o}=e,s={...o,...n!==void 0&&{invoiceNotes:n},...i!==void 0&&{tags:[i]}};return V2(t.client,r,s)}},{name:"finalize_customer_credit_note",description:"Finalize a draft customer credit note (set saveAsDraft=false). Status becomes UNAPPLIED.",params:{resourceId:{type:"string",description:"Customer credit note resourceId"},reference:vo,valueDate:Io,lineItems:Aa,notes:di},required:["resourceId"],group:"customer_credit_notes",readOnly:!1,searchHint:"approve finalize customer credit note",isDestructive:!0,execute:async(t,e)=>{let{resourceId:r,notes:n,...i}=e,o={...i,...n!==void 0&&{invoiceNotes:n}},s=await UB(t.client,"customer_credit_note",r,o),a=fl(s,{assumeFinalize:!0});return a||mR(t.client,r,s)}},{name:"create_customer_credit_note_refund",description:"Record a refund payment against a customer credit note.",params:{creditNoteId:{type:"string",description:"Customer credit note resourceId"},paymentAmount:{type:"number",description:"Refund amount"},transactionAmount:{type:"number",description:"Amount in credit note currency (defaults to paymentAmount for same-currency)"},accountResourceId:QB,valueDate:{type:"string",description:"Payment date (YYYY-MM-DD)"},reference:{type:"string",description:"Payment reference"},paymentMethod:Vv,adjustment:Wv},required:["creditNoteId","paymentAmount","accountResourceId","valueDate"],group:"customer_credit_notes",readOnly:!1,searchHint:"refund customer credit note to bank account",isDestructive:!0,execute:async(t,e)=>{let r=Number(e.paymentAmount);if(!Number.isFinite(r)||r<=0)throw new Error("paymentAmount must be a positive number");let n=Number(e.transactionAmount??r);if(!Number.isFinite(n)||n<=0)throw new Error("transactionAmount must be a positive number");return AR(t.client,e.creditNoteId,{paymentAmount:r,transactionAmount:n,accountResourceId:e.accountResourceId,valueDate:e.valueDate,dueDate:e.valueDate,reference:e.reference??"",paymentMethod:e.paymentMethod??"BANK_TRANSFER",saveAsDraft:!1,adjustment:e.adjustment})}},{name:"list_customer_credit_note_refunds",description:"List refund payments for a customer credit note.",params:{creditNoteId:{type:"string",description:"Customer credit note resourceId"}},required:["creditNoteId"],group:"customer_credit_notes",readOnly:!0,searchHint:"list refunds on a customer credit note",isConcurrencySafe:!0,maxResultSizeChars:5e4,execute:async(t,e)=>Z2(t.client,e.creditNoteId)},hr("list_supplier_credit_notes","List supplier credit notes (AP adjustments/refunds). Paginated \u2014 response includes totalElements. Use limit/offset to page.","supplier_credit_notes",(t,e,r,n)=>tU(t,{limit:r,offset:e,view:n}),"list supplier credit notes with status pagination",{leanView:!0}),Wt({name:"search_supplier_credit_notes",description:"Search supplier credit notes. Status: DRAFT, UNAPPLIED, PARTIALLY_APPLIED, APPLIED, VOID.",group:"supplier_credit_notes",fields:$p,defaults:sS,fetcher:gR,searchHint:"find supplier credit notes refunds CN by reference status contact tag"}),{name:"get_supplier_credit_note",description:"Fetch a supplier credit note by internal resourceId. To search by other fields, use `search_supplier_credit_notes`.",params:{resourceId:{type:"string",description:"Supplier credit note resourceId"}},required:["resourceId"],group:"supplier_credit_notes",readOnly:!0,searchHint:"get supplier credit note details line items",isConcurrencySafe:!0,maxResultSizeChars:2e4,execute:async(t,e)=>Fl(t.client,e.resourceId)},{name:"create_supplier_credit_note",description:`Create a supplier credit note. Saves as draft by default.
742
742
  - Status when finalized is UNAPPLIED (not APPROVED).
743
- - Line items use "name" for item description.`,params:{reference:{type:"string",description:"Credit note reference number"},valueDate:{type:"string",description:"Credit note date (YYYY-MM-DD)"},contactResourceId:{type:"string",description:"Supplier contact resourceId"},lineItems:{type:"array",items:{type:"object",properties:{name:{type:"string",description:"Line item description"},quantity:{type:"number"},unitPrice:{type:"number"},accountResourceId:Jv},required:["name","quantity","unitPrice"]},description:"Credit note line items"},currency:Am,saveAsDraft:{type:"boolean",description:"Save as draft (default true)"},notes:di,tag:id,customFields:Qi},required:["valueDate","lineItems"],group:"supplier_credit_notes",readOnly:!1,searchHint:"create new supplier credit note draft",execute:async(t,e)=>{let r=fl(e);if(r)return r;let{notes:n,tag:i,...o}=e,s={...o,...n!==void 0&&{invoiceNotes:n},...i!==void 0&&{tags:[i]}};s.reference||(s.reference=ui("SCN"));let a=await yR(t.client,s);return Sf(a,Ww(a.appliedRate,e.currency))}},Wr("delete_supplier_credit_note",MB("supplier credit note"),"supplier_credit_notes",nU,"delete draft or void active supplier credit note",{paramDescription:"Supplier credit note resourceId",voidable:!0}),PB("download_supplier_credit_note_pdf","supplier credit note","supplier_credit_notes",(t,e)=>iU(t,e)),{name:"update_supplier_credit_note",description:'Update a draft supplier credit note (change amount, line items, contact, date, notes). Use when the user says "update", "change", "fix", or "correct" a credit note.',params:{resourceId:{type:"string",description:"Supplier credit note resourceId"},reference:vo,valueDate:Io,lineItems:Aa,notes:di,tag:id,customFields:Qi},required:["resourceId"],group:"supplier_credit_notes",readOnly:!1,searchHint:"update supplier credit note lines reference",execute:async(t,e)=>{let{resourceId:r,notes:n,tag:i,...o}=e,s={...o,...n!==void 0&&{invoiceNotes:n},...i!==void 0&&{tags:[i]}};return rU(t.client,r,s)}},{name:"finalize_supplier_credit_note",description:"Finalize a draft supplier credit note (set saveAsDraft=false). Status becomes UNAPPLIED.",params:{resourceId:{type:"string",description:"Supplier credit note resourceId"},reference:vo,valueDate:Io,lineItems:Aa,notes:di},required:["resourceId"],group:"supplier_credit_notes",readOnly:!1,searchHint:"approve finalize supplier credit note",isDestructive:!0,execute:async(t,e)=>{let{resourceId:r,notes:n,...i}=e,o={...i,...n!==void 0&&{invoiceNotes:n}},s=await UB(t.client,"supplier_credit_note",r,o),a=fl(s,{assumeFinalize:!0});return a||ER(t.client,r,s)}},{name:"create_supplier_credit_note_refund",description:"Record a refund payment against a supplier credit note.",params:{creditNoteId:{type:"string",description:"Supplier credit note resourceId"},paymentAmount:{type:"number",description:"Refund amount"},transactionAmount:{type:"number",description:"Amount in credit note currency (defaults to paymentAmount for same-currency)"},accountResourceId:QB,valueDate:{type:"string",description:"Payment date (YYYY-MM-DD)"},reference:{type:"string",description:"Payment reference"},paymentMethod:Vv,adjustment:Wv},required:["creditNoteId","paymentAmount","accountResourceId","valueDate"],group:"supplier_credit_notes",readOnly:!1,searchHint:"refund supplier credit note from bank account",isDestructive:!0,execute:async(t,e)=>{let r=Number(e.paymentAmount);if(!Number.isFinite(r)||r<=0)throw new Error("paymentAmount must be a positive number");let n=Number(e.transactionAmount??r);if(!Number.isFinite(n)||n<=0)throw new Error("transactionAmount must be a positive number");return bR(t.client,e.creditNoteId,{paymentAmount:r,transactionAmount:n,accountResourceId:e.accountResourceId,valueDate:e.valueDate,dueDate:e.valueDate,reference:e.reference??"",paymentMethod:e.paymentMethod??"BANK_TRANSFER",saveAsDraft:!1,adjustment:e.adjustment})}},{name:"list_supplier_credit_note_refunds",description:"List refund payments for a supplier credit note.",params:{creditNoteId:{type:"string",description:"Supplier credit note resourceId"}},required:["creditNoteId"],group:"supplier_credit_notes",readOnly:!0,searchHint:"list refunds on a supplier credit note",isConcurrencySafe:!0,maxResultSizeChars:5e4,execute:async(t,e)=>oU(t.client,e.creditNoteId)},{name:"list_currencies",description:"List currencies enabled for the organization. Returns code, name, symbol, isBaseCurrency.",params:{},required:[],group:"currencies",readOnly:!0,searchHint:"list currencies enabled active organization base currency code symbol",isConcurrencySafe:!0,maxResultSizeChars:5e4,execute:async t=>CR(t.client)},{name:"add_currency",description:"Enable one or more currencies for the organization.",params:{currencies:{type:"array",items:{type:"string"},description:'Currency codes to add (e.g., ["USD", "EUR"])'}},required:["currencies"],group:"currencies",readOnly:!1,searchHint:"add new currency to organization",execute:async(t,e)=>{let r=e.currencies,n=await CR(t.client),i=new Set(n.data.map(c=>c.currencyCode.toUpperCase())),o=r.filter(c=>i.has(c.toUpperCase())),s=r.filter(c=>!i.has(c.toUpperCase()));if(s.length===0)return{_guard:"duplicate_skipped",message:`All currencies already enabled: ${r.join(", ")}.`,existing:o};let a=await cU(t.client,s);return o.length>0?{...a,_note:`Skipped already-enabled: ${o.join(", ")}`}:a}},{name:"list_currency_rates",description:"List exchange rates for a specific currency. IMPORTANT: You MUST call list_currencies first to discover which currencies the org has enabled \u2014 never guess or assume currency codes.",params:{currencyCode:{type:"string",description:'Currency code (e.g., "USD")'},...Tfe},required:["currencyCode"],group:"currencies",readOnly:!0,searchHint:"list exchange rates for a currency pair",isConcurrencySafe:!0,maxResultSizeChars:5e4,execute:async(t,e)=>{let{limit:r,offset:n}=Est(e),i=e.currencyCode;return eS((o,s)=>lU(t.client,i,{limit:s,offset:o}),r,n,100)}},{name:"add_currency_rate",description:'Add or set an exchange rate for a currency. ALWAYS use this tool even when the user says "update rate" \u2014 it handles both new and existing rates. Rate direction is base\u2192source (1 org-base unit = N of this currency); see the rate param before sending. Call list_currencies first to get valid currency codes.',params:{currencyCode:{type:"string",description:"Currency code"},rate:{type:"number",description:'Base\u2192source: N where 1 org-base unit = N of this currency. Invert ONLY if your figure reads "1 thisCurrency = X base" \u2014 SGD org + USD ("1 USD = 1.35 SGD") \u2192 0.74; USD org + PHP ("1 USD = 56.5 PHP") \u2192 56.5 unchanged. Or declare rateDirection and pass your figure as-is.'},rateDirection:{type:"string",enum:["FUNCTIONAL_TO_SOURCE","SOURCE_TO_FUNCTIONAL"],description:'Optional. Declare how your rate reads and skip the mental arithmetic: SOURCE_TO_FUNCTIONAL lets you pass a bank quote ("1 USD = 1.35 SGD" \u2192 1.35) verbatim. Default FUNCTIONAL_TO_SOURCE.'},rateApplicableFrom:{type:"string",description:"Start date (YYYY-MM-DD)"},rateApplicableTo:{type:"string",description:"End date (YYYY-MM-DD, optional)"}},required:["currencyCode","rate","rateApplicableFrom"],group:"currencies",readOnly:!1,searchHint:"add new exchange rate for currency pair",execute:async(t,e)=>uU(t.client,e.currencyCode,{rate:e.rate,rateDirection:e.rateDirection,rateApplicableFrom:e.rateApplicableFrom,rateApplicableTo:e.rateApplicableTo})},{name:"update_currency_rate",description:'Update an EXISTING exchange rate record by its resourceId. Requires the rate resourceId from list_currency_rates. WARNING: If the user says "update the rate" or "set the rate", they almost always mean add_currency_rate (which creates/overwrites for a date). Only use this tool when explicitly modifying an existing rate record by ID.',params:{currencyCode:{type:"string",description:"Currency code"},resourceId:{type:"string",description:"Rate resourceId"},rate:{type:"number",description:'New rate. Base\u2192source: N where 1 org-base unit = N of this currency. Invert only if your figure reads "1 thisCurrency = X base" (send 1/X), or declare rateDirection.'},rateDirection:{type:"string",enum:["FUNCTIONAL_TO_SOURCE","SOURCE_TO_FUNCTIONAL"],description:'Optional. Declare how your rate reads and skip the mental arithmetic: SOURCE_TO_FUNCTIONAL lets you pass a bank quote ("1 USD = 1.35 SGD" \u2192 1.35) verbatim. Default FUNCTIONAL_TO_SOURCE.'},rateApplicableFrom:{type:"string",description:"Start date (YYYY-MM-DD)"},rateApplicableTo:{type:"string",description:"End date (YYYY-MM-DD, optional)"}},required:["currencyCode","resourceId","rate","rateApplicableFrom"],group:"currencies",readOnly:!1,searchHint:"update existing exchange rate value",execute:async(t,e)=>dU(t.client,e.currencyCode,e.resourceId,{rate:e.rate,rateDirection:e.rateDirection,rateApplicableFrom:e.rateApplicableFrom,rateApplicableTo:e.rateApplicableTo})},{name:"bulk_upsert_currency_rates",description:"Max 500 exchange rates per call. Auto-enables currencies not yet enabled in the org \u2014 no need to call add_currency first. Requires rateDirection per rate. Response surfaces per-row failures: `failedRows[]` (each with rowIndex, columnName, columnValue, errorCode, errorMessage) + `failedCount` alongside `resourceIds[]` for successful inserts. Omitting `rateApplicableTo` defaults it to `rateApplicableFrom - 0.999ms` (no temporal gap).",params:{rates:{type:"array",description:"Array of exchange rates to create",items:{type:"object",properties:{sourceCurrencyCode:{type:"string",description:"Source currency code (ISO 4217, e.g. USD, EUR)"},rate:{type:"number",description:"Exchange rate value (must be > 0)"},rateDirection:{type:"string",description:"Rate direction",enum:["FUNCTIONAL_TO_SOURCE","SOURCE_TO_FUNCTIONAL"]},rateApplicableFrom:{type:"string",description:"Rate start date (YYYY-MM-DD)"},rateApplicableTo:{type:"string",description:"Rate end date (YYYY-MM-DD, optional)"}},required:["sourceCurrencyCode","rate","rateDirection","rateApplicableFrom"]}}},required:["rates"],group:"currencies",readOnly:!1,searchHint:"bulk create or update multiple currency rates",execute:async(t,e)=>(await fU(t.client,e.rates)).data},hr("list_tax_profiles","List tax profiles (GST, VAT, etc.). Returns name, rate, tax type.","tax_profiles",(t,e,r)=>OE(t,{limit:r,offset:e}),"list tax profiles GST VAT rates"),hr("list_tax_types","List available tax types. Use the tax type code when creating tax profiles.","tax_profiles",(t,e,r)=>MF(t,{limit:r,offset:e}),"list available tax types for profile creation"),hr("list_modules","List the modules (features/capabilities) enabled for the organization.","modules",(t,e,r)=>hPe(t,{limit:r,offset:e}),"list enabled org modules features capabilities"),Bi("get_module","Get details for a single org module by resourceId.","modules",(t,e)=>mPe(t,e),"get module details"),hr("list_account_classifications","List account classifications (reference list for categorising chart-of-accounts entries).","accounts",(t,e,r)=>Q0e(t,{limit:r,offset:e}),"list account classifications categories for chart of accounts"),hr("list_purchase_items","List purchase-side catalog items.","purchase_items",(t,e,r)=>gPe(t,{limit:r,offset:e}),"list purchase items purchasable catalog products"),Bi("get_purchase_item","Get a single purchase item by resourceId.","purchase_items",(t,e)=>yPe(t,e),"get purchase item details"),Wt({name:"search_purchase_items",description:"Search purchase items by name, reference, or currency.",group:"purchase_items",fields:PX,defaults:UX,fetcher:EPe,searchHint:"find purchase items purchasable catalog by name reference currency"}),hr("list_catalogs","List catalogs (product/service groupings).","catalogs",(t,e,r)=>q2(t,{limit:r,offset:e}),"list catalogs product service groupings"),Bi("get_catalog","Get a catalog by resourceId (includes its items).","catalogs",(t,e)=>j2(t,e),"get catalog details items"),Wt({name:"search_catalogs",description:"Search catalogs by name, description, status, or contact group.",group:"catalogs",fields:vS,defaults:wS,fetcher:Y2,searchHint:"find catalogs by name description status contact group"}),{name:"create_catalog",description:"Create a catalog. status defaults to INACTIVE. items[] are catalog-item rows; contactGroupResourceIds[] scopes it to contact groups.",params:{catalogName:{type:"string",description:"Catalog name"},description:{type:"string",description:"Catalog description"},status:{type:"string",enum:["ACTIVE","INACTIVE"],description:"Record status (defaults INACTIVE)"},contactGroupResourceIds:{type:"array",items:{type:"string"},description:"Contact group resourceIds to scope the catalog to"},items:ist},required:["catalogName","items"],group:"catalogs",readOnly:!1,searchHint:"create new catalog product service grouping",execute:async(t,e)=>H2(t.client,{catalogName:e.catalogName,description:e.description,status:e.status,contactGroupResourceIds:e.contactGroupResourceIds,items:e.items})},{name:"update_catalog",description:"Update a catalog. FULL REPLACEMENT \u2014 GET first, merge, then send the complete body; omitting items or contactGroupResourceIds DROPS them.",params:{resourceId:{type:"string",description:"Catalog resourceId"},catalogName:{type:"string",description:"Catalog name"},description:{type:"string",description:"Catalog description"},status:{type:"string",enum:["ACTIVE","INACTIVE"],description:"Record status"},contactGroupResourceIds:{type:"array",items:{type:"string"},description:"Contact group resourceIds"},items:ist},required:["resourceId","catalogName","items"],group:"catalogs",readOnly:!1,searchHint:"update edit catalog",execute:async(t,e)=>z2(t.client,e.resourceId,{catalogName:e.catalogName,description:e.description,status:e.status,contactGroupResourceIds:e.contactGroupResourceIds,items:e.items})},Wr("delete_catalog","Delete a catalog.","catalogs",(t,e)=>G2(t,e),"delete remove catalog"),hr("list_organization_report_templates","List saved organization report templates.","report_templates",(t,e,r)=>LPe(t,{limit:r,offset:e}),"list organization report templates saved"),Bi("get_organization_report_template","Get a saved report template by resourceId.","report_templates",(t,e)=>MPe(t,e),"get report template details"),Wt({name:"search_organization_report_templates",description:"Search report templates by type, category, or default flag.",group:"report_templates",fields:$X,defaults:qX,fetcher:PPe,searchHint:"find organization report templates by type category default"}),{name:"move_transaction_capsules",description:"Move business transactions from one capsule to another. Pass the transaction resourceIds, the source capsule (oldCapsuleResourceId), and the destination (newCapsuleResourceId).",params:{businessTransactionResourceIds:{type:"array",items:{type:"string"},description:"Transaction resourceIds to move"},newCapsuleResourceId:{type:"string",description:"Destination capsule resourceId"},oldCapsuleResourceId:{type:"string",description:"Source capsule resourceId"}},required:["businessTransactionResourceIds","newCapsuleResourceId","oldCapsuleResourceId"],group:"capsules",readOnly:!1,searchHint:"move transactions between capsules regroup reassign capsule",execute:async(t,e)=>LF(t.client,{businessTransactionResourceIds:e.businessTransactionResourceIds,newCapsuleResourceId:e.newCapsuleResourceId,oldCapsuleResourceId:e.oldCapsuleResourceId})},{name:"create_tax_profile",description:"Create a new tax profile. List tax types first to get the taxTypeCode. Automatically checks for duplicates by name \u2014 returns existing profile if found.",params:{name:{type:"string",description:'Tax profile name (e.g., "GST 9%")'},taxRate:{type:"number",description:"Tax rate as percentage (e.g., 9 for 9%)"},taxTypeCode:{type:"string",description:"Tax type code (from list_tax_types)"}},required:["name","taxRate","taxTypeCode"],group:"tax_profiles",readOnly:!1,searchHint:"create new tax profile GST VAT rate",execute:async(t,e)=>{let r=e.name,n=await b1(t.client,r);return n?{_guard:"duplicate_skipped",message:`Tax profile "${r}" already exists.`,existing:n}:PF(t.client,{name:r,taxRate:e.taxRate,taxTypeCode:e.taxTypeCode})}},hr("list_cash_in","List cash-in entries (direct cash receipts). Paginated.","cash_entries",(t,e,r)=>UH(t,{limit:r,offset:e}),"list cash in receipt entries with pagination"),{name:"create_cash_in",description:`Record money received INTO a bank account from an EXTERNAL source (customer payment, refund received, deposit). For inter-account moves use create_cash_transfer.
743
+ - Line items use "name" for item description.`,params:{reference:{type:"string",description:"Credit note reference number"},valueDate:{type:"string",description:"Credit note date (YYYY-MM-DD)"},contactResourceId:{type:"string",description:"Supplier contact resourceId"},lineItems:{type:"array",items:{type:"object",properties:{name:{type:"string",description:"Line item description"},quantity:{type:"number"},unitPrice:{type:"number"},accountResourceId:Jv},required:["name","quantity","unitPrice"]},description:"Credit note line items"},currency:Am,saveAsDraft:{type:"boolean",description:"Save as draft (default true)"},notes:di,tag:id,customFields:Qi},required:["valueDate","lineItems"],group:"supplier_credit_notes",readOnly:!1,searchHint:"create new supplier credit note draft",execute:async(t,e)=>{let r=fl(e);if(r)return r;let{notes:n,tag:i,...o}=e,s={...o,...n!==void 0&&{invoiceNotes:n},...i!==void 0&&{tags:[i]}};s.reference||(s.reference=ui("SCN"));let a=await yR(t.client,s);return Sf(a,Ww(a.appliedRate,e.currency))}},Wr("delete_supplier_credit_note",MB("supplier credit note"),"supplier_credit_notes",nU,"delete draft or void active supplier credit note",{paramDescription:"Supplier credit note resourceId",voidable:!0}),PB("download_supplier_credit_note_pdf","supplier credit note","supplier_credit_notes",(t,e)=>iU(t,e)),{name:"update_supplier_credit_note",description:'Update a draft supplier credit note (change amount, line items, contact, date, notes). Use when the user says "update", "change", "fix", or "correct" a credit note.',params:{resourceId:{type:"string",description:"Supplier credit note resourceId"},reference:vo,valueDate:Io,lineItems:Aa,notes:di,tag:id,customFields:Qi},required:["resourceId"],group:"supplier_credit_notes",readOnly:!1,searchHint:"update supplier credit note lines reference",execute:async(t,e)=>{let{resourceId:r,notes:n,tag:i,...o}=e,s={...o,...n!==void 0&&{invoiceNotes:n},...i!==void 0&&{tags:[i]}};return rU(t.client,r,s)}},{name:"finalize_supplier_credit_note",description:"Finalize a draft supplier credit note (set saveAsDraft=false). Status becomes UNAPPLIED.",params:{resourceId:{type:"string",description:"Supplier credit note resourceId"},reference:vo,valueDate:Io,lineItems:Aa,notes:di},required:["resourceId"],group:"supplier_credit_notes",readOnly:!1,searchHint:"approve finalize supplier credit note",isDestructive:!0,execute:async(t,e)=>{let{resourceId:r,notes:n,...i}=e,o={...i,...n!==void 0&&{invoiceNotes:n}},s=await UB(t.client,"supplier_credit_note",r,o),a=fl(s,{assumeFinalize:!0});return a||ER(t.client,r,s)}},{name:"create_supplier_credit_note_refund",description:"Record a refund payment against a supplier credit note.",params:{creditNoteId:{type:"string",description:"Supplier credit note resourceId"},paymentAmount:{type:"number",description:"Refund amount"},transactionAmount:{type:"number",description:"Amount in credit note currency (defaults to paymentAmount for same-currency)"},accountResourceId:QB,valueDate:{type:"string",description:"Payment date (YYYY-MM-DD)"},reference:{type:"string",description:"Payment reference"},paymentMethod:Vv,adjustment:Wv},required:["creditNoteId","paymentAmount","accountResourceId","valueDate"],group:"supplier_credit_notes",readOnly:!1,searchHint:"refund supplier credit note from bank account",isDestructive:!0,execute:async(t,e)=>{let r=Number(e.paymentAmount);if(!Number.isFinite(r)||r<=0)throw new Error("paymentAmount must be a positive number");let n=Number(e.transactionAmount??r);if(!Number.isFinite(n)||n<=0)throw new Error("transactionAmount must be a positive number");return bR(t.client,e.creditNoteId,{paymentAmount:r,transactionAmount:n,accountResourceId:e.accountResourceId,valueDate:e.valueDate,dueDate:e.valueDate,reference:e.reference??"",paymentMethod:e.paymentMethod??"BANK_TRANSFER",saveAsDraft:!1,adjustment:e.adjustment})}},{name:"list_supplier_credit_note_refunds",description:"List refund payments for a supplier credit note.",params:{creditNoteId:{type:"string",description:"Supplier credit note resourceId"}},required:["creditNoteId"],group:"supplier_credit_notes",readOnly:!0,searchHint:"list refunds on a supplier credit note",isConcurrencySafe:!0,maxResultSizeChars:5e4,execute:async(t,e)=>oU(t.client,e.creditNoteId)},{name:"list_currencies",description:"List currencies enabled for the organization. Returns code, name, symbol, isBaseCurrency.",params:{},required:[],group:"currencies",readOnly:!0,searchHint:"list currencies enabled active organization base currency code symbol",isConcurrencySafe:!0,maxResultSizeChars:5e4,execute:async t=>CR(t.client)},{name:"add_currency",description:"Enable one or more currencies for the organization.",params:{currencies:{type:"array",items:{type:"string"},description:'Currency codes to add (e.g., ["USD", "EUR"])'}},required:["currencies"],group:"currencies",readOnly:!1,searchHint:"add new currency to organization",execute:async(t,e)=>{let r=e.currencies,n=await CR(t.client),i=new Set(n.data.map(c=>c.currencyCode.toUpperCase())),o=r.filter(c=>i.has(c.toUpperCase())),s=r.filter(c=>!i.has(c.toUpperCase()));if(s.length===0)return{_guard:"duplicate_skipped",message:`All currencies already enabled: ${r.join(", ")}.`,existing:o};let a=await cU(t.client,s);return o.length>0?{...a,_note:`Skipped already-enabled: ${o.join(", ")}`}:a}},{name:"list_currency_rates",description:"List exchange rates for a specific currency. IMPORTANT: You MUST call list_currencies first to discover which currencies the org has enabled \u2014 never guess or assume currency codes.",params:{currencyCode:{type:"string",description:'Currency code (e.g., "USD")'},...Tfe},required:["currencyCode"],group:"currencies",readOnly:!0,searchHint:"list exchange rates for a currency pair",isConcurrencySafe:!0,maxResultSizeChars:5e4,execute:async(t,e)=>{let{limit:r,offset:n}=Est(e),i=e.currencyCode;return eS((o,s)=>lU(t.client,i,{limit:s,offset:o}),r,n,100)}},{name:"add_currency_rate",description:'Add or set an exchange rate for a currency. ALWAYS use this tool even when the user says "update rate" \u2014 it handles both new and existing rates. Rate direction is base\u2192source (1 org-base unit = N of this currency); see the rate param before sending. Call list_currencies first to get valid currency codes.',params:{currencyCode:{type:"string",description:"Currency code"},rate:{type:"number",description:'Base\u2192source: N where 1 org-base unit = N of this currency. Invert ONLY if your figure reads "1 thisCurrency = X base" \u2014 SGD org + USD ("1 USD = 1.35 SGD") \u2192 0.74; USD org + PHP ("1 USD = 56.5 PHP") \u2192 56.5 unchanged. Or declare rateDirection and pass your figure as-is.'},rateDirection:{type:"string",enum:["FUNCTIONAL_TO_SOURCE","SOURCE_TO_FUNCTIONAL"],description:'Optional. Declare how your rate reads and skip the mental arithmetic: SOURCE_TO_FUNCTIONAL lets you pass a bank quote ("1 USD = 1.35 SGD" \u2192 1.35) verbatim. Default FUNCTIONAL_TO_SOURCE.'},rateApplicableFrom:{type:"string",description:"Start date (YYYY-MM-DD)"},rateApplicableTo:{type:"string",description:"End date (YYYY-MM-DD, optional)"}},required:["currencyCode","rate","rateApplicableFrom"],group:"currencies",readOnly:!1,searchHint:"add new exchange rate for currency pair",execute:async(t,e)=>uU(t.client,e.currencyCode,{rate:e.rate,rateDirection:e.rateDirection,rateApplicableFrom:e.rateApplicableFrom,rateApplicableTo:e.rateApplicableTo})},{name:"update_currency_rate",description:'Update an EXISTING exchange rate record by its resourceId. Requires the rate resourceId from list_currency_rates. WARNING: If the user says "update the rate" or "set the rate", they almost always mean add_currency_rate (which creates/overwrites for a date). Only use this tool when explicitly modifying an existing rate record by ID.',params:{currencyCode:{type:"string",description:"Currency code"},resourceId:{type:"string",description:"Rate resourceId"},rate:{type:"number",description:'New rate. Base\u2192source: N where 1 org-base unit = N of this currency. Invert only if your figure reads "1 thisCurrency = X base" (send 1/X), or declare rateDirection.'},rateDirection:{type:"string",enum:["FUNCTIONAL_TO_SOURCE","SOURCE_TO_FUNCTIONAL"],description:'Optional. Declare how your rate reads and skip the mental arithmetic: SOURCE_TO_FUNCTIONAL lets you pass a bank quote ("1 USD = 1.35 SGD" \u2192 1.35) verbatim. Default FUNCTIONAL_TO_SOURCE.'},rateApplicableFrom:{type:"string",description:"Start date (YYYY-MM-DD)"},rateApplicableTo:{type:"string",description:"End date (YYYY-MM-DD, optional)"}},required:["currencyCode","resourceId","rate","rateApplicableFrom"],group:"currencies",readOnly:!1,searchHint:"update existing exchange rate value",execute:async(t,e)=>dU(t.client,e.currencyCode,e.resourceId,{rate:e.rate,rateDirection:e.rateDirection,rateApplicableFrom:e.rateApplicableFrom,rateApplicableTo:e.rateApplicableTo})},{name:"bulk_upsert_currency_rates",description:"Max 500 exchange rates per call. Auto-enables currencies not yet enabled in the org \u2014 no need to call add_currency first. Requires rateDirection per rate. Response surfaces per-row failures: `failedRows[]` (each with rowIndex, columnName, columnValue, errorCode, errorMessage) + `failedCount` alongside `resourceIds[]` for successful inserts. Omitting `rateApplicableTo` defaults it to `rateApplicableFrom - 0.999ms` (no temporal gap).",params:{rates:{type:"array",description:"Array of exchange rates to create",items:{type:"object",properties:{sourceCurrencyCode:{type:"string",description:"Source currency code (ISO 4217, e.g. USD, EUR)"},rate:{type:"number",description:"Must be > 0. Read in whatever direction rateDirection declares."},rateDirection:{type:"string",description:'REQUIRED here, no default. FUNCTIONAL_TO_SOURCE = 1 org-base unit = N of this currency (what list_currency_rates returns). SOURCE_TO_FUNCTIONAL = a bank quote ("1 USD = 1.35 SGD" \u2192 1.35) passed verbatim.',enum:["FUNCTIONAL_TO_SOURCE","SOURCE_TO_FUNCTIONAL"]},rateApplicableFrom:{type:"string",description:"Rate start date (YYYY-MM-DD)"},rateApplicableTo:{type:"string",description:"Rate end date (YYYY-MM-DD, optional)"}},required:["sourceCurrencyCode","rate","rateDirection","rateApplicableFrom"]}}},required:["rates"],group:"currencies",readOnly:!1,searchHint:"bulk create or update multiple currency rates",execute:async(t,e)=>(await fU(t.client,e.rates)).data},hr("list_tax_profiles","List tax profiles (GST, VAT, etc.). Returns name, rate, tax type.","tax_profiles",(t,e,r)=>OE(t,{limit:r,offset:e}),"list tax profiles GST VAT rates"),hr("list_tax_types","List available tax types. Use the tax type code when creating tax profiles.","tax_profiles",(t,e,r)=>MF(t,{limit:r,offset:e}),"list available tax types for profile creation"),hr("list_modules","List the modules (features/capabilities) enabled for the organization.","modules",(t,e,r)=>hPe(t,{limit:r,offset:e}),"list enabled org modules features capabilities"),Bi("get_module","Get details for a single org module by resourceId.","modules",(t,e)=>mPe(t,e),"get module details"),hr("list_account_classifications","List account classifications (reference list for categorising chart-of-accounts entries).","accounts",(t,e,r)=>Q0e(t,{limit:r,offset:e}),"list account classifications categories for chart of accounts"),hr("list_purchase_items","List purchase-side catalog items.","purchase_items",(t,e,r)=>gPe(t,{limit:r,offset:e}),"list purchase items purchasable catalog products"),Bi("get_purchase_item","Get a single purchase item by resourceId.","purchase_items",(t,e)=>yPe(t,e),"get purchase item details"),Wt({name:"search_purchase_items",description:"Search purchase items by name, reference, or currency.",group:"purchase_items",fields:PX,defaults:UX,fetcher:EPe,searchHint:"find purchase items purchasable catalog by name reference currency"}),hr("list_catalogs","List catalogs (product/service groupings).","catalogs",(t,e,r)=>q2(t,{limit:r,offset:e}),"list catalogs product service groupings"),Bi("get_catalog","Get a catalog by resourceId (includes its items).","catalogs",(t,e)=>j2(t,e),"get catalog details items"),Wt({name:"search_catalogs",description:"Search catalogs by name, description, status, or contact group.",group:"catalogs",fields:vS,defaults:wS,fetcher:Y2,searchHint:"find catalogs by name description status contact group"}),{name:"create_catalog",description:"Create a catalog. status defaults to INACTIVE. items[] are catalog-item rows; contactGroupResourceIds[] scopes it to contact groups.",params:{catalogName:{type:"string",description:"Catalog name"},description:{type:"string",description:"Catalog description"},status:{type:"string",enum:["ACTIVE","INACTIVE"],description:"Record status (defaults INACTIVE)"},contactGroupResourceIds:{type:"array",items:{type:"string"},description:"Contact group resourceIds to scope the catalog to"},items:ist},required:["catalogName","items"],group:"catalogs",readOnly:!1,searchHint:"create new catalog product service grouping",execute:async(t,e)=>H2(t.client,{catalogName:e.catalogName,description:e.description,status:e.status,contactGroupResourceIds:e.contactGroupResourceIds,items:e.items})},{name:"update_catalog",description:"Update a catalog. FULL REPLACEMENT \u2014 GET first, merge, then send the complete body; omitting items or contactGroupResourceIds DROPS them.",params:{resourceId:{type:"string",description:"Catalog resourceId"},catalogName:{type:"string",description:"Catalog name"},description:{type:"string",description:"Catalog description"},status:{type:"string",enum:["ACTIVE","INACTIVE"],description:"Record status"},contactGroupResourceIds:{type:"array",items:{type:"string"},description:"Contact group resourceIds"},items:ist},required:["resourceId","catalogName","items"],group:"catalogs",readOnly:!1,searchHint:"update edit catalog",execute:async(t,e)=>z2(t.client,e.resourceId,{catalogName:e.catalogName,description:e.description,status:e.status,contactGroupResourceIds:e.contactGroupResourceIds,items:e.items})},Wr("delete_catalog","Delete a catalog.","catalogs",(t,e)=>G2(t,e),"delete remove catalog"),hr("list_organization_report_templates","List saved organization report templates.","report_templates",(t,e,r)=>LPe(t,{limit:r,offset:e}),"list organization report templates saved"),Bi("get_organization_report_template","Get a saved report template by resourceId.","report_templates",(t,e)=>MPe(t,e),"get report template details"),Wt({name:"search_organization_report_templates",description:"Search report templates by type, category, or default flag.",group:"report_templates",fields:$X,defaults:qX,fetcher:PPe,searchHint:"find organization report templates by type category default"}),{name:"move_transaction_capsules",description:"Move business transactions from one capsule to another. Pass the transaction resourceIds, the source capsule (oldCapsuleResourceId), and the destination (newCapsuleResourceId).",params:{businessTransactionResourceIds:{type:"array",items:{type:"string"},description:"Transaction resourceIds to move"},newCapsuleResourceId:{type:"string",description:"Destination capsule resourceId"},oldCapsuleResourceId:{type:"string",description:"Source capsule resourceId"}},required:["businessTransactionResourceIds","newCapsuleResourceId","oldCapsuleResourceId"],group:"capsules",readOnly:!1,searchHint:"move transactions between capsules regroup reassign capsule",execute:async(t,e)=>LF(t.client,{businessTransactionResourceIds:e.businessTransactionResourceIds,newCapsuleResourceId:e.newCapsuleResourceId,oldCapsuleResourceId:e.oldCapsuleResourceId})},{name:"create_tax_profile",description:"Create a new tax profile. List tax types first to get the taxTypeCode. Automatically checks for duplicates by name \u2014 returns existing profile if found.",params:{name:{type:"string",description:'Tax profile name (e.g., "GST 9%")'},taxRate:{type:"number",description:"Tax rate as percentage (e.g., 9 for 9%)"},taxTypeCode:{type:"string",description:"Tax type code (from list_tax_types)"}},required:["name","taxRate","taxTypeCode"],group:"tax_profiles",readOnly:!1,searchHint:"create new tax profile GST VAT rate",execute:async(t,e)=>{let r=e.name,n=await b1(t.client,r);return n?{_guard:"duplicate_skipped",message:`Tax profile "${r}" already exists.`,existing:n}:PF(t.client,{name:r,taxRate:e.taxRate,taxTypeCode:e.taxTypeCode})}},hr("list_cash_in","List cash-in entries (direct cash receipts). Paginated.","cash_entries",(t,e,r)=>UH(t,{limit:r,offset:e}),"list cash in receipt entries with pagination"),{name:"create_cash_in",description:`Record money received INTO a bank account from an EXTERNAL source (customer payment, refund received, deposit). For inter-account moves use create_cash_transfer.
744
744
 
745
745
  accountResourceId MUST be a Bank/Cash account (from list_bank_accounts) \u2014 any other type fails. Cannot appear in lines (API enforces separation).
746
746
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jaz-clio",
3
- "version": "5.47.8",
3
+ "version": "5.47.9",
4
4
  "description": "Clio: Command Line Interface Operator for Jaz AI.",
5
5
  "type": "module",
6
6
  "bin": {