@levitating/tensor-mcp 5.0.0 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +302 -184
- package/dist/index.js +294 -64
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -61,7 +61,15 @@ var SEARCH_RECORD_TYPES_MIRROR = [
|
|
|
61
61
|
"file",
|
|
62
62
|
"todo",
|
|
63
63
|
"idea",
|
|
64
|
-
"memo"
|
|
64
|
+
"memo",
|
|
65
|
+
// WEB. A bookmark and a TAB — the searchable unit is a tab, not a group
|
|
66
|
+
// (you search a title; you delete a session), which is why this is `tab`
|
|
67
|
+
// while the Trash surface key is `tab_group`. Missing them here did not
|
|
68
|
+
// widen anything — the route intersects lanes with the key's scopes before
|
|
69
|
+
// it generates SQL — it made two real lanes UNASKABLE, since a value this
|
|
70
|
+
// z.enum refuses never reaches the server at all.
|
|
71
|
+
"bookmark",
|
|
72
|
+
"tab"
|
|
65
73
|
];
|
|
66
74
|
var IDEA_KINDS = ["link", "note", "image", "video"];
|
|
67
75
|
function tiptapDocJson(text) {
|
|
@@ -78,7 +86,7 @@ function numListParam(value) {
|
|
|
78
86
|
function registerAllTools(server2, api) {
|
|
79
87
|
server2.tool(
|
|
80
88
|
"list_entities",
|
|
81
|
-
"List all entities (people, trusts, companies) in the organization",
|
|
89
|
+
"List all entities (people, trusts, companies) in the organization. Requires the tensor:portfolio:read scope.",
|
|
82
90
|
{ limit: z.number().optional().describe("Max results to return"), offset: z.number().optional().describe("Pagination offset") },
|
|
83
91
|
async ({ limit, offset }) => {
|
|
84
92
|
const params = new URLSearchParams();
|
|
@@ -91,7 +99,7 @@ function registerAllTools(server2, api) {
|
|
|
91
99
|
);
|
|
92
100
|
server2.tool(
|
|
93
101
|
"create_entity",
|
|
94
|
-
"Create a new entity (person, trust, or company)",
|
|
102
|
+
"Create a new entity (person, trust, or company). Requires the tensor:portfolio:write scope.",
|
|
95
103
|
{
|
|
96
104
|
name: z.string().describe("Entity name"),
|
|
97
105
|
type: z.string().describe("Entity type key (e.g. 'Individual', 'Trust', 'LLC'). Must match an existing entity-types row."),
|
|
@@ -108,7 +116,7 @@ function registerAllTools(server2, api) {
|
|
|
108
116
|
);
|
|
109
117
|
server2.tool(
|
|
110
118
|
"update_entity",
|
|
111
|
-
"Update an existing entity (partial update)",
|
|
119
|
+
"Update an existing entity (partial update). Requires the tensor:portfolio:write scope.",
|
|
112
120
|
{
|
|
113
121
|
id: z.number().describe("Entity ID to update"),
|
|
114
122
|
name: z.string().optional().describe("New entity name"),
|
|
@@ -126,7 +134,7 @@ function registerAllTools(server2, api) {
|
|
|
126
134
|
);
|
|
127
135
|
server2.tool(
|
|
128
136
|
"delete_entity",
|
|
129
|
-
"Delete an entity by ID",
|
|
137
|
+
"Delete an entity by ID. Requires the tensor:portfolio:write scope.",
|
|
130
138
|
{ id: z.number().describe("Entity ID to delete") },
|
|
131
139
|
async ({ id }) => {
|
|
132
140
|
const data = await api("DELETE", `/api/entities/${id}`);
|
|
@@ -135,7 +143,7 @@ function registerAllTools(server2, api) {
|
|
|
135
143
|
);
|
|
136
144
|
server2.tool(
|
|
137
145
|
"list_entity_relationships",
|
|
138
|
-
"List all entity relationships (ownership, beneficiary, etc.)",
|
|
146
|
+
"List all entity relationships (ownership, beneficiary, etc.). Requires the tensor:portfolio:read scope.",
|
|
139
147
|
{ limit: z.number().optional(), offset: z.number().optional() },
|
|
140
148
|
async ({ limit, offset }) => {
|
|
141
149
|
const params = new URLSearchParams();
|
|
@@ -148,7 +156,7 @@ function registerAllTools(server2, api) {
|
|
|
148
156
|
);
|
|
149
157
|
server2.tool(
|
|
150
158
|
"create_entity_relationship",
|
|
151
|
-
"Create a relationship between two entities (ownership, beneficiary, trustee, etc.)",
|
|
159
|
+
"Create a relationship between two entities (ownership, beneficiary, trustee, etc.). Requires the tensor:portfolio:write scope.",
|
|
152
160
|
{
|
|
153
161
|
sourceEntityId: z.number().describe("Source entity ID (the parent/owner)"),
|
|
154
162
|
targetEntityId: z.number().describe("Target entity ID (the child/owned)"),
|
|
@@ -167,7 +175,7 @@ function registerAllTools(server2, api) {
|
|
|
167
175
|
);
|
|
168
176
|
server2.tool(
|
|
169
177
|
"update_entity_relationship",
|
|
170
|
-
"Update an entity relationship (partial update)",
|
|
178
|
+
"Update an entity relationship (partial update). Requires the tensor:portfolio:write scope.",
|
|
171
179
|
{
|
|
172
180
|
id: z.number().describe("Relationship ID"),
|
|
173
181
|
sourceEntityId: z.number().optional(),
|
|
@@ -187,7 +195,7 @@ function registerAllTools(server2, api) {
|
|
|
187
195
|
);
|
|
188
196
|
server2.tool(
|
|
189
197
|
"delete_entity_relationship",
|
|
190
|
-
"Delete an entity relationship",
|
|
198
|
+
"Delete an entity relationship. Requires the tensor:portfolio:write scope.",
|
|
191
199
|
{ id: z.number().describe("Relationship ID to delete") },
|
|
192
200
|
async ({ id }) => {
|
|
193
201
|
const data = await api("DELETE", `/api/entity-relationships/${id}`);
|
|
@@ -196,7 +204,7 @@ function registerAllTools(server2, api) {
|
|
|
196
204
|
);
|
|
197
205
|
server2.tool(
|
|
198
206
|
"list_accounts",
|
|
199
|
-
"List all accounts (brokerage, bank, retirement, etc.) in the organization",
|
|
207
|
+
"List all accounts (brokerage, bank, retirement, etc.) in the organization. Requires the tensor:portfolio:read scope.",
|
|
200
208
|
{ limit: z.number().optional(), offset: z.number().optional() },
|
|
201
209
|
async ({ limit, offset }) => {
|
|
202
210
|
const params = new URLSearchParams();
|
|
@@ -209,7 +217,7 @@ function registerAllTools(server2, api) {
|
|
|
209
217
|
);
|
|
210
218
|
server2.tool(
|
|
211
219
|
"create_account",
|
|
212
|
-
"Create a new account (brokerage, bank, retirement, etc.)",
|
|
220
|
+
"Create a new account (brokerage, bank, retirement, etc.). Requires the tensor:portfolio:write scope.",
|
|
213
221
|
{
|
|
214
222
|
name: z.string().describe("Account name"),
|
|
215
223
|
entityId: z.number().describe("Owner entity ID"),
|
|
@@ -225,7 +233,7 @@ function registerAllTools(server2, api) {
|
|
|
225
233
|
);
|
|
226
234
|
server2.tool(
|
|
227
235
|
"update_account",
|
|
228
|
-
"Update an existing account (partial update)",
|
|
236
|
+
"Update an existing account (partial update). Requires the tensor:portfolio:write scope.",
|
|
229
237
|
{
|
|
230
238
|
id: z.number().describe("Account ID to update"),
|
|
231
239
|
name: z.string().optional(),
|
|
@@ -242,7 +250,7 @@ function registerAllTools(server2, api) {
|
|
|
242
250
|
);
|
|
243
251
|
server2.tool(
|
|
244
252
|
"delete_account",
|
|
245
|
-
"Delete an account by ID",
|
|
253
|
+
"Delete an account by ID. Requires the tensor:portfolio:write scope.",
|
|
246
254
|
{ id: z.number().describe("Account ID to delete") },
|
|
247
255
|
async ({ id }) => {
|
|
248
256
|
const data = await api("DELETE", `/api/accounts/${id}`);
|
|
@@ -251,7 +259,7 @@ function registerAllTools(server2, api) {
|
|
|
251
259
|
);
|
|
252
260
|
server2.tool(
|
|
253
261
|
"list_assets",
|
|
254
|
-
"List assets (stocks, bonds, crypto, real estate, etc.). Filter server-side rather than pulling the whole catalog.",
|
|
262
|
+
"List assets (stocks, bonds, crypto, real estate, etc.). Filter server-side rather than pulling the whole catalog. Requires the tensor:portfolio:read scope.",
|
|
255
263
|
{
|
|
256
264
|
limit: z.number().optional(),
|
|
257
265
|
offset: z.number().optional(),
|
|
@@ -275,7 +283,7 @@ function registerAllTools(server2, api) {
|
|
|
275
283
|
);
|
|
276
284
|
server2.tool(
|
|
277
285
|
"get_asset",
|
|
278
|
-
"Get a single asset by ID",
|
|
286
|
+
"Get a single asset by ID. Requires the tensor:portfolio:read scope.",
|
|
279
287
|
{ id: z.number().describe("Asset ID") },
|
|
280
288
|
async ({ id }) => {
|
|
281
289
|
const data = await api("GET", `/api/assets/${id}`);
|
|
@@ -284,7 +292,7 @@ function registerAllTools(server2, api) {
|
|
|
284
292
|
);
|
|
285
293
|
server2.tool(
|
|
286
294
|
"create_asset",
|
|
287
|
-
"Create a new asset (stock, bond, crypto, real estate, etc.). To make an asset price itself automatically, set tickerSymbol to a market quote symbol \u2014 find one first with search_market_quotes, and pass verifyQuote+syncPrice so a bad symbol fails here instead of becoming an asset that silently never prices.",
|
|
295
|
+
"Create a new asset (stock, bond, crypto, real estate, etc.). To make an asset price itself automatically, set tickerSymbol to a market quote symbol \u2014 find one first with search_market_quotes, and pass verifyQuote+syncPrice so a bad symbol fails here instead of becoming an asset that silently never prices. Requires the tensor:portfolio:write scope.",
|
|
288
296
|
{
|
|
289
297
|
name: z.string().describe("Asset name"),
|
|
290
298
|
assetClass: z.string().describe("Asset class key (e.g. 'Equity', 'Bond', 'Crypto', 'Real Estate'). Must match an existing asset-classes row."),
|
|
@@ -307,7 +315,7 @@ function registerAllTools(server2, api) {
|
|
|
307
315
|
);
|
|
308
316
|
server2.tool(
|
|
309
317
|
"update_asset",
|
|
310
|
-
"Update an existing asset (partial update). Set tickerSymbol to link or relink the asset to a market quote.",
|
|
318
|
+
"Update an existing asset (partial update). Set tickerSymbol to link or relink the asset to a market quote. Requires the tensor:portfolio:write scope.",
|
|
311
319
|
{
|
|
312
320
|
id: z.number().describe("Asset ID to update"),
|
|
313
321
|
name: z.string().optional(),
|
|
@@ -331,7 +339,7 @@ function registerAllTools(server2, api) {
|
|
|
331
339
|
);
|
|
332
340
|
server2.tool(
|
|
333
341
|
"delete_asset",
|
|
334
|
-
"Delete an asset by ID",
|
|
342
|
+
"Delete an asset by ID. Requires the tensor:portfolio:write scope.",
|
|
335
343
|
{ id: z.number().describe("Asset ID to delete") },
|
|
336
344
|
async ({ id }) => {
|
|
337
345
|
const data = await api("DELETE", `/api/assets/${id}`);
|
|
@@ -340,7 +348,7 @@ function registerAllTools(server2, api) {
|
|
|
340
348
|
);
|
|
341
349
|
server2.tool(
|
|
342
350
|
"list_asset_prices",
|
|
343
|
-
"List historical prices for an asset",
|
|
351
|
+
"List historical prices for an asset. Requires the tensor:portfolio:read scope.",
|
|
344
352
|
{
|
|
345
353
|
id: z.number().describe("Asset ID"),
|
|
346
354
|
limit: z.number().optional(),
|
|
@@ -357,7 +365,7 @@ function registerAllTools(server2, api) {
|
|
|
357
365
|
);
|
|
358
366
|
server2.tool(
|
|
359
367
|
"update_asset_price",
|
|
360
|
-
"Record a new price for an asset",
|
|
368
|
+
"Record a new price for an asset. Requires the tensor:portfolio:write scope.",
|
|
361
369
|
{
|
|
362
370
|
id: z.number().describe("Asset ID"),
|
|
363
371
|
price: z.number().describe("New price value"),
|
|
@@ -372,7 +380,7 @@ function registerAllTools(server2, api) {
|
|
|
372
380
|
);
|
|
373
381
|
server2.tool(
|
|
374
382
|
"list_positions",
|
|
375
|
-
"List positions (holdings) across accounts. Filter server-side instead of pulling every row \u2014 and for totals like net worth use get_portfolio_summary rather than summing these yourself.",
|
|
383
|
+
"List positions (holdings) across accounts. Filter server-side instead of pulling every row \u2014 and for totals like net worth use get_portfolio_summary rather than summing these yourself. Requires the tensor:portfolio:read scope.",
|
|
376
384
|
{
|
|
377
385
|
limit: z.number().optional(),
|
|
378
386
|
offset: z.number().optional(),
|
|
@@ -402,7 +410,7 @@ function registerAllTools(server2, api) {
|
|
|
402
410
|
);
|
|
403
411
|
server2.tool(
|
|
404
412
|
"create_position",
|
|
405
|
-
"Create a new position (a holding of an asset, owned by an entity, optionally in an account). Two shapes: a UNITIZED holding (shares/units \u2014 send quantity + averageCost) or a fund CAPITAL ACCOUNT (a fund LP interest, which has no units because the GP reports a balance \u2014 send costBasis instead). `costBasis` is the ONLY switch that makes a capital account; there is no inference from a missing quantity. Get the shape right at open: create_transaction refuses unitized types on a capital account, and the fund performance figures (paid-in, DPI/TVPI, IRR) exist only for one.",
|
|
413
|
+
"Create a new position (a holding of an asset, owned by an entity, optionally in an account). Two shapes: a UNITIZED holding (shares/units \u2014 send quantity + averageCost) or a fund CAPITAL ACCOUNT (a fund LP interest, which has no units because the GP reports a balance \u2014 send costBasis instead). `costBasis` is the ONLY switch that makes a capital account; there is no inference from a missing quantity. Get the shape right at open: create_transaction refuses unitized types on a capital account, and the fund performance figures (paid-in, DPI/TVPI, IRR) exist only for one. Requires the tensor:portfolio:write scope.",
|
|
406
414
|
{
|
|
407
415
|
entityId: z.number().describe("Owner entity ID"),
|
|
408
416
|
label: z.string().describe("Display label for this position (e.g. 'AAPL @ Schwab', 'Brooklyn rental')"),
|
|
@@ -429,7 +437,7 @@ function registerAllTools(server2, api) {
|
|
|
429
437
|
);
|
|
430
438
|
server2.tool(
|
|
431
439
|
"update_position",
|
|
432
|
-
"Update an existing position (partial update)",
|
|
440
|
+
"Update an existing position (partial update). Requires the tensor:portfolio:write scope.",
|
|
433
441
|
{
|
|
434
442
|
id: z.number().describe("Position ID to update"),
|
|
435
443
|
entityId: z.number().optional(),
|
|
@@ -454,7 +462,7 @@ function registerAllTools(server2, api) {
|
|
|
454
462
|
);
|
|
455
463
|
server2.tool(
|
|
456
464
|
"delete_position",
|
|
457
|
-
"PERMANENTLY delete a position and everything hanging off it, in one transaction and with no undo: its ENTIRE transaction ledger, its whole valuation-event history, its loan or fund terms, its relations to other positions, and its file/todo attachments. There is no soft delete and no restore. Deleting is NOT how you record an exit \u2014 a sold-out holding should be closed with sell_all_position, which keeps the history and the realized gain. Reach for this only to remove a position that should never have existed, and confirm with the user first.",
|
|
465
|
+
"PERMANENTLY delete a position and everything hanging off it, in one transaction and with no undo: its ENTIRE transaction ledger, its whole valuation-event history, its loan or fund terms, its relations to other positions, and its file/todo attachments. There is no soft delete and no restore. Deleting is NOT how you record an exit \u2014 a sold-out holding should be closed with sell_all_position, which keeps the history and the realized gain. Reach for this only to remove a position that should never have existed, and confirm with the user first. Requires the tensor:portfolio:write scope.",
|
|
458
466
|
{ id: z.number().describe("Position ID to delete") },
|
|
459
467
|
async ({ id }) => {
|
|
460
468
|
const data = await api("DELETE", `/api/positions/${id}`);
|
|
@@ -463,7 +471,7 @@ function registerAllTools(server2, api) {
|
|
|
463
471
|
);
|
|
464
472
|
server2.tool(
|
|
465
473
|
"sell_all_position",
|
|
466
|
-
"Close/sell all of a position (creates a sell transaction)",
|
|
474
|
+
"Close/sell all of a position (creates a sell transaction). Requires the tensor:portfolio:write scope.",
|
|
467
475
|
{
|
|
468
476
|
id: z.number().describe("Position ID to sell"),
|
|
469
477
|
price: z.number().optional().describe("Sale price per unit"),
|
|
@@ -480,7 +488,7 @@ function registerAllTools(server2, api) {
|
|
|
480
488
|
);
|
|
481
489
|
server2.tool(
|
|
482
490
|
"list_position_events",
|
|
483
|
-
"List valuation events for a specific position (append-only history)",
|
|
491
|
+
"List valuation events for a specific position (append-only history). Requires the tensor:portfolio:read scope.",
|
|
484
492
|
{
|
|
485
493
|
id: z.number().describe("Position ID"),
|
|
486
494
|
limit: z.number().optional(),
|
|
@@ -497,7 +505,7 @@ function registerAllTools(server2, api) {
|
|
|
497
505
|
);
|
|
498
506
|
server2.tool(
|
|
499
507
|
"list_events",
|
|
500
|
-
"List valuation events across all positions in the organization",
|
|
508
|
+
"List valuation events across all positions in the organization. Requires the tensor:portfolio:read scope.",
|
|
501
509
|
{ limit: z.number().optional(), offset: z.number().optional() },
|
|
502
510
|
async ({ limit, offset }) => {
|
|
503
511
|
const params = new URLSearchParams();
|
|
@@ -510,7 +518,7 @@ function registerAllTools(server2, api) {
|
|
|
510
518
|
);
|
|
511
519
|
server2.tool(
|
|
512
520
|
"list_position_relations",
|
|
513
|
-
"List all position relations (linked/related positions)",
|
|
521
|
+
"List all position relations (linked/related positions). Requires the tensor:portfolio:read scope.",
|
|
514
522
|
{ limit: z.number().optional(), offset: z.number().optional() },
|
|
515
523
|
async ({ limit, offset }) => {
|
|
516
524
|
const params = new URLSearchParams();
|
|
@@ -523,7 +531,7 @@ function registerAllTools(server2, api) {
|
|
|
523
531
|
);
|
|
524
532
|
server2.tool(
|
|
525
533
|
"create_position_relation",
|
|
526
|
-
"Link two positions together",
|
|
534
|
+
"Link two positions together. Requires the tensor:portfolio:write scope.",
|
|
527
535
|
{
|
|
528
536
|
positionId: z.number().describe("First position ID"),
|
|
529
537
|
relatedPositionId: z.number().describe("Related position ID")
|
|
@@ -535,7 +543,7 @@ function registerAllTools(server2, api) {
|
|
|
535
543
|
);
|
|
536
544
|
server2.tool(
|
|
537
545
|
"delete_position_relation",
|
|
538
|
-
"Remove a position relation",
|
|
546
|
+
"Remove a position relation. Requires the tensor:portfolio:write scope.",
|
|
539
547
|
{ id: z.number().describe("Position relation ID to delete") },
|
|
540
548
|
async ({ id }) => {
|
|
541
549
|
const data = await api("DELETE", `/api/position-relations/${id}`);
|
|
@@ -544,7 +552,7 @@ function registerAllTools(server2, api) {
|
|
|
544
552
|
);
|
|
545
553
|
server2.tool(
|
|
546
554
|
"list_transactions",
|
|
547
|
-
"List transactions (buys, sells, dividends, fees, etc.). Filter by position or date range server-side.",
|
|
555
|
+
"List transactions (buys, sells, dividends, fees, etc.). Filter by position or date range server-side. Requires the tensor:portfolio:read scope.",
|
|
548
556
|
{
|
|
549
557
|
limit: z.number().optional(),
|
|
550
558
|
offset: z.number().optional(),
|
|
@@ -568,7 +576,7 @@ function registerAllTools(server2, api) {
|
|
|
568
576
|
);
|
|
569
577
|
server2.tool(
|
|
570
578
|
"create_transaction",
|
|
571
|
-
"Append a transaction to a position's ledger (buy, sell, dividend, fee, etc.). THE LEDGER IS APPEND-ONLY AND THIS WRITE IS PERMANENT. There is no way to edit or delete a transaction \u2014 position state is a non-invertible fold over the ledger, so a destructive edit would corrupt cost basis. A mistake is corrected by posting a COMPENSATING entry of the opposite type (a wrong buy is offset by a sell, a wrong capital_call by a return_of_capital), which leaves both rows visible in history. Get it right the first time, and confirm anything you are unsure of with the user before posting.",
|
|
579
|
+
"Append a transaction to a position's ledger (buy, sell, dividend, fee, etc.). THE LEDGER IS APPEND-ONLY AND THIS WRITE IS PERMANENT. There is no way to edit or delete a transaction \u2014 position state is a non-invertible fold over the ledger, so a destructive edit would corrupt cost basis. A mistake is corrected by posting a COMPENSATING entry of the opposite type (a wrong buy is offset by a sell, a wrong capital_call by a return_of_capital), which leaves both rows visible in history. Get it right the first time, and confirm anything you are unsure of with the user before posting. Requires the tensor:portfolio:write scope.",
|
|
572
580
|
{
|
|
573
581
|
positionId: z.number().describe("Position ID this transaction belongs to"),
|
|
574
582
|
// This string is what an LLM reads to pick a type. When the loan types
|
|
@@ -578,17 +586,22 @@ function registerAllTools(server2, api) {
|
|
|
578
586
|
// into the published bundle), so the list is a literal — pinned against
|
|
579
587
|
// TRANSACTION_TYPE_KEYS by an assertion in script/smoke-clerk-api-keys.ts
|
|
580
588
|
// so it can never silently drift again.
|
|
581
|
-
transactionType: z.string().describe("Ledger type. One of: buy, sell, deposit, withdrawal, interest, dividend, transfer_in, transfer_out, contribution, capital_call, distribution, return_of_capital, recallable_distribution, management_fee, write_off, borrow, repay, fee, loan_accrual, repayment_received. THIS FIELD, NOT THE SIGN OF ANY NUMBER, IS WHAT SETS DIRECTION. buy/contribution/capital_call update cost basis; sell/distribution realize gain; dividend
|
|
582
|
-
quantity: z.number().describe(
|
|
589
|
+
transactionType: z.string().describe("Ledger type. One of: buy, sell, deposit, withdrawal, interest, dividend, coupon, transfer_in, transfer_out, contribution, capital_call, distribution, return_of_capital, recallable_distribution, management_fee, write_off, borrow, repay, fee, loan_accrual, repayment_received. THIS FIELD, NOT THE SIGN OF ANY NUMBER, IS WHAT SETS DIRECTION. buy/contribution/capital_call update cost basis; sell/distribution realize gain; fee is logged with no P/L impact. INCOME \u2014 dividend, interest and coupon are one rule under three names: post them with `settlement` (see that field) and on the position that PAID the income. For loans YOU made: loan_accrual adds PIK interest to the balance (post amount 0), repayment_received records the borrower paying you back, interest first: the part that pays off accrued interest is booked as realized income and the rest is a return of capital with no gain \u2014 do NOT use sell/withdrawal for those. For fund LP interests (capital accounts, which have no units \u2014 post quantity 0 and put the money in amount): capital_call/contribution add paid-in capital, return_of_capital REDUCES cost basis and books no gain (use this, not distribution, for a GP returning your capital \u2014 distribution would invent a profit), recallable_distribution does the same but also restores unfunded commitment, distribution books profit, management_fee records a fee billed outside the fund (never record fees already netted inside the reported NAV \u2014 that double-counts them), write_off closes an UNDER-WATER wind-up: the fund returned less than it took, so the basis it could never return becomes a realized loss. Its AMOUNT IS DERIVED from the remaining cost basis and whatever you post is ignored \u2014 post 0. Use it only after the final return_of_capital, and only when the fund is genuinely finished; it zeroes the NAV and closes the position. It is not a distribution and never counts toward DPI or TVPI. A CAPITAL ACCOUNT ACCEPTS ONLY THOSE FUND TYPES. Posting a unitized type (buy, sell, deposit, borrow, \u2026) against a position that has a costBasis is REJECTED with a 400, because a fund has no units: a `buy 10 @ 100` would otherwise overwrite a GP-reported NAV of 1.4M with 1,000, and a `sell` would close the position outright with nothing in the app able to reopen it."),
|
|
590
|
+
quantity: z.number().describe('Units moved, as a POSITIVE magnitude \u2014 never negative. Direction comes from transactionType (a sell removes what a buy adds). Use 0 for cash and economic events that move no units: income with settlement "cash", fees, and every capital-account entry. Income with settlement "in_kind" posts the units received.'),
|
|
583
591
|
// Was documented as "positive for inflows, negative for outflows", which
|
|
584
592
|
// is not what the server does with it: both the unitized and the
|
|
585
593
|
// capital-account folds take Math.abs(amount). A negative amount was
|
|
586
594
|
// silently absorbed, so an agent following that instruction believed it
|
|
587
595
|
// had recorded an outflow and had in fact recorded an inflow.
|
|
588
|
-
amount: z.number().describe(
|
|
589
|
-
price: z.number().optional().describe("Price per unit (for buys/sells). Omit on a capital account, which has no unit price."),
|
|
596
|
+
amount: z.number().describe('Total cash that changed hands, as a POSITIVE magnitude. Do NOT signal an outflow with a negative number: the server takes the absolute value and reads direction from transactionType alone, so a negative amount is silently treated as positive rather than reversing the entry. Post 0 for loan_accrual (PIK interest \u2014 no money moves). On income with settlement "in_kind" it is stored as sent and never read: the cost comes from price alone.'),
|
|
597
|
+
price: z.number().optional().describe("Price per unit (for buys/sells). On in-kind income it is the COST per unit received (0 when omitted), never the market price \u2014 the position keeps its existing mark. Omit on a capital account, which has no unit price."),
|
|
590
598
|
fees: z.number().optional().describe("Fee amount, positive. Default: 0. Every fee is expensed exactly once: a fee on a capital_call/contribution is CAPITALIZED into cost basis, while a fee on a distribution, return_of_capital, sell or management_fee is expensed against realized gain."),
|
|
591
599
|
timestamp: z.number().optional().describe("Transaction time as epoch milliseconds. Default: now. ENTRIES MUST BE RECORDED IN DATE ORDER: a timestamp earlier than the position's latest activity is REJECTED with a 400, because the running state is folded in insert order and a backdate would silently mis-order the fold. When backfilling history, post oldest first. On a capital account the floor also includes dated NAV marks, so a capital call cannot be slipped in behind a mark that already reflects it."),
|
|
600
|
+
// Optional so every pre-5.2 call keeps its meaning. Without it a
|
|
601
|
+
// dividend still books income and moves nothing and an interest row
|
|
602
|
+
// still adds units and books nothing (the legacy rules), which is why the
|
|
603
|
+
// description asks for it explicitly rather than defaulting it here.
|
|
604
|
+
settlement: z.enum(["cash", "in_kind"]).optional().describe(`INCOME ONLY (dividend, interest, coupon); rejected with a 400 on any other type. "cash": the income was paid as money \u2014 it is booked to realized gain (amount \u2212 fees) on this position and no units move; post quantity 0. Where the money landed is NOT recorded by this row: if you track that cash balance, post a separate deposit on the cash position. "in_kind": the income was paid in units of THIS instrument (a USDC coupon into a USDC note, staking rewards, a scrip dividend): quantity is the units received and price is the COST PER UNIT, 0 when omitted (never derived from amount, which is stored as sent and not read) \u2014 free units leave total cost unchanged, lower the average cost, and show as unrealized gain until sold. A non-zero price books quantity \xD7 price as realized income now and carries it as the units' cost. Omit only to reproduce the pre-5.2 behaviour \u2014 on a loan that capitalises the interest at a cost, so it is never booked as income; record loan interest as loan_accrual instead.`),
|
|
592
605
|
memo: z.string().optional()
|
|
593
606
|
},
|
|
594
607
|
async (params) => {
|
|
@@ -598,7 +611,7 @@ function registerAllTools(server2, api) {
|
|
|
598
611
|
);
|
|
599
612
|
server2.tool(
|
|
600
613
|
"list_institutions",
|
|
601
|
-
"List all institutions (banks, brokers, custodians)",
|
|
614
|
+
"List all institutions (banks, brokers, custodians). Requires the tensor:reference:read scope.",
|
|
602
615
|
{},
|
|
603
616
|
async () => {
|
|
604
617
|
const data = await api("GET", "/api/institutions");
|
|
@@ -607,7 +620,7 @@ function registerAllTools(server2, api) {
|
|
|
607
620
|
);
|
|
608
621
|
server2.tool(
|
|
609
622
|
"create_institution",
|
|
610
|
-
"Create a new institution",
|
|
623
|
+
"Create a new institution. Requires the tensor:reference:write scope.",
|
|
611
624
|
{
|
|
612
625
|
name: z.string().describe("Institution name"),
|
|
613
626
|
notes: z.string().optional()
|
|
@@ -619,7 +632,7 @@ function registerAllTools(server2, api) {
|
|
|
619
632
|
);
|
|
620
633
|
server2.tool(
|
|
621
634
|
"update_institution",
|
|
622
|
-
"Update an institution",
|
|
635
|
+
"Update an institution. Requires the tensor:reference:write scope.",
|
|
623
636
|
{
|
|
624
637
|
id: z.number().describe("Institution ID"),
|
|
625
638
|
name: z.string().optional(),
|
|
@@ -632,7 +645,7 @@ function registerAllTools(server2, api) {
|
|
|
632
645
|
);
|
|
633
646
|
server2.tool(
|
|
634
647
|
"delete_institution",
|
|
635
|
-
"Delete an institution",
|
|
648
|
+
"Delete an institution. Requires the tensor:reference:write scope.",
|
|
636
649
|
{ id: z.number().describe("Institution ID to delete") },
|
|
637
650
|
async ({ id }) => {
|
|
638
651
|
const data = await api("DELETE", `/api/institutions/${id}`);
|
|
@@ -641,7 +654,7 @@ function registerAllTools(server2, api) {
|
|
|
641
654
|
);
|
|
642
655
|
server2.tool(
|
|
643
656
|
"list_entity_types",
|
|
644
|
-
"List all entity types (Individual, Trust, Corporation, etc.)",
|
|
657
|
+
"List all entity types (Individual, Trust, Corporation, etc.). Requires the tensor:reference:read scope.",
|
|
645
658
|
{},
|
|
646
659
|
async () => {
|
|
647
660
|
const data = await api("GET", "/api/entity-types");
|
|
@@ -650,7 +663,7 @@ function registerAllTools(server2, api) {
|
|
|
650
663
|
);
|
|
651
664
|
server2.tool(
|
|
652
665
|
"create_entity_type",
|
|
653
|
-
"Create a new entity type catalog entry",
|
|
666
|
+
"Create a new entity type catalog entry. Requires the tensor:reference:write scope.",
|
|
654
667
|
{
|
|
655
668
|
key: z.string().describe("Stable key referenced by entities.type (e.g. 'Individual', 'Trust')"),
|
|
656
669
|
label: z.string().describe("Human-readable display label"),
|
|
@@ -663,7 +676,7 @@ function registerAllTools(server2, api) {
|
|
|
663
676
|
);
|
|
664
677
|
server2.tool(
|
|
665
678
|
"update_entity_type",
|
|
666
|
-
"Update an entity type catalog entry (partial update)",
|
|
679
|
+
"Update an entity type catalog entry (partial update). Requires the tensor:reference:write scope.",
|
|
667
680
|
{
|
|
668
681
|
id: z.number().describe("Entity type ID"),
|
|
669
682
|
key: z.string().optional(),
|
|
@@ -677,7 +690,7 @@ function registerAllTools(server2, api) {
|
|
|
677
690
|
);
|
|
678
691
|
server2.tool(
|
|
679
692
|
"delete_entity_type",
|
|
680
|
-
"Delete an entity type",
|
|
693
|
+
"Delete an entity type. Requires the tensor:reference:write scope.",
|
|
681
694
|
{ id: z.number().describe("Entity type ID to delete") },
|
|
682
695
|
async ({ id }) => {
|
|
683
696
|
const data = await api("DELETE", `/api/entity-types/${id}`);
|
|
@@ -686,7 +699,7 @@ function registerAllTools(server2, api) {
|
|
|
686
699
|
);
|
|
687
700
|
server2.tool(
|
|
688
701
|
"list_role_types",
|
|
689
|
-
"List all role types (Owner, Beneficiary, Trustee, etc.)",
|
|
702
|
+
"List all role types (Owner, Beneficiary, Trustee, etc.). Requires the tensor:reference:read scope.",
|
|
690
703
|
{},
|
|
691
704
|
async () => {
|
|
692
705
|
const data = await api("GET", "/api/role-types");
|
|
@@ -695,7 +708,7 @@ function registerAllTools(server2, api) {
|
|
|
695
708
|
);
|
|
696
709
|
server2.tool(
|
|
697
710
|
"create_role_type",
|
|
698
|
-
"Create a new role type catalog entry",
|
|
711
|
+
"Create a new role type catalog entry. Requires the tensor:reference:write scope.",
|
|
699
712
|
{
|
|
700
713
|
key: z.string().describe("Stable key (e.g. 'Owner', 'Trustee', 'Beneficiary')"),
|
|
701
714
|
label: z.string().describe("Human-readable display label"),
|
|
@@ -708,7 +721,7 @@ function registerAllTools(server2, api) {
|
|
|
708
721
|
);
|
|
709
722
|
server2.tool(
|
|
710
723
|
"update_role_type",
|
|
711
|
-
"Update a role type catalog entry (partial update)",
|
|
724
|
+
"Update a role type catalog entry (partial update). Requires the tensor:reference:write scope.",
|
|
712
725
|
{
|
|
713
726
|
id: z.number().describe("Role type ID"),
|
|
714
727
|
key: z.string().optional(),
|
|
@@ -722,7 +735,7 @@ function registerAllTools(server2, api) {
|
|
|
722
735
|
);
|
|
723
736
|
server2.tool(
|
|
724
737
|
"delete_role_type",
|
|
725
|
-
"Delete a role type",
|
|
738
|
+
"Delete a role type. Requires the tensor:reference:write scope.",
|
|
726
739
|
{ id: z.number().describe("Role type ID to delete") },
|
|
727
740
|
async ({ id }) => {
|
|
728
741
|
const data = await api("DELETE", `/api/role-types/${id}`);
|
|
@@ -731,7 +744,7 @@ function registerAllTools(server2, api) {
|
|
|
731
744
|
);
|
|
732
745
|
server2.tool(
|
|
733
746
|
"list_account_types",
|
|
734
|
-
"List all account types (Brokerage, Checking, IRA, 401k, etc.)",
|
|
747
|
+
"List all account types (Brokerage, Checking, IRA, 401k, etc.). Requires the tensor:reference:read scope.",
|
|
735
748
|
{},
|
|
736
749
|
async () => {
|
|
737
750
|
const data = await api("GET", "/api/account-types");
|
|
@@ -740,7 +753,7 @@ function registerAllTools(server2, api) {
|
|
|
740
753
|
);
|
|
741
754
|
server2.tool(
|
|
742
755
|
"create_account_type",
|
|
743
|
-
"Create a new account type catalog entry",
|
|
756
|
+
"Create a new account type catalog entry. Requires the tensor:reference:write scope.",
|
|
744
757
|
{
|
|
745
758
|
key: z.string().describe("Stable key referenced by accounts.accountType (e.g. 'Brokerage', 'Bank')"),
|
|
746
759
|
label: z.string().describe("Human-readable display label"),
|
|
@@ -753,7 +766,7 @@ function registerAllTools(server2, api) {
|
|
|
753
766
|
);
|
|
754
767
|
server2.tool(
|
|
755
768
|
"update_account_type",
|
|
756
|
-
"Update an account type catalog entry (partial update)",
|
|
769
|
+
"Update an account type catalog entry (partial update). Requires the tensor:reference:write scope.",
|
|
757
770
|
{
|
|
758
771
|
id: z.number().describe("Account type ID"),
|
|
759
772
|
key: z.string().optional(),
|
|
@@ -767,7 +780,7 @@ function registerAllTools(server2, api) {
|
|
|
767
780
|
);
|
|
768
781
|
server2.tool(
|
|
769
782
|
"delete_account_type",
|
|
770
|
-
"Delete an account type",
|
|
783
|
+
"Delete an account type. Requires the tensor:reference:write scope.",
|
|
771
784
|
{ id: z.number().describe("Account type ID to delete") },
|
|
772
785
|
async ({ id }) => {
|
|
773
786
|
const data = await api("DELETE", `/api/account-types/${id}`);
|
|
@@ -776,7 +789,7 @@ function registerAllTools(server2, api) {
|
|
|
776
789
|
);
|
|
777
790
|
server2.tool(
|
|
778
791
|
"list_asset_classes",
|
|
779
|
-
"List all asset classes (Equities, Fixed Income, Real Estate, etc.)",
|
|
792
|
+
"List all asset classes (Equities, Fixed Income, Real Estate, etc.). Requires the tensor:reference:read scope.",
|
|
780
793
|
{},
|
|
781
794
|
async () => {
|
|
782
795
|
const data = await api("GET", "/api/asset-classes");
|
|
@@ -785,7 +798,7 @@ function registerAllTools(server2, api) {
|
|
|
785
798
|
);
|
|
786
799
|
server2.tool(
|
|
787
800
|
"create_asset_class",
|
|
788
|
-
"Create a new asset class catalog entry",
|
|
801
|
+
"Create a new asset class catalog entry. Requires the tensor:reference:write scope.",
|
|
789
802
|
{
|
|
790
803
|
key: z.string().describe("Stable key referenced by assets.assetClass (e.g. 'Equity', 'Real Estate')"),
|
|
791
804
|
label: z.string().describe("Human-readable display label"),
|
|
@@ -799,7 +812,7 @@ function registerAllTools(server2, api) {
|
|
|
799
812
|
);
|
|
800
813
|
server2.tool(
|
|
801
814
|
"update_asset_class",
|
|
802
|
-
"Update an asset class catalog entry (partial update)",
|
|
815
|
+
"Update an asset class catalog entry (partial update). Requires the tensor:reference:write scope.",
|
|
803
816
|
{
|
|
804
817
|
id: z.number().describe("Asset class ID"),
|
|
805
818
|
key: z.string().optional(),
|
|
@@ -814,7 +827,7 @@ function registerAllTools(server2, api) {
|
|
|
814
827
|
);
|
|
815
828
|
server2.tool(
|
|
816
829
|
"delete_asset_class",
|
|
817
|
-
"Delete an asset class",
|
|
830
|
+
"Delete an asset class. Requires the tensor:reference:write scope.",
|
|
818
831
|
{ id: z.number().describe("Asset class ID to delete") },
|
|
819
832
|
async ({ id }) => {
|
|
820
833
|
const data = await api("DELETE", `/api/asset-classes/${id}`);
|
|
@@ -874,7 +887,7 @@ function registerAllTools(server2, api) {
|
|
|
874
887
|
);
|
|
875
888
|
server2.tool(
|
|
876
889
|
"get_portfolio_summary",
|
|
877
|
-
"Net worth, total assets, total liabilities, cost basis and unrealized P/L for the organization, computed server-side in USD \u2014 optionally broken down by entity, account, asset class or currency. USE THIS instead of listing positions and adding them up: the underlying math has real subtleties (a position's stored value is a snapshot rather than a market value, liabilities are sign-mirrored, cost basis has a fallback that must not apply to priced positions) and this endpoint folds exactly the same chain the Tensor dashboard shows. The `coverage` field reports how much of the portfolio the numbers actually cover \u2014 check it before quoting a total as exact.",
|
|
890
|
+
"Net worth, total assets, total liabilities, cost basis and unrealized P/L for the organization, computed server-side in USD \u2014 optionally broken down by entity, account, asset class or currency. USE THIS instead of listing positions and adding them up: the underlying math has real subtleties (a position's stored value is a snapshot rather than a market value, liabilities are sign-mirrored, cost basis has a fallback that must not apply to priced positions) and this endpoint folds exactly the same chain the Tensor dashboard shows. The `coverage` field reports how much of the portfolio the numbers actually cover \u2014 check it before quoting a total as exact. Requires the tensor:portfolio:read scope.",
|
|
878
891
|
{
|
|
879
892
|
groupBy: z.string().optional().describe("Comma-separated breakdowns: entity, account, assetClass, currency. Omit for headline totals only."),
|
|
880
893
|
scope: z.enum(["dashboard", "all"]).optional().describe("'dashboard' (default) counts only entities marked for portfolio display, matching the Tensor dashboard. 'all' counts every entity."),
|
|
@@ -898,7 +911,7 @@ function registerAllTools(server2, api) {
|
|
|
898
911
|
);
|
|
899
912
|
server2.tool(
|
|
900
913
|
"search_market_quotes",
|
|
901
|
-
"Search the price providers (Yahoo Finance for listed instruments, CoinGecko for crypto) for market quotes matching a free-text query. Returns candidate symbols with their name and exchange. The `symbol` of the result you pick is what goes into an asset's tickerSymbol field (returned as both tickerSymbol and fmpSymbol) to make it price automatically. Always search rather than guessing a ticker \u2014 exchange suffixes and crypto ids are not predictable.",
|
|
914
|
+
"Search the price providers (Yahoo Finance for listed instruments, CoinGecko for crypto) for market quotes matching a free-text query. Returns candidate symbols with their name and exchange. The `symbol` of the result you pick is what goes into an asset's tickerSymbol field (returned as both tickerSymbol and fmpSymbol) to make it price automatically. Always search rather than guessing a ticker \u2014 exchange suffixes and crypto ids are not predictable. Requires the tensor:portfolio:read scope.",
|
|
902
915
|
{
|
|
903
916
|
q: z.string().describe("Free-text query \u2014 a company name, ticker, or coin name"),
|
|
904
917
|
limit: z.number().optional().describe("Max candidates to return. Default 10, max 25.")
|
|
@@ -912,7 +925,7 @@ function registerAllTools(server2, api) {
|
|
|
912
925
|
);
|
|
913
926
|
server2.tool(
|
|
914
927
|
"verify_market_quote",
|
|
915
|
-
"Resolve a single market-quote symbol to a live price WITHOUT writing anything. Use this to confirm a symbol is real before linking it to an asset. Returns `corrected: true` when the provider answered on a different spelling than the one asked for \u2014 store the returned `symbol`, not the one you sent.",
|
|
928
|
+
"Resolve a single market-quote symbol to a live price WITHOUT writing anything. Use this to confirm a symbol is real before linking it to an asset. Returns `corrected: true` when the provider answered on a different spelling than the one asked for \u2014 store the returned `symbol`, not the one you sent. Requires the tensor:portfolio:read scope.",
|
|
916
929
|
{ symbol: z.string().describe("Provider symbol to check, e.g. 'BRK-B', 'BTC-USD', or 'CG:official-trump'") },
|
|
917
930
|
async ({ symbol }) => {
|
|
918
931
|
const data = await api("GET", `/api/v1/prices/quote?symbol=${encodeURIComponent(symbol)}`);
|
|
@@ -921,7 +934,7 @@ function registerAllTools(server2, api) {
|
|
|
921
934
|
);
|
|
922
935
|
server2.tool(
|
|
923
936
|
"sync_prices",
|
|
924
|
-
"Trigger a price sync: fetch current quotes for the organization's linked assets and record them, revaluing every position that holds them. Omit assetIds to sync the whole catalog, or pass a subset. This WRITES \u2014 each synced asset gets a price-history row and its positions are repriced. The result reports what synced, what was skipped for having no symbol, and per-symbol failure reasons.",
|
|
937
|
+
"Trigger a price sync: fetch current quotes for the organization's linked assets and record them, revaluing every position that holds them. Omit assetIds to sync the whole catalog, or pass a subset. This WRITES \u2014 each synced asset gets a price-history row and its positions are repriced. The result reports what synced, what was skipped for having no symbol, and per-symbol failure reasons. Requires the tensor:portfolio:write scope.",
|
|
925
938
|
{
|
|
926
939
|
assetIds: z.array(z.number()).optional().describe("Only sync these asset IDs. Omit to sync every linked asset in the organization.")
|
|
927
940
|
},
|
|
@@ -932,7 +945,7 @@ function registerAllTools(server2, api) {
|
|
|
932
945
|
);
|
|
933
946
|
server2.tool(
|
|
934
947
|
"sync_asset_price",
|
|
935
|
-
"Trigger a price sync for one asset by ID. Fails if the asset has no price-provider symbol linked. Use sync_prices for bulk.",
|
|
948
|
+
"Trigger a price sync for one asset by ID. Fails if the asset has no price-provider symbol linked. Use sync_prices for bulk. Requires the tensor:portfolio:write scope.",
|
|
936
949
|
{ id: z.number().describe("Asset ID to reprice") },
|
|
937
950
|
async ({ id }) => {
|
|
938
951
|
const data = await api("POST", `/api/v1/prices/sync/${id}`);
|
|
@@ -941,7 +954,7 @@ function registerAllTools(server2, api) {
|
|
|
941
954
|
);
|
|
942
955
|
server2.tool(
|
|
943
956
|
"list_changes",
|
|
944
|
-
"What changed in this organization's data since a timestamp \u2014 creates, updates AND deletes, across both the CRUD routes and applied data batches. Use this to catch up incrementally instead of re-listing every table. Check `coverage.complete`: when false, the requested `since` predates the audit history and the delta cannot be trusted \u2014 do a full read instead. Resume the next poll from the returned `until`.",
|
|
957
|
+
"What changed in this organization's data since a timestamp \u2014 creates, updates AND deletes, across both the CRUD routes and applied data batches. Use this to catch up incrementally instead of re-listing every table. Check `coverage.complete`: when false, the requested `since` predates the audit history and the delta cannot be trusted \u2014 do a full read instead. Resume the next poll from the returned `until`. The history is kept 90 days. Requires the tensor:portfolio:read scope.",
|
|
945
958
|
{
|
|
946
959
|
since: z.number().optional().describe("Epoch-ms lower bound (exclusive). Omit or 0 for everything on record."),
|
|
947
960
|
limit: z.number().optional().describe("Max changes per page. Default 500."),
|
|
@@ -959,7 +972,7 @@ function registerAllTools(server2, api) {
|
|
|
959
972
|
);
|
|
960
973
|
server2.tool(
|
|
961
974
|
"search_records",
|
|
962
|
-
"Site-wide ranked search across every record type at once \u2014 entities, institutions, accounts, positions, assets, transactions, files, todos and
|
|
975
|
+
"Site-wide ranked search across every record type at once \u2014 entities, institutions, accounts, positions, assets, transactions, files, todos, ideas, bookmarks and parked tabs. Reference ids resolve directly: 'TSK-12' (todo), 'AS002' (asset), 'T042' (transaction), 'BMK-9' (bookmark). Lanes are scope-gated per key: each record type requires that domain's read scope (tensor:portfolio:read for the five ledger types, reference:read for institutions, files/todos/ideas/bookmarks/tabs:read for theirs). THE TAB LANE'S UNIT IS A TAB, NOT A GROUP \u2014 you search a title and get the parked page, though the thing you can restore or delete is its group. Memos are the one record type NO key reaches: the lane exists and no scope opens it, because memos are session-only. Lanes the key does not cover are silently omitted \u2014 the result is your slice of the org, not evidence the rest is empty \u2014 and a key covering no lane at all gets 403. Empty q returns no hits. Not for market tickers: that is search_market_quotes.",
|
|
963
976
|
{
|
|
964
977
|
q: z.string().describe("The query. Title, body and reference-id lanes, one ranking; short and literal works best."),
|
|
965
978
|
types: z.array(z.enum(SEARCH_RECORD_TYPES_MIRROR)).optional().describe("Restrict to these record types. Omit for all \u2014 transactions are excluded from the default set unless the query is a T-ref or you name them here explicitly. 'memo' is spelled here because it is one of Tensor's record types, not because a key can search it: naming it adds nothing, and naming it alone is the no-lane 403."),
|
|
@@ -1825,6 +1838,223 @@ function registerAllTools(server2, api) {
|
|
|
1825
1838
|
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
1826
1839
|
}
|
|
1827
1840
|
);
|
|
1841
|
+
server2.tool(
|
|
1842
|
+
"list_bookmarks",
|
|
1843
|
+
"List filed bookmarks in the order the owner arranged them: Unfiled first, then folder by folder in the order list_bookmark_folders answers, each folder's bookmarks in their own hand-set order (a new bookmark goes first in its folder). Keep that order \u2014 do not re-sort by date or title. The Trash (trash: true) reads newest first instead. `folderId` is THREE-VALUED and the third value is the one that is easy to lose: a positive integer asks for one folder, the string 'none' asks for the UNFILED (folderId is null \u2014 a resting state, not an error), and omitting it asks for everything. Sending 'none' as absent turns an Unfiled view into the whole library. The response is FLAT \u2014 no folder is hydrated into a row \u2014 so read the tree with list_bookmark_folders and join on each row's folderId. Requires the tensor:bookmarks:read scope.",
|
|
1844
|
+
{
|
|
1845
|
+
limit: z.number().optional().describe("Max results. Default 500."),
|
|
1846
|
+
offset: z.number().optional().describe("Pagination offset"),
|
|
1847
|
+
folderId: z.union([z.number(), z.literal("none")]).optional().describe("One folder by id, or 'none' for the unfiled. Omit for every bookmark."),
|
|
1848
|
+
q: z.string().optional().describe("Case-insensitive substring over title, url and site name"),
|
|
1849
|
+
trash: z.boolean().optional().describe("true = the Trash instead of the live library")
|
|
1850
|
+
},
|
|
1851
|
+
async ({ limit, offset, folderId, q, trash }) => {
|
|
1852
|
+
const params = new URLSearchParams();
|
|
1853
|
+
if (limit) params.set("limit", String(limit));
|
|
1854
|
+
if (offset) params.set("offset", String(offset));
|
|
1855
|
+
if (folderId !== void 0) params.set("folderId", String(folderId));
|
|
1856
|
+
if (q) params.set("q", q);
|
|
1857
|
+
if (trash) params.set("trash", "1");
|
|
1858
|
+
const qs = params.toString();
|
|
1859
|
+
const data = await api("GET", `/api/bookmarks${qs ? `?${qs}` : ""}`);
|
|
1860
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
1861
|
+
}
|
|
1862
|
+
);
|
|
1863
|
+
server2.tool(
|
|
1864
|
+
"get_bookmark",
|
|
1865
|
+
"Get one bookmark. `normalizedUrl` beside the raw url is what duplicate detection compares \u2014 it is derived server-side and cannot be written. Requires the tensor:bookmarks:read scope.",
|
|
1866
|
+
{ id: z.number().describe("Bookmark ID") },
|
|
1867
|
+
async ({ id }) => {
|
|
1868
|
+
const data = await api("GET", `/api/bookmarks/${id}`);
|
|
1869
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
1870
|
+
}
|
|
1871
|
+
);
|
|
1872
|
+
server2.tool(
|
|
1873
|
+
"create_bookmark",
|
|
1874
|
+
"File a bookmark. Only `url` is required; leaving `folderId` off files it as UNFILED, which is a resting state rather than an incomplete one \u2014 do not invent a folder to put it in. A DUPLICATE IS FLAGGED, NOT REFUSED: if the same page was saved before, the row is still created and the response carries `duplicateOf` naming the earlier one, so you can offer to open that instead. Requires the tensor:bookmarks:write scope.",
|
|
1875
|
+
{
|
|
1876
|
+
url: z.string().describe("The page URL (max 2048 chars)"),
|
|
1877
|
+
title: z.string().optional().describe("Title (max 1024 chars)"),
|
|
1878
|
+
folderId: z.number().optional().describe("File it into this folder. Omit for unfiled."),
|
|
1879
|
+
excerpt: z.string().optional().describe("Page excerpt (og:description), max 4096"),
|
|
1880
|
+
siteName: z.string().optional().describe("Site display name (og:site_name)"),
|
|
1881
|
+
faviconUrl: z.string().optional().describe("Favicon URL \u2014 kept remote, never mirrored into storage"),
|
|
1882
|
+
thumbnailUrl: z.string().optional().describe("Preview image URL \u2014 kept remote")
|
|
1883
|
+
},
|
|
1884
|
+
async (params) => {
|
|
1885
|
+
const data = await api("POST", "/api/bookmarks", params);
|
|
1886
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
1887
|
+
}
|
|
1888
|
+
);
|
|
1889
|
+
server2.tool(
|
|
1890
|
+
"update_bookmark",
|
|
1891
|
+
"Edit a bookmark. Every field is optional and only what you send changes. Pass folderId as null to UNFILE it \u2014 omitting the field leaves it where it is. Requires the tensor:bookmarks:write scope.",
|
|
1892
|
+
{
|
|
1893
|
+
id: z.number().describe("Bookmark ID"),
|
|
1894
|
+
url: z.string().optional().describe("Replacement URL"),
|
|
1895
|
+
title: z.string().nullable().optional().describe("Replacement title"),
|
|
1896
|
+
folderId: z.number().nullable().optional().describe("Move to this folder, or null to unfile"),
|
|
1897
|
+
excerpt: z.string().nullable().optional().describe("Replacement excerpt"),
|
|
1898
|
+
siteName: z.string().nullable().optional().describe("Replacement site name"),
|
|
1899
|
+
faviconUrl: z.string().nullable().optional().describe("Replacement favicon URL"),
|
|
1900
|
+
thumbnailUrl: z.string().nullable().optional().describe("Replacement preview image URL")
|
|
1901
|
+
},
|
|
1902
|
+
async ({ id, ...body }) => {
|
|
1903
|
+
const data = await api("PATCH", `/api/bookmarks/${id}`, body);
|
|
1904
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
1905
|
+
}
|
|
1906
|
+
);
|
|
1907
|
+
server2.tool(
|
|
1908
|
+
"delete_bookmark",
|
|
1909
|
+
"Move a bookmark to the Trash (soft delete). Restorable with restore_bookmark, and it goes back to the folder it was filed in. The Trash empties itself sixty days after deletion; the permanent purge is deliberately not reachable with an API key, so a key cannot unrecoverably delete a bookmark. Returns the trashed row rather than an ok flag, so you can read the deletedAt it just earned. Requires the tensor:bookmarks:write scope.",
|
|
1910
|
+
{ id: z.number().describe("Bookmark ID") },
|
|
1911
|
+
async ({ id }) => {
|
|
1912
|
+
const data = await api("DELETE", `/api/bookmarks/${id}`);
|
|
1913
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
1914
|
+
}
|
|
1915
|
+
);
|
|
1916
|
+
server2.tool(
|
|
1917
|
+
"restore_bookmark",
|
|
1918
|
+
"Restore a bookmark from the Trash, back into the folder it was filed in. 404 when it is not in the Trash. Requires the tensor:bookmarks:write scope.",
|
|
1919
|
+
{ id: z.number().describe("Bookmark ID") },
|
|
1920
|
+
async ({ id }) => {
|
|
1921
|
+
const data = await api("POST", `/api/bookmarks/${id}/restore`);
|
|
1922
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
1923
|
+
}
|
|
1924
|
+
);
|
|
1925
|
+
server2.tool(
|
|
1926
|
+
"list_bookmark_folders",
|
|
1927
|
+
"The bookmark folder tree \u2014 every folder in the organization, each with its parentId, in the order the owner arranged them: parents before children, siblings in their hand-set order. Keep that order rather than sorting by name. Folders nest. This is a SIBLING resource of /api/bookmarks rather than a sub-path of it, but one scope opens both. Requires the tensor:bookmarks:read scope.",
|
|
1928
|
+
{},
|
|
1929
|
+
async () => {
|
|
1930
|
+
const data = await api("GET", "/api/bookmark-folders");
|
|
1931
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
1932
|
+
}
|
|
1933
|
+
);
|
|
1934
|
+
server2.tool(
|
|
1935
|
+
"create_bookmark_folder",
|
|
1936
|
+
"Create a bookmark folder, optionally inside another. Requires the tensor:bookmarks:write scope.",
|
|
1937
|
+
{
|
|
1938
|
+
name: z.string().describe("Folder name (1-256 chars)"),
|
|
1939
|
+
parentId: z.number().optional().describe("Nest it inside this folder. Omit for a root folder.")
|
|
1940
|
+
},
|
|
1941
|
+
async (params) => {
|
|
1942
|
+
const data = await api("POST", "/api/bookmark-folders", params);
|
|
1943
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
1944
|
+
}
|
|
1945
|
+
);
|
|
1946
|
+
server2.tool(
|
|
1947
|
+
"update_bookmark_folder",
|
|
1948
|
+
"Rename a folder or move it to a different parent. Pass parentId as null to make it a root folder. A move that would put a folder inside itself, or push the tree past its depth ceiling, is refused with 409 and a message saying which \u2014 branch on the message rather than retrying. Requires the tensor:bookmarks:write scope.",
|
|
1949
|
+
{
|
|
1950
|
+
id: z.number().describe("Folder ID"),
|
|
1951
|
+
name: z.string().optional().describe("Replacement name"),
|
|
1952
|
+
parentId: z.number().nullable().optional().describe("New parent, or null for a root folder")
|
|
1953
|
+
},
|
|
1954
|
+
async ({ id, ...body }) => {
|
|
1955
|
+
const data = await api("PATCH", `/api/bookmark-folders/${id}`, body);
|
|
1956
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
1957
|
+
}
|
|
1958
|
+
);
|
|
1959
|
+
server2.tool(
|
|
1960
|
+
"delete_bookmark_folder",
|
|
1961
|
+
"Destroy a folder AND NOTHING ELSE. Its bookmarks are UNFILED \u2014 folderId set to null, still in the library and not in the Trash \u2014 and its sub-folders are promoted to its own parent. A non-empty folder is therefore accepted, unlike delete_file_folder which refuses one: nothing under it is lost. THERE IS NO UNDO, because a folder is a filing decision rather than a Trash surface; the bookmarks survive but the folder does not come back. Requires the tensor:bookmarks:write scope.",
|
|
1962
|
+
{ id: z.number().describe("Folder ID") },
|
|
1963
|
+
async ({ id }) => {
|
|
1964
|
+
const data = await api("DELETE", `/api/bookmark-folders/${id}`);
|
|
1965
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
1966
|
+
}
|
|
1967
|
+
);
|
|
1968
|
+
server2.tool(
|
|
1969
|
+
"list_tab_groups",
|
|
1970
|
+
"List tab groups synced from a browser, each hydrated with its tabs \u2014 there is no per-tab read, because the group is the unit of everything except search. Starred groups come first, then newest first. `limit`/`offset` page the GROUPS; a group's tabs are never truncated. Requires the tensor:tabs:read scope, which is SEPARATE from tensor:bookmarks:read on purpose: a synced group is in effect a partial browsing history.",
|
|
1971
|
+
{
|
|
1972
|
+
limit: z.number().optional().describe("Max GROUPS. Default 500."),
|
|
1973
|
+
offset: z.number().optional().describe("Pagination offset, in groups"),
|
|
1974
|
+
trash: z.boolean().optional().describe("true = trashed groups instead of live ones")
|
|
1975
|
+
},
|
|
1976
|
+
async ({ limit, offset, trash }) => {
|
|
1977
|
+
const params = new URLSearchParams();
|
|
1978
|
+
if (limit) params.set("limit", String(limit));
|
|
1979
|
+
if (offset) params.set("offset", String(offset));
|
|
1980
|
+
if (trash) params.set("trash", "1");
|
|
1981
|
+
const qs = params.toString();
|
|
1982
|
+
const data = await api("GET", `/api/tabs${qs ? `?${qs}` : ""}`);
|
|
1983
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
1984
|
+
}
|
|
1985
|
+
);
|
|
1986
|
+
server2.tool(
|
|
1987
|
+
"get_tab_group",
|
|
1988
|
+
"Get one tab group with its tabs in order. `deviceLabel` says which machine collapsed it and is display only \u2014 never an identity or a key. Requires the tensor:tabs:read scope.",
|
|
1989
|
+
{ id: z.number().describe("Tab group ID") },
|
|
1990
|
+
async ({ id }) => {
|
|
1991
|
+
const data = await api("GET", `/api/tabs/${id}`);
|
|
1992
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
1993
|
+
}
|
|
1994
|
+
);
|
|
1995
|
+
server2.tool(
|
|
1996
|
+
"create_tab_group",
|
|
1997
|
+
"Park a set of tabs as one group. ONE CALL CARRIES THE WHOLE GROUP and that is a requirement rather than a convenience \u2014 the per-key rate limit is 120 requests a minute, so posting fifty tabs one at a time would spend a third of the window on a single collapse. Between 1 and 500 tabs, kept in the order you send them. Requires the tensor:tabs:write scope.",
|
|
1998
|
+
{
|
|
1999
|
+
items: z.array(z.object({
|
|
2000
|
+
url: z.string().describe("The tab's URL (max 2048 chars)"),
|
|
2001
|
+
title: z.string().nullable().optional().describe("Page title"),
|
|
2002
|
+
faviconUrl: z.string().nullable().optional().describe("Favicon URL \u2014 kept remote")
|
|
2003
|
+
})).describe("The tabs, in order. At least one, at most 500."),
|
|
2004
|
+
name: z.string().nullable().optional().describe(`Group name. THE SERVER NEVER FILLS THIS IN: omit it and the group stays unnamed, and every Tensor surface renders it as "Untitled group". The Chrome extension's groups look dated because the extension stamps a date itself before posting, which is not something this route does for you \u2014 so name the group here, or accept that it has none.`),
|
|
2005
|
+
deviceLabel: z.string().nullable().optional().describe("Which machine this came from. Display only."),
|
|
2006
|
+
locked: z.boolean().optional().describe("Do not let anything clear this group"),
|
|
2007
|
+
starred: z.boolean().optional().describe("Pin it to the top of the list")
|
|
2008
|
+
},
|
|
2009
|
+
async (params) => {
|
|
2010
|
+
const data = await api("POST", "/api/tabs", params);
|
|
2011
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
2012
|
+
}
|
|
2013
|
+
);
|
|
2014
|
+
server2.tool(
|
|
2015
|
+
"update_tab_group",
|
|
2016
|
+
`Edit a tab group. EXACTLY THREE FIELDS ARE EDITABLE \u2014 name, locked, starred \u2014 and the tab list is deliberately not among them: a whole-array replace would make "which tabs did I have" unanswerable from the audit trail. A tab leaves through delete_tab; tabs arrive by creating another group (the HTTP API's batched POST /api/tabs/{id}/items, used by the browser extension, has no tool). A trashed group answers 404 until it is restored. Requires the tensor:tabs:write scope.`,
|
|
2017
|
+
{
|
|
2018
|
+
id: z.number().describe("Tab group ID"),
|
|
2019
|
+
name: z.string().nullable().optional().describe("Replacement name"),
|
|
2020
|
+
locked: z.boolean().optional().describe("Do not let anything clear this group"),
|
|
2021
|
+
starred: z.boolean().optional().describe("Pin it to the top of the list")
|
|
2022
|
+
},
|
|
2023
|
+
async ({ id, ...body }) => {
|
|
2024
|
+
const data = await api("PATCH", `/api/tabs/${id}`, body);
|
|
2025
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
2026
|
+
}
|
|
2027
|
+
);
|
|
2028
|
+
server2.tool(
|
|
2029
|
+
"delete_tab",
|
|
2030
|
+
"Remove ONE tab from a live group. Immediate and not recoverable \u2014 a tab has no Trash of its own because the GROUP is the recoverable unit. To put the whole group aside instead, use delete_tab_group. Requires the tensor:tabs:write scope.",
|
|
2031
|
+
{
|
|
2032
|
+
id: z.number().describe("Tab group ID"),
|
|
2033
|
+
itemId: z.number().describe("The tab's own id, from the group's items")
|
|
2034
|
+
},
|
|
2035
|
+
async ({ id, itemId }) => {
|
|
2036
|
+
const data = await api("DELETE", `/api/tabs/${id}/items/${itemId}`);
|
|
2037
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
2038
|
+
}
|
|
2039
|
+
);
|
|
2040
|
+
server2.tool(
|
|
2041
|
+
"delete_tab_group",
|
|
2042
|
+
"Move a whole tab group to the Trash (soft delete). The tabs stay attached and restore_tab_group undoes it. The Trash empties itself sixty days after deletion; the permanent purge is deliberately not reachable with an API key. Requires the tensor:tabs:write scope.",
|
|
2043
|
+
{ id: z.number().describe("Tab group ID") },
|
|
2044
|
+
async ({ id }) => {
|
|
2045
|
+
const data = await api("DELETE", `/api/tabs/${id}`);
|
|
2046
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
2047
|
+
}
|
|
2048
|
+
);
|
|
2049
|
+
server2.tool(
|
|
2050
|
+
"restore_tab_group",
|
|
2051
|
+
"Restore a tab group from the Trash, tabs and all. 404 when it is not in the Trash. Requires the tensor:tabs:write scope.",
|
|
2052
|
+
{ id: z.number().describe("Tab group ID") },
|
|
2053
|
+
async ({ id }) => {
|
|
2054
|
+
const data = await api("POST", `/api/tabs/${id}/restore`);
|
|
2055
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
2056
|
+
}
|
|
2057
|
+
);
|
|
1828
2058
|
}
|
|
1829
2059
|
function createApiClient(opts) {
|
|
1830
2060
|
const baseUrl = opts.baseUrl.replace(/\/+$/, "");
|
|
@@ -1857,7 +2087,7 @@ function createApiClient(opts) {
|
|
|
1857
2087
|
// package.json
|
|
1858
2088
|
var package_default = {
|
|
1859
2089
|
name: "@levitating/tensor-mcp",
|
|
1860
|
-
version: "5.
|
|
2090
|
+
version: "5.2.0",
|
|
1861
2091
|
description: "Tensor MCP \u2014 Model Context Protocol server for the Tensor wealth management API. Exposes the Tensor API as tools for Claude, Cursor, Codex, and any MCP-aware client.",
|
|
1862
2092
|
type: "module",
|
|
1863
2093
|
main: "./dist/index.js",
|