@firedrill-tools/quickbooks 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +240 -0
  3. package/firedrill/agent.target.json +17 -0
  4. package/firedrill/baseline.scenario.json +2338 -0
  5. package/firedrill/conformance.suite.json +22 -0
  6. package/firedrill/payment-response-lost.scenario.json +2344 -0
  7. package/firedrill/qbo-company-query.drill.json +143 -0
  8. package/firedrill/qbo-customers-items.drill.json +173 -0
  9. package/firedrill/qbo-default-identity.drill.json +53 -0
  10. package/firedrill/qbo-denied.drill.json +53 -0
  11. package/firedrill/qbo-escape-heavy-invoices.drill.json +160 -0
  12. package/firedrill/qbo-invalid-auth.drill.json +398 -0
  13. package/firedrill/qbo-invoice-lifecycle.drill.json +193 -0
  14. package/firedrill/qbo-large-invoice.drill.json +174 -0
  15. package/firedrill/qbo-mcp-shapes.drill.json +503 -0
  16. package/firedrill/qbo-payment-response-lost.drill.json +80 -0
  17. package/firedrill/qbo-payments.drill.json +110 -0
  18. package/firedrill/qbo-reports-only.drill.json +398 -0
  19. package/firedrill/qbo-roles.drill.json +143 -0
  20. package/firedrill/qbo-throttled.drill.json +398 -0
  21. package/firedrill/qbo-tight-limits.drill.json +368 -0
  22. package/firedrill/qbo-write-outage.drill.json +411 -0
  23. package/firedrill/throttled.scenario.json +2344 -0
  24. package/firedrill/tight-limits.scenario.json +2338 -0
  25. package/firedrill/tools/quickbooks/app/assets/ATTRIBUTION.md +33 -0
  26. package/firedrill/tools/quickbooks/app/assets/fonts/OFL.txt +93 -0
  27. package/firedrill/tools/quickbooks/app/assets/intuit-quickbooks.svg +1 -0
  28. package/firedrill/tools/quickbooks/app/assets/quickbooks.svg +1 -0
  29. package/firedrill/tools/quickbooks/app/site/app.js +157 -0
  30. package/firedrill/tools/quickbooks/app/site/assets/fonts/figtree-latin.woff2 +0 -0
  31. package/firedrill/tools/quickbooks/app/site/assets/intuit-quickbooks.svg +1 -0
  32. package/firedrill/tools/quickbooks/app/site/assets/quickbooks.svg +1 -0
  33. package/firedrill/tools/quickbooks/app/site/base.css +107 -0
  34. package/firedrill/tools/quickbooks/app/site/forms.css +85 -0
  35. package/firedrill/tools/quickbooks/app/site/icons.js +73 -0
  36. package/firedrill/tools/quickbooks/app/site/index.html +81 -0
  37. package/firedrill/tools/quickbooks/app/site/nav.css +99 -0
  38. package/firedrill/tools/quickbooks/app/site/store.js +85 -0
  39. package/firedrill/tools/quickbooks/app/site/tables.css +114 -0
  40. package/firedrill/tools/quickbooks/app/site/ui.js +189 -0
  41. package/firedrill/tools/quickbooks/app/site/views/accounts.js +59 -0
  42. package/firedrill/tools/quickbooks/app/site/views/batch-actions.js +116 -0
  43. package/firedrill/tools/quickbooks/app/site/views/batch.js +91 -0
  44. package/firedrill/tools/quickbooks/app/site/views/common.js +87 -0
  45. package/firedrill/tools/quickbooks/app/site/views/customer-detail.js +85 -0
  46. package/firedrill/tools/quickbooks/app/site/views/customer-drawer.js +71 -0
  47. package/firedrill/tools/quickbooks/app/site/views/customers.js +87 -0
  48. package/firedrill/tools/quickbooks/app/site/views/home.js +79 -0
  49. package/firedrill/tools/quickbooks/app/site/views/invoice-actions.js +109 -0
  50. package/firedrill/tools/quickbooks/app/site/views/invoice-editor.js +126 -0
  51. package/firedrill/tools/quickbooks/app/site/views/invoice-lines.js +92 -0
  52. package/firedrill/tools/quickbooks/app/site/views/invoices.js +118 -0
  53. package/firedrill/tools/quickbooks/app/site/views/items.js +105 -0
  54. package/firedrill/tools/quickbooks/app/site/views/payments.js +63 -0
  55. package/firedrill/tools/quickbooks/app/site/views/receive-payment.js +102 -0
  56. package/firedrill/tools/quickbooks/app/site/views/txn-frame.js +25 -0
  57. package/firedrill/tools/quickbooks/behavior.mjs +10 -0
  58. package/firedrill/tools/quickbooks/lib/access.mjs +167 -0
  59. package/firedrill/tools/quickbooks/lib/common.mjs +204 -0
  60. package/firedrill/tools/quickbooks/lib/criteria.mjs +107 -0
  61. package/firedrill/tools/quickbooks/lib/customers.mjs +140 -0
  62. package/firedrill/tools/quickbooks/lib/fields.mjs +157 -0
  63. package/firedrill/tools/quickbooks/lib/handlers-read.mjs +81 -0
  64. package/firedrill/tools/quickbooks/lib/handlers-write.mjs +95 -0
  65. package/firedrill/tools/quickbooks/lib/invoice-draft.mjs +165 -0
  66. package/firedrill/tools/quickbooks/lib/invoices.mjs +229 -0
  67. package/firedrill/tools/quickbooks/lib/items.mjs +117 -0
  68. package/firedrill/tools/quickbooks/lib/like.mjs +49 -0
  69. package/firedrill/tools/quickbooks/lib/payments.mjs +200 -0
  70. package/firedrill/tools/quickbooks/lib/pdf.mjs +96 -0
  71. package/firedrill/tools/quickbooks/lib/query-eval.mjs +178 -0
  72. package/firedrill/tools/quickbooks/lib/query-parse.mjs +229 -0
  73. package/firedrill/tools/quickbooks/lib/views.mjs +88 -0
  74. package/firedrill/tools/quickbooks/lib/wire.mjs +147 -0
  75. package/firedrill/tools/quickbooks/quickbooks.tool.json +11014 -0
  76. package/firedrill/world.json +559 -0
  77. package/firedrill/write-outage.scenario.json +2344 -0
  78. package/firedrill.json +5 -0
  79. package/package.json +52 -0
  80. package/starter.json +2337 -0
  81. package/test/conformance.mjs +674 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Reload Tech Inc.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,240 @@
