@astramindapp/mcp-server 0.24.1 → 0.25.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 +24 -5
- package/dist/integration-guide.d.ts +2 -2
- package/dist/integration-guide.d.ts.map +1 -1
- package/dist/integration-guide.js +22 -6
- package/dist/integration-guide.js.map +1 -1
- package/dist/mind-client.d.ts +13 -0
- package/dist/mind-client.d.ts.map +1 -1
- package/dist/mind-client.js +37 -0
- package/dist/mind-client.js.map +1 -1
- package/dist/server.d.ts +21 -27
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +1343 -178
- package/dist/server.js.map +1 -1
- package/package.json +4 -3
package/dist/server.js
CHANGED
|
@@ -12,33 +12,27 @@
|
|
|
12
12
|
* integration path to use for its runtime, how to authenticate, and the
|
|
13
13
|
* session protocol — without having to be told.
|
|
14
14
|
*
|
|
15
|
-
* Tools (
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* mind_tickets — Admin-only agent ticket queue (file, view, answer,
|
|
37
|
-
* triage, resolve client feedback / bugs / ideas)
|
|
38
|
-
* mind_accounts — Multi-MIND accounts: discover/create MINDs, manage
|
|
39
|
-
* owners and viewers, send invitations
|
|
40
|
-
* mind_list_templates / mind_get_template / mind_save_typed /
|
|
41
|
-
* mind_bootstrap_templates — the 16 Front Layer typed-document templates
|
|
15
|
+
* Tools (44):
|
|
16
|
+
* Memory & knowledge — mind_query, mind_remember, mind_folders,
|
|
17
|
+
* mind_folder_routes, mind_folder_suggest, mind_share (document share
|
|
18
|
+
* links), mind_context, mind_graph, mind_insights, mind_research,
|
|
19
|
+
* mind_train
|
|
20
|
+
* Life & work — mind_life, mind_focuses, mind_tasks, mind_automate,
|
|
21
|
+
* mind_notify, mind_checklists (Kanon checklists)
|
|
22
|
+
* People — mind_crm
|
|
23
|
+
* Social & profile — mind_social, mind_social_analytics, mind_profile,
|
|
24
|
+
* mind_personas
|
|
25
|
+
* Intelligence & trading — mind_sense, mind_trader, mind_osint
|
|
26
|
+
* Front Layer templates — mind_list_templates, mind_get_template,
|
|
27
|
+
* mind_save_typed, mind_bootstrap_templates
|
|
28
|
+
* Fleet & admin (admin key) — mind_agents, mind_tickets, mind_admin,
|
|
29
|
+
* mind_accounts
|
|
30
|
+
* Full-coverage apps (v0.25.0) — mind_mindmap (MIND Mind Map),
|
|
31
|
+
* mind_moneymind (MoneyMIND), mind_budget (13-week cash flow),
|
|
32
|
+
* mind_sheets (Airtable-style tables), mind_email (Email Manager),
|
|
33
|
+
* mind_sign (e-signature), mind_invoices (Invoice Agent),
|
|
34
|
+
* mind_books (MIND Books accounting), mind_timer (Tempo time tracking),
|
|
35
|
+
* mind_forms (Quill forms), mind_library (bookshelf)
|
|
42
36
|
*/
|
|
43
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
38
|
exports.createMindMcpServer = createMindMcpServer;
|
|
@@ -58,6 +52,15 @@ const err = (t) => ({
|
|
|
58
52
|
const ok = (result) => ({
|
|
59
53
|
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
60
54
|
});
|
|
55
|
+
// Required-field guard for the generic action-dispatch tools (mind_mindmap,
|
|
56
|
+
// mind_moneymind, mind_budget, mind_sheets, mind_email, mind_checklists,
|
|
57
|
+
// mind_sign, mind_invoices, mind_books, mind_timer, mind_forms, mind_library).
|
|
58
|
+
// Returns an error string naming every missing field, or null when all are
|
|
59
|
+
// present — call sites do `const m = need(args, [...]); if (m) return err(m);`
|
|
60
|
+
const need = (args, fields) => {
|
|
61
|
+
const missing = fields.filter((f) => args[f] === undefined || args[f] === null || args[f] === "");
|
|
62
|
+
return missing.length ? `Error: ${missing.join(", ")} required for this action.` : null;
|
|
63
|
+
};
|
|
61
64
|
// Backend detail strings beat raw JSON dumps: FastAPI returns
|
|
62
65
|
// {"detail": "..."} (or {"detail": {"message": "..."}}) — surface the
|
|
63
66
|
// human sentence, never the wire body (CLAUDE.md lesson #6).
|
|
@@ -81,7 +84,7 @@ const apiDetail = (e) => {
|
|
|
81
84
|
function createMindMcpServer(client) {
|
|
82
85
|
const server = new mcp_js_1.McpServer({
|
|
83
86
|
name: "mind",
|
|
84
|
-
version: "0.
|
|
87
|
+
version: "0.25.0",
|
|
85
88
|
}, {
|
|
86
89
|
// Returned to every client in the MCP `initialize` response — the first
|
|
87
90
|
// thing any connecting agent sees about how to integrate with MIND.
|
|
@@ -91,7 +94,7 @@ function createMindMcpServer(client) {
|
|
|
91
94
|
// The full integration playbook, readable on demand by any MCP client.
|
|
92
95
|
server.registerResource("integration-guide", "mind://integration-guide", {
|
|
93
96
|
title: "MIND Integration Guide",
|
|
94
|
-
description: "Complete playbook for integrating any AI agent with MIND — the three integration paths (MCP server, OpenClaw plugin, REST API), authentication, the session protocol, all
|
|
97
|
+
description: "Complete playbook for integrating any AI agent with MIND — the three integration paths (MCP server, OpenClaw plugin, REST API), authentication, the session protocol, all 44 tools, REST endpoint mapping, and common recipes.",
|
|
95
98
|
mimeType: "text/markdown",
|
|
96
99
|
}, async (uri) => ({
|
|
97
100
|
contents: [
|
|
@@ -1430,155 +1433,6 @@ function createMindMcpServer(client) {
|
|
|
1430
1433
|
};
|
|
1431
1434
|
}
|
|
1432
1435
|
});
|
|
1433
|
-
// ─── mind_checklists ────────────────────────────────────
|
|
1434
|
-
// The granular level beneath a Task. Shape: Template → Sections[phase] →
|
|
1435
|
-
// Items. Templates (yours + flagship) instantiate into runs attached to a
|
|
1436
|
-
// task or life item; items are toggled and runs completed (which mirrors the
|
|
1437
|
-
// finished checklist into the knowledge graph).
|
|
1438
|
-
server.tool("mind_checklists", "Manage checklists in MIND — the granular level beneath a Task in the Focus→Project→Outcome→Task→Checklist hierarchy. A checklist attaches to a task (parent_type=task) or a Life item (parent_type=life_item) and groups checkable steps into phase-bucketed sections (pre/run/post). Use list_templates/get_template/create_template for reusable blueprints (including global flagship templates), then create a run from a template_id or inline sections_json, toggle_item to check steps, and complete to finish + mirror it into the knowledge graph.", {
|
|
1439
|
-
action: zod_1.z
|
|
1440
|
-
.enum([
|
|
1441
|
-
"list_templates", "get_template", "create_template",
|
|
1442
|
-
"list", "create", "get", "toggle_item", "complete", "delete",
|
|
1443
|
-
])
|
|
1444
|
-
.describe("What to do: list_templates/get_template/create_template (blueprints); list/create/get/toggle_item/complete/delete (runs)"),
|
|
1445
|
-
template_id: zod_1.z.string().optional().describe("Template ID — required for get_template; optional on create (instantiate from a template)"),
|
|
1446
|
-
checklist_id: zod_1.z.string().optional().describe("Checklist run ID — required for get/toggle_item/complete/delete"),
|
|
1447
|
-
item_id: zod_1.z.string().optional().describe("Checklist item ID — required for toggle_item"),
|
|
1448
|
-
title: zod_1.z.string().optional().describe("Title (required for create_template; optional for create run)"),
|
|
1449
|
-
description: zod_1.z.string().optional().describe("Template description (create_template)"),
|
|
1450
|
-
parent_type: zod_1.z.string().optional().describe("Attach a run to: task or life_item (required for create + list filter)"),
|
|
1451
|
-
parent_id: zod_1.z.string().optional().describe("ID of the parent task / life item (required for create)"),
|
|
1452
|
-
parent_label: zod_1.z.string().optional().describe("Optional human label for the parent"),
|
|
1453
|
-
sections_json: zod_1.z.string().optional().describe('Inline sections as JSON, e.g. [{"title":"Setup","phase":"pre","items":[{"label":"do x"}]}] — for create_template or an inline create run'),
|
|
1454
|
-
}, async ({ action, template_id, checklist_id, item_id, title, description, parent_type, parent_id, parent_label, sections_json }) => {
|
|
1455
|
-
try {
|
|
1456
|
-
const parseSections = () => {
|
|
1457
|
-
if (!sections_json)
|
|
1458
|
-
return undefined;
|
|
1459
|
-
const parsed = JSON.parse(sections_json);
|
|
1460
|
-
if (!Array.isArray(parsed))
|
|
1461
|
-
throw new Error("sections_json must be a JSON array of sections");
|
|
1462
|
-
return parsed;
|
|
1463
|
-
};
|
|
1464
|
-
const fmtTemplate = (t) => {
|
|
1465
|
-
const secCount = (t.sections ?? []).length;
|
|
1466
|
-
const itemCount = (t.sections ?? []).reduce((n, s) => n + (s.items?.length ?? 0), 0);
|
|
1467
|
-
return `• ${t.title}${t.origin === "flagship" ? " ⭐ flagship" : ""} — ${secCount} section(s), ${itemCount} item(s) — id: ${t.template_id}`;
|
|
1468
|
-
};
|
|
1469
|
-
const fmtSections = (sections) => (sections ?? [])
|
|
1470
|
-
.map((s) => {
|
|
1471
|
-
const head = ` [${s.phase}] ${s.title}`;
|
|
1472
|
-
const items = (s.items ?? [])
|
|
1473
|
-
.map((it) => ` ${it.checked ? "[x]" : "[ ]"} ${it.label} — id: ${it.item_id}`)
|
|
1474
|
-
.join("\n");
|
|
1475
|
-
return items ? `${head}\n${items}` : head;
|
|
1476
|
-
})
|
|
1477
|
-
.join("\n");
|
|
1478
|
-
const fmtChecklist = (c, withItems = false) => {
|
|
1479
|
-
const p = c.progress ?? { done: 0, total: 0, pct: 0 };
|
|
1480
|
-
const head = `• ${c.title} (${p.done}/${p.total}, ${p.pct}%)` +
|
|
1481
|
-
`${c.completed_at ? " ✅ complete" : ""}` +
|
|
1482
|
-
`${c.parent_label ? `, on ${c.parent_label}` : ""} — id: ${c.checklist_id}`;
|
|
1483
|
-
return withItems ? `${head}\n${fmtSections(c.sections ?? [])}` : head;
|
|
1484
|
-
};
|
|
1485
|
-
switch (action) {
|
|
1486
|
-
case "list_templates": {
|
|
1487
|
-
const result = await client.listChecklistTemplates();
|
|
1488
|
-
const templates = result.templates ?? [];
|
|
1489
|
-
if (templates.length === 0) {
|
|
1490
|
-
return { content: [{ type: "text", text: "No checklist templates found." }] };
|
|
1491
|
-
}
|
|
1492
|
-
return {
|
|
1493
|
-
content: [{
|
|
1494
|
-
type: "text",
|
|
1495
|
-
text: `${result.total} template(s):\n` + templates.map(fmtTemplate).join("\n"),
|
|
1496
|
-
}],
|
|
1497
|
-
};
|
|
1498
|
-
}
|
|
1499
|
-
case "get_template": {
|
|
1500
|
-
if (!template_id) {
|
|
1501
|
-
return { content: [{ type: "text", text: "Error: template_id is required for get_template" }], isError: true };
|
|
1502
|
-
}
|
|
1503
|
-
const t = await client.getChecklistTemplate(template_id);
|
|
1504
|
-
return {
|
|
1505
|
-
content: [{
|
|
1506
|
-
type: "text",
|
|
1507
|
-
text: `${fmtTemplate(t)}${t.description ? `\n${t.description}` : ""}\n${fmtSections(t.sections ?? [])}`,
|
|
1508
|
-
}],
|
|
1509
|
-
};
|
|
1510
|
-
}
|
|
1511
|
-
case "create_template": {
|
|
1512
|
-
if (!title) {
|
|
1513
|
-
return { content: [{ type: "text", text: "Error: title is required to create a template" }], isError: true };
|
|
1514
|
-
}
|
|
1515
|
-
const t = await client.createChecklistTemplate({
|
|
1516
|
-
title, description, sections: parseSections(),
|
|
1517
|
-
});
|
|
1518
|
-
return { content: [{ type: "text", text: `✅ Created template: ${fmtTemplate(t)}` }] };
|
|
1519
|
-
}
|
|
1520
|
-
case "list": {
|
|
1521
|
-
const result = await client.listChecklists(parent_type, parent_id);
|
|
1522
|
-
const checklists = result.checklists ?? [];
|
|
1523
|
-
if (checklists.length === 0) {
|
|
1524
|
-
return { content: [{ type: "text", text: "No checklists found." }] };
|
|
1525
|
-
}
|
|
1526
|
-
return {
|
|
1527
|
-
content: [{
|
|
1528
|
-
type: "text",
|
|
1529
|
-
text: `${result.total} checklist(s):\n` + checklists.map((c) => fmtChecklist(c)).join("\n"),
|
|
1530
|
-
}],
|
|
1531
|
-
};
|
|
1532
|
-
}
|
|
1533
|
-
case "create": {
|
|
1534
|
-
if (!parent_type || !parent_id) {
|
|
1535
|
-
return { content: [{ type: "text", text: "Error: parent_type and parent_id are required to create a checklist run" }], isError: true };
|
|
1536
|
-
}
|
|
1537
|
-
const c = await client.createChecklist({
|
|
1538
|
-
parent_type, parent_id, parent_label, title,
|
|
1539
|
-
template_id, sections: parseSections(),
|
|
1540
|
-
});
|
|
1541
|
-
return { content: [{ type: "text", text: `✅ Created checklist:\n${fmtChecklist(c, true)}` }] };
|
|
1542
|
-
}
|
|
1543
|
-
case "get": {
|
|
1544
|
-
if (!checklist_id) {
|
|
1545
|
-
return { content: [{ type: "text", text: "Error: checklist_id is required for get" }], isError: true };
|
|
1546
|
-
}
|
|
1547
|
-
const c = await client.getChecklist(checklist_id);
|
|
1548
|
-
return { content: [{ type: "text", text: fmtChecklist(c, true) }] };
|
|
1549
|
-
}
|
|
1550
|
-
case "toggle_item": {
|
|
1551
|
-
if (!checklist_id || !item_id) {
|
|
1552
|
-
return { content: [{ type: "text", text: "Error: checklist_id and item_id are required for toggle_item" }], isError: true };
|
|
1553
|
-
}
|
|
1554
|
-
const c = await client.toggleChecklistItem(checklist_id, item_id);
|
|
1555
|
-
return { content: [{ type: "text", text: `✅ Toggled item:\n${fmtChecklist(c, true)}` }] };
|
|
1556
|
-
}
|
|
1557
|
-
case "complete": {
|
|
1558
|
-
if (!checklist_id) {
|
|
1559
|
-
return { content: [{ type: "text", text: "Error: checklist_id is required for complete" }], isError: true };
|
|
1560
|
-
}
|
|
1561
|
-
const c = await client.completeChecklist(checklist_id);
|
|
1562
|
-
return { content: [{ type: "text", text: `✅ Completed checklist "${c.title}" — mirrored to the knowledge graph.` }] };
|
|
1563
|
-
}
|
|
1564
|
-
case "delete": {
|
|
1565
|
-
if (!checklist_id) {
|
|
1566
|
-
return { content: [{ type: "text", text: "Error: checklist_id is required for delete" }], isError: true };
|
|
1567
|
-
}
|
|
1568
|
-
await client.deleteChecklist(checklist_id);
|
|
1569
|
-
return { content: [{ type: "text", text: `🗑️ Deleted checklist ${checklist_id}` }] };
|
|
1570
|
-
}
|
|
1571
|
-
default:
|
|
1572
|
-
return { content: [{ type: "text", text: `Unknown action: ${action}` }], isError: true };
|
|
1573
|
-
}
|
|
1574
|
-
}
|
|
1575
|
-
catch (err) {
|
|
1576
|
-
return {
|
|
1577
|
-
content: [{ type: "text", text: `mind_checklists error: ${err instanceof Error ? err.message : String(err)}` }],
|
|
1578
|
-
isError: true,
|
|
1579
|
-
};
|
|
1580
|
-
}
|
|
1581
|
-
});
|
|
1582
1436
|
// ─── mind_crm ───────────────────────────────────────────
|
|
1583
1437
|
// Read/write contacts, interactions, and activities.
|
|
1584
1438
|
// Enhanced: delete, get, log_activity, list_activities.
|
|
@@ -5007,6 +4861,1317 @@ function createMindMcpServer(client) {
|
|
|
5007
4861
|
return err(`mind_trader error: ${e instanceof Error ? e.message : String(e)}`);
|
|
5008
4862
|
}
|
|
5009
4863
|
});
|
|
4864
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
4865
|
+
// FULL-COVERAGE APP TOOLS (v0.25.0) — mind_mindmap, mind_moneymind,
|
|
4866
|
+
// mind_budget, mind_sheets, mind_email, mind_checklists, mind_sign,
|
|
4867
|
+
// mind_invoices, mind_books, mind_timer, mind_forms, mind_library
|
|
4868
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
4869
|
+
// ─── mind_mindmap ───────────────────────────────────────
|
|
4870
|
+
server.tool("mind_mindmap", "MIND Mind Map — visual mind-mapping canvases at m-i-n-d.ai/#/mind-map. Actions: list, get, create, update, delete, get_shared (read a publicly shared map, no auth needed). Sharing, collaborators and AI generation from a prompt or project stay in the web app at m-i-n-d.ai/#/mind-map.", {
|
|
4871
|
+
action: zod_1.z
|
|
4872
|
+
.enum(["list", "get", "create", "update", "delete", "get_shared"])
|
|
4873
|
+
.describe("Which mind-map operation to perform."),
|
|
4874
|
+
map_id: zod_1.z.string().optional().describe("Mind map id — required for get/update/delete."),
|
|
4875
|
+
name: zod_1.z.string().optional().describe("Map name/title — create/update (defaults to 'Untitled map' on create)."),
|
|
4876
|
+
data: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional().describe("Map contents: {nodes, edges, camera, defaults, nextId, notes} — create/update."),
|
|
4877
|
+
thumbnail: zod_1.z.string().optional().describe("Base64/data-url thumbnail image — create/update."),
|
|
4878
|
+
share_id: zod_1.z.string().optional().describe("Public share id — required for get_shared."),
|
|
4879
|
+
}, async (args) => {
|
|
4880
|
+
const { action } = args;
|
|
4881
|
+
try {
|
|
4882
|
+
switch (action) {
|
|
4883
|
+
case "list":
|
|
4884
|
+
return ok(await client.call("GET", "/mindmaps", args));
|
|
4885
|
+
case "get": {
|
|
4886
|
+
const m = need(args, ["map_id"]);
|
|
4887
|
+
if (m)
|
|
4888
|
+
return err(m);
|
|
4889
|
+
return ok(await client.call("GET", "/mindmaps/{map_id}", args, ["map_id"]));
|
|
4890
|
+
}
|
|
4891
|
+
case "create":
|
|
4892
|
+
return ok(await client.call("POST", "/mindmaps", args, [], [], ["name", "data", "thumbnail"]));
|
|
4893
|
+
case "update": {
|
|
4894
|
+
const m = need(args, ["map_id"]);
|
|
4895
|
+
if (m)
|
|
4896
|
+
return err(m);
|
|
4897
|
+
return ok(await client.call("PUT", "/mindmaps/{map_id}", args, ["map_id"], [], ["name", "data", "thumbnail"]));
|
|
4898
|
+
}
|
|
4899
|
+
case "delete": {
|
|
4900
|
+
const m = need(args, ["map_id"]);
|
|
4901
|
+
if (m)
|
|
4902
|
+
return err(m);
|
|
4903
|
+
return ok(await client.call("DELETE", "/mindmaps/{map_id}", args, ["map_id"]));
|
|
4904
|
+
}
|
|
4905
|
+
case "get_shared": {
|
|
4906
|
+
const m = need(args, ["share_id"]);
|
|
4907
|
+
if (m)
|
|
4908
|
+
return err(m);
|
|
4909
|
+
return ok(await client.call("GET", "/mindmaps/shared/{share_id}", args, ["share_id"]));
|
|
4910
|
+
}
|
|
4911
|
+
default: {
|
|
4912
|
+
const _exhaustive = action;
|
|
4913
|
+
return err(`Unknown action: ${_exhaustive}`);
|
|
4914
|
+
}
|
|
4915
|
+
}
|
|
4916
|
+
}
|
|
4917
|
+
catch (e) {
|
|
4918
|
+
if (e instanceof mind_client_js_1.MindApiError)
|
|
4919
|
+
return err(`mind_mindmap ${action} failed (HTTP ${e.status}): ${apiDetail(e)}`);
|
|
4920
|
+
return err(`mind_mindmap error: ${e instanceof Error ? e.message : String(e)}`);
|
|
4921
|
+
}
|
|
4922
|
+
});
|
|
4923
|
+
// ─── mind_moneymind ─────────────────────────────────────
|
|
4924
|
+
server.tool("mind_moneymind", "MoneyMIND — personal finance at m-i-n-d.ai/#/moneyMIND: accounts, transactions, categories, budgets, recurring bills, net worth, goals, credit, alerts, bill negotiation, bank statements. Actions: overview, accounts_list, account_create, account_update, account_delete, transactions_list, transaction_create, transaction_update, transaction_split, spending_summary, categories_list, category_create, rules_list, rule_create, rule_delete, budgets_list, budget_set, budget_delete, recurring_list, recurring_update, recurring_cancel, networth, networth_manual, networth_snapshot, goals_list, goal_create, goal_update, goal_delete, credit, alerts_config, alerts_config_set, alerts_feed, negotiate_list, negotiate_create, statements_list, statement_get, statement_delete. Note: rule_create's REST body field 'action' is exposed here as `rule_action` (an 'action' field would collide with this tool's own dispatch key).", {
|
|
4925
|
+
action: zod_1.z
|
|
4926
|
+
.enum([
|
|
4927
|
+
"overview", "accounts_list", "account_create", "account_update", "account_delete",
|
|
4928
|
+
"transactions_list", "transaction_create", "transaction_update", "transaction_split",
|
|
4929
|
+
"spending_summary", "categories_list", "category_create", "rules_list", "rule_create", "rule_delete",
|
|
4930
|
+
"budgets_list", "budget_set", "budget_delete", "recurring_list", "recurring_update", "recurring_cancel",
|
|
4931
|
+
"networth", "networth_manual", "networth_snapshot", "goals_list", "goal_create", "goal_update", "goal_delete",
|
|
4932
|
+
"credit", "alerts_config", "alerts_config_set", "alerts_feed", "negotiate_list", "negotiate_create",
|
|
4933
|
+
"statements_list", "statement_get", "statement_delete",
|
|
4934
|
+
])
|
|
4935
|
+
.describe("Which MoneyMIND operation to perform."),
|
|
4936
|
+
account_id: zod_1.z.string().optional().describe("Account id — account_update/account_delete; also filters transactions_list."),
|
|
4937
|
+
name: zod_1.z.string().optional().describe("Display name — account_create/category_create/goal_create/goal_update/networth_manual."),
|
|
4938
|
+
type: zod_1.z.enum(["checking", "savings", "credit", "loan", "investment", "manual"]).optional().describe("Account type — account_create (default 'manual')."),
|
|
4939
|
+
balance_cents: zod_1.z.number().int().optional().describe("Balance in cents — account_create/account_update."),
|
|
4940
|
+
institution: zod_1.z.string().optional().describe("Bank/institution name — account_create/account_update."),
|
|
4941
|
+
mask: zod_1.z.string().optional().describe("Last-4 account mask — account_create."),
|
|
4942
|
+
currency: zod_1.z.string().optional().describe("ISO currency code — account_create (default 'USD')."),
|
|
4943
|
+
hidden: zod_1.z.boolean().optional().describe("Hide from overview — account_update/recurring_update."),
|
|
4944
|
+
txn_id: zod_1.z.string().optional().describe("Transaction id — transaction_update/transaction_split."),
|
|
4945
|
+
from: zod_1.z.string().optional().describe("Start date (YYYY-MM-DD) — transactions_list filter."),
|
|
4946
|
+
to: zod_1.z.string().optional().describe("End date (YYYY-MM-DD) — transactions_list filter."),
|
|
4947
|
+
category: zod_1.z.string().optional().describe("Category name — transactions_list filter / transaction_create / transaction_update; also the path segment for budget_set/budget_delete."),
|
|
4948
|
+
search: zod_1.z.string().optional().describe("Free-text search — transactions_list filter."),
|
|
4949
|
+
limit: zod_1.z.number().int().optional().describe("Max results — transactions_list."),
|
|
4950
|
+
cursor: zod_1.z.string().optional().describe("Pagination cursor — transactions_list."),
|
|
4951
|
+
recurring: zod_1.z.boolean().optional().describe("Filter to recurring transactions — transactions_list."),
|
|
4952
|
+
excluded: zod_1.z.boolean().optional().describe("Filter by excluded flag — transactions_list filter; also set on transaction_update."),
|
|
4953
|
+
date: zod_1.z.string().optional().describe("Transaction date (YYYY-MM-DD) — required for transaction_create."),
|
|
4954
|
+
amount_cents: zod_1.z.number().int().optional().describe("Amount in cents — required for transaction_create."),
|
|
4955
|
+
merchant: zod_1.z.string().optional().describe("Merchant name — transaction_create (required)/transaction_update."),
|
|
4956
|
+
notes: zod_1.z.string().optional().describe("Free-text notes — transaction_update/negotiate context fields elsewhere."),
|
|
4957
|
+
splits: zod_1.z.array(zod_1.z.record(zod_1.z.string(), zod_1.z.any())).optional().describe("[{category, amount_cents}] — transaction_split (required) / transaction_update."),
|
|
4958
|
+
period: zod_1.z.string().optional().describe("Summary period, e.g. 'month' — spending_summary (default 'month')."),
|
|
4959
|
+
anchor: zod_1.z.string().optional().describe("Anchor date (YYYY-MM-DD) for spending_summary."),
|
|
4960
|
+
group: zod_1.z.string().optional().describe("Category group — category_create (default 'Other')."),
|
|
4961
|
+
icon: zod_1.z.string().optional().describe("Icon name — category_create."),
|
|
4962
|
+
color: zod_1.z.string().optional().describe("Color hex/token — category_create."),
|
|
4963
|
+
match: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional().describe("{field: 'merchant'|'raw_name'|'amount_cents', op: 'contains'|'equals'|'starts_with'|'gt'|'lt', value} — required for rule_create."),
|
|
4964
|
+
rule_action: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional().describe("{set_category?, exclude?, assign_bill?} — required for rule_create. Maps to the REST body field named 'action'."),
|
|
4965
|
+
rule_id: zod_1.z.string().optional().describe("Rule id — required for rule_delete."),
|
|
4966
|
+
limit_cents: zod_1.z.number().int().optional().describe("Monthly limit in cents — required for budget_set."),
|
|
4967
|
+
rollover: zod_1.z.boolean().optional().describe("Roll unused budget forward — budget_set."),
|
|
4968
|
+
recurring_id: zod_1.z.string().optional().describe("Recurring bill id — recurring_update/recurring_cancel."),
|
|
4969
|
+
status: zod_1.z.string().optional().describe("New status ('active'|'inactive'|'cancel_requested'|'cancelled') — recurring_update."),
|
|
4970
|
+
reason: zod_1.z.string().optional().describe("Cancellation reason — recurring_cancel."),
|
|
4971
|
+
kind: zod_1.z.enum(["asset", "liability"]).optional().describe("Manual net-worth item kind — networth_manual (default 'asset')."),
|
|
4972
|
+
value_cents: zod_1.z.number().int().optional().describe("Value in cents — required for networth_manual."),
|
|
4973
|
+
goal_id: zod_1.z.string().optional().describe("Savings goal id — goal_update/goal_delete."),
|
|
4974
|
+
target_cents: zod_1.z.number().int().optional().describe("Goal target in cents — required for goal_create; goal_update."),
|
|
4975
|
+
mode: zod_1.z.enum(["autopilot", "custom"]).optional().describe("Goal funding mode — goal_create (default 'custom')/goal_update."),
|
|
4976
|
+
ambition: zod_1.z.string().optional().describe("Free-text ambition note — goal_create/goal_update."),
|
|
4977
|
+
monthly_cents: zod_1.z.number().int().optional().describe("Monthly contribution in cents — goal_create/goal_update."),
|
|
4978
|
+
saved_cents: zod_1.z.number().int().optional().describe("Amount saved so far in cents — goal_update."),
|
|
4979
|
+
alert_type: zod_1.z.string().optional().describe("Alert type key — required for alerts_config_set. Maps to the REST body field 'type'."),
|
|
4980
|
+
enabled: zod_1.z.boolean().optional().describe("Enable/disable the alert — alerts_config_set (default true)."),
|
|
4981
|
+
threshold_cents: zod_1.z.number().int().optional().describe("Alert threshold in cents — alerts_config_set."),
|
|
4982
|
+
channels: zod_1.z.array(zod_1.z.string()).optional().describe("Notification channels — alerts_config_set."),
|
|
4983
|
+
bill_id: zod_1.z.string().optional().describe("Bill id to negotiate — negotiate_create."),
|
|
4984
|
+
provider: zod_1.z.string().optional().describe("Provider/company name — required for negotiate_create."),
|
|
4985
|
+
statement_doc_id: zod_1.z.string().optional().describe("Linked statement document id — negotiate_create."),
|
|
4986
|
+
statement_id: zod_1.z.string().optional().describe("Bank statement id — required for statement_get/statement_delete."),
|
|
4987
|
+
}, async (args) => {
|
|
4988
|
+
const { action } = args;
|
|
4989
|
+
const base = "/developer/v1/moneymind";
|
|
4990
|
+
try {
|
|
4991
|
+
switch (action) {
|
|
4992
|
+
case "overview":
|
|
4993
|
+
return ok(await client.call("GET", `${base}/overview`, args));
|
|
4994
|
+
case "accounts_list":
|
|
4995
|
+
return ok(await client.call("GET", `${base}/accounts`, args));
|
|
4996
|
+
case "account_create":
|
|
4997
|
+
return ok(await client.call("POST", `${base}/accounts`, args, [], [], ["name", "type", "balance_cents", "institution", "mask", "currency"]));
|
|
4998
|
+
case "account_update": {
|
|
4999
|
+
const m = need(args, ["account_id"]);
|
|
5000
|
+
if (m)
|
|
5001
|
+
return err(m);
|
|
5002
|
+
return ok(await client.call("PATCH", `${base}/accounts/{account_id}`, args, ["account_id"], [], ["name", "balance_cents", "hidden", "institution"]));
|
|
5003
|
+
}
|
|
5004
|
+
case "account_delete": {
|
|
5005
|
+
const m = need(args, ["account_id"]);
|
|
5006
|
+
if (m)
|
|
5007
|
+
return err(m);
|
|
5008
|
+
return ok(await client.call("DELETE", `${base}/accounts/{account_id}`, args, ["account_id"]));
|
|
5009
|
+
}
|
|
5010
|
+
case "transactions_list":
|
|
5011
|
+
return ok(await client.call("GET", `${base}/transactions`, args, [], [
|
|
5012
|
+
"from", "to", "account_id", "category", "search", "limit", "cursor", "recurring", "excluded",
|
|
5013
|
+
]));
|
|
5014
|
+
case "transaction_create": {
|
|
5015
|
+
const m = need(args, ["date", "amount_cents", "merchant", "account_id"]);
|
|
5016
|
+
if (m)
|
|
5017
|
+
return err(m);
|
|
5018
|
+
return ok(await client.call("POST", `${base}/transactions`, args, [], [], ["date", "amount_cents", "merchant", "category", "account_id", "notes"]));
|
|
5019
|
+
}
|
|
5020
|
+
case "transaction_update": {
|
|
5021
|
+
const m = need(args, ["txn_id"]);
|
|
5022
|
+
if (m)
|
|
5023
|
+
return err(m);
|
|
5024
|
+
return ok(await client.call("PATCH", `${base}/transactions/{txn_id}`, args, ["txn_id"], [], ["category", "notes", "excluded", "splits", "merchant"]));
|
|
5025
|
+
}
|
|
5026
|
+
case "transaction_split": {
|
|
5027
|
+
const m = need(args, ["txn_id", "splits"]);
|
|
5028
|
+
if (m)
|
|
5029
|
+
return err(m);
|
|
5030
|
+
return ok(await client.call("POST", `${base}/transactions/{txn_id}/split`, args, ["txn_id"], [], ["splits"]));
|
|
5031
|
+
}
|
|
5032
|
+
case "spending_summary":
|
|
5033
|
+
return ok(await client.call("GET", `${base}/spending/summary`, args, [], ["period", "anchor"]));
|
|
5034
|
+
case "categories_list":
|
|
5035
|
+
return ok(await client.call("GET", `${base}/categories`, args));
|
|
5036
|
+
case "category_create": {
|
|
5037
|
+
const m = need(args, ["name"]);
|
|
5038
|
+
if (m)
|
|
5039
|
+
return err(m);
|
|
5040
|
+
return ok(await client.call("POST", `${base}/categories`, args, [], [], ["name", "group", "icon", "color"]));
|
|
5041
|
+
}
|
|
5042
|
+
case "rules_list":
|
|
5043
|
+
return ok(await client.call("GET", `${base}/rules`, args));
|
|
5044
|
+
case "rule_create": {
|
|
5045
|
+
const m = need(args, ["match", "rule_action"]);
|
|
5046
|
+
if (m)
|
|
5047
|
+
return err(m);
|
|
5048
|
+
const body = { ...args, action: args.rule_action };
|
|
5049
|
+
return ok(await client.call("POST", `${base}/rules`, body, [], [], ["match", "action"]));
|
|
5050
|
+
}
|
|
5051
|
+
case "rule_delete": {
|
|
5052
|
+
const m = need(args, ["rule_id"]);
|
|
5053
|
+
if (m)
|
|
5054
|
+
return err(m);
|
|
5055
|
+
return ok(await client.call("DELETE", `${base}/rules/{rule_id}`, args, ["rule_id"]));
|
|
5056
|
+
}
|
|
5057
|
+
case "budgets_list":
|
|
5058
|
+
return ok(await client.call("GET", `${base}/budgets`, args));
|
|
5059
|
+
case "budget_set": {
|
|
5060
|
+
const m = need(args, ["category", "limit_cents"]);
|
|
5061
|
+
if (m)
|
|
5062
|
+
return err(m);
|
|
5063
|
+
return ok(await client.call("PUT", `${base}/budgets/{category}`, args, ["category"], [], ["limit_cents", "rollover"]));
|
|
5064
|
+
}
|
|
5065
|
+
case "budget_delete": {
|
|
5066
|
+
const m = need(args, ["category"]);
|
|
5067
|
+
if (m)
|
|
5068
|
+
return err(m);
|
|
5069
|
+
return ok(await client.call("DELETE", `${base}/budgets/{category}`, args, ["category"]));
|
|
5070
|
+
}
|
|
5071
|
+
case "recurring_list":
|
|
5072
|
+
return ok(await client.call("GET", `${base}/recurring`, args));
|
|
5073
|
+
case "recurring_update": {
|
|
5074
|
+
const m = need(args, ["recurring_id"]);
|
|
5075
|
+
if (m)
|
|
5076
|
+
return err(m);
|
|
5077
|
+
return ok(await client.call("PATCH", `${base}/recurring/{recurring_id}`, args, ["recurring_id"], [], ["status", "category", "hidden"]));
|
|
5078
|
+
}
|
|
5079
|
+
case "recurring_cancel": {
|
|
5080
|
+
const m = need(args, ["recurring_id"]);
|
|
5081
|
+
if (m)
|
|
5082
|
+
return err(m);
|
|
5083
|
+
return ok(await client.call("POST", `${base}/recurring/{recurring_id}/cancel`, args, ["recurring_id"], [], ["reason"]));
|
|
5084
|
+
}
|
|
5085
|
+
case "networth":
|
|
5086
|
+
return ok(await client.call("GET", `${base}/networth`, args));
|
|
5087
|
+
case "networth_manual": {
|
|
5088
|
+
const m = need(args, ["name", "value_cents"]);
|
|
5089
|
+
if (m)
|
|
5090
|
+
return err(m);
|
|
5091
|
+
return ok(await client.call("POST", `${base}/networth/manual`, args, [], [], ["name", "kind", "value_cents"]));
|
|
5092
|
+
}
|
|
5093
|
+
case "networth_snapshot":
|
|
5094
|
+
return ok(await client.call("POST", `${base}/networth/snapshot`, args));
|
|
5095
|
+
case "goals_list":
|
|
5096
|
+
return ok(await client.call("GET", `${base}/goals`, args));
|
|
5097
|
+
case "goal_create": {
|
|
5098
|
+
const m = need(args, ["name", "target_cents"]);
|
|
5099
|
+
if (m)
|
|
5100
|
+
return err(m);
|
|
5101
|
+
return ok(await client.call("POST", `${base}/goals`, args, [], [], ["name", "target_cents", "mode", "ambition", "monthly_cents"]));
|
|
5102
|
+
}
|
|
5103
|
+
case "goal_update": {
|
|
5104
|
+
const m = need(args, ["goal_id"]);
|
|
5105
|
+
if (m)
|
|
5106
|
+
return err(m);
|
|
5107
|
+
return ok(await client.call("PATCH", `${base}/goals/{goal_id}`, args, ["goal_id"], [], [
|
|
5108
|
+
"name", "target_cents", "saved_cents", "monthly_cents", "ambition", "mode",
|
|
5109
|
+
]));
|
|
5110
|
+
}
|
|
5111
|
+
case "goal_delete": {
|
|
5112
|
+
const m = need(args, ["goal_id"]);
|
|
5113
|
+
if (m)
|
|
5114
|
+
return err(m);
|
|
5115
|
+
return ok(await client.call("DELETE", `${base}/goals/{goal_id}`, args, ["goal_id"]));
|
|
5116
|
+
}
|
|
5117
|
+
case "credit":
|
|
5118
|
+
return ok(await client.call("GET", `${base}/credit`, args));
|
|
5119
|
+
case "alerts_config":
|
|
5120
|
+
return ok(await client.call("GET", `${base}/alerts/config`, args));
|
|
5121
|
+
case "alerts_config_set": {
|
|
5122
|
+
const m = need(args, ["alert_type"]);
|
|
5123
|
+
if (m)
|
|
5124
|
+
return err(m);
|
|
5125
|
+
const body = { ...args, type: args.alert_type };
|
|
5126
|
+
return ok(await client.call("PUT", `${base}/alerts/config`, body, [], [], ["type", "enabled", "threshold_cents", "channels"]));
|
|
5127
|
+
}
|
|
5128
|
+
case "alerts_feed":
|
|
5129
|
+
return ok(await client.call("GET", `${base}/alerts/feed`, args));
|
|
5130
|
+
case "negotiate_list":
|
|
5131
|
+
return ok(await client.call("GET", `${base}/negotiate`, args));
|
|
5132
|
+
case "negotiate_create": {
|
|
5133
|
+
const m = need(args, ["provider"]);
|
|
5134
|
+
if (m)
|
|
5135
|
+
return err(m);
|
|
5136
|
+
return ok(await client.call("POST", `${base}/negotiate`, args, [], [], ["bill_id", "recurring_id", "provider", "statement_doc_id"]));
|
|
5137
|
+
}
|
|
5138
|
+
case "statements_list":
|
|
5139
|
+
return ok(await client.call("GET", `${base}/statements`, args));
|
|
5140
|
+
case "statement_get": {
|
|
5141
|
+
const m = need(args, ["statement_id"]);
|
|
5142
|
+
if (m)
|
|
5143
|
+
return err(m);
|
|
5144
|
+
return ok(await client.call("GET", `${base}/statements/{statement_id}`, args, ["statement_id"]));
|
|
5145
|
+
}
|
|
5146
|
+
case "statement_delete": {
|
|
5147
|
+
const m = need(args, ["statement_id"]);
|
|
5148
|
+
if (m)
|
|
5149
|
+
return err(m);
|
|
5150
|
+
return ok(await client.call("DELETE", `${base}/statements/{statement_id}`, args, ["statement_id"]));
|
|
5151
|
+
}
|
|
5152
|
+
default: {
|
|
5153
|
+
const _exhaustive = action;
|
|
5154
|
+
return err(`Unknown action: ${_exhaustive}`);
|
|
5155
|
+
}
|
|
5156
|
+
}
|
|
5157
|
+
}
|
|
5158
|
+
catch (e) {
|
|
5159
|
+
if (e instanceof mind_client_js_1.MindApiError)
|
|
5160
|
+
return err(`mind_moneymind ${action} failed (HTTP ${e.status}): ${apiDetail(e)}`);
|
|
5161
|
+
return err(`mind_moneymind error: ${e instanceof Error ? e.message : String(e)}`);
|
|
5162
|
+
}
|
|
5163
|
+
});
|
|
5164
|
+
// ─── mind_budget ────────────────────────────────────────
|
|
5165
|
+
server.tool("mind_budget", "MIND Budget — 13-week cash-flow planner at m-i-n-d.ai/#/budget. Actions: overview, set_cells, set_starting, set_rows, row_create, row_update, row_delete, rows_reorder, row_cancel, row_restore, set_goals, set_quarter, variance, roll_forward, autofill_from_statement, autofill_accept, build_from_statements, build_accept, automanage_health.", {
|
|
5166
|
+
action: zod_1.z
|
|
5167
|
+
.enum([
|
|
5168
|
+
"overview", "set_cells", "set_starting", "set_rows", "row_create", "row_update", "row_delete",
|
|
5169
|
+
"rows_reorder", "row_cancel", "row_restore", "set_goals", "set_quarter", "variance", "roll_forward",
|
|
5170
|
+
"autofill_from_statement", "autofill_accept", "build_from_statements", "build_accept", "automanage_health",
|
|
5171
|
+
])
|
|
5172
|
+
.describe("Which 13-week budget operation to perform."),
|
|
5173
|
+
cells: zod_1.z.array(zod_1.z.record(zod_1.z.string(), zod_1.z.any())).optional().describe("[{quarter_id, layer: 'projected'|'actual', row_id, week_index 0-12, amount_cents}] — set_cells."),
|
|
5174
|
+
quarter_id: zod_1.z.string().optional().describe("Quarter id — set_starting (required), variance (required), roll_forward/autofill_*/build_* (required)."),
|
|
5175
|
+
layer: zod_1.z.enum(["projected", "actual"]).optional().describe("Which layer to write — set_starting (required)."),
|
|
5176
|
+
starting_cents: zod_1.z.number().int().optional().describe("Starting cash balance in cents — required for set_starting."),
|
|
5177
|
+
rows: zod_1.z.array(zod_1.z.record(zod_1.z.string(), zod_1.z.any())).optional().describe("[{id?, label, group: 'receipt'|'paidout'|'paidout2', order}] — set_rows (replaces the whole row set)."),
|
|
5178
|
+
row_id: zod_1.z.string().optional().describe("Row id — row_update/row_delete/row_cancel/row_restore."),
|
|
5179
|
+
label: zod_1.z.string().optional().describe("Row label — required for row_create; row_update."),
|
|
5180
|
+
group: zod_1.z.enum(["receipt", "paidout", "paidout2"]).optional().describe("Row group — row_create (default 'paidout')/row_update."),
|
|
5181
|
+
order: zod_1.z.number().int().optional().describe("Sort order — row_create/row_update."),
|
|
5182
|
+
category: zod_1.z.string().optional().describe("Category tag — row_create/row_update."),
|
|
5183
|
+
orders: zod_1.z.array(zod_1.z.record(zod_1.z.string(), zod_1.z.any())).optional().describe("[{id, order}] — rows_reorder."),
|
|
5184
|
+
from_week: zod_1.z.number().int().optional().describe("Week index 0-12 to cancel from — row_cancel (defaults to current week)."),
|
|
5185
|
+
note: zod_1.z.string().optional().describe("Free-text note — row_cancel."),
|
|
5186
|
+
goals: zod_1.z.array(zod_1.z.string()).optional().describe("Headline goal strings — set_goals."),
|
|
5187
|
+
label_text: zod_1.z.string().optional().describe("Quarter label, e.g. 'Q1 2027' — set_quarter. Maps to the REST body field 'label'."),
|
|
5188
|
+
start_date: zod_1.z.string().optional().describe("Quarter start date (YYYY-MM-DD) — set_quarter."),
|
|
5189
|
+
carry_ending: zod_1.z.boolean().optional().describe("Carry the previous quarter's ending balance forward — set_quarter (default true)."),
|
|
5190
|
+
threshold_pct: zod_1.z.number().optional().describe("Variance alert threshold percent — variance (server default 20)."),
|
|
5191
|
+
create_next: zod_1.z.boolean().optional().describe("Create the next quarter — roll_forward (default true)."),
|
|
5192
|
+
as_of: zod_1.z.string().optional().describe("As-of date (YYYY-MM-DD) — roll_forward."),
|
|
5193
|
+
transactions: zod_1.z.array(zod_1.z.record(zod_1.z.string(), zod_1.z.any())).optional().describe("[{date, amount?, amount_cents?, merchant?, description?, category?, direction?}] — autofill_from_statement/build_from_statements."),
|
|
5194
|
+
apply: zod_1.z.boolean().optional().describe("Apply the autofill immediately — autofill_from_statement (default false)."),
|
|
5195
|
+
proposal_ids: zod_1.z.array(zod_1.z.string()).optional().describe("Which autofill proposals to accept — autofill_accept (empty = accept all)."),
|
|
5196
|
+
replace_rows: zod_1.z.boolean().optional().describe("Replace existing rows — build_from_statements/build_accept (default true)."),
|
|
5197
|
+
align_to_statement: zod_1.z.boolean().optional().describe("Align cells to statement dates — build_from_statements (default true)."),
|
|
5198
|
+
proposal: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional().describe("The full BuildProposal object returned by build_from_statements — required for build_accept."),
|
|
5199
|
+
}, async (args) => {
|
|
5200
|
+
const { action } = args;
|
|
5201
|
+
const base = "/developer/v1/budget";
|
|
5202
|
+
try {
|
|
5203
|
+
switch (action) {
|
|
5204
|
+
case "overview":
|
|
5205
|
+
return ok(await client.call("GET", `${base}/overview`, args));
|
|
5206
|
+
case "set_cells":
|
|
5207
|
+
return ok(await client.call("PUT", `${base}/cells`, args, [], [], ["cells"]));
|
|
5208
|
+
case "set_starting": {
|
|
5209
|
+
const m = need(args, ["quarter_id", "layer", "starting_cents"]);
|
|
5210
|
+
if (m)
|
|
5211
|
+
return err(m);
|
|
5212
|
+
return ok(await client.call("PUT", `${base}/starting`, args, [], [], ["quarter_id", "layer", "starting_cents"]));
|
|
5213
|
+
}
|
|
5214
|
+
case "set_rows":
|
|
5215
|
+
return ok(await client.call("PUT", `${base}/rows`, args, [], [], ["rows"]));
|
|
5216
|
+
case "row_create": {
|
|
5217
|
+
const m = need(args, ["label"]);
|
|
5218
|
+
if (m)
|
|
5219
|
+
return err(m);
|
|
5220
|
+
return ok(await client.call("POST", `${base}/rows`, args, [], [], ["label", "group", "order", "category"]));
|
|
5221
|
+
}
|
|
5222
|
+
case "row_update": {
|
|
5223
|
+
const m = need(args, ["row_id"]);
|
|
5224
|
+
if (m)
|
|
5225
|
+
return err(m);
|
|
5226
|
+
return ok(await client.call("PATCH", `${base}/rows/{row_id}`, args, ["row_id"], [], ["label", "group", "order", "category"]));
|
|
5227
|
+
}
|
|
5228
|
+
case "row_delete": {
|
|
5229
|
+
const m = need(args, ["row_id"]);
|
|
5230
|
+
if (m)
|
|
5231
|
+
return err(m);
|
|
5232
|
+
return ok(await client.call("DELETE", `${base}/rows/{row_id}`, args, ["row_id"]));
|
|
5233
|
+
}
|
|
5234
|
+
case "rows_reorder":
|
|
5235
|
+
return ok(await client.call("POST", `${base}/rows/reorder`, args, [], [], ["orders"]));
|
|
5236
|
+
case "row_cancel": {
|
|
5237
|
+
const m = need(args, ["row_id"]);
|
|
5238
|
+
if (m)
|
|
5239
|
+
return err(m);
|
|
5240
|
+
return ok(await client.call("POST", `${base}/rows/{row_id}/cancel`, args, ["row_id"], [], ["quarter_id", "from_week", "note"]));
|
|
5241
|
+
}
|
|
5242
|
+
case "row_restore": {
|
|
5243
|
+
const m = need(args, ["row_id"]);
|
|
5244
|
+
if (m)
|
|
5245
|
+
return err(m);
|
|
5246
|
+
return ok(await client.call("POST", `${base}/rows/{row_id}/restore`, args, ["row_id"]));
|
|
5247
|
+
}
|
|
5248
|
+
case "set_goals":
|
|
5249
|
+
return ok(await client.call("PUT", `${base}/goals`, args, [], [], ["goals"]));
|
|
5250
|
+
case "set_quarter": {
|
|
5251
|
+
const body = { ...args, label: args.label_text };
|
|
5252
|
+
return ok(await client.call("POST", `${base}/quarter`, body, [], [], ["label", "start_date", "carry_ending"]));
|
|
5253
|
+
}
|
|
5254
|
+
case "variance": {
|
|
5255
|
+
const m = need(args, ["quarter_id"]);
|
|
5256
|
+
if (m)
|
|
5257
|
+
return err(m);
|
|
5258
|
+
return ok(await client.call("GET", `${base}/variance`, args, [], ["quarter_id", "threshold_pct"]));
|
|
5259
|
+
}
|
|
5260
|
+
case "roll_forward":
|
|
5261
|
+
return ok(await client.call("POST", `${base}/roll-forward`, args, [], [], ["quarter_id", "create_next", "as_of"]));
|
|
5262
|
+
case "autofill_from_statement": {
|
|
5263
|
+
const m = need(args, ["quarter_id"]);
|
|
5264
|
+
if (m)
|
|
5265
|
+
return err(m);
|
|
5266
|
+
return ok(await client.call("POST", `${base}/autofill-from-statement`, args, [], [], ["quarter_id", "transactions", "apply"]));
|
|
5267
|
+
}
|
|
5268
|
+
case "autofill_accept": {
|
|
5269
|
+
const m = need(args, ["quarter_id"]);
|
|
5270
|
+
if (m)
|
|
5271
|
+
return err(m);
|
|
5272
|
+
return ok(await client.call("POST", `${base}/autofill/accept`, args, [], [], ["quarter_id", "proposal_ids"]));
|
|
5273
|
+
}
|
|
5274
|
+
case "build_from_statements": {
|
|
5275
|
+
const m = need(args, ["quarter_id"]);
|
|
5276
|
+
if (m)
|
|
5277
|
+
return err(m);
|
|
5278
|
+
return ok(await client.call("POST", `${base}/build-from-statements`, args, [], [], [
|
|
5279
|
+
"quarter_id", "transactions", "replace_rows", "align_to_statement",
|
|
5280
|
+
]));
|
|
5281
|
+
}
|
|
5282
|
+
case "build_accept": {
|
|
5283
|
+
const m = need(args, ["quarter_id", "proposal"]);
|
|
5284
|
+
if (m)
|
|
5285
|
+
return err(m);
|
|
5286
|
+
return ok(await client.call("POST", `${base}/build/accept`, args, [], [], ["quarter_id", "proposal"]));
|
|
5287
|
+
}
|
|
5288
|
+
case "automanage_health":
|
|
5289
|
+
return ok(await client.call("GET", `${base}/automanage/health`, args));
|
|
5290
|
+
default: {
|
|
5291
|
+
const _exhaustive = action;
|
|
5292
|
+
return err(`Unknown action: ${_exhaustive}`);
|
|
5293
|
+
}
|
|
5294
|
+
}
|
|
5295
|
+
}
|
|
5296
|
+
catch (e) {
|
|
5297
|
+
if (e instanceof mind_client_js_1.MindApiError)
|
|
5298
|
+
return err(`mind_budget ${action} failed (HTTP ${e.status}): ${apiDetail(e)}`);
|
|
5299
|
+
return err(`mind_budget error: ${e instanceof Error ? e.message : String(e)}`);
|
|
5300
|
+
}
|
|
5301
|
+
});
|
|
5302
|
+
// ─── mind_sheets ────────────────────────────────────────
|
|
5303
|
+
server.tool("mind_sheets", "MIND Sheets — Airtable-style tables at m-i-n-d.ai/#/sheets. Actions: tables_list, table_create, table_update, table_delete, column_add, column_update, column_delete, columns_reorder, rows_list, row_create, row_update, row_delete, rows_bulk_delete, export_csv (returns raw CSV text).", {
|
|
5304
|
+
action: zod_1.z
|
|
5305
|
+
.enum([
|
|
5306
|
+
"tables_list", "table_create", "table_update", "table_delete", "column_add", "column_update",
|
|
5307
|
+
"column_delete", "columns_reorder", "rows_list", "row_create", "row_update", "row_delete",
|
|
5308
|
+
"rows_bulk_delete", "export_csv",
|
|
5309
|
+
])
|
|
5310
|
+
.describe("Which sheets operation to perform."),
|
|
5311
|
+
table_id: zod_1.z.string().optional().describe("Table id — every action except tables_list/table_create."),
|
|
5312
|
+
name: zod_1.z.string().optional().describe("Table name (table_create required/table_update required) or column name (column_add required/column_update)."),
|
|
5313
|
+
columns: zod_1.z.array(zod_1.z.record(zod_1.z.string(), zod_1.z.any())).optional().describe("[{name, type, options?, width?}] — table_create initial columns."),
|
|
5314
|
+
column_id: zod_1.z.string().optional().describe("Column id — column_update/column_delete."),
|
|
5315
|
+
type: zod_1.z.string().optional().describe("Column type: text|number|select|date|checkbox|url — required for column_add; column_update."),
|
|
5316
|
+
options: zod_1.z.array(zod_1.z.string()).optional().describe("Select-type options — column_add/column_update."),
|
|
5317
|
+
width: zod_1.z.number().int().optional().describe("Column width in px — column_update."),
|
|
5318
|
+
column_ids: zod_1.z.array(zod_1.z.string()).optional().describe("New column order — required for columns_reorder."),
|
|
5319
|
+
limit: zod_1.z.number().int().optional().describe("Max rows — rows_list (default 500, max 2000)."),
|
|
5320
|
+
offset: zod_1.z.number().int().optional().describe("Row offset — rows_list (default 0)."),
|
|
5321
|
+
row_id: zod_1.z.string().optional().describe("Row id — row_update/row_delete."),
|
|
5322
|
+
cells: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional().describe("{column_id: value, ...} — row_create/row_update (required)."),
|
|
5323
|
+
row_ids: zod_1.z.array(zod_1.z.string()).optional().describe("Row ids to delete — required for rows_bulk_delete."),
|
|
5324
|
+
}, async (args) => {
|
|
5325
|
+
const { action } = args;
|
|
5326
|
+
const base = "/sheets";
|
|
5327
|
+
try {
|
|
5328
|
+
switch (action) {
|
|
5329
|
+
case "tables_list":
|
|
5330
|
+
return ok(await client.call("GET", `${base}/tables`, args));
|
|
5331
|
+
case "table_create": {
|
|
5332
|
+
const m = need(args, ["name"]);
|
|
5333
|
+
if (m)
|
|
5334
|
+
return err(m);
|
|
5335
|
+
return ok(await client.call("POST", `${base}/tables`, args, [], [], ["name", "columns"]));
|
|
5336
|
+
}
|
|
5337
|
+
case "table_update": {
|
|
5338
|
+
const m = need(args, ["table_id", "name"]);
|
|
5339
|
+
if (m)
|
|
5340
|
+
return err(m);
|
|
5341
|
+
return ok(await client.call("PATCH", `${base}/tables/{table_id}`, args, ["table_id"], [], ["name"]));
|
|
5342
|
+
}
|
|
5343
|
+
case "table_delete": {
|
|
5344
|
+
const m = need(args, ["table_id"]);
|
|
5345
|
+
if (m)
|
|
5346
|
+
return err(m);
|
|
5347
|
+
return ok(await client.call("DELETE", `${base}/tables/{table_id}`, args, ["table_id"]));
|
|
5348
|
+
}
|
|
5349
|
+
case "column_add": {
|
|
5350
|
+
const m = need(args, ["table_id", "name", "type"]);
|
|
5351
|
+
if (m)
|
|
5352
|
+
return err(m);
|
|
5353
|
+
return ok(await client.call("POST", `${base}/tables/{table_id}/columns`, args, ["table_id"], [], ["name", "type", "options"]));
|
|
5354
|
+
}
|
|
5355
|
+
case "column_update": {
|
|
5356
|
+
const m = need(args, ["table_id", "column_id"]);
|
|
5357
|
+
if (m)
|
|
5358
|
+
return err(m);
|
|
5359
|
+
return ok(await client.call("PATCH", `${base}/tables/{table_id}/columns/{column_id}`, args, ["table_id", "column_id"], [], [
|
|
5360
|
+
"name", "type", "options", "width",
|
|
5361
|
+
]));
|
|
5362
|
+
}
|
|
5363
|
+
case "column_delete": {
|
|
5364
|
+
const m = need(args, ["table_id", "column_id"]);
|
|
5365
|
+
if (m)
|
|
5366
|
+
return err(m);
|
|
5367
|
+
return ok(await client.call("DELETE", `${base}/tables/{table_id}/columns/{column_id}`, args, ["table_id", "column_id"]));
|
|
5368
|
+
}
|
|
5369
|
+
case "columns_reorder": {
|
|
5370
|
+
const m = need(args, ["table_id", "column_ids"]);
|
|
5371
|
+
if (m)
|
|
5372
|
+
return err(m);
|
|
5373
|
+
return ok(await client.call("POST", `${base}/tables/{table_id}/columns/reorder`, args, ["table_id"], [], ["column_ids"]));
|
|
5374
|
+
}
|
|
5375
|
+
case "rows_list": {
|
|
5376
|
+
const m = need(args, ["table_id"]);
|
|
5377
|
+
if (m)
|
|
5378
|
+
return err(m);
|
|
5379
|
+
return ok(await client.call("GET", `${base}/tables/{table_id}/rows`, args, ["table_id"], ["limit", "offset"]));
|
|
5380
|
+
}
|
|
5381
|
+
case "row_create": {
|
|
5382
|
+
const m = need(args, ["table_id"]);
|
|
5383
|
+
if (m)
|
|
5384
|
+
return err(m);
|
|
5385
|
+
return ok(await client.call("POST", `${base}/tables/{table_id}/rows`, args, ["table_id"], [], ["cells"]));
|
|
5386
|
+
}
|
|
5387
|
+
case "row_update": {
|
|
5388
|
+
const m = need(args, ["table_id", "row_id", "cells"]);
|
|
5389
|
+
if (m)
|
|
5390
|
+
return err(m);
|
|
5391
|
+
return ok(await client.call("PATCH", `${base}/tables/{table_id}/rows/{row_id}`, args, ["table_id", "row_id"], [], ["cells"]));
|
|
5392
|
+
}
|
|
5393
|
+
case "row_delete": {
|
|
5394
|
+
const m = need(args, ["table_id", "row_id"]);
|
|
5395
|
+
if (m)
|
|
5396
|
+
return err(m);
|
|
5397
|
+
return ok(await client.call("DELETE", `${base}/tables/{table_id}/rows/{row_id}`, args, ["table_id", "row_id"]));
|
|
5398
|
+
}
|
|
5399
|
+
case "rows_bulk_delete": {
|
|
5400
|
+
const m = need(args, ["table_id", "row_ids"]);
|
|
5401
|
+
if (m)
|
|
5402
|
+
return err(m);
|
|
5403
|
+
return ok(await client.call("POST", `${base}/tables/{table_id}/rows/bulk_delete`, args, ["table_id"], [], ["row_ids"]));
|
|
5404
|
+
}
|
|
5405
|
+
case "export_csv": {
|
|
5406
|
+
const m = need(args, ["table_id"]);
|
|
5407
|
+
if (m)
|
|
5408
|
+
return err(m);
|
|
5409
|
+
return ok(await client.call("GET", `${base}/tables/{table_id}/export.csv`, args, ["table_id"]));
|
|
5410
|
+
}
|
|
5411
|
+
default: {
|
|
5412
|
+
const _exhaustive = action;
|
|
5413
|
+
return err(`Unknown action: ${_exhaustive}`);
|
|
5414
|
+
}
|
|
5415
|
+
}
|
|
5416
|
+
}
|
|
5417
|
+
catch (e) {
|
|
5418
|
+
if (e instanceof mind_client_js_1.MindApiError)
|
|
5419
|
+
return err(`mind_sheets ${action} failed (HTTP ${e.status}): ${apiDetail(e)}`);
|
|
5420
|
+
return err(`mind_sheets error: ${e instanceof Error ? e.message : String(e)}`);
|
|
5421
|
+
}
|
|
5422
|
+
});
|
|
5423
|
+
// ─── mind_email ─────────────────────────────────────────
|
|
5424
|
+
server.tool("mind_email", "MIND Email Manager at m-i-n-d.ai/#/email. Actions: status, inbox, thread, message, search, sync, action (archive/trash/mark_read/mark_unread/star/unstar a batch of messages), draft (AI-draft a reply or new email, no send), draft_save, send (⚠️ OUTWARD — sends a real email; confirm with the user before calling), voice, voice_pref_set, voice_pref_clear, voice_rebuild. Note: the REST body field 'action' on the `action` operation is exposed here as `email_action` (an 'action' field would collide with this tool's own dispatch key).", {
|
|
5425
|
+
action: zod_1.z
|
|
5426
|
+
.enum(["status", "inbox", "thread", "message", "search", "sync", "action", "draft", "draft_save", "send", "voice", "voice_pref_set", "voice_pref_clear", "voice_rebuild"])
|
|
5427
|
+
.describe("Which email operation to perform."),
|
|
5428
|
+
mode: zod_1.z.string().optional().describe("Mailbox mode, e.g. 'user' — most actions (default 'user')."),
|
|
5429
|
+
thread_id: zod_1.z.string().optional().describe("Thread id — required for action=thread."),
|
|
5430
|
+
message_id: zod_1.z.string().optional().describe("Message id — required for action=message; also draft (reply target)/draft_save (required)."),
|
|
5431
|
+
q: zod_1.z.string().optional().describe("Search query — required for search."),
|
|
5432
|
+
limit: zod_1.z.number().int().optional().describe("Max results — search/inbox (as 'top')."),
|
|
5433
|
+
top: zod_1.z.number().int().optional().describe("Max results to sync/list — inbox/sync (default 25)."),
|
|
5434
|
+
page_token: zod_1.z.string().optional().describe("Pagination token — inbox."),
|
|
5435
|
+
unread_only: zod_1.z.boolean().optional().describe("Only unread messages — inbox."),
|
|
5436
|
+
message_ids: zod_1.z.array(zod_1.z.string()).optional().describe("Message ids to act on — required for action='action'."),
|
|
5437
|
+
email_action: zod_1.z.enum(["archive", "trash", "mark_read", "mark_unread", "star", "unstar"]).optional().describe("Which mailbox action to apply — required for action='action'. Maps to the REST body field 'action'."),
|
|
5438
|
+
instructions: zod_1.z.string().optional().describe("Free-text drafting instructions — draft."),
|
|
5439
|
+
thread_context: zod_1.z.string().optional().describe("Pre-fetched thread context to skip a lookup — draft."),
|
|
5440
|
+
remember_instruction: zod_1.z.boolean().optional().describe("Promote the instruction to a standing voice correction — draft."),
|
|
5441
|
+
body_text: zod_1.z.string().optional().describe("Draft/send body text — draft_save (required)/send."),
|
|
5442
|
+
to: zod_1.z.array(zod_1.z.string()).optional().describe("Recipient addresses — send (required unless reply_to_message_id is set)."),
|
|
5443
|
+
cc: zod_1.z.array(zod_1.z.string()).optional().describe("CC addresses — send."),
|
|
5444
|
+
subject: zod_1.z.string().optional().describe("Subject line — send."),
|
|
5445
|
+
body: zod_1.z.string().optional().describe("Send body (HTML/plain) — send (either body or body_text required)."),
|
|
5446
|
+
reply_to_message_id: zod_1.z.string().optional().describe("Reply target message id — send."),
|
|
5447
|
+
instruction: zod_1.z.string().optional().describe("Voice instruction text — required for voice_pref_set/voice_pref_clear."),
|
|
5448
|
+
}, async (args) => {
|
|
5449
|
+
const { action } = args;
|
|
5450
|
+
const base = "/email";
|
|
5451
|
+
try {
|
|
5452
|
+
switch (action) {
|
|
5453
|
+
case "status":
|
|
5454
|
+
return ok(await client.call("GET", `${base}/status`, args, [], ["mode"]));
|
|
5455
|
+
case "inbox":
|
|
5456
|
+
return ok(await client.call("GET", `${base}/inbox`, args, [], ["mode", "top", "page_token", "unread_only"]));
|
|
5457
|
+
case "thread": {
|
|
5458
|
+
const m = need(args, ["thread_id"]);
|
|
5459
|
+
if (m)
|
|
5460
|
+
return err(m);
|
|
5461
|
+
return ok(await client.call("GET", `${base}/thread/{thread_id}`, args, ["thread_id"], ["mode"]));
|
|
5462
|
+
}
|
|
5463
|
+
case "message": {
|
|
5464
|
+
const m = need(args, ["message_id"]);
|
|
5465
|
+
if (m)
|
|
5466
|
+
return err(m);
|
|
5467
|
+
return ok(await client.call("GET", `${base}/message/{message_id}`, args, ["message_id"], ["mode"]));
|
|
5468
|
+
}
|
|
5469
|
+
case "search": {
|
|
5470
|
+
const m = need(args, ["q"]);
|
|
5471
|
+
if (m)
|
|
5472
|
+
return err(m);
|
|
5473
|
+
return ok(await client.call("GET", `${base}/search`, args, [], ["mode", "q", "limit"]));
|
|
5474
|
+
}
|
|
5475
|
+
case "sync":
|
|
5476
|
+
return ok(await client.call("POST", `${base}/sync`, args, [], [], ["mode", "top"]));
|
|
5477
|
+
case "action": {
|
|
5478
|
+
const m = need(args, ["message_ids", "email_action"]);
|
|
5479
|
+
if (m)
|
|
5480
|
+
return err(m);
|
|
5481
|
+
const body = { ...args, action: args.email_action };
|
|
5482
|
+
return ok(await client.call("POST", `${base}/action`, body, [], [], ["mode", "message_ids", "action"]));
|
|
5483
|
+
}
|
|
5484
|
+
case "draft":
|
|
5485
|
+
return ok(await client.call("POST", `${base}/draft`, args, [], [], [
|
|
5486
|
+
"mode", "message_id", "instructions", "thread_context", "remember_instruction",
|
|
5487
|
+
]));
|
|
5488
|
+
case "draft_save": {
|
|
5489
|
+
const m = need(args, ["message_id", "body_text"]);
|
|
5490
|
+
if (m)
|
|
5491
|
+
return err(m);
|
|
5492
|
+
return ok(await client.call("POST", `${base}/draft/save`, args, [], [], ["mode", "message_id", "body_text"]));
|
|
5493
|
+
}
|
|
5494
|
+
case "send": {
|
|
5495
|
+
if (!args.body && !args.body_text)
|
|
5496
|
+
return err("Error: body or body_text required for send.");
|
|
5497
|
+
return ok(await client.call("POST", `${base}/send`, args, [], [], [
|
|
5498
|
+
"mode", "to", "cc", "subject", "body", "body_text", "reply_to_message_id",
|
|
5499
|
+
]));
|
|
5500
|
+
}
|
|
5501
|
+
case "voice":
|
|
5502
|
+
return ok(await client.call("GET", `${base}/voice`, args));
|
|
5503
|
+
case "voice_pref_set": {
|
|
5504
|
+
const m = need(args, ["instruction"]);
|
|
5505
|
+
if (m)
|
|
5506
|
+
return err(m);
|
|
5507
|
+
return ok(await client.call("POST", `${base}/voice/pref`, args, [], [], ["instruction"]));
|
|
5508
|
+
}
|
|
5509
|
+
case "voice_pref_clear": {
|
|
5510
|
+
const m = need(args, ["instruction"]);
|
|
5511
|
+
if (m)
|
|
5512
|
+
return err(m);
|
|
5513
|
+
return ok(await client.call("DELETE", `${base}/voice/pref`, args, [], [], ["instruction"]));
|
|
5514
|
+
}
|
|
5515
|
+
case "voice_rebuild":
|
|
5516
|
+
return ok(await client.call("POST", `${base}/voice/rebuild`, args));
|
|
5517
|
+
default: {
|
|
5518
|
+
const _exhaustive = action;
|
|
5519
|
+
return err(`Unknown action: ${_exhaustive}`);
|
|
5520
|
+
}
|
|
5521
|
+
}
|
|
5522
|
+
}
|
|
5523
|
+
catch (e) {
|
|
5524
|
+
if (e instanceof mind_client_js_1.MindApiError)
|
|
5525
|
+
return err(`mind_email ${action} failed (HTTP ${e.status}): ${apiDetail(e)}`);
|
|
5526
|
+
return err(`mind_email error: ${e instanceof Error ? e.message : String(e)}`);
|
|
5527
|
+
}
|
|
5528
|
+
});
|
|
5529
|
+
// ─── mind_checklists ────────────────────────────────────
|
|
5530
|
+
server.tool("mind_checklists", "Kanon checklists at kanon.theastraway.com, attached to Life items or tasks. Actions: templates_list, template_get, template_create, template_update, template_delete, list, get, create, update, delete, toggle_item, complete, progress (rollup for a parent_type+parent_id).", {
|
|
5531
|
+
action: zod_1.z
|
|
5532
|
+
.enum(["templates_list", "template_get", "template_create", "template_update", "template_delete", "list", "get", "create", "update", "delete", "toggle_item", "complete", "progress"])
|
|
5533
|
+
.describe("Which checklist operation to perform."),
|
|
5534
|
+
template_id: zod_1.z.string().optional().describe("Checklist template id — template_get/template_update/template_delete (required); create (instantiate from a template)."),
|
|
5535
|
+
title: zod_1.z.string().optional().describe("Title — template_create (required)/template_update; create/update (checklist title)."),
|
|
5536
|
+
description: zod_1.z.string().optional().describe("Long description — template_create/template_update."),
|
|
5537
|
+
sections: zod_1.z.array(zod_1.z.record(zod_1.z.string(), zod_1.z.any())).optional().describe("[{section_id?, title, phase: 'pre'|'run'|'post', items: [{item_id?, label, note?, checked?, assignee?}]}] — template_create/template_update; create/update (inline sections, alternative to template_id)."),
|
|
5538
|
+
origin: zod_1.z.enum(["user", "flagship"]).optional().describe("Template origin — template_create (default 'user')."),
|
|
5539
|
+
schedule: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional().describe("Recurrence config — template_create/template_update; create/update."),
|
|
5540
|
+
checklist_id: zod_1.z.string().optional().describe("Checklist id — get/update/delete/toggle_item/complete (required)."),
|
|
5541
|
+
parent_type: zod_1.z.enum(["life_item", "task"]).optional().describe("Parent type — create (required); list/progress filter (progress requires it)."),
|
|
5542
|
+
parent_id: zod_1.z.string().optional().describe("Parent id (a Life item_id or task id) — create (required); list/progress filter (progress requires it)."),
|
|
5543
|
+
parent_label: zod_1.z.string().optional().describe("Human-readable parent label — create."),
|
|
5544
|
+
assigned_to: zod_1.z.string().optional().describe("Assignee (e.g. 'Dae') — create/update."),
|
|
5545
|
+
item_id: zod_1.z.string().optional().describe("Checklist item id — required for toggle_item."),
|
|
5546
|
+
}, async (args) => {
|
|
5547
|
+
const { action } = args;
|
|
5548
|
+
const base = "/developer/v1/checklists";
|
|
5549
|
+
try {
|
|
5550
|
+
switch (action) {
|
|
5551
|
+
case "templates_list":
|
|
5552
|
+
return ok(await client.call("GET", `${base}/templates`, args));
|
|
5553
|
+
case "template_get": {
|
|
5554
|
+
const m = need(args, ["template_id"]);
|
|
5555
|
+
if (m)
|
|
5556
|
+
return err(m);
|
|
5557
|
+
return ok(await client.call("GET", `${base}/templates/{template_id}`, args, ["template_id"]));
|
|
5558
|
+
}
|
|
5559
|
+
case "template_create": {
|
|
5560
|
+
const m = need(args, ["title"]);
|
|
5561
|
+
if (m)
|
|
5562
|
+
return err(m);
|
|
5563
|
+
return ok(await client.call("POST", `${base}/templates`, args, [], [], ["title", "description", "sections", "origin", "schedule"]));
|
|
5564
|
+
}
|
|
5565
|
+
case "template_update": {
|
|
5566
|
+
const m = need(args, ["template_id"]);
|
|
5567
|
+
if (m)
|
|
5568
|
+
return err(m);
|
|
5569
|
+
return ok(await client.call("PATCH", `${base}/templates/{template_id}`, args, ["template_id"], [], ["title", "description", "sections", "schedule"]));
|
|
5570
|
+
}
|
|
5571
|
+
case "template_delete": {
|
|
5572
|
+
const m = need(args, ["template_id"]);
|
|
5573
|
+
if (m)
|
|
5574
|
+
return err(m);
|
|
5575
|
+
return ok(await client.call("DELETE", `${base}/templates/{template_id}`, args, ["template_id"]));
|
|
5576
|
+
}
|
|
5577
|
+
case "list":
|
|
5578
|
+
return ok(await client.call("GET", base, args, [], ["parent_type", "parent_id"]));
|
|
5579
|
+
case "get": {
|
|
5580
|
+
const m = need(args, ["checklist_id"]);
|
|
5581
|
+
if (m)
|
|
5582
|
+
return err(m);
|
|
5583
|
+
return ok(await client.call("GET", `${base}/{checklist_id}`, args, ["checklist_id"]));
|
|
5584
|
+
}
|
|
5585
|
+
case "create": {
|
|
5586
|
+
const m = need(args, ["parent_type", "parent_id"]);
|
|
5587
|
+
if (m)
|
|
5588
|
+
return err(m);
|
|
5589
|
+
return ok(await client.call("POST", base, args, [], [], [
|
|
5590
|
+
"parent_type", "parent_id", "parent_label", "template_id", "title", "sections", "schedule", "assigned_to",
|
|
5591
|
+
]));
|
|
5592
|
+
}
|
|
5593
|
+
case "update": {
|
|
5594
|
+
const m = need(args, ["checklist_id"]);
|
|
5595
|
+
if (m)
|
|
5596
|
+
return err(m);
|
|
5597
|
+
return ok(await client.call("PATCH", `${base}/{checklist_id}`, args, ["checklist_id"], [], ["title", "sections", "schedule", "assigned_to"]));
|
|
5598
|
+
}
|
|
5599
|
+
case "delete": {
|
|
5600
|
+
const m = need(args, ["checklist_id"]);
|
|
5601
|
+
if (m)
|
|
5602
|
+
return err(m);
|
|
5603
|
+
return ok(await client.call("DELETE", `${base}/{checklist_id}`, args, ["checklist_id"]));
|
|
5604
|
+
}
|
|
5605
|
+
case "toggle_item": {
|
|
5606
|
+
const m = need(args, ["checklist_id", "item_id"]);
|
|
5607
|
+
if (m)
|
|
5608
|
+
return err(m);
|
|
5609
|
+
return ok(await client.call("POST", `${base}/{checklist_id}/items/{item_id}/toggle`, args, ["checklist_id", "item_id"]));
|
|
5610
|
+
}
|
|
5611
|
+
case "complete": {
|
|
5612
|
+
const m = need(args, ["checklist_id"]);
|
|
5613
|
+
if (m)
|
|
5614
|
+
return err(m);
|
|
5615
|
+
return ok(await client.call("POST", `${base}/{checklist_id}/complete`, args, ["checklist_id"]));
|
|
5616
|
+
}
|
|
5617
|
+
case "progress": {
|
|
5618
|
+
const m = need(args, ["parent_type", "parent_id"]);
|
|
5619
|
+
if (m)
|
|
5620
|
+
return err(m);
|
|
5621
|
+
return ok(await client.call("GET", `${base}/progress`, args, [], ["parent_type", "parent_id"]));
|
|
5622
|
+
}
|
|
5623
|
+
default: {
|
|
5624
|
+
const _exhaustive = action;
|
|
5625
|
+
return err(`Unknown action: ${_exhaustive}`);
|
|
5626
|
+
}
|
|
5627
|
+
}
|
|
5628
|
+
}
|
|
5629
|
+
catch (e) {
|
|
5630
|
+
if (e instanceof mind_client_js_1.MindApiError)
|
|
5631
|
+
return err(`mind_checklists ${action} failed (HTTP ${e.status}): ${apiDetail(e)}`);
|
|
5632
|
+
return err(`mind_checklists error: ${e instanceof Error ? e.message : String(e)}`);
|
|
5633
|
+
}
|
|
5634
|
+
});
|
|
5635
|
+
// ─── mind_sign ──────────────────────────────────────────
|
|
5636
|
+
server.tool("mind_sign", "MIND Sign — e-signature envelopes at m-i-n-d.ai/#/mindsign. Actions: list, get, create (JSON variant — document by pdf_url or pdf_base64), setup, fields, send (⚠️ OUTWARD — emails every signer; confirm with the user before calling), resend (⚠️ OUTWARD — re-emails one signer; confirm with the user before calling), void, delete, audit, certificate, download_url (returns a download link string, no binary transferred through MCP).", {
|
|
5637
|
+
action: zod_1.z
|
|
5638
|
+
.enum(["list", "get", "create", "setup", "fields", "send", "resend", "void", "delete", "audit", "certificate", "download_url"])
|
|
5639
|
+
.describe("Which e-signature operation to perform."),
|
|
5640
|
+
envelope_id: zod_1.z.string().optional().describe("Envelope id — every action except list/create."),
|
|
5641
|
+
status: zod_1.z.enum(["draft", "sent", "completed", "voided"]).optional().describe("Filter by status — list."),
|
|
5642
|
+
q: zod_1.z.string().optional().describe("Free-text search — list."),
|
|
5643
|
+
limit: zod_1.z.number().int().optional().describe("Max results — list (default 50, 1-200)."),
|
|
5644
|
+
offset: zod_1.z.number().int().optional().describe("Pagination offset — list (default 0)."),
|
|
5645
|
+
include_deleted: zod_1.z.boolean().optional().describe("Include soft-deleted envelopes — list/get."),
|
|
5646
|
+
title: zod_1.z.string().optional().describe("Envelope title — required for create."),
|
|
5647
|
+
pdf_url: zod_1.z.string().optional().describe("Source PDF URL — create (exactly one of pdf_url/pdf_base64 required)."),
|
|
5648
|
+
pdf_base64: zod_1.z.string().optional().describe("Source PDF as base64 — create (exactly one of pdf_url/pdf_base64 required)."),
|
|
5649
|
+
signers: zod_1.z.array(zod_1.z.record(zod_1.z.string(), zod_1.z.any())).optional().describe("[{name, email}] — required for create/setup."),
|
|
5650
|
+
fields: zod_1.z.array(zod_1.z.record(zod_1.z.string(), zod_1.z.any())).optional().describe("[{page, x, y, w, h, type: 'signature'|'initials'|'name'|'date'|'text', signer_index?, label?, default_value?, required?, font_size?}] — required for create/setup/fields."),
|
|
5651
|
+
message: zod_1.z.string().optional().describe("Message to signers — create/send/resend."),
|
|
5652
|
+
send: zod_1.z.boolean().optional().describe("Send immediately on create — create (default false)."),
|
|
5653
|
+
signing_order: zod_1.z.enum(["parallel", "sequential"]).optional().describe("Signing order — create/setup."),
|
|
5654
|
+
only_email: zod_1.z.string().optional().describe("Send only to this signer's email — send."),
|
|
5655
|
+
signer_email: zod_1.z.string().optional().describe("Signer email to resend to — required for resend."),
|
|
5656
|
+
reason: zod_1.z.string().optional().describe("Void reason — void."),
|
|
5657
|
+
}, async (args) => {
|
|
5658
|
+
const { action } = args;
|
|
5659
|
+
const base = "/api/sign/envelopes";
|
|
5660
|
+
try {
|
|
5661
|
+
switch (action) {
|
|
5662
|
+
case "list":
|
|
5663
|
+
return ok(await client.call("GET", base, args, [], ["status", "q", "limit", "offset", "include_deleted"]));
|
|
5664
|
+
case "get": {
|
|
5665
|
+
const m = need(args, ["envelope_id"]);
|
|
5666
|
+
if (m)
|
|
5667
|
+
return err(m);
|
|
5668
|
+
return ok(await client.call("GET", `${base}/{envelope_id}`, args, ["envelope_id"], ["include_deleted"]));
|
|
5669
|
+
}
|
|
5670
|
+
case "create": {
|
|
5671
|
+
const m = need(args, ["title", "signers", "fields"]);
|
|
5672
|
+
if (m)
|
|
5673
|
+
return err(m);
|
|
5674
|
+
if (!args.pdf_url && !args.pdf_base64)
|
|
5675
|
+
return err("Error: pdf_url or pdf_base64 required for create.");
|
|
5676
|
+
return ok(await client.call("POST", `${base}/json`, args, [], [], [
|
|
5677
|
+
"title", "pdf_url", "pdf_base64", "signers", "fields", "message", "send", "signing_order",
|
|
5678
|
+
]));
|
|
5679
|
+
}
|
|
5680
|
+
case "setup": {
|
|
5681
|
+
const m = need(args, ["envelope_id", "fields", "signers"]);
|
|
5682
|
+
if (m)
|
|
5683
|
+
return err(m);
|
|
5684
|
+
return ok(await client.call("PUT", `${base}/{envelope_id}/setup`, args, ["envelope_id"], [], ["fields", "signers", "signing_order"]));
|
|
5685
|
+
}
|
|
5686
|
+
case "fields": {
|
|
5687
|
+
const m = need(args, ["envelope_id", "fields"]);
|
|
5688
|
+
if (m)
|
|
5689
|
+
return err(m);
|
|
5690
|
+
return ok(await client.call("PATCH", `${base}/{envelope_id}/fields`, args, ["envelope_id"], [], ["fields"]));
|
|
5691
|
+
}
|
|
5692
|
+
case "send": {
|
|
5693
|
+
const m = need(args, ["envelope_id"]);
|
|
5694
|
+
if (m)
|
|
5695
|
+
return err(m);
|
|
5696
|
+
return ok(await client.call("POST", `${base}/{envelope_id}/send`, args, ["envelope_id"], [], ["message", "only_email"]));
|
|
5697
|
+
}
|
|
5698
|
+
case "resend": {
|
|
5699
|
+
const m = need(args, ["envelope_id", "signer_email"]);
|
|
5700
|
+
if (m)
|
|
5701
|
+
return err(m);
|
|
5702
|
+
return ok(await client.call("POST", `${base}/{envelope_id}/resend`, args, ["envelope_id"], [], ["signer_email", "message"]));
|
|
5703
|
+
}
|
|
5704
|
+
case "void": {
|
|
5705
|
+
const m = need(args, ["envelope_id"]);
|
|
5706
|
+
if (m)
|
|
5707
|
+
return err(m);
|
|
5708
|
+
return ok(await client.call("POST", `${base}/{envelope_id}/void`, args, ["envelope_id"], [], ["reason"]));
|
|
5709
|
+
}
|
|
5710
|
+
case "delete": {
|
|
5711
|
+
const m = need(args, ["envelope_id"]);
|
|
5712
|
+
if (m)
|
|
5713
|
+
return err(m);
|
|
5714
|
+
return ok(await client.call("DELETE", `${base}/{envelope_id}`, args, ["envelope_id"]));
|
|
5715
|
+
}
|
|
5716
|
+
case "audit": {
|
|
5717
|
+
const m = need(args, ["envelope_id"]);
|
|
5718
|
+
if (m)
|
|
5719
|
+
return err(m);
|
|
5720
|
+
return ok(await client.call("GET", `${base}/{envelope_id}/audit`, args, ["envelope_id"]));
|
|
5721
|
+
}
|
|
5722
|
+
case "certificate": {
|
|
5723
|
+
const m = need(args, ["envelope_id"]);
|
|
5724
|
+
if (m)
|
|
5725
|
+
return err(m);
|
|
5726
|
+
return ok(await client.call("GET", `${base}/{envelope_id}/certificate`, args, ["envelope_id"]));
|
|
5727
|
+
}
|
|
5728
|
+
case "download_url": {
|
|
5729
|
+
const m = need(args, ["envelope_id"]);
|
|
5730
|
+
if (m)
|
|
5731
|
+
return err(m);
|
|
5732
|
+
return ok({ download_url: `https://www.m-i-n-d.ai/api/sign/envelopes/${encodeURIComponent(String(args.envelope_id))}/download` });
|
|
5733
|
+
}
|
|
5734
|
+
default: {
|
|
5735
|
+
const _exhaustive = action;
|
|
5736
|
+
return err(`Unknown action: ${_exhaustive}`);
|
|
5737
|
+
}
|
|
5738
|
+
}
|
|
5739
|
+
}
|
|
5740
|
+
catch (e) {
|
|
5741
|
+
if (e instanceof mind_client_js_1.MindApiError)
|
|
5742
|
+
return err(`mind_sign ${action} failed (HTTP ${e.status}): ${apiDetail(e)}`);
|
|
5743
|
+
return err(`mind_sign error: ${e instanceof Error ? e.message : String(e)}`);
|
|
5744
|
+
}
|
|
5745
|
+
});
|
|
5746
|
+
// ─── mind_invoices ──────────────────────────────────────
|
|
5747
|
+
server.tool("mind_invoices", "Invoice Agent at m-i-n-d.ai/#/invoiceagent. Actions: list, get, create, update, delete, ask (ask a question about an invoice), invite (⚠️ OUTWARD — emails the bill-to party a payment link; confirm with the user before calling), pdf_url (returns a PDF link string, no binary transferred through MCP), received (invoices billed to you).", {
|
|
5748
|
+
action: zod_1.z.enum(["list", "get", "create", "update", "delete", "ask", "invite", "pdf_url", "received"]).describe("Which invoice operation to perform."),
|
|
5749
|
+
invoice_id: zod_1.z.string().optional().describe("Invoice id — every action except list/create/received."),
|
|
5750
|
+
limit: zod_1.z.number().int().optional().describe("Max results — list (default 100)/received (default 100)."),
|
|
5751
|
+
invoice_number: zod_1.z.string().optional().describe("Invoice number — create/update."),
|
|
5752
|
+
issue_date: zod_1.z.string().optional().describe("Issue date (YYYY-MM-DD) — create/update."),
|
|
5753
|
+
due_date: zod_1.z.string().optional().describe("Due date (YYYY-MM-DD) — create/update."),
|
|
5754
|
+
bill_from: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional().describe("{name, company?, email?, address_line_1?, address_line_2?, city?, region?, postal_code?, country?, tax_id?} — required for create; update."),
|
|
5755
|
+
bill_to: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional().describe("Same shape as bill_from — required for create; update."),
|
|
5756
|
+
line_items: zod_1.z.array(zod_1.z.record(zod_1.z.string(), zod_1.z.any())).optional().describe("[{description, quantity?, unit_price?, tier?, agent_slug?, project_id?, line_kind?, period_start?, period_end?, market_value?, market_price?, market_note?, net_price?, justification?}] — create/update."),
|
|
5757
|
+
tax_rate: zod_1.z.number().optional().describe("Tax rate (e.g. 0.0825) — create/update."),
|
|
5758
|
+
discount_amount: zod_1.z.number().optional().describe("Flat discount amount — create/update."),
|
|
5759
|
+
currency: zod_1.z.string().optional().describe("Currency code — create/update (default 'USD')."),
|
|
5760
|
+
notes: zod_1.z.string().optional().describe("Free-text notes — create/update."),
|
|
5761
|
+
payment_terms: zod_1.z.string().optional().describe("Payment terms string — create/update (default 'Net 15')."),
|
|
5762
|
+
logo_data_url: zod_1.z.string().optional().describe("Logo image as a data URL — create/update."),
|
|
5763
|
+
status: zod_1.z.enum(["draft", "sent", "paid", "overdue", "void"]).optional().describe("Invoice status — update."),
|
|
5764
|
+
question: zod_1.z.string().optional().describe("Question about the invoice — required for ask."),
|
|
5765
|
+
outstanding_only: zod_1.z.boolean().optional().describe("Only unpaid received invoices — received (default true)."),
|
|
5766
|
+
}, async (args) => {
|
|
5767
|
+
const { action } = args;
|
|
5768
|
+
const base = "/invoices";
|
|
5769
|
+
try {
|
|
5770
|
+
switch (action) {
|
|
5771
|
+
case "list":
|
|
5772
|
+
return ok(await client.call("GET", base, args, [], ["limit"]));
|
|
5773
|
+
case "get": {
|
|
5774
|
+
const m = need(args, ["invoice_id"]);
|
|
5775
|
+
if (m)
|
|
5776
|
+
return err(m);
|
|
5777
|
+
return ok(await client.call("GET", `${base}/{invoice_id}`, args, ["invoice_id"]));
|
|
5778
|
+
}
|
|
5779
|
+
case "create": {
|
|
5780
|
+
const m = need(args, ["bill_from", "bill_to"]);
|
|
5781
|
+
if (m)
|
|
5782
|
+
return err(m);
|
|
5783
|
+
return ok(await client.call("POST", base, args, [], [], [
|
|
5784
|
+
"invoice_number", "issue_date", "due_date", "bill_from", "bill_to", "line_items",
|
|
5785
|
+
"tax_rate", "discount_amount", "currency", "notes", "payment_terms", "logo_data_url",
|
|
5786
|
+
]));
|
|
5787
|
+
}
|
|
5788
|
+
case "update": {
|
|
5789
|
+
const m = need(args, ["invoice_id"]);
|
|
5790
|
+
if (m)
|
|
5791
|
+
return err(m);
|
|
5792
|
+
return ok(await client.call("PATCH", `${base}/{invoice_id}`, args, ["invoice_id"], [], [
|
|
5793
|
+
"invoice_number", "issue_date", "due_date", "bill_from", "bill_to", "line_items",
|
|
5794
|
+
"tax_rate", "discount_amount", "currency", "notes", "payment_terms", "status", "logo_data_url",
|
|
5795
|
+
]));
|
|
5796
|
+
}
|
|
5797
|
+
case "delete": {
|
|
5798
|
+
const m = need(args, ["invoice_id"]);
|
|
5799
|
+
if (m)
|
|
5800
|
+
return err(m);
|
|
5801
|
+
return ok(await client.call("DELETE", `${base}/{invoice_id}`, args, ["invoice_id"]));
|
|
5802
|
+
}
|
|
5803
|
+
case "ask": {
|
|
5804
|
+
const m = need(args, ["invoice_id", "question"]);
|
|
5805
|
+
if (m)
|
|
5806
|
+
return err(m);
|
|
5807
|
+
return ok(await client.call("POST", `${base}/{invoice_id}/ask`, args, ["invoice_id"], [], ["question"]));
|
|
5808
|
+
}
|
|
5809
|
+
case "invite": {
|
|
5810
|
+
const m = need(args, ["invoice_id"]);
|
|
5811
|
+
if (m)
|
|
5812
|
+
return err(m);
|
|
5813
|
+
return ok(await client.call("POST", `${base}/{invoice_id}/invite`, args, ["invoice_id"]));
|
|
5814
|
+
}
|
|
5815
|
+
case "pdf_url": {
|
|
5816
|
+
const m = need(args, ["invoice_id"]);
|
|
5817
|
+
if (m)
|
|
5818
|
+
return err(m);
|
|
5819
|
+
return ok({ pdf_url: `https://www.m-i-n-d.ai/invoices/${encodeURIComponent(String(args.invoice_id))}/pdf` });
|
|
5820
|
+
}
|
|
5821
|
+
case "received":
|
|
5822
|
+
return ok(await client.call("GET", `${base}/received`, args, [], ["outstanding_only", "limit"]));
|
|
5823
|
+
default: {
|
|
5824
|
+
const _exhaustive = action;
|
|
5825
|
+
return err(`Unknown action: ${_exhaustive}`);
|
|
5826
|
+
}
|
|
5827
|
+
}
|
|
5828
|
+
}
|
|
5829
|
+
catch (e) {
|
|
5830
|
+
if (e instanceof mind_client_js_1.MindApiError)
|
|
5831
|
+
return err(`mind_invoices ${action} failed (HTTP ${e.status}): ${apiDetail(e)}`);
|
|
5832
|
+
return err(`mind_invoices error: ${e instanceof Error ? e.message : String(e)}`);
|
|
5833
|
+
}
|
|
5834
|
+
});
|
|
5835
|
+
// ─── mind_books ─────────────────────────────────────────
|
|
5836
|
+
server.tool("mind_books", "MIND Books — small-business accounting at m-i-n-d.ai/#/mind-books. Actions: overview, vendors_list, vendor_create, customers_list, customer_create, accounts, bills, invoices, health.", {
|
|
5837
|
+
action: zod_1.z.enum(["overview", "vendors_list", "vendor_create", "customers_list", "customer_create", "accounts", "bills", "invoices", "health"]).describe("Which MIND Books operation to perform."),
|
|
5838
|
+
display_name: zod_1.z.string().optional().describe("Vendor/customer display name — required for vendor_create/customer_create."),
|
|
5839
|
+
email: zod_1.z.string().optional().describe("Contact email — vendor_create/customer_create."),
|
|
5840
|
+
phone: zod_1.z.string().optional().describe("Contact phone — vendor_create."),
|
|
5841
|
+
note: zod_1.z.string().optional().describe("Free-text note — vendor_create."),
|
|
5842
|
+
}, async (args) => {
|
|
5843
|
+
const { action } = args;
|
|
5844
|
+
const base = "/developer/v1/mind-books";
|
|
5845
|
+
try {
|
|
5846
|
+
switch (action) {
|
|
5847
|
+
case "overview":
|
|
5848
|
+
return ok(await client.call("GET", `${base}/overview`, args));
|
|
5849
|
+
case "vendors_list":
|
|
5850
|
+
return ok(await client.call("GET", `${base}/vendors`, args));
|
|
5851
|
+
case "vendor_create": {
|
|
5852
|
+
const m = need(args, ["display_name"]);
|
|
5853
|
+
if (m)
|
|
5854
|
+
return err(m);
|
|
5855
|
+
return ok(await client.call("POST", `${base}/vendors`, args, [], [], ["display_name", "email", "phone", "note"]));
|
|
5856
|
+
}
|
|
5857
|
+
case "customers_list":
|
|
5858
|
+
return ok(await client.call("GET", `${base}/customers`, args));
|
|
5859
|
+
case "customer_create": {
|
|
5860
|
+
const m = need(args, ["display_name"]);
|
|
5861
|
+
if (m)
|
|
5862
|
+
return err(m);
|
|
5863
|
+
return ok(await client.call("POST", `${base}/customers`, args, [], [], ["display_name", "email"]));
|
|
5864
|
+
}
|
|
5865
|
+
case "accounts":
|
|
5866
|
+
return ok(await client.call("GET", `${base}/accounts`, args));
|
|
5867
|
+
case "bills":
|
|
5868
|
+
return ok(await client.call("GET", `${base}/bills`, args));
|
|
5869
|
+
case "invoices":
|
|
5870
|
+
return ok(await client.call("GET", `${base}/invoices`, args));
|
|
5871
|
+
case "health":
|
|
5872
|
+
return ok(await client.call("GET", `${base}/health`, args));
|
|
5873
|
+
default: {
|
|
5874
|
+
const _exhaustive = action;
|
|
5875
|
+
return err(`Unknown action: ${_exhaustive}`);
|
|
5876
|
+
}
|
|
5877
|
+
}
|
|
5878
|
+
}
|
|
5879
|
+
catch (e) {
|
|
5880
|
+
if (e instanceof mind_client_js_1.MindApiError)
|
|
5881
|
+
return err(`mind_books ${action} failed (HTTP ${e.status}): ${apiDetail(e)}`);
|
|
5882
|
+
return err(`mind_books error: ${e instanceof Error ? e.message : String(e)}`);
|
|
5883
|
+
}
|
|
5884
|
+
});
|
|
5885
|
+
// ─── mind_timer ─────────────────────────────────────────
|
|
5886
|
+
server.tool("mind_timer", "Tempo time tracking. Actions: start, stop, current (the running entry, if any), entries_list, entry_create (manual entry), entry_update, entry_delete, summary.", {
|
|
5887
|
+
action: zod_1.z.enum(["start", "stop", "current", "entries_list", "entry_create", "entry_update", "entry_delete", "summary"]).describe("Which timer operation to perform."),
|
|
5888
|
+
description: zod_1.z.string().optional().describe("What you're working on — start/entry_create/entry_update."),
|
|
5889
|
+
entry_id: zod_1.z.string().optional().describe("Time entry id — required for entry_update/entry_delete."),
|
|
5890
|
+
item_id: zod_1.z.string().optional().describe("Life item_id this time is logged against — start/entry_create/entry_update."),
|
|
5891
|
+
project: zod_1.z.string().optional().describe("Free-text project label — start/entry_create/entry_update."),
|
|
5892
|
+
tags: zod_1.z.array(zod_1.z.string()).optional().describe("Tags — start/entry_create/entry_update."),
|
|
5893
|
+
billable: zod_1.z.boolean().optional().describe("Mark billable — start/entry_create/entry_update (default false)."),
|
|
5894
|
+
days: zod_1.z.number().int().optional().describe("How many days back to list — entries_list (default 7, 1-90)."),
|
|
5895
|
+
started_at: zod_1.z.string().optional().describe("Start timestamp (ISO 8601) — required for entry_create; entry_update."),
|
|
5896
|
+
stopped_at: zod_1.z.string().optional().describe("Stop timestamp (ISO 8601) — required for entry_create; entry_update."),
|
|
5897
|
+
}, async (args) => {
|
|
5898
|
+
const { action } = args;
|
|
5899
|
+
const base = "/timer";
|
|
5900
|
+
try {
|
|
5901
|
+
switch (action) {
|
|
5902
|
+
case "start":
|
|
5903
|
+
return ok(await client.call("POST", `${base}/start`, args, [], [], ["description", "item_id", "project", "tags", "billable"]));
|
|
5904
|
+
case "stop":
|
|
5905
|
+
return ok(await client.call("POST", `${base}/stop`, args));
|
|
5906
|
+
case "current":
|
|
5907
|
+
return ok(await client.call("GET", `${base}/current`, args));
|
|
5908
|
+
case "entries_list":
|
|
5909
|
+
return ok(await client.call("GET", `${base}/entries`, args, [], ["days"]));
|
|
5910
|
+
case "entry_create": {
|
|
5911
|
+
const m = need(args, ["started_at", "stopped_at"]);
|
|
5912
|
+
if (m)
|
|
5913
|
+
return err(m);
|
|
5914
|
+
return ok(await client.call("POST", `${base}/entries`, args, [], [], [
|
|
5915
|
+
"description", "item_id", "project", "tags", "billable", "started_at", "stopped_at",
|
|
5916
|
+
]));
|
|
5917
|
+
}
|
|
5918
|
+
case "entry_update": {
|
|
5919
|
+
const m = need(args, ["entry_id"]);
|
|
5920
|
+
if (m)
|
|
5921
|
+
return err(m);
|
|
5922
|
+
return ok(await client.call("PATCH", `${base}/entries/{entry_id}`, args, ["entry_id"], [], [
|
|
5923
|
+
"description", "project", "item_id", "tags", "billable", "started_at", "stopped_at",
|
|
5924
|
+
]));
|
|
5925
|
+
}
|
|
5926
|
+
case "entry_delete": {
|
|
5927
|
+
const m = need(args, ["entry_id"]);
|
|
5928
|
+
if (m)
|
|
5929
|
+
return err(m);
|
|
5930
|
+
return ok(await client.call("DELETE", `${base}/entries/{entry_id}`, args, ["entry_id"]));
|
|
5931
|
+
}
|
|
5932
|
+
case "summary":
|
|
5933
|
+
return ok(await client.call("GET", `${base}/summary`, args));
|
|
5934
|
+
default: {
|
|
5935
|
+
const _exhaustive = action;
|
|
5936
|
+
return err(`Unknown action: ${_exhaustive}`);
|
|
5937
|
+
}
|
|
5938
|
+
}
|
|
5939
|
+
}
|
|
5940
|
+
catch (e) {
|
|
5941
|
+
if (e instanceof mind_client_js_1.MindApiError)
|
|
5942
|
+
return err(`mind_timer ${action} failed (HTTP ${e.status}): ${apiDetail(e)}`);
|
|
5943
|
+
return err(`mind_timer error: ${e instanceof Error ? e.message : String(e)}`);
|
|
5944
|
+
}
|
|
5945
|
+
});
|
|
5946
|
+
// ─── mind_forms ─────────────────────────────────────────
|
|
5947
|
+
server.tool("mind_forms", "Quill forms at m-i-n-d.ai/#/forms — public lead-capture forms that can auto-create CRM contacts / Life items. Actions: list, get, create, update, delete, submissions, public_get (read a published form by its public slug, no auth needed).", {
|
|
5948
|
+
action: zod_1.z.enum(["list", "get", "create", "update", "delete", "submissions", "public_get"]).describe("Which form operation to perform."),
|
|
5949
|
+
form_id: zod_1.z.string().optional().describe("Form id — get/update/delete/submissions (required)."),
|
|
5950
|
+
name: zod_1.z.string().optional().describe("Form name — required for create; update."),
|
|
5951
|
+
description: zod_1.z.string().optional().describe("Form description — create/update."),
|
|
5952
|
+
fields: zod_1.z.array(zod_1.z.record(zod_1.z.string(), zod_1.z.any())).optional().describe("[{field_id?, label, type?, required?, options?, placeholder?, maps_to?}] — create/update."),
|
|
5953
|
+
settings: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional().describe("{create_contact?, create_life_item?, contact_type?, success_message?, accent?} — create/update."),
|
|
5954
|
+
is_published: zod_1.z.boolean().optional().describe("Publish/unpublish the form — update."),
|
|
5955
|
+
slug: zod_1.z.string().optional().describe("Public form slug — required for public_get."),
|
|
5956
|
+
}, async (args) => {
|
|
5957
|
+
const { action } = args;
|
|
5958
|
+
const base = "/forms";
|
|
5959
|
+
try {
|
|
5960
|
+
switch (action) {
|
|
5961
|
+
case "list":
|
|
5962
|
+
return ok(await client.call("GET", base, args));
|
|
5963
|
+
case "get": {
|
|
5964
|
+
const m = need(args, ["form_id"]);
|
|
5965
|
+
if (m)
|
|
5966
|
+
return err(m);
|
|
5967
|
+
return ok(await client.call("GET", `${base}/{form_id}`, args, ["form_id"]));
|
|
5968
|
+
}
|
|
5969
|
+
case "create": {
|
|
5970
|
+
const m = need(args, ["name"]);
|
|
5971
|
+
if (m)
|
|
5972
|
+
return err(m);
|
|
5973
|
+
return ok(await client.call("POST", base, args, [], [], ["name", "description", "fields", "settings"]));
|
|
5974
|
+
}
|
|
5975
|
+
case "update": {
|
|
5976
|
+
const m = need(args, ["form_id"]);
|
|
5977
|
+
if (m)
|
|
5978
|
+
return err(m);
|
|
5979
|
+
return ok(await client.call("PATCH", `${base}/{form_id}`, args, ["form_id"], [], ["name", "description", "fields", "settings", "is_published"]));
|
|
5980
|
+
}
|
|
5981
|
+
case "delete": {
|
|
5982
|
+
const m = need(args, ["form_id"]);
|
|
5983
|
+
if (m)
|
|
5984
|
+
return err(m);
|
|
5985
|
+
return ok(await client.call("DELETE", `${base}/{form_id}`, args, ["form_id"]));
|
|
5986
|
+
}
|
|
5987
|
+
case "submissions": {
|
|
5988
|
+
const m = need(args, ["form_id"]);
|
|
5989
|
+
if (m)
|
|
5990
|
+
return err(m);
|
|
5991
|
+
return ok(await client.call("GET", `${base}/{form_id}/submissions`, args, ["form_id"]));
|
|
5992
|
+
}
|
|
5993
|
+
case "public_get": {
|
|
5994
|
+
const m = need(args, ["slug"]);
|
|
5995
|
+
if (m)
|
|
5996
|
+
return err(m);
|
|
5997
|
+
return ok(await client.call("GET", `${base}/public/{slug}`, args, ["slug"]));
|
|
5998
|
+
}
|
|
5999
|
+
default: {
|
|
6000
|
+
const _exhaustive = action;
|
|
6001
|
+
return err(`Unknown action: ${_exhaustive}`);
|
|
6002
|
+
}
|
|
6003
|
+
}
|
|
6004
|
+
}
|
|
6005
|
+
catch (e) {
|
|
6006
|
+
if (e instanceof mind_client_js_1.MindApiError)
|
|
6007
|
+
return err(`mind_forms ${action} failed (HTTP ${e.status}): ${apiDetail(e)}`);
|
|
6008
|
+
return err(`mind_forms error: ${e instanceof Error ? e.message : String(e)}`);
|
|
6009
|
+
}
|
|
6010
|
+
});
|
|
6011
|
+
// ─── mind_library ───────────────────────────────────────
|
|
6012
|
+
server.tool("mind_library", "MIND Library — personal bookshelf at m-i-n-d.ai/#/library. Actions: authors (author stats), books_list, book_get, book_content (chapter text/table of contents), book_companion (AI reading companion for a book), book_create, book_update, book_delete.", {
|
|
6013
|
+
action: zod_1.z.enum(["authors", "books_list", "book_get", "book_content", "book_companion", "book_create", "book_update", "book_delete"]).describe("Which library operation to perform."),
|
|
6014
|
+
book_id: zod_1.z.string().optional().describe("Book id — every action except authors/books_list/book_create."),
|
|
6015
|
+
q: zod_1.z.string().optional().describe("Free-text search — books_list."),
|
|
6016
|
+
author: zod_1.z.string().optional().describe("Filter by author — books_list."),
|
|
6017
|
+
genre: zod_1.z.string().optional().describe("Filter by genre — books_list."),
|
|
6018
|
+
series: zod_1.z.string().optional().describe("Filter by series — books_list; book_create/book_update."),
|
|
6019
|
+
status: zod_1.z.enum(["unread", "reading", "finished", "abandoned"]).optional().describe("Filter by reading status — books_list; book_create (default 'unread')/book_update."),
|
|
6020
|
+
shelf_id: zod_1.z.string().optional().describe("Filter by shelf id — books_list."),
|
|
6021
|
+
tag: zod_1.z.string().optional().describe("Filter by tag — books_list."),
|
|
6022
|
+
sort: zod_1.z.string().optional().describe("Sort field — books_list (default 'added')."),
|
|
6023
|
+
order: zod_1.z.string().optional().describe("Sort order 'asc'|'desc' — books_list (default 'desc')."),
|
|
6024
|
+
limit: zod_1.z.number().int().optional().describe("Max results — books_list (default 60, 1-500)."),
|
|
6025
|
+
offset: zod_1.z.number().int().optional().describe("Pagination offset — books_list (default 0)."),
|
|
6026
|
+
chapter: zod_1.z.string().optional().describe("Return only this chapter id — book_content."),
|
|
6027
|
+
toc_only: zod_1.z.boolean().optional().describe("Return only the table of contents, no HTML — book_content (default false)."),
|
|
6028
|
+
title: zod_1.z.string().optional().describe("Book title — required for book_create; book_update."),
|
|
6029
|
+
subtitle: zod_1.z.string().optional().describe("Book subtitle — book_create/book_update."),
|
|
6030
|
+
authors: zod_1.z.array(zod_1.z.string()).optional().describe("Author names — book_create/book_update."),
|
|
6031
|
+
genres: zod_1.z.array(zod_1.z.string()).optional().describe("Genres — book_create/book_update."),
|
|
6032
|
+
series_index: zod_1.z.number().optional().describe("Position within the series — book_create/book_update."),
|
|
6033
|
+
isbn10: zod_1.z.string().optional().describe("ISBN-10 — book_create/book_update."),
|
|
6034
|
+
isbn13: zod_1.z.string().optional().describe("ISBN-13 — book_create/book_update."),
|
|
6035
|
+
publisher: zod_1.z.string().optional().describe("Publisher — book_create/book_update."),
|
|
6036
|
+
published_year: zod_1.z.number().int().optional().describe("Publication year — book_create/book_update."),
|
|
6037
|
+
language: zod_1.z.string().optional().describe("Language code — book_create/book_update."),
|
|
6038
|
+
page_count: zod_1.z.number().int().optional().describe("Page count — book_create/book_update."),
|
|
6039
|
+
description: zod_1.z.string().optional().describe("Book description/blurb — book_create/book_update."),
|
|
6040
|
+
cover_url: zod_1.z.string().optional().describe("Cover image URL — book_create/book_update."),
|
|
6041
|
+
tags: zod_1.z.array(zod_1.z.string()).optional().describe("Tags — book_create/book_update."),
|
|
6042
|
+
source: zod_1.z.string().optional().describe("Source of the record — book_create (default 'manual')."),
|
|
6043
|
+
source_id: zod_1.z.string().optional().describe("External source id — book_create."),
|
|
6044
|
+
file_url: zod_1.z.string().optional().describe("Book file URL — book_create/book_update."),
|
|
6045
|
+
file_format: zod_1.z.string().optional().describe("File format, e.g. 'epub'/'pdf' — book_create/book_update."),
|
|
6046
|
+
file_size: zod_1.z.number().int().optional().describe("File size in bytes — book_create/book_update."),
|
|
6047
|
+
progress_pct: zod_1.z.number().int().optional().describe("Reading progress percent 0-100 — book_create (default 0)/book_update."),
|
|
6048
|
+
rating: zod_1.z.number().optional().describe("Rating 0-5 — book_create/book_update."),
|
|
6049
|
+
notes: zod_1.z.string().optional().describe("Free-text notes — book_create/book_update."),
|
|
6050
|
+
date_started: zod_1.z.string().optional().describe("Date started (YYYY-MM-DD) — book_create/book_update."),
|
|
6051
|
+
date_finished: zod_1.z.string().optional().describe("Date finished (YYYY-MM-DD) — book_create/book_update."),
|
|
6052
|
+
}, async (args) => {
|
|
6053
|
+
const { action } = args;
|
|
6054
|
+
const base = "/library";
|
|
6055
|
+
try {
|
|
6056
|
+
switch (action) {
|
|
6057
|
+
case "authors":
|
|
6058
|
+
return ok(await client.call("GET", `${base}/authors`, args));
|
|
6059
|
+
case "books_list":
|
|
6060
|
+
return ok(await client.call("GET", `${base}/books`, args, [], [
|
|
6061
|
+
"q", "author", "genre", "series", "status", "shelf_id", "tag", "sort", "order", "limit", "offset",
|
|
6062
|
+
]));
|
|
6063
|
+
case "book_get": {
|
|
6064
|
+
const m = need(args, ["book_id"]);
|
|
6065
|
+
if (m)
|
|
6066
|
+
return err(m);
|
|
6067
|
+
return ok(await client.call("GET", `${base}/books/{book_id}`, args, ["book_id"]));
|
|
6068
|
+
}
|
|
6069
|
+
case "book_content": {
|
|
6070
|
+
const m = need(args, ["book_id"]);
|
|
6071
|
+
if (m)
|
|
6072
|
+
return err(m);
|
|
6073
|
+
return ok(await client.call("GET", `${base}/books/{book_id}/content`, args, ["book_id"], ["chapter", "toc_only"]));
|
|
6074
|
+
}
|
|
6075
|
+
case "book_companion": {
|
|
6076
|
+
const m = need(args, ["book_id"]);
|
|
6077
|
+
if (m)
|
|
6078
|
+
return err(m);
|
|
6079
|
+
return ok(await client.call("GET", `${base}/books/{book_id}/companion`, args, ["book_id"]));
|
|
6080
|
+
}
|
|
6081
|
+
case "book_create": {
|
|
6082
|
+
const m = need(args, ["title"]);
|
|
6083
|
+
if (m)
|
|
6084
|
+
return err(m);
|
|
6085
|
+
return ok(await client.call("POST", `${base}/books`, args, [], [], [
|
|
6086
|
+
"title", "subtitle", "authors", "genres", "series", "series_index", "isbn10", "isbn13",
|
|
6087
|
+
"publisher", "published_year", "language", "page_count", "description", "cover_url", "tags",
|
|
6088
|
+
"source", "source_id", "file_url", "file_format", "file_size", "status", "progress_pct",
|
|
6089
|
+
"rating", "notes", "date_started", "date_finished",
|
|
6090
|
+
]));
|
|
6091
|
+
}
|
|
6092
|
+
case "book_update": {
|
|
6093
|
+
const m = need(args, ["book_id"]);
|
|
6094
|
+
if (m)
|
|
6095
|
+
return err(m);
|
|
6096
|
+
return ok(await client.call("PUT", `${base}/books/{book_id}`, args, ["book_id"], [], [
|
|
6097
|
+
"title", "subtitle", "authors", "genres", "series", "series_index", "isbn10", "isbn13",
|
|
6098
|
+
"publisher", "published_year", "language", "page_count", "description", "cover_url", "tags",
|
|
6099
|
+
"file_url", "file_format", "file_size", "status", "progress_pct", "rating", "notes",
|
|
6100
|
+
"date_started", "date_finished",
|
|
6101
|
+
]));
|
|
6102
|
+
}
|
|
6103
|
+
case "book_delete": {
|
|
6104
|
+
const m = need(args, ["book_id"]);
|
|
6105
|
+
if (m)
|
|
6106
|
+
return err(m);
|
|
6107
|
+
return ok(await client.call("DELETE", `${base}/books/{book_id}`, args, ["book_id"]));
|
|
6108
|
+
}
|
|
6109
|
+
default: {
|
|
6110
|
+
const _exhaustive = action;
|
|
6111
|
+
return err(`Unknown action: ${_exhaustive}`);
|
|
6112
|
+
}
|
|
6113
|
+
}
|
|
6114
|
+
}
|
|
6115
|
+
catch (e) {
|
|
6116
|
+
if (e instanceof mind_client_js_1.MindApiError)
|
|
6117
|
+
return err(`mind_library ${action} failed (HTTP ${e.status}): ${apiDetail(e)}`);
|
|
6118
|
+
return err(`mind_library error: ${e instanceof Error ? e.message : String(e)}`);
|
|
6119
|
+
}
|
|
6120
|
+
});
|
|
6121
|
+
// ─── mind_share ─────────────────────────────────────────
|
|
6122
|
+
// Share links for one MIND document (distinct from mind_mindmap's own
|
|
6123
|
+
// share/unshare, which are web-app-only). Mirrors the hosted handler
|
|
6124
|
+
// _t_mind_share in backend/routes/mcp_server_routes.py 1:1.
|
|
6125
|
+
server.tool("mind_share", "Create and manage share links for a MIND document. Actions: create (default — mint a new share link), list (this document's share links), list_all (every share link across your documents), revoke (delete one share link).", {
|
|
6126
|
+
action: zod_1.z
|
|
6127
|
+
.enum(["create", "list", "list_all", "revoke"])
|
|
6128
|
+
.optional()
|
|
6129
|
+
.default("create")
|
|
6130
|
+
.describe("Which share operation to perform. Defaults to 'create'."),
|
|
6131
|
+
doc_id: zod_1.z.string().optional().describe("Document id — required for create/list/revoke."),
|
|
6132
|
+
role: zod_1.z.string().optional().describe("Access role granted to the share, e.g. 'viewer' — create."),
|
|
6133
|
+
grantee_username: zod_1.z.string().optional().describe("Share directly with this MIND username instead of a public link — create."),
|
|
6134
|
+
expires_in_days: zod_1.z.number().int().optional().describe("Share link expiry in days — create."),
|
|
6135
|
+
password: zod_1.z.string().optional().describe("Password to protect the share link — create."),
|
|
6136
|
+
share_id: zod_1.z.string().optional().describe("Share id — required for revoke."),
|
|
6137
|
+
}, async (args) => {
|
|
6138
|
+
const { action } = args;
|
|
6139
|
+
try {
|
|
6140
|
+
switch (action) {
|
|
6141
|
+
case "create": {
|
|
6142
|
+
const m = need(args, ["doc_id"]);
|
|
6143
|
+
if (m)
|
|
6144
|
+
return err(m);
|
|
6145
|
+
return ok(await client.call("POST", "/developer/v1/documents/{doc_id}/share", args, ["doc_id"], [], [
|
|
6146
|
+
"role", "grantee_username", "expires_in_days", "password",
|
|
6147
|
+
]));
|
|
6148
|
+
}
|
|
6149
|
+
case "list": {
|
|
6150
|
+
const m = need(args, ["doc_id"]);
|
|
6151
|
+
if (m)
|
|
6152
|
+
return err(m);
|
|
6153
|
+
return ok(await client.call("GET", "/developer/v1/documents/{doc_id}/share", args, ["doc_id"]));
|
|
6154
|
+
}
|
|
6155
|
+
case "list_all":
|
|
6156
|
+
return ok(await client.call("GET", "/developer/v1/documents/shares", args));
|
|
6157
|
+
case "revoke": {
|
|
6158
|
+
const m = need(args, ["doc_id", "share_id"]);
|
|
6159
|
+
if (m)
|
|
6160
|
+
return err(m);
|
|
6161
|
+
return ok(await client.call("DELETE", "/developer/v1/documents/{doc_id}/share/{share_id}", args, ["doc_id", "share_id"]));
|
|
6162
|
+
}
|
|
6163
|
+
default: {
|
|
6164
|
+
const _exhaustive = action;
|
|
6165
|
+
return err(`Unknown action: ${_exhaustive}`);
|
|
6166
|
+
}
|
|
6167
|
+
}
|
|
6168
|
+
}
|
|
6169
|
+
catch (e) {
|
|
6170
|
+
if (e instanceof mind_client_js_1.MindApiError)
|
|
6171
|
+
return err(`mind_share ${action} failed (HTTP ${e.status}): ${apiDetail(e)}`);
|
|
6172
|
+
return err(`mind_share error: ${e instanceof Error ? e.message : String(e)}`);
|
|
6173
|
+
}
|
|
6174
|
+
});
|
|
5010
6175
|
return server;
|
|
5011
6176
|
}
|
|
5012
6177
|
//# sourceMappingURL=server.js.map
|