@iwo-szapar/data-mcp 0.1.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.
Files changed (213) hide show
  1. package/dist/adapter/factory.d.ts +9 -0
  2. package/dist/adapter/factory.d.ts.map +1 -0
  3. package/dist/adapter/factory.js +23 -0
  4. package/dist/adapter/factory.js.map +1 -0
  5. package/dist/adapter/pocketbase.d.ts +37 -0
  6. package/dist/adapter/pocketbase.d.ts.map +1 -0
  7. package/dist/adapter/pocketbase.js +350 -0
  8. package/dist/adapter/pocketbase.js.map +1 -0
  9. package/dist/adapter/schema-map.d.ts +45 -0
  10. package/dist/adapter/schema-map.d.ts.map +1 -0
  11. package/dist/adapter/schema-map.js +75 -0
  12. package/dist/adapter/schema-map.js.map +1 -0
  13. package/dist/adapter/supabase.d.ts +32 -0
  14. package/dist/adapter/supabase.d.ts.map +1 -0
  15. package/dist/adapter/supabase.js +294 -0
  16. package/dist/adapter/supabase.js.map +1 -0
  17. package/dist/adapter/types.d.ts +67 -0
  18. package/dist/adapter/types.d.ts.map +1 -0
  19. package/dist/adapter/types.js +9 -0
  20. package/dist/adapter/types.js.map +1 -0
  21. package/dist/config.d.ts +31 -0
  22. package/dist/config.d.ts.map +1 -0
  23. package/dist/config.js +62 -0
  24. package/dist/config.js.map +1 -0
  25. package/dist/errors/adapter-error.d.ts +12 -0
  26. package/dist/errors/adapter-error.d.ts.map +1 -0
  27. package/dist/errors/adapter-error.js +15 -0
  28. package/dist/errors/adapter-error.js.map +1 -0
  29. package/dist/index.d.ts +9 -0
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.js +27 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/search/alias-expansion.d.ts +53 -0
  34. package/dist/search/alias-expansion.d.ts.map +1 -0
  35. package/dist/search/alias-expansion.js +131 -0
  36. package/dist/search/alias-expansion.js.map +1 -0
  37. package/dist/server.d.ts +9 -0
  38. package/dist/server.d.ts.map +1 -0
  39. package/dist/server.js +40 -0
  40. package/dist/server.js.map +1 -0
  41. package/dist/tools/business/blog-create.d.ts +9 -0
  42. package/dist/tools/business/blog-create.d.ts.map +1 -0
  43. package/dist/tools/business/blog-create.js +53 -0
  44. package/dist/tools/business/blog-create.js.map +1 -0
  45. package/dist/tools/business/blog-delete.d.ts +9 -0
  46. package/dist/tools/business/blog-delete.d.ts.map +1 -0
  47. package/dist/tools/business/blog-delete.js +29 -0
  48. package/dist/tools/business/blog-delete.js.map +1 -0
  49. package/dist/tools/business/blog-list.d.ts +9 -0
  50. package/dist/tools/business/blog-list.d.ts.map +1 -0
  51. package/dist/tools/business/blog-list.js +37 -0
  52. package/dist/tools/business/blog-list.js.map +1 -0
  53. package/dist/tools/business/blog-update.d.ts +9 -0
  54. package/dist/tools/business/blog-update.d.ts.map +1 -0
  55. package/dist/tools/business/blog-update.js +66 -0
  56. package/dist/tools/business/blog-update.js.map +1 -0
  57. package/dist/tools/business/content-queue-add.d.ts +9 -0
  58. package/dist/tools/business/content-queue-add.d.ts.map +1 -0
  59. package/dist/tools/business/content-queue-add.js +40 -0
  60. package/dist/tools/business/content-queue-add.js.map +1 -0
  61. package/dist/tools/business/content-queue-list.d.ts +9 -0
  62. package/dist/tools/business/content-queue-list.d.ts.map +1 -0
  63. package/dist/tools/business/content-queue-list.js +41 -0
  64. package/dist/tools/business/content-queue-list.js.map +1 -0
  65. package/dist/tools/business/email-queue-add.d.ts +9 -0
  66. package/dist/tools/business/email-queue-add.d.ts.map +1 -0
  67. package/dist/tools/business/email-queue-add.js +47 -0
  68. package/dist/tools/business/email-queue-add.js.map +1 -0
  69. package/dist/tools/business/prospect-create.d.ts +9 -0
  70. package/dist/tools/business/prospect-create.d.ts.map +1 -0
  71. package/dist/tools/business/prospect-create.js +50 -0
  72. package/dist/tools/business/prospect-create.js.map +1 -0
  73. package/dist/tools/business/prospect-list.d.ts +9 -0
  74. package/dist/tools/business/prospect-list.d.ts.map +1 -0
  75. package/dist/tools/business/prospect-list.js +37 -0
  76. package/dist/tools/business/prospect-list.js.map +1 -0
  77. package/dist/tools/business/prospect-search.d.ts +9 -0
  78. package/dist/tools/business/prospect-search.d.ts.map +1 -0
  79. package/dist/tools/business/prospect-search.js +29 -0
  80. package/dist/tools/business/prospect-search.js.map +1 -0
  81. package/dist/tools/business/prospect-update.d.ts +9 -0
  82. package/dist/tools/business/prospect-update.d.ts.map +1 -0
  83. package/dist/tools/business/prospect-update.js +68 -0
  84. package/dist/tools/business/prospect-update.js.map +1 -0
  85. package/dist/tools/memory/brain-decay.d.ts +11 -0
  86. package/dist/tools/memory/brain-decay.d.ts.map +1 -0
  87. package/dist/tools/memory/brain-decay.js +58 -0
  88. package/dist/tools/memory/brain-decay.js.map +1 -0
  89. package/dist/tools/memory/brain-stats.d.ts +11 -0
  90. package/dist/tools/memory/brain-stats.d.ts.map +1 -0
  91. package/dist/tools/memory/brain-stats.js +63 -0
  92. package/dist/tools/memory/brain-stats.js.map +1 -0
  93. package/dist/tools/memory/contact-create.d.ts +9 -0
  94. package/dist/tools/memory/contact-create.d.ts.map +1 -0
  95. package/dist/tools/memory/contact-create.js +42 -0
  96. package/dist/tools/memory/contact-create.js.map +1 -0
  97. package/dist/tools/memory/contact-list.d.ts +9 -0
  98. package/dist/tools/memory/contact-list.d.ts.map +1 -0
  99. package/dist/tools/memory/contact-list.js +30 -0
  100. package/dist/tools/memory/contact-list.js.map +1 -0
  101. package/dist/tools/memory/contact-search.d.ts +9 -0
  102. package/dist/tools/memory/contact-search.d.ts.map +1 -0
  103. package/dist/tools/memory/contact-search.js +29 -0
  104. package/dist/tools/memory/contact-search.js.map +1 -0
  105. package/dist/tools/memory/contact-update.d.ts +9 -0
  106. package/dist/tools/memory/contact-update.d.ts.map +1 -0
  107. package/dist/tools/memory/contact-update.js +59 -0
  108. package/dist/tools/memory/contact-update.js.map +1 -0
  109. package/dist/tools/memory/goal-create.d.ts +9 -0
  110. package/dist/tools/memory/goal-create.d.ts.map +1 -0
  111. package/dist/tools/memory/goal-create.js +40 -0
  112. package/dist/tools/memory/goal-create.js.map +1 -0
  113. package/dist/tools/memory/goal-list.d.ts +9 -0
  114. package/dist/tools/memory/goal-list.d.ts.map +1 -0
  115. package/dist/tools/memory/goal-list.js +41 -0
  116. package/dist/tools/memory/goal-list.js.map +1 -0
  117. package/dist/tools/memory/goal-update.d.ts +9 -0
  118. package/dist/tools/memory/goal-update.d.ts.map +1 -0
  119. package/dist/tools/memory/goal-update.js +51 -0
  120. package/dist/tools/memory/goal-update.js.map +1 -0
  121. package/dist/tools/memory/knowledge-decide.d.ts +10 -0
  122. package/dist/tools/memory/knowledge-decide.d.ts.map +1 -0
  123. package/dist/tools/memory/knowledge-decide.js +39 -0
  124. package/dist/tools/memory/knowledge-decide.js.map +1 -0
  125. package/dist/tools/memory/knowledge-delete.d.ts +10 -0
  126. package/dist/tools/memory/knowledge-delete.d.ts.map +1 -0
  127. package/dist/tools/memory/knowledge-delete.js +33 -0
  128. package/dist/tools/memory/knowledge-delete.js.map +1 -0
  129. package/dist/tools/memory/knowledge-learn.d.ts +10 -0
  130. package/dist/tools/memory/knowledge-learn.d.ts.map +1 -0
  131. package/dist/tools/memory/knowledge-learn.js +39 -0
  132. package/dist/tools/memory/knowledge-learn.js.map +1 -0
  133. package/dist/tools/memory/knowledge-list.d.ts +9 -0
  134. package/dist/tools/memory/knowledge-list.d.ts.map +1 -0
  135. package/dist/tools/memory/knowledge-list.js +43 -0
  136. package/dist/tools/memory/knowledge-list.js.map +1 -0
  137. package/dist/tools/memory/knowledge-recall.d.ts +11 -0
  138. package/dist/tools/memory/knowledge-recall.d.ts.map +1 -0
  139. package/dist/tools/memory/knowledge-recall.js +79 -0
  140. package/dist/tools/memory/knowledge-recall.js.map +1 -0
  141. package/dist/tools/memory/knowledge-store.d.ts +10 -0
  142. package/dist/tools/memory/knowledge-store.d.ts.map +1 -0
  143. package/dist/tools/memory/knowledge-store.js +56 -0
  144. package/dist/tools/memory/knowledge-store.js.map +1 -0
  145. package/dist/tools/memory/knowledge-update.d.ts +10 -0
  146. package/dist/tools/memory/knowledge-update.d.ts.map +1 -0
  147. package/dist/tools/memory/knowledge-update.js +50 -0
  148. package/dist/tools/memory/knowledge-update.js.map +1 -0
  149. package/dist/tools/memory/knowledge-validate.d.ts +10 -0
  150. package/dist/tools/memory/knowledge-validate.d.ts.map +1 -0
  151. package/dist/tools/memory/knowledge-validate.js +40 -0
  152. package/dist/tools/memory/knowledge-validate.js.map +1 -0
  153. package/dist/tools/memory/session-list.d.ts +9 -0
  154. package/dist/tools/memory/session-list.d.ts.map +1 -0
  155. package/dist/tools/memory/session-list.js +30 -0
  156. package/dist/tools/memory/session-list.js.map +1 -0
  157. package/dist/tools/memory/session-log.d.ts +9 -0
  158. package/dist/tools/memory/session-log.d.ts.map +1 -0
  159. package/dist/tools/memory/session-log.js +56 -0
  160. package/dist/tools/memory/session-log.js.map +1 -0
  161. package/dist/tools/memory/task-create.d.ts +9 -0
  162. package/dist/tools/memory/task-create.d.ts.map +1 -0
  163. package/dist/tools/memory/task-create.js +38 -0
  164. package/dist/tools/memory/task-create.js.map +1 -0
  165. package/dist/tools/memory/task-list.d.ts +9 -0
  166. package/dist/tools/memory/task-list.d.ts.map +1 -0
  167. package/dist/tools/memory/task-list.js +41 -0
  168. package/dist/tools/memory/task-list.js.map +1 -0
  169. package/dist/tools/memory/task-update.d.ts +9 -0
  170. package/dist/tools/memory/task-update.d.ts.map +1 -0
  171. package/dist/tools/memory/task-update.js +50 -0
  172. package/dist/tools/memory/task-update.js.map +1 -0
  173. package/dist/tools/register.d.ts +7 -0
  174. package/dist/tools/register.d.ts.map +1 -0
  175. package/dist/tools/register.js +84 -0
  176. package/dist/tools/register.js.map +1 -0
  177. package/dist/tools/setup/setup-migrate.d.ts +10 -0
  178. package/dist/tools/setup/setup-migrate.d.ts.map +1 -0
  179. package/dist/tools/setup/setup-migrate.js +73 -0
  180. package/dist/tools/setup/setup-migrate.js.map +1 -0
  181. package/dist/tools/setup/setup-seed.d.ts +9 -0
  182. package/dist/tools/setup/setup-seed.d.ts.map +1 -0
  183. package/dist/tools/setup/setup-seed.js +133 -0
  184. package/dist/tools/setup/setup-seed.js.map +1 -0
  185. package/dist/tools/setup/setup-status.d.ts +9 -0
  186. package/dist/tools/setup/setup-status.d.ts.map +1 -0
  187. package/dist/tools/setup/setup-status.js +76 -0
  188. package/dist/tools/setup/setup-status.js.map +1 -0
  189. package/dist/tools/shared.d.ts +56 -0
  190. package/dist/tools/shared.d.ts.map +1 -0
  191. package/dist/tools/shared.js +93 -0
  192. package/dist/tools/shared.js.map +1 -0
  193. package/dist/types/records.d.ts +163 -0
  194. package/dist/types/records.d.ts.map +1 -0
  195. package/dist/types/records.js +8 -0
  196. package/dist/types/records.js.map +1 -0
  197. package/migrations/pocketbase/001_core_schema.js +72 -0
  198. package/migrations/pocketbase/002_goals_tasks.js +49 -0
  199. package/migrations/pocketbase/003_contacts.js +29 -0
  200. package/migrations/pocketbase/004_entity_aliases.js +40 -0
  201. package/migrations/pocketbase/005_prospects.js +33 -0
  202. package/migrations/pocketbase/006_business.js +80 -0
  203. package/migrations/pocketbase/007_newsletter_affiliates.js +50 -0
  204. package/migrations/supabase/001_core_schema.sql +78 -0
  205. package/migrations/supabase/002_goals_tasks.sql +38 -0
  206. package/migrations/supabase/003_contacts.sql +27 -0
  207. package/migrations/supabase/004_entity_aliases.sql +22 -0
  208. package/migrations/supabase/005_prospects.sql +31 -0
  209. package/migrations/supabase/006_business.sql +68 -0
  210. package/migrations/supabase/007_seed_aliases.sql +69 -0
  211. package/migrations/supabase/008_newsletter_affiliates.sql +39 -0
  212. package/package.json +48 -0
  213. package/seed/entity-aliases.json +57 -0
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Tool: email_queue_add
3
+ *
4
+ * Add an email to the queue. Does NOT send — just inserts into email_queue table.
5
+ */
6
+ import { z } from 'zod';
7
+ import { makeToolResponse, handleAdapterError, withGracefulDegradation } from '../shared.js';
8
+ export function registerEmailQueueAdd(server, adapter) {
9
+ server.tool('email_queue_add', 'Add an email to the sending queue. Does NOT send the email — it only queues it for later processing.', {
10
+ to_email: z.string().min(1).max(200).describe('Recipient email address'),
11
+ to_name: z.string().max(200).optional().describe('Recipient name'),
12
+ subject: z.string().min(1).max(500).describe('Email subject'),
13
+ body_html: z.string().min(1).max(50000).describe('HTML body content (max 50KB)'),
14
+ body_text: z.string().optional().describe('Plain text body (fallback)'),
15
+ sequence_id: z.string().max(100).optional().describe('Email sequence ID'),
16
+ sequence_step: z.number().int().optional().describe('Step number in sequence'),
17
+ prospect_id: z.string().min(1).optional().describe('Related prospect ID'),
18
+ scheduled_at: z.string().optional().describe('Scheduled send time (ISO format)'),
19
+ }, withGracefulDegradation('email_queue', adapter, async (params) => {
20
+ try {
21
+ const record = await adapter.create('email_queue', {
22
+ to_email: params.to_email,
23
+ to_name: params.to_name ?? null,
24
+ subject: params.subject,
25
+ body_html: params.body_html,
26
+ body_text: params.body_text ?? null,
27
+ status: 'queued',
28
+ sequence_id: params.sequence_id ?? null,
29
+ sequence_step: params.sequence_step ?? null,
30
+ prospect_id: params.prospect_id ?? null,
31
+ scheduled_at: params.scheduled_at ?? null,
32
+ sent_at: null,
33
+ error: null,
34
+ resend_id: null,
35
+ });
36
+ return makeToolResponse({
37
+ queued: true,
38
+ item: { id: record.id, to_email: record.to_email, subject: record.subject, status: 'queued', created_at: record.created_at },
39
+ message: `Email queued to ${params.to_email}: "${params.subject}"`,
40
+ });
41
+ }
42
+ catch (error) {
43
+ return handleAdapterError(error, 'email_queue_add');
44
+ }
45
+ }));
46
+ }
47
+ //# sourceMappingURL=email-queue-add.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email-queue-add.js","sourceRoot":"","sources":["../../../src/tools/business/email-queue-add.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,uBAAuB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
3
+ *
4
+ * Add a prospect to the CRM pipeline.
5
+ */
6
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
7
+ import type { DataAdapter } from '../../adapter/types.js';
8
+ export declare function registerProspectCreate(server: McpServer, adapter: DataAdapter): void;
9
+ //# sourceMappingURL=prospect-create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prospect-create.d.ts","sourceRoot":"","sources":["../../../src/tools/business/prospect-create.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAI1D,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CA8CpF"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Tool: prospect_create
3
+ *
4
+ * Add a prospect to the CRM pipeline.
5
+ */
6
+ import { z } from 'zod';
7
+ import { makeToolResponse, handleAdapterError, withGracefulDegradation } from '../shared.js';
8
+ export function registerProspectCreate(server, adapter) {
9
+ server.tool('prospect_create', 'Add a prospect to the sales pipeline. Track leads through stages from new to closed.', {
10
+ name: z.string().min(1).max(200).describe('Prospect name'),
11
+ email: z.string().max(200).optional().describe('Email address'),
12
+ company: z.string().max(200).optional().describe('Company name'),
13
+ role: z.string().max(200).optional().describe('Role/title'),
14
+ stage: z.enum(['new', 'contacted', 'responded', 'interested', 'ready_to_buy', 'proposal_sent', 'negotiating', 'closed_won', 'closed_lost', 'nurturing']).optional().describe('Pipeline stage (default: new)'),
15
+ source: z.string().max(200).optional().describe('Where the prospect came from'),
16
+ estimated_value: z.number().int().optional().describe('Estimated deal value in cents'),
17
+ next_action_type: z.string().max(100).optional().describe('Next action type'),
18
+ next_followup_date: z.string().max(50).optional().describe('Next followup date (ISO format)'),
19
+ notes: z.string().max(10000).optional().describe('Notes about the prospect'),
20
+ tags: z.array(z.string().max(100)).max(20).optional().describe('Tags'),
21
+ linkedin_url: z.string().max(500).optional().describe('LinkedIn profile URL'),
22
+ }, withGracefulDegradation('prospects', adapter, async (params) => {
23
+ try {
24
+ const record = await adapter.create('prospects', {
25
+ name: params.name.trim(),
26
+ email: params.email ?? null,
27
+ company: params.company ?? null,
28
+ role: params.role ?? null,
29
+ stage: params.stage ?? 'new',
30
+ source: params.source ?? null,
31
+ estimated_value: params.estimated_value ?? null,
32
+ next_action_type: params.next_action_type ?? null,
33
+ next_followup_date: params.next_followup_date ?? null,
34
+ last_contact_date: null,
35
+ notes: params.notes ?? null,
36
+ tags: params.tags ?? [],
37
+ linkedin_url: params.linkedin_url ?? null,
38
+ });
39
+ return makeToolResponse({
40
+ created: true,
41
+ item: { id: record.id, name: record.name, stage: record.stage, created_at: record.created_at },
42
+ message: `Prospect created: "${params.name}" (stage: ${params.stage ?? 'new'})`,
43
+ });
44
+ }
45
+ catch (error) {
46
+ return handleAdapterError(error, 'prospect_create');
47
+ }
48
+ }));
49
+ }
50
+ //# sourceMappingURL=prospect-create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prospect-create.js","sourceRoot":"","sources":["../../../src/tools/business/prospect-create.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAE7F,MAAM,UAAU,sBAAsB,CAAC,MAAiB,EAAE,OAAoB;IAC5E,MAAM,CAAC,IAAI,CACT,iBAAiB,EACjB,sFAAsF,EACtF;QACE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC;QAC1D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,C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EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE;gBAC9F,OAAO,EAAE,sBAAsB,MAAM,CAAC,IAAI,aAAa,MAAM,CAAC,KAAK,IAAI,KAAK,GAAG;aAChF,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;QACtD,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Tool: prospect_list
3
+ *
4
+ * List prospects with optional stage filter.
5
+ */
6
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
7
+ import type { DataAdapter } from '../../adapter/types.js';
8
+ export declare function registerProspectList(server: McpServer, adapter: DataAdapter): void;
9
+ //# sourceMappingURL=prospect-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prospect-list.d.ts","sourceRoot":"","sources":["../../../src/tools/business/prospect-list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAgB,MAAM,wBAAwB,CAAC;AAIxE,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CAoClF"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Tool: prospect_list
3
+ *
4
+ * List prospects with optional stage filter.
5
+ */
6
+ import { z } from 'zod';
7
+ import { makeToolResponse, handleAdapterError, withGracefulDegradation } from '../shared.js';
8
+ export function registerProspectList(server, adapter) {
9
+ server.tool('prospect_list', 'List prospects with optional stage filter. Most recent first.', {
10
+ stage: z.enum(['new', 'contacted', 'responded', 'interested', 'ready_to_buy', 'proposal_sent', 'negotiating', 'closed_won', 'closed_lost', 'nurturing']).optional().describe('Filter by pipeline stage'),
11
+ limit: z.number().int().min(1).max(100).optional().describe('Max results (default 20)'),
12
+ offset: z.number().int().min(0).optional().describe('Offset for pagination (default 0)'),
13
+ }, { readOnlyHint: true }, withGracefulDegradation('prospects', adapter, async (params) => {
14
+ try {
15
+ const clauses = [];
16
+ if (params.stage) {
17
+ clauses.push({ field: 'stage', op: 'eq', value: params.stage });
18
+ }
19
+ const filter = clauses.length > 0 ? [clauses] : undefined;
20
+ const result = await adapter.list('prospects', {
21
+ filter,
22
+ sort: [{ field: 'created_at', direction: 'desc' }],
23
+ page: { limit: params.limit ?? 20, offset: params.offset ?? 0 },
24
+ });
25
+ return makeToolResponse({
26
+ items: result.items,
27
+ total: result.totalItems,
28
+ page: result.page,
29
+ per_page: result.perPage,
30
+ });
31
+ }
32
+ catch (error) {
33
+ return handleAdapterError(error, 'prospect_list');
34
+ }
35
+ }));
36
+ }
37
+ //# sourceMappingURL=prospect-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prospect-list.js","sourceRoot":"","sources":["../../../src/tools/business/prospect-list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAE7F,MAAM,UAAU,oBAAoB,CAAC,MAAiB,EAAE,OAAoB;IAC1E,MAAM,CAAC,IAAI,CACT,eAAe,EACf,+DAA+D,EAC/D;QACE,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;QACxM,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG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O,kBAAkB,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;QACpD,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Tool: prospect_search
3
+ *
4
+ * Search prospects by name, company, or notes.
5
+ */
6
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
7
+ import type { DataAdapter } from '../../adapter/types.js';
8
+ export declare function registerProspectSearch(server: McpServer, adapter: DataAdapter): void;
9
+ //# sourceMappingURL=prospect-search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prospect-search.d.ts","sourceRoot":"","sources":["../../../src/tools/business/prospect-search.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAI1D,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CA8BpF"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Tool: prospect_search
3
+ *
4
+ * Search prospects by name, company, or notes.
5
+ */
6
+ import { z } from 'zod';
7
+ import { makeToolResponse, handleAdapterError, withGracefulDegradation } from '../shared.js';
8
+ export function registerProspectSearch(server, adapter) {
9
+ server.tool('prospect_search', 'Search prospects by name, company, or notes.', {
10
+ query: z.string().min(1).max(200).describe('Search query'),
11
+ limit: z.number().int().min(1).max(50).optional().describe('Max results (default 10)'),
12
+ }, { readOnlyHint: true }, withGracefulDegradation('prospects', adapter, async (params) => {
13
+ try {
14
+ const results = await adapter.textSearch('prospects', params.query, {
15
+ fields: ['name', 'company', 'notes', 'email'],
16
+ limit: params.limit ?? 10,
17
+ });
18
+ return makeToolResponse({
19
+ results,
20
+ total: results.length,
21
+ query: params.query,
22
+ });
23
+ }
24
+ catch (error) {
25
+ return handleAdapterError(error, 'prospect_search');
26
+ }
27
+ }));
28
+ }
29
+ //# sourceMappingURL=prospect-search.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prospect-search.js","sourceRoot":"","sources":["../../../src/tools/business/prospect-search.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAE7F,MAAM,UAAU,sBAAsB,CAAC,MAAiB,EAAE,OAAoB;IAC5E,MAAM,CAAC,IAAI,CACT,iBAAiB,EACjB,8CAA8C,EAC9C;QACE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC;QAC1D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;KACvF,EACD,EAAE,YAAY,EAAE,IAAI,EAAE,EACtB,uBAAuB,CAAC,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QAC7D,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,UAAU,CACtC,WAAW,EACX,MAAM,CAAC,KAAK,EACZ;gBACE,MAAM,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC;gBAC7C,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,EAAE;aAC1B,CACF,CAAC;YAEF,OAAO,gBAAgB,CAAC;gBACtB,OAAO;gBACP,KAAK,EAAE,OAAO,CAAC,MAAM;gBACrB,KAAK,EAAE,MAAM,CAAC,KAAK;aACpB,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;QACtD,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Tool: prospect_update
3
+ *
4
+ * Update a prospect's stage, notes, next action, or other fields.
5
+ */
6
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
7
+ import type { DataAdapter } from '../../adapter/types.js';
8
+ export declare function registerProspectUpdate(server: McpServer, adapter: DataAdapter): void;
9
+ //# sourceMappingURL=prospect-update.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prospect-update.d.ts","sourceRoot":"","sources":["../../../src/tools/business/prospect-update.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAI1D,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CAsDpF"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Tool: prospect_update
3
+ *
4
+ * Update a prospect's stage, notes, next action, or other fields.
5
+ */
6
+ import { z } from 'zod';
7
+ import { makeToolResponse, handleAdapterError, withGracefulDegradation } from '../shared.js';
8
+ export function registerProspectUpdate(server, adapter) {
9
+ server.tool('prospect_update', 'Update a prospect. Change stage, notes, next action, or any other field.', {
10
+ id: z.string().min(1).describe('ID of the prospect to update'),
11
+ name: z.string().min(1).max(200).optional().describe('New name'),
12
+ email: z.string().max(200).optional().describe('New email'),
13
+ company: z.string().max(200).optional().describe('New company'),
14
+ role: z.string().max(200).optional().describe('New role'),
15
+ stage: z.enum(['new', 'contacted', 'responded', 'interested', 'ready_to_buy', 'proposal_sent', 'negotiating', 'closed_won', 'closed_lost', 'nurturing']).optional().describe('New stage'),
16
+ estimated_value: z.number().int().optional().describe('New estimated value (cents)'),
17
+ next_action_type: z.string().max(100).optional().describe('New next action type'),
18
+ next_followup_date: z.string().max(50).optional().describe('New followup date'),
19
+ last_contact_date: z.string().max(50).optional().describe('Last contact date'),
20
+ notes: z.string().max(10000).optional().describe('New notes'),
21
+ tags: z.array(z.string().max(100)).max(20).optional().describe('New tags'),
22
+ linkedin_url: z.string().max(500).optional().describe('New LinkedIn URL'),
23
+ }, withGracefulDegradation('prospects', adapter, async (params) => {
24
+ try {
25
+ const updates = {};
26
+ if (params.name !== undefined)
27
+ updates.name = params.name.trim();
28
+ if (params.email !== undefined)
29
+ updates.email = params.email;
30
+ if (params.company !== undefined)
31
+ updates.company = params.company;
32
+ if (params.role !== undefined)
33
+ updates.role = params.role;
34
+ if (params.stage !== undefined)
35
+ updates.stage = params.stage;
36
+ if (params.estimated_value !== undefined)
37
+ updates.estimated_value = params.estimated_value;
38
+ if (params.next_action_type !== undefined)
39
+ updates.next_action_type = params.next_action_type;
40
+ if (params.next_followup_date !== undefined)
41
+ updates.next_followup_date = params.next_followup_date;
42
+ if (params.last_contact_date !== undefined)
43
+ updates.last_contact_date = params.last_contact_date;
44
+ if (params.notes !== undefined)
45
+ updates.notes = params.notes;
46
+ if (params.tags !== undefined)
47
+ updates.tags = params.tags;
48
+ if (params.linkedin_url !== undefined)
49
+ updates.linkedin_url = params.linkedin_url;
50
+ if (Object.keys(updates).length === 0) {
51
+ return makeToolResponse({
52
+ updated: false,
53
+ message: 'No fields to update. Provide at least one field to change.',
54
+ });
55
+ }
56
+ const record = await adapter.update('prospects', params.id, updates);
57
+ return makeToolResponse({
58
+ updated: true,
59
+ item: { id: record.id, name: record.name, stage: record.stage, updated_at: record.updated_at },
60
+ message: `Prospect updated: "${record.name}"`,
61
+ });
62
+ }
63
+ catch (error) {
64
+ return handleAdapterError(error, 'prospect_update');
65
+ }
66
+ }));
67
+ }
68
+ //# sourceMappingURL=prospect-update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosp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AM,CAAiB,WAAW,EAAE,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;YAErF,OAAO,gBAAgB,CAAC;gBACtB,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE;gBAC9F,OAAO,EAAE,sBAAsB,MAAM,CAAC,IAAI,GAAG;aAC9C,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;QACtD,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Tool: brain_decay
3
+ *
4
+ * List knowledge items where decay exceeds a threshold.
5
+ * Decay formula: 1.0 - (days_since_validated / 180), clamped to [0, 1].
6
+ * Computed on-read — not stored in DB.
7
+ */
8
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
9
+ import type { DataAdapter } from '../../adapter/types.js';
10
+ export declare function registerBrainDecay(server: McpServer, adapter: DataAdapter): void;
11
+ //# sourceMappingURL=brain-decay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brain-decay.d.ts","sourceRoot":"","sources":["../../../src/tools/memory/brain-decay.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAc1D,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CA8ChF"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Tool: brain_decay
3
+ *
4
+ * List knowledge items where decay exceeds a threshold.
5
+ * Decay formula: 1.0 - (days_since_validated / 180), clamped to [0, 1].
6
+ * Computed on-read — not stored in DB.
7
+ */
8
+ import { z } from 'zod';
9
+ import { makeToolResponse, handleAdapterError, withGracefulDegradation } from '../shared.js';
10
+ const DECAY_PERIOD_DAYS = 180;
11
+ function computeDecayScore(lastValidatedAt) {
12
+ if (!lastValidatedAt)
13
+ return 0;
14
+ const validated = new Date(lastValidatedAt);
15
+ const now = new Date();
16
+ const daysSinceValidated = (now.getTime() - validated.getTime()) / (1000 * 60 * 60 * 24);
17
+ const score = 1.0 - (daysSinceValidated / DECAY_PERIOD_DAYS);
18
+ return Math.max(0, Math.min(1, score));
19
+ }
20
+ export function registerBrainDecay(server, adapter) {
21
+ server.tool('brain_decay', 'List knowledge items that are decaying (freshness score below threshold). Decay is computed as 1.0 - (days_since_validated / 180). Use knowledge_validate to refresh items.', {
22
+ threshold: z.number().min(0).max(1).optional().describe('Decay threshold (default 0.5). Items BELOW this score are returned.'),
23
+ limit: z.number().int().min(1).max(100).optional().describe('Max results (default 20)'),
24
+ }, { readOnlyHint: true }, withGracefulDegradation('knowledge', adapter, async (params) => {
25
+ try {
26
+ const threshold = params.threshold ?? 0.5;
27
+ // Compute the date threshold: items validated before this date have decay < threshold
28
+ // threshold = 1.0 - (days / 180)
29
+ // days = (1.0 - threshold) * 180
30
+ const daysThreshold = (1.0 - threshold) * DECAY_PERIOD_DAYS;
31
+ const cutoffDate = new Date();
32
+ cutoffDate.setDate(cutoffDate.getDate() - Math.floor(daysThreshold));
33
+ const result = await adapter.list('knowledge', {
34
+ filter: [[
35
+ { field: 'last_validated_at', op: 'lt', value: cutoffDate.toISOString() },
36
+ ]],
37
+ sort: [{ field: 'last_validated_at', direction: 'asc' }],
38
+ page: { limit: params.limit ?? 20, offset: 0 },
39
+ });
40
+ const items = result.items.map((item) => ({
41
+ ...item,
42
+ decay_score: computeDecayScore(item.last_validated_at),
43
+ }));
44
+ return makeToolResponse({
45
+ items,
46
+ total: result.totalItems,
47
+ threshold,
48
+ message: items.length > 0
49
+ ? `Found ${result.totalItems} items with decay below ${threshold}. Use knowledge_validate to refresh them.`
50
+ : 'No stale items found. Your knowledge base is fresh!',
51
+ });
52
+ }
53
+ catch (error) {
54
+ return handleAdapterError(error, 'brain_decay');
55
+ }
56
+ }));
57
+ }
58
+ //# sourceMappingURL=brain-decay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brain-decay.js","sourceRoot":"","sources":["../../../src/tools/memory/brain-decay.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAE7F,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,SAAS,iBAAiB,CAAC,eAA8B;IACvD,IAAI,CAAC,eAAe;QAAE,OAAO,CAAC,CAAC;IAC/B,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,eAAe,CAAC,CAAC;IAC5C,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,MAAM,kBAAkB,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;IACzF,MAAM,KAAK,GAAG,GAAG,GAAG,CAAC,kBAAkB,GAAG,iBAAiB,CAAC,CAAC;IAC7D,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,MAAiB,EAAE,OAAoB;IACxE,MAAM,CAAC,IAAI,CACT,aAAa,EACb,6KAA6K,EAC7K;QACE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,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E,EAAE,CAAC,CAAC;gBACxC,GAAG,IAAI;gBACP,WAAW,EAAE,iBAAiB,CAAC,IAAI,CAAC,iBAAkC,CAAC;aACxE,CAAC,CAAC,CAAC;YAEJ,OAAO,gBAAgB,CAAC;gBACtB,KAAK;gBACL,KAAK,EAAE,MAAM,CAAC,UAAU;gBACxB,SAAS;gBACT,OAAO,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC;oBACvB,CAAC,CAAC,SAAS,MAAM,CAAC,UAAU,2BAA2B,SAAS,2CAA2C;oBAC3G,CAAC,CAAC,qDAAqD;aAC1D,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,kBAAkB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;QAClD,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Tool: brain_stats
3
+ *
4
+ * Aggregate counts and health metrics across all collections.
5
+ * Knowledge breakdown by type. Stale item count.
6
+ * Uses Promise.all to parallelize queries.
7
+ */
8
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
9
+ import type { DataAdapter } from '../../adapter/types.js';
10
+ export declare function registerBrainStats(server: McpServer, adapter: DataAdapter): void;
11
+ //# sourceMappingURL=brain-stats.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brain-stats.d.ts","sourceRoot":"","sources":["../../../src/tools/memory/brain-stats.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAS1D,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CA0DhF"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Tool: brain_stats
3
+ *
4
+ * Aggregate counts and health metrics across all collections.
5
+ * Knowledge breakdown by type. Stale item count.
6
+ * Uses Promise.all to parallelize queries.
7
+ */
8
+ import { makeToolResponse, handleAdapterError, withGracefulDegradation } from '../shared.js';
9
+ const COLLECTIONS = ['knowledge', 'decisions', 'sessions', 'goals', 'tasks', 'contacts'];
10
+ const KNOWLEDGE_TYPES = ['fact', 'pattern', 'insight', 'lesson', 'reference'];
11
+ // Items not validated in 90+ days are considered stale
12
+ const STALE_THRESHOLD_DAYS = 90;
13
+ export function registerBrainStats(server, adapter) {
14
+ server.tool('brain_stats', 'Get aggregate statistics about your Second Brain. Shows counts for all collections, knowledge breakdown by type, and stale item count.', {}, { readOnlyHint: true }, withGracefulDegradation('knowledge', adapter, async () => {
15
+ try {
16
+ // Count all collections in parallel
17
+ const countEntries = await Promise.all(COLLECTIONS.map(async (collection) => {
18
+ try {
19
+ const exists = await adapter.collectionExists(collection);
20
+ return [collection, exists ? await adapter.count(collection) : 0];
21
+ }
22
+ catch {
23
+ return [collection, 0];
24
+ }
25
+ }));
26
+ const counts = Object.fromEntries(countEntries);
27
+ // Knowledge breakdown by type in parallel
28
+ const typeEntries = await Promise.all(KNOWLEDGE_TYPES.map(async (type) => {
29
+ try {
30
+ return [type, await adapter.count('knowledge', [
31
+ [{ field: 'type', op: 'eq', value: type }],
32
+ ])];
33
+ }
34
+ catch {
35
+ return [type, 0];
36
+ }
37
+ }));
38
+ const knowledgeByType = Object.fromEntries(typeEntries);
39
+ // Stale count
40
+ let staleCount = 0;
41
+ try {
42
+ const staleDate = new Date();
43
+ staleDate.setDate(staleDate.getDate() - STALE_THRESHOLD_DAYS);
44
+ staleCount = await adapter.count('knowledge', [
45
+ [{ field: 'last_validated_at', op: 'lt', value: staleDate.toISOString() }],
46
+ ]);
47
+ }
48
+ catch {
49
+ // last_validated_at might not exist
50
+ }
51
+ return makeToolResponse({
52
+ counts,
53
+ knowledge_by_type: knowledgeByType,
54
+ stale_count: staleCount,
55
+ stale_threshold_days: STALE_THRESHOLD_DAYS,
56
+ });
57
+ }
58
+ catch (error) {
59
+ return handleAdapterError(error, 'brain_stats');
60
+ }
61
+ }));
62
+ }
63
+ //# sourceMappingURL=brain-stats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brain-stats.js","sourceRoot":"","sources":["../../../src/tools/memory/brain-stats.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAE7F,MAAM,WAAW,GAAG,CAAC,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;AACzF,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;AAE9E,uDAAuD;AACvD,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEhC,MAAM,UAAU,kBAAkB,CAAC,MAAiB,EAAE,OAAoB;IACxE,MAAM,CAAC,IAAI,CACT,aAAa,EACb,wIAAwI,EACxI,EAAE,EACF,EAAE,YAAY,EAAE,IAAI,EAAE,EACtB,uBAAuB,CAAC,WAAW,EAAE,OAAO,EAAE,KAAK,IAAI,EAAE;QACvD,IAAI,CAAC;YACH,oCAAoC;YACpC,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,GAAG,CACpC,WAAW,CAAC,GAAG,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE;gBACnC,IAAI,CAAC;oBACH,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;oBAC1D,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAU,CAAC;gBAC7E,CAAC;gBAAC,MAAM,CAAC;oBACP,OAAO,CAAC,UAAU,EAAE,CAAC,CAAU,CAAC;gBAClC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QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,kBAAkB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;QAClD,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Tool: contact_create
3
+ *
4
+ * Create a contact record.
5
+ */
6
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
7
+ import type { DataAdapter } from '../../adapter/types.js';
8
+ export declare function registerContactCreate(server: McpServer, adapter: DataAdapter): void;
9
+ //# sourceMappingURL=contact-create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contact-create.d.ts","sourceRoot":"","sources":["../../../src/tools/memory/contact-create.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAI1D,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CAsCnF"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Tool: contact_create
3
+ *
4
+ * Create a contact record.
5
+ */
6
+ import { z } from 'zod';
7
+ import { makeToolResponse, handleAdapterError, withGracefulDegradation } from '../shared.js';
8
+ export function registerContactCreate(server, adapter) {
9
+ server.tool('contact_create', 'Create a new contact with name, company, role, and other details.', {
10
+ name: z.string().min(1).max(200).describe('Contact name'),
11
+ company: z.string().max(200).optional().describe('Company name'),
12
+ role: z.string().max(200).optional().describe('Role/title'),
13
+ email: z.string().max(200).optional().describe('Email address'),
14
+ phone: z.string().max(50).optional().describe('Phone number'),
15
+ relationship: z.enum(['colleague', 'client', 'prospect', 'partner', 'other']).optional().describe('Relationship type'),
16
+ notes: z.string().max(5000).optional().describe('Notes about the contact'),
17
+ tags: z.array(z.string().max(100)).max(20).optional().describe('Tags for categorization'),
18
+ }, withGracefulDegradation('contacts', adapter, async (params) => {
19
+ try {
20
+ const record = await adapter.create('contacts', {
21
+ name: params.name.trim(),
22
+ company: params.company ?? null,
23
+ role: params.role ?? null,
24
+ email: params.email ?? null,
25
+ phone: params.phone ?? null,
26
+ relationship: params.relationship ?? null,
27
+ notes: params.notes ?? null,
28
+ tags: params.tags ?? [],
29
+ last_contact_date: null,
30
+ });
31
+ return makeToolResponse({
32
+ created: true,
33
+ item: { id: record.id, name: record.name, company: record.company, created_at: record.created_at },
34
+ message: `Contact created: "${params.name}"`,
35
+ });
36
+ }
37
+ catch (error) {
38
+ return handleAdapterError(error, 'contact_create');
39
+ }
40
+ }));
41
+ }
42
+ //# sourceMappingURL=contact-create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contact-create.js","sourceRoot":"","sources":["../../../src/tools/memory/contact-create.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAE7F,MAAM,UAAU,qBAAqB,CAAC,MAAiB,EAAE,OAAoB;IAC3E,MAAM,CAAC,IAAI,CACT,gBAAgB,EAChB,mEAAmE,EACnE;QACE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC;QACzD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;QAChE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC;QAC3D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,G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,EAAE;gBACvB,iBAAiB,EAAE,IAAI;aACxB,CAAC,CAAC;YAEH,OAAO,gBAAgB,CAAC;gBACtB,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE;gBAClG,OAAO,EAAE,qBAAqB,MAAM,CAAC,IAAI,GAAG;aAC7C,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;QACrD,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Tool: contact_list
3
+ *
4
+ * List contacts with pagination.
5
+ */
6
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
7
+ import type { DataAdapter } from '../../adapter/types.js';
8
+ export declare function registerContactList(server: McpServer, adapter: DataAdapter): void;
9
+ //# sourceMappingURL=contact-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contact-list.d.ts","sourceRoot":"","sources":["../../../src/tools/memory/contact-list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAI1D,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CA2BjF"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Tool: contact_list
3
+ *
4
+ * List contacts with pagination.
5
+ */
6
+ import { z } from 'zod';
7
+ import { makeToolResponse, handleAdapterError, withGracefulDegradation } from '../shared.js';
8
+ export function registerContactList(server, adapter) {
9
+ server.tool('contact_list', 'List contacts with pagination. Most recently created first.', {
10
+ limit: z.number().int().min(1).max(100).optional().describe('Max results (default 20)'),
11
+ offset: z.number().int().min(0).optional().describe('Offset for pagination (default 0)'),
12
+ }, { readOnlyHint: true }, withGracefulDegradation('contacts', adapter, async (params) => {
13
+ try {
14
+ const result = await adapter.list('contacts', {
15
+ sort: [{ field: 'created_at', direction: 'desc' }],
16
+ page: { limit: params.limit ?? 20, offset: params.offset ?? 0 },
17
+ });
18
+ return makeToolResponse({
19
+ items: result.items,
20
+ total: result.totalItems,
21
+ page: result.page,
22
+ per_page: result.perPage,
23
+ });
24
+ }
25
+ catch (error) {
26
+ return handleAdapterError(error, 'contact_list');
27
+ }
28
+ }));
29
+ }
30
+ //# sourceMappingURL=contact-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contact-list.js","sourceRoot":"","sources":["../../../src/tools/memory/contact-list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAE7F,MAAM,UAAU,mBAAmB,CAAC,MAAiB,EAAE,OAAoB;IACzE,MAAM,CAAC,IAAI,CACT,cAAc,EACd,6DAA6D,EAC7D;QACE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;QACvF,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;KACzF,EACD,EAAE,YAAY,EAAE,IAAI,EAAE,EACtB,uBAAuB,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,EA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