1
+ # @firedrill-tools/quickbooks
2
+
3
+ A synthetic **QuickBooks Online** Tool for [Firedrill](https://firedrill.run): one fictional company (realm) exposed through a
4
+ subset of the QuickBooks Online Accounting API v3 (`/v3/company/{realmId}/…`) and through MCP tool names used by QuickBooks MCP
5
+ servers. All state is local and deterministic: Firedrill owns the ledger, virtual time and evidence. No Intuit service is contacted,
6
+ no e-mail is delivered and no money moves.
7
+
8
+ Version `0.1.1`, engine `>=0.1.0 <0.2.0`, licence Apache-2.0. The package also ships a browser app that recreates the QuickBooks Online web app over the same local state (see [Browser app](#browser-app)).
9
+
10
+ ## Install
11
+
12
+ ```sh
13
+ firedrill tool add @firedrill-tools/quickbooks --install
14
+ ```
15
+
16
+ `firedrill tool add` seeds the starter company from `starter.json` (virtual time 2026-09-15T09:00:00Z, 02:00 company time).
17
+ Grant the operations your agent needs, for example:
18
+
19
+ ```json
20
+ { "packageId": "quickbooks", "operationId": "query.run" },
21
+ { "packageId": "quickbooks", "operationId": "invoices.post" },
22
+ { "packageId": "quickbooks", "operationId": "payments.post" }
23
+ ```
24
+
25
+ ## Connecting a client
26
+
27
+ - **HTTP** (connection recipe `qbo-rest`): use `FIREDRILL_HTTP_URL` as the base URL instead of `https://quickbooks.api.intuit.com`
28
+ and `FIREDRILL_HTTP_TOKEN` as the OAuth 2 Bearer token. Paths are `/v3/company/9341453172839201/<entity>`. Intuit SDKs hard-code
29
+ the host, so the client must be configured to read the base URL.
30
+ - **MCP** (connection recipe `qbo-mcp`): connect a Streamable HTTP MCP client to `FIREDRILL_MCP_URL` with `FIREDRILL_MCP_TOKEN`.
31
+ The 19 alias tool names below are listed next to the canonical `quickbooks.<operation>` names (44 tools in total). Results are the
32
+ JSON object as `structuredContent` plus the same JSON as a text block (the entity itself, or `{ results, totalCount? }` for searches),
33
+ not the prose text of the open-source stdio MCP server.
34
+
35
+ ## Identities
36
+
37
+ | actor attribute | meaning |
38
+ |---|---|
39
+ | `realmId` (optional) | Realm the token was issued for. Present and different from `9341453172839201` → `AUTHENTICATION_FAILED` (HTTP 401, code `3200`) on every operation. |
40
+ | `role` (optional) | `company_admin` (everything), `standard_limited_customers` (customers, invoices, payments read/write; items read-only; no chart of accounts) or `reports_only` (company info only). Any other value → `AUTHENTICATION_FAILED`. |
41
+
42
+ **Fresh-install fallback:** an actor without attributes (as `firedrill tool add` creates) acts as `company_admin` of the seeded realm.
43
+ The `{realmId}` path segment of HTTP routes must equal the company realm; otherwise `AUTHORIZATION_FAILED` (403, code `3100`), as
44
+ QuickBooks answers for a token used against another company. The user-role model is a test fixture: real QuickBooks lets only admins
45
+ connect apps. There is no per-row ownership; every permitted caller sees the whole company.
46
+
47
+ ## Starting data
48
+
49
+ Brightwater Studio LLC, a fictional San Diego design and photography studio (company time fixed at UTC−07:00), 57 state rows:
50
+
51
+ - 10 accounts (Checking opening 12,480.00, Undeposited Funds, Accounts Receivable, three income accounts, an inactive income account,
52
+ Printing Costs, Software Subscriptions, Owner's Equity).
53
+ - 14 customers (Ids 58–71): two `Harbor…` names, `O'Neill Bakery`, `Fernwood Café`, `Juniper Yoga` without e-mail, inactive
54
+ `Old Town Florist`, `Nova Dental Lab` without transactions, `Pacific Rowing Club` with an open balance.
55
+ - 8 items (Ids 20–27): Service and NonInventory items, a 0-price `Hours` item, inactive `Legacy retainer`.
56
+ - 14 invoices (Ids 1036–1049): 4 paid, 1 partially paid (1042, 900.00 due), 4 overdue, 1 due today, 3 not yet due (one with custom
57
+ DocNumber `BW-2026-07`), 1 voided. Open A/R is 9,805.00.
58
+ - 6 payments (Ids 190–195) including a two-invoice payment, a 500.00 unapplied payment and a voided payment; 2 synthetic delivery rows.
59
+
60
+ Row ids are the entity id zero-padded to 10 digits (`invoices/0000001042`). Ids and automatic DocNumbers come from `meta/counters`.
61
+
62
+ ## Operations
63
+
64
+ All HTTP paths are prefixed `/v3/company/{realmId}` and use `Authorization: Bearer`. QuickBooks puts create, update, delete and void
65
+ of an entity on one `POST /<entity>` (selected by `Id`+`SyncToken` in the body and `?operation=`), and Firedrill matches routes on
66
+ method and path only, so each writable entity has one REST dispatcher operation (`*.post`) whose output carries `action`. The
67
+ `requestid` query parameter is the idempotency key on every write route; `minorversion` is accepted and ignored.
68
+
69
+ | operation | MCP alias | HTTP route | notes |
70
+ |---|---|---|---|
71
+ | `company-info.get` | `get_company_info` | `GET /companyinfo/{companyId}` | `time` is company virtual time |
72
+ | `query.run` | — | `GET /query?query=`, `POST /query` (`application/text` body) | `select * \| count(*) \| fields from Customer\|Item\|Invoice\|Payment\|Account\|CompanyInfo`, `where` with `AND`, `=`, `<`, `>`, `<=`, `>=`, `IN`, `LIKE` (`%` only), `orderby`, `startposition`, `maxresults` ≤ 1000 |
73
+ | `customers.get` | `get_customer` | `GET /customer/{id}` | `Balance` computed from invoices |
74
+ | `customers.post` | — | `POST /customer` | create, full update, sparse update (`sparse: true`), `?operation=update` |
75
+ | `customers.search` | `search_customers` | — | criteria array/object, `limit`, `offset`, `asc`, `desc`, `count`, `fetchAll` |
76
+ | `customers.create` | `create_customer` | — | `{ customer }` |
77
+ | `customers.update` | `update_customer` | — | `{ customer }` with `Id` and `SyncToken` |
78
+ | `customers.delete` | `delete_customer` | — | makes the customer inactive (QuickBooks has no customer delete); refused with an open balance |
79
+ | `items.get` | `read_item` | `GET /item/{id}` | |
80
+ | `items.post` | — | `POST /item` | `Service` and `NonInventory` only |
81
+ | `items.search` | `search_items` | — | |
82
+ | `invoices.get` | `read_invoice` | `GET /invoice/{id}` | `LinkedTxn` payments and a `SubTotalLineDetail` line |
83
+ | `invoices.post` | — | `POST /invoice` | `?operation=update\|delete\|void`, `?include=allowduplicatedocnum` |
84
+ | `invoices.send` | — | `POST /invoice/{id}/send?sendTo=` | synthetic delivery row; sets `EmailStatus EmailSent` and `DeliveryInfo` |
85
+ | `invoices.pdf` | `get_invoice_pdf` | `GET /invoice/{id}/pdf` | HTTP answers `application/pdf` bytes; MCP answers base64 |
86
+ | `invoices.search` | `search_invoices` | — | |
87
+ | `invoices.create` | `create_invoice` | — | `{ customer_ref, line_items[{ item_ref, qty, unit_price }] … }` |
88
+ | `invoices.update` | `update_invoice` | — | `{ invoice_id, patch }`; missing `SyncToken` means the current one |
89
+ | `invoices.delete` | `delete_invoice` | — | id or `{ Id, SyncToken }` |
90
+ | `payments.get` | `get_payment` | `GET /payment/{id}` | `UnappliedAmt` computed |
91
+ | `payments.post` | — | `POST /payment` | `?operation=update\|delete\|void`; linked invoice balances change in the same operation |
92
+ | `payments.search` | `search_payments` | — | `{ customer_ref, txn_date_from, txn_date_to, limit }` |
93
+ | `payments.create` | `create_payment` | — | `{ customer_ref, total_amt, line[{ amount, linked_txn }] … }` |
94
+ | `accounts.get` | `get_account` | `GET /account/{id}` | `CurrentBalance` computed from the ledger |
95
+ | `accounts.search` | `search_accounts` | — | |
96
+
97
+ 25 operations, 14 HTTP routes, 19 MCP aliases. Endpoints outside this list do not exist (404 or 405).
98
+
99
+ ### Behaviour
100
+
101
+ - Money is computed in integer cents; line `Amount` must equal `Qty × UnitPrice`. No sales tax is calculated (`TotalTax` is 0).
102
+ - Invoice `Balance` = `TotalAmt` − applied payment lines. A payment line can never exceed the invoice's open balance, link an invoice
103
+ of another customer or a voided invoice; the applied total can never exceed `TotalAmt`.
104
+ - Voiding an invoice zeroes its amounts and un-applies linked payments (they keep `TotalAmt` and become unapplied); deleting it
105
+ removes the row and un-applies the same way. Voiding or deleting a payment restores the invoice balances.
106
+ - `SyncToken` increases on every write of a row, including balance changes caused by payments; a stale token fails `5010`.
107
+ - Customer and item names are unique case-insensitively (`6240`); invoice `DocNumber` is unique unless `include=allowduplicatedocnum` (`6140`).
108
+ - Queries on Customer, Item and Account return only active rows unless `Active` is filtered. Default order is `Id`.
109
+ - Malformed percent-encoding: serve decodes query strings leniently, so a broken escape such as `%E0%A4%A` reaches the Tool as U+FFFD. U+FFFD anywhere in a query (GET `query=` or a POST text body) fails `4000` "Error parsing query" instead of running a corrupted search, and U+FFFD in `sendTo` fails `6000` "Invalid Email Address format". A correctly encoded U+FFFD (`%EF%BF%BD`) is rejected the same way. `%ZZ` stays literal, and non-ASCII values such as `café` work normally.
110
+ - Scans are bounded by `meta/limits.maxScanRows` (default 5000). Passing the bound fails `STATE_BOUND_EXCEEDED` (HTTP 500,
111
+ `SystemFault`) instead of returning partial results. Query pages stop before about 900 KB of encoded JSON: the rows that
112
+ fit are returned and `maxResults` counts them, so `STARTPOSITION + maxResults` is the next position. Because of that, a
113
+ page shorter than the requested `MAXRESULTS` cannot be told apart from the last page (real QuickBooks clients, including
114
+ Intuit's SDK samples, treat a short page as the end): a client that wants every row must continue until a page comes back
115
+ as an empty `QueryResponse` (`{"QueryResponse":{}}`), or drive its loop from `select count(*)`; the bundled app does the
116
+ former. The first row of a page is always returned (see the invoice byte bound under Limitations), so a row that `GET` can
117
+ read is always found by its own query; a single row that could never fit fails `STATE_BOUND_EXCEEDED` rather than an
118
+ opaque framework 500.
119
+
120
+ ### Errors
121
+
122
+ Errors use the QuickBooks `Fault` envelope: `{ "Fault": { "Error": [{ "Message", "Detail", "code", "element" }], "type" }, "time" }`.
123
+
124
+ | declared error | QuickBooks code | HTTP |
125
+ |---|---|---|
126
+ | `OBJECT_NOT_FOUND` | 610 | 400 |
127
+ | `REQUIRED_PARAM_MISSING` | 2020 | 400 |
128
+ | `INVALID_REFERENCE` | 2500 | 400 |
129
+ | `QUERY_PARSE_ERROR` / `QUERY_VALIDATION_ERROR` | 4000 / 4001 | 400 |
130
+ | `STALE_OBJECT` | 5010 | 400 |
131
+ | `BUSINESS_VALIDATION` | 6000 | 400 |
132
+ | `DUPLICATE_DOC_NUMBER` / `DUPLICATE_NAME` | 6140 / 6240 | 400 |
133
+ | `AUTHENTICATION_FAILED` | 3200 | 401 |
134
+ | `AUTHORIZATION_FAILED` | 3100 | 403 |
135
+ | `THROTTLE_EXCEEDED` (fault only) | 3001 | 429 |
136
+ | `STATE_BOUND_EXCEEDED` | 10000 | 500 |
137
+ | `SERVICE_UNAVAILABLE` (fault only) | 10000 | 503 |
138
+
139
+ ## Events and faults
140
+
141
+ - Events `invoice.changed`, `payment.changed`, `customer.changed` with `{ realmId, name, id, operation, lastUpdated }`, following the
142
+ entity/operation vocabulary of QuickBooks webhooks (one event per entity change, not a batched notification).
143
+ - Fault `throttled` (all operations, before): HTTP 429, code `3001`.
144
+ - Fault `write-outage` (the 12 writes, before): HTTP 503; reads keep working.
145
+ - Fault `payment-response-lost` (`payments.post`, `payments.create`, after commit): the payment is saved and events are emitted, but the
146
+ caller receives 503. A naive retry of a full payment then fails `6000`; a retry of an unapplied payment creates a second payment.
147
+
148
+ ## Compatibility
149
+
150
+ Not verified against a real client. No official Intuit SDK or `node-quickbooks` has been run against this package, so
151
+ `manifest.compatibility` is empty. The package conformance suite (`firedrill tool test quickbooks`, 16 drills) exercises the HTTP routes
152
+ with plain `fetch` and the MCP aliases with raw JSON-RPC.
153
+
154
+ Known deviations from QuickBooks Online:
155
+
156
+ - **Fault responses have no `time`.** A fault outcome never runs the handler, so throttling and outage bodies omit `time`; declared
157
+ errors include it. The exact 429 and 503 bodies are not published by Intuit; the shapes here are approximations.
158
+ - **Framework refusals.** Over HTTP, a request the input schema rejects (for example a JSON array as the body) is rendered as a `6000`
159
+ Fault whose Detail is `Business Validation Error: arguments do not match quickbooks.<operation>`; over MCP the client receives the
160
+ MCP input-validation error instead; a request body nested deeper than 512 levels is refused before the operation runs. A caller denied by
161
+ Firedrill grants receives HTTP 403 before the handler runs.
162
+ - **MCP results are JSON**, not the text content of the stdio MCP server. `search_*` return `{ results, totalCount? }`.
163
+ `get_invoice_pdf` returns base64 and refuses `output_path` (a Tool cannot write files). `delete_customer` makes the customer inactive.
164
+ - **`requestid` reuse.** Replaying a write with the same `requestid` and body returns the first result (JSON key order may differ).
165
+ Reusing a `requestid` with a different body returns HTTP 400 with a `6000` ValidationFault whose Detail is the framework message
166
+ `the idempotency key was already used with different arguments`, without `time`; QuickBooks' own behaviour for that case is not published.
167
+ - **Large query pages.** A page whose entities would exceed about 900 KB of UTF-8 JSON is cut before the first row that does
168
+ not fit; `maxResults` counts the rows returned and `startPosition + maxResults` is the next position. QuickBooks itself
169
+ only cuts a page at `MAXRESULTS`, so its clients treat `maxResults` below what they asked for as the last page — here that
170
+ assumption silently drops every row after a byte cut. Callers must continue until an empty `QueryResponse` (or compare
171
+ with `select count(*)`). `search_*` with `fetchAll` has no next position and fails `STATE_BOUND_EXCEEDED` (HTTP 500,
172
+ `10000` SystemFault) when everything does not fit; use `limit` and `offset` instead.
173
+ - **Malformed escapes in the path.** Firedrill decodes every path segment before it matches a route, so a broken percent escape in
174
+ the path (`GET …/customer/%E0%A4%A`, `…/customer/%ZZ`, `/v3/company/%E0%A4%A/customer/58`) answers HTTP 404 with the framework body
175
+ `{"schemaVersion":1,"code":"framework.HTTP_ROUTE_NOT_FOUND","error":"synthetic API route not found"}` rather than a QuickBooks Fault;
176
+ the Tool is never called. A well-formed id that merely does not exist (including a correctly encoded U+FFFD, `%EF%BF%BD`) reaches the
177
+ Tool and gets the `610` Object Not Found Fault. The canonical `/v1/operations` path takes ids as JSON, so it always reaches the Tool.
178
+ - **`intuit_tid`** is the Firedrill call id, not an Intuit transaction id.
179
+ - **Webhooks** are modelled as Firedrill events; no `dataChangeEvent` HTTP notification is delivered unless you configure callbacks.
180
+
181
+ ## Browser app
182
+
183
+ `firedrill serve` prints an app link for this Tool (also under **Tools → Open app** in the inspector). The app recreates the current
184
+ QuickBooks Online web layout, is served from `firedrill/tools/quickbooks/app/site/`, and every screen calls this Tool's own operations
185
+ through `/_firedrill/client.js`, so UI writes are visible over HTTP/MCP and the reverse. It never reads the browser clock: "today" comes
186
+ from the `time` field of `company-info.get` / `query.run` (world virtual time in the company time zone).
187
+
188
+ | screen | what works | operations |
189
+ |---|---|---|
190
+ | Home | greeting, shortcuts, Invoices widget (unpaid overdue / not due yet, paid not deposited / deposited), Bank accounts, Sales last 30 days, Customers owing money | `company-info.get`, `query.run` |
191
+ | Sales & Get paid → Invoices | money bar filters, status / date / customer filters, invoice-number search, 25-per-page paging, Receive payment, row menu Edit / Send / Print or download / Void / Delete with confirmations, row selection with the "N selected" batch bar (Print transactions / Send transactions / Delete, each reported per row) | `query.run`, `invoices.post`, `invoices.send`, `invoices.pdf` |
192
+ | Invoice form (new / edit) | customer, e-mail, terms (fixed list), dates, invoice no. (automatic when blank), line table, message and internal notes, totals and balance due, Save, Save and send, duplicate-number prompt ("Use anyway"), stale-edit banner | `invoices.get`, `query.run`, `invoices.post`, `invoices.send` |
193
+ | Receive payment | customer, date, method, reference, deposit account, outstanding invoices with per-line amounts, unapplied remainder | `query.run`, `payments.post` |
194
+ | Payments | received payments with customer filter and paging, Void / Delete | `query.run`, `payments.post` |
195
+ | Customers | money bar, search, open-balance filter, include inactive, paging, New customer drawer, row actions, row selection with the "N selected" batch bar (Make inactive, reported per row) | `query.run`, `customers.post` |
196
+ | Customer page | contact header, open and overdue totals, Transaction list, Customer details, Edit, Make inactive / active | `customers.get`, `query.run`, `customers.post`, `customers.delete` |
197
+ | Products & services | search, status filter, paging, New / Edit drawer (Service, Non-inventory), Make inactive / active, row selection with the "N selected" batch bar (Make active / Make inactive, reported per row) | `query.run`, `items.post` |
198
+ | Accounting → Chart of accounts | read-only account list with balances, name/number search, include inactive | `query.run` |
199
+
200
+ Mutations send an idempotency key, reused only when retrying a throttled attempt. Lists refresh when the world revision moves, unless a
201
+ form or dialog is open. Access failures (for example the `reports_only` role) render "You don't have access" states; QuickBooks Fault
202
+ details and codes appear in error banners.
203
+
204
+ The left menu collapses to an icon rail with the "Collapse the menu" control, as it does in the real client; each rail item keeps its
205
+ label as a tooltip and accessible name, and the choice is remembered for the browser session. Below 900px the menu becomes the drawer
206
+ opened by the top-bar menu button.
207
+
208
+ Chrome that is visible but **not simulated** (it opens a "not simulated by this Tool" panel): Bookmarks, Feed, Reports, All apps,
209
+ Expenses & Bills, Banking, Payroll, Taxes, Mileage, My accountant, Team, Customize, the Overview and All sales tabs, My experts, Help,
210
+ Notifications, Settings, the account menu, templates, import, the batch-actions entries Print packing slip (invoices) and Email and
211
+ Create statements (customers) and Reclassify and Assign category (products & services), list print/export/settings icons (including the chart of accounts print and table-settings icons), the Home Profit & loss and Expenses cards, statements, form history/settings/help icons, and
212
+ every Create-menu entry other than Invoice, Receive payment, Add customer and Add product/service. Inventory and Bundle item types are
213
+ shown disabled. The font is Figtree (OFL), a stand-in for Intuit's proprietary typeface; logo sources are recorded in
214
+ `firedrill/tools/quickbooks/app/assets/ATTRIBUTION.md`.
215
+
216
+ ## Limitations
217
+
218
+ - One company, US English, USD only: no multicurrency, sub-customers (jobs), classes, departments, locations or custom fields.
219
+ - No sales tax engine: `TaxCodeRef` is stored (`TAX`/`NON`) but `TotalTax` is always 0; `GlobalTaxCalculation` accepts only `NotApplicable`.
220
+ - Items are `Service` and `NonInventory` only; no inventory quantities, bundles or categories.
221
+ - Invoice lines are `SalesItemLineDetail` only (no discount, description-only or group lines). Estimates cannot be linked.
222
+ - An invoice has at most 250 lines and each `Line.Description` at most 4,000 characters (as in QuickBooks), and additionally
223
+ all `Line.Description` text on one invoice (including descriptions inherited from items) totals at most 600,000 bytes
224
+ *as returned* — JSON-encoded UTF-8 without the quotes, so a newline, quote or backslash counts 2 bytes, a control
225
+ character 6 and a CJK character 3 (`6000` ValidationFault on create, full update and sparse update, over REST and MCP).
226
+ This keeps every stored invoice readable by `GET`, the PDF route, a single-row query and every list page that contains
227
+ it under the framework's 1 MiB response cap.
228
+ - Payments link invoices only (no credit memos or journal entries) and do not process cards (`ProcessPayment` must be false).
229
+ - Terms are a fixed list (`1` Due on receipt, `2` Net 15, `3` Net 30); payment methods are stored as given refs.
230
+ - The chart of accounts, CompanyInfo and account balances are read-only; `CurrentBalance` is derived from invoices and payments only.
231
+ - Not implemented (the routes do not exist): vendors, bills, estimates, sales receipts, credit memos, refunds, deposits, transfers,
232
+ journal entries, purchases, employees, time activities, attachables, preferences, reports, batch, change data capture, OAuth endpoints.
233
+ - The query language has no `OR`, parentheses, `NOT` or joins (QuickBooks has none either); `LIKE` supports `%` only.
234
+ - The user-role model (`standard_limited_customers`, `reports_only`) is a simplified test fixture.
235
+ - "Send" records a synthetic delivery row; no e-mail is sent. The PDF is a simple deterministic one-page layout, not Intuit's template.
236
+
237
+ ## Trademarks
238
+
239
+ QuickBooks, Intuit and their logos (bundled unmodified in the browser app) are trademarks of Intuit Inc. They are used only to identify the simulated service in a test environment.
240
+ This package is not affiliated with or endorsed by Intuit.
@@ -0,0 +1,17 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "target": {
4
+ "id": "conformance-agent",
5
+ "kind": "command",
6
+ "bindings": [
7
+ "http",
8
+ "mcp"
9
+ ],
10
+ "executable": "node",
11
+ "arguments": [
12
+ "test/conformance.mjs"
13
+ ],
14
+ "workingDirectory": ".",
15
+ "timeoutMs": 120000
16
+ }
17
+ }