@jbctechsolutions/mcp-office365 3.0.0 → 4.0.1

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 (340) hide show
  1. package/README.md +42 -65
  2. package/dist/approval/hash.d.ts +8 -8
  3. package/dist/approval/token-manager.d.ts +12 -6
  4. package/dist/approval/token-manager.d.ts.map +1 -1
  5. package/dist/approval/token-manager.js +11 -3
  6. package/dist/approval/token-manager.js.map +1 -1
  7. package/dist/approval/types.d.ts +7 -3
  8. package/dist/approval/types.d.ts.map +1 -1
  9. package/dist/cli.d.ts +4 -0
  10. package/dist/cli.d.ts.map +1 -1
  11. package/dist/cli.js +18 -3
  12. package/dist/cli.js.map +1 -1
  13. package/dist/database/repository.d.ts +48 -48
  14. package/dist/database/repository.d.ts.map +1 -1
  15. package/dist/database/repository.js.map +1 -1
  16. package/dist/delta/mirror.d.ts +67 -0
  17. package/dist/delta/mirror.d.ts.map +1 -0
  18. package/dist/delta/mirror.js +183 -0
  19. package/dist/delta/mirror.js.map +1 -0
  20. package/dist/graph/auth/account-id.d.ts +19 -0
  21. package/dist/graph/auth/account-id.d.ts.map +1 -0
  22. package/dist/graph/auth/account-id.js +55 -0
  23. package/dist/graph/auth/account-id.js.map +1 -0
  24. package/dist/graph/auth/config.d.ts +1 -1
  25. package/dist/graph/auth/config.d.ts.map +1 -1
  26. package/dist/graph/auth/config.js +8 -0
  27. package/dist/graph/auth/config.js.map +1 -1
  28. package/dist/graph/auth/index.d.ts +1 -0
  29. package/dist/graph/auth/index.d.ts.map +1 -1
  30. package/dist/graph/auth/index.js +1 -0
  31. package/dist/graph/auth/index.js.map +1 -1
  32. package/dist/graph/client/graph-client.d.ts +105 -0
  33. package/dist/graph/client/graph-client.d.ts.map +1 -1
  34. package/dist/graph/client/graph-client.js +414 -18
  35. package/dist/graph/client/graph-client.js.map +1 -1
  36. package/dist/graph/client/immutable-id-middleware.d.ts +50 -0
  37. package/dist/graph/client/immutable-id-middleware.d.ts.map +1 -0
  38. package/dist/graph/client/immutable-id-middleware.js +137 -0
  39. package/dist/graph/client/immutable-id-middleware.js.map +1 -0
  40. package/dist/graph/content-readers.d.ts +0 -12
  41. package/dist/graph/content-readers.d.ts.map +1 -1
  42. package/dist/graph/content-readers.js +0 -21
  43. package/dist/graph/content-readers.js.map +1 -1
  44. package/dist/graph/index.d.ts +5 -6
  45. package/dist/graph/index.d.ts.map +1 -1
  46. package/dist/graph/index.js +5 -6
  47. package/dist/graph/index.js.map +1 -1
  48. package/dist/graph/mailbox-adapter.d.ts +15 -15
  49. package/dist/graph/mappers/contact-mapper.d.ts +4 -1
  50. package/dist/graph/mappers/contact-mapper.d.ts.map +1 -1
  51. package/dist/graph/mappers/contact-mapper.js +7 -3
  52. package/dist/graph/mappers/contact-mapper.js.map +1 -1
  53. package/dist/graph/mappers/email-mapper.d.ts.map +1 -1
  54. package/dist/graph/mappers/email-mapper.js +7 -4
  55. package/dist/graph/mappers/email-mapper.js.map +1 -1
  56. package/dist/graph/mappers/event-mapper.d.ts.map +1 -1
  57. package/dist/graph/mappers/event-mapper.js +6 -3
  58. package/dist/graph/mappers/event-mapper.js.map +1 -1
  59. package/dist/graph/mappers/folder-mapper.d.ts +0 -4
  60. package/dist/graph/mappers/folder-mapper.d.ts.map +1 -1
  61. package/dist/graph/mappers/folder-mapper.js +9 -19
  62. package/dist/graph/mappers/folder-mapper.js.map +1 -1
  63. package/dist/graph/mappers/index.d.ts +2 -2
  64. package/dist/graph/mappers/index.d.ts.map +1 -1
  65. package/dist/graph/mappers/index.js +2 -2
  66. package/dist/graph/mappers/index.js.map +1 -1
  67. package/dist/graph/mappers/task-mapper.d.ts +4 -2
  68. package/dist/graph/mappers/task-mapper.d.ts.map +1 -1
  69. package/dist/graph/mappers/task-mapper.js +7 -5
  70. package/dist/graph/mappers/task-mapper.js.map +1 -1
  71. package/dist/graph/mappers/utils.d.ts +0 -10
  72. package/dist/graph/mappers/utils.d.ts.map +1 -1
  73. package/dist/graph/mappers/utils.js +0 -19
  74. package/dist/graph/mappers/utils.js.map +1 -1
  75. package/dist/graph/repository.d.ts +400 -270
  76. package/dist/graph/repository.d.ts.map +1 -1
  77. package/dist/graph/repository.js +739 -1046
  78. package/dist/graph/repository.js.map +1 -1
  79. package/dist/ids/next-action.d.ts +29 -0
  80. package/dist/ids/next-action.d.ts.map +1 -0
  81. package/dist/ids/next-action.js +58 -0
  82. package/dist/ids/next-action.js.map +1 -0
  83. package/dist/ids/resolver.d.ts +2 -1
  84. package/dist/ids/resolver.d.ts.map +1 -1
  85. package/dist/ids/resolver.js +19 -4
  86. package/dist/ids/resolver.js.map +1 -1
  87. package/dist/ids/schema.d.ts +91 -0
  88. package/dist/ids/schema.d.ts.map +1 -0
  89. package/dist/ids/schema.js +131 -0
  90. package/dist/ids/schema.js.map +1 -0
  91. package/dist/ids/token.d.ts +7 -1
  92. package/dist/ids/token.d.ts.map +1 -1
  93. package/dist/ids/token.js +46 -7
  94. package/dist/ids/token.js.map +1 -1
  95. package/dist/index.d.ts +4 -6
  96. package/dist/index.d.ts.map +1 -1
  97. package/dist/index.js +63 -100
  98. package/dist/index.js.map +1 -1
  99. package/dist/parsers/index.d.ts +0 -1
  100. package/dist/parsers/index.d.ts.map +1 -1
  101. package/dist/parsers/index.js +0 -1
  102. package/dist/parsers/index.js.map +1 -1
  103. package/dist/registry/all-tools.d.ts.map +1 -1
  104. package/dist/registry/all-tools.js +8 -4
  105. package/dist/registry/all-tools.js.map +1 -1
  106. package/dist/registry/context.d.ts +1 -7
  107. package/dist/registry/context.d.ts.map +1 -1
  108. package/dist/registry/context.js +0 -11
  109. package/dist/registry/context.js.map +1 -1
  110. package/dist/registry/elicit-links.d.ts +35 -0
  111. package/dist/registry/elicit-links.d.ts.map +1 -0
  112. package/dist/registry/elicit-links.js +102 -0
  113. package/dist/registry/elicit-links.js.map +1 -0
  114. package/dist/registry/elicitor.d.ts +24 -0
  115. package/dist/registry/elicitor.d.ts.map +1 -0
  116. package/dist/registry/elicitor.js +51 -0
  117. package/dist/registry/elicitor.js.map +1 -0
  118. package/dist/registry/index.d.ts +2 -2
  119. package/dist/registry/index.d.ts.map +1 -1
  120. package/dist/registry/index.js +1 -1
  121. package/dist/registry/index.js.map +1 -1
  122. package/dist/registry/registry.d.ts +11 -0
  123. package/dist/registry/registry.d.ts.map +1 -1
  124. package/dist/registry/registry.js +87 -0
  125. package/dist/registry/registry.js.map +1 -1
  126. package/dist/registry/types.d.ts +61 -13
  127. package/dist/registry/types.d.ts.map +1 -1
  128. package/dist/state/delta-store.d.ts +85 -0
  129. package/dist/state/delta-store.d.ts.map +1 -0
  130. package/dist/state/delta-store.js +124 -0
  131. package/dist/state/delta-store.js.map +1 -0
  132. package/dist/state/schema.d.ts +2 -3
  133. package/dist/state/schema.d.ts.map +1 -1
  134. package/dist/state/schema.js +26 -3
  135. package/dist/state/schema.js.map +1 -1
  136. package/dist/state/store.d.ts +3 -0
  137. package/dist/state/store.d.ts.map +1 -1
  138. package/dist/state/store.js +4 -0
  139. package/dist/state/store.js.map +1 -1
  140. package/dist/tools/calendar-graph.d.ts.map +1 -1
  141. package/dist/tools/calendar-graph.js +10 -9
  142. package/dist/tools/calendar-graph.js.map +1 -1
  143. package/dist/tools/calendar-permissions.d.ts +7 -7
  144. package/dist/tools/calendar-permissions.d.ts.map +1 -1
  145. package/dist/tools/calendar-permissions.js +7 -4
  146. package/dist/tools/calendar-permissions.js.map +1 -1
  147. package/dist/tools/calendar.d.ts +14 -114
  148. package/dist/tools/calendar.d.ts.map +1 -1
  149. package/dist/tools/calendar.js +41 -202
  150. package/dist/tools/calendar.js.map +1 -1
  151. package/dist/tools/categories.d.ts +4 -4
  152. package/dist/tools/categories.d.ts.map +1 -1
  153. package/dist/tools/categories.js +5 -2
  154. package/dist/tools/categories.js.map +1 -1
  155. package/dist/tools/checklist-items.d.ts +9 -9
  156. package/dist/tools/checklist-items.d.ts.map +1 -1
  157. package/dist/tools/checklist-items.js +8 -5
  158. package/dist/tools/checklist-items.js.map +1 -1
  159. package/dist/tools/contact-folders.d.ts +2 -2
  160. package/dist/tools/contact-folders.d.ts.map +1 -1
  161. package/dist/tools/contact-folders.js +5 -2
  162. package/dist/tools/contact-folders.js.map +1 -1
  163. package/dist/tools/contacts-graph.d.ts +1 -1
  164. package/dist/tools/contacts-graph.d.ts.map +1 -1
  165. package/dist/tools/contacts-graph.js +8 -6
  166. package/dist/tools/contacts-graph.js.map +1 -1
  167. package/dist/tools/contacts.d.ts +9 -44
  168. package/dist/tools/contacts.d.ts.map +1 -1
  169. package/dist/tools/contacts.js +23 -131
  170. package/dist/tools/contacts.js.map +1 -1
  171. package/dist/tools/excel.d.ts +10 -10
  172. package/dist/tools/excel.d.ts.map +1 -1
  173. package/dist/tools/excel.js +9 -6
  174. package/dist/tools/excel.js.map +1 -1
  175. package/dist/tools/focused-overrides.d.ts +4 -4
  176. package/dist/tools/focused-overrides.d.ts.map +1 -1
  177. package/dist/tools/focused-overrides.js +5 -2
  178. package/dist/tools/focused-overrides.js.map +1 -1
  179. package/dist/tools/index.d.ts +4 -5
  180. package/dist/tools/index.d.ts.map +1 -1
  181. package/dist/tools/index.js +4 -6
  182. package/dist/tools/index.js.map +1 -1
  183. package/dist/tools/linked-resources.d.ts +7 -7
  184. package/dist/tools/linked-resources.d.ts.map +1 -1
  185. package/dist/tools/linked-resources.js +7 -4
  186. package/dist/tools/linked-resources.js.map +1 -1
  187. package/dist/tools/mail-graph.d.ts.map +1 -1
  188. package/dist/tools/mail-graph.js +21 -12
  189. package/dist/tools/mail-graph.js.map +1 -1
  190. package/dist/tools/mail-rules.d.ts +8 -8
  191. package/dist/tools/mail-rules.d.ts.map +1 -1
  192. package/dist/tools/mail-rules.js +7 -7
  193. package/dist/tools/mail-rules.js.map +1 -1
  194. package/dist/tools/mail-send.d.ts +27 -27
  195. package/dist/tools/mail-send.d.ts.map +1 -1
  196. package/dist/tools/mail-send.js +30 -19
  197. package/dist/tools/mail-send.js.map +1 -1
  198. package/dist/tools/mail.d.ts +22 -79
  199. package/dist/tools/mail.d.ts.map +1 -1
  200. package/dist/tools/mail.js +45 -293
  201. package/dist/tools/mail.js.map +1 -1
  202. package/dist/tools/mailbox-organization.d.ts +34 -37
  203. package/dist/tools/mailbox-organization.d.ts.map +1 -1
  204. package/dist/tools/mailbox-organization.js +72 -64
  205. package/dist/tools/mailbox-organization.js.map +1 -1
  206. package/dist/tools/meetings.d.ts +14 -14
  207. package/dist/tools/meetings.d.ts.map +1 -1
  208. package/dist/tools/meetings.js +8 -6
  209. package/dist/tools/meetings.js.map +1 -1
  210. package/dist/tools/onedrive.d.ts +16 -16
  211. package/dist/tools/onedrive.d.ts.map +1 -1
  212. package/dist/tools/onedrive.js +16 -11
  213. package/dist/tools/onedrive.js.map +1 -1
  214. package/dist/tools/onenote.d.ts +63 -0
  215. package/dist/tools/onenote.d.ts.map +1 -0
  216. package/dist/tools/onenote.js +221 -0
  217. package/dist/tools/onenote.js.map +1 -0
  218. package/dist/tools/planner-visualization.d.ts +5 -5
  219. package/dist/tools/planner-visualization.d.ts.map +1 -1
  220. package/dist/tools/planner-visualization.js +5 -4
  221. package/dist/tools/planner-visualization.js.map +1 -1
  222. package/dist/tools/planner.d.ts +59 -39
  223. package/dist/tools/planner.d.ts.map +1 -1
  224. package/dist/tools/planner.js +48 -23
  225. package/dist/tools/planner.js.map +1 -1
  226. package/dist/tools/shared-mailbox.d.ts +164 -0
  227. package/dist/tools/shared-mailbox.d.ts.map +1 -0
  228. package/dist/tools/shared-mailbox.js +318 -0
  229. package/dist/tools/shared-mailbox.js.map +1 -0
  230. package/dist/tools/sharepoint-lists.d.ts +131 -0
  231. package/dist/tools/sharepoint-lists.d.ts.map +1 -0
  232. package/dist/tools/sharepoint-lists.js +246 -0
  233. package/dist/tools/sharepoint-lists.js.map +1 -0
  234. package/dist/tools/sharepoint.d.ts +14 -14
  235. package/dist/tools/sharepoint.d.ts.map +1 -1
  236. package/dist/tools/sharepoint.js +11 -9
  237. package/dist/tools/sharepoint.js.map +1 -1
  238. package/dist/tools/task-attachments.d.ts +7 -7
  239. package/dist/tools/task-attachments.d.ts.map +1 -1
  240. package/dist/tools/task-attachments.js +7 -4
  241. package/dist/tools/task-attachments.js.map +1 -1
  242. package/dist/tools/task-lists.d.ts +3 -3
  243. package/dist/tools/task-lists.d.ts.map +1 -1
  244. package/dist/tools/task-lists.js +10 -6
  245. package/dist/tools/task-lists.js.map +1 -1
  246. package/dist/tools/tasks-graph.d.ts +2 -2
  247. package/dist/tools/tasks-graph.d.ts.map +1 -1
  248. package/dist/tools/tasks-graph.js +6 -4
  249. package/dist/tools/tasks-graph.js.map +1 -1
  250. package/dist/tools/tasks.d.ts +8 -43
  251. package/dist/tools/tasks.d.ts.map +1 -1
  252. package/dist/tools/tasks.js +19 -122
  253. package/dist/tools/tasks.js.map +1 -1
  254. package/dist/tools/teams.d.ts +46 -46
  255. package/dist/tools/teams.d.ts.map +1 -1
  256. package/dist/tools/teams.js +34 -26
  257. package/dist/tools/teams.js.map +1 -1
  258. package/dist/tools/what-changed.d.ts +48 -0
  259. package/dist/tools/what-changed.d.ts.map +1 -0
  260. package/dist/tools/what-changed.js +149 -0
  261. package/dist/tools/what-changed.js.map +1 -0
  262. package/dist/types/calendar.d.ts +1 -1
  263. package/dist/types/calendar.d.ts.map +1 -1
  264. package/dist/types/calendar.js.map +1 -1
  265. package/dist/types/contacts.d.ts +1 -1
  266. package/dist/types/contacts.d.ts.map +1 -1
  267. package/dist/types/contacts.js.map +1 -1
  268. package/dist/types/mail.d.ts +1 -1
  269. package/dist/types/mail.d.ts.map +1 -1
  270. package/dist/types/mail.js.map +1 -1
  271. package/dist/utils/errors.d.ts +15 -34
  272. package/dist/utils/errors.d.ts.map +1 -1
  273. package/dist/utils/errors.js +13 -49
  274. package/dist/utils/errors.js.map +1 -1
  275. package/dist/visualization/types.d.ts +4 -4
  276. package/package.json +3 -4
  277. package/dist/applescript/account-repository.d.ts +0 -30
  278. package/dist/applescript/account-repository.d.ts.map +0 -1
  279. package/dist/applescript/account-repository.js +0 -38
  280. package/dist/applescript/account-repository.js.map +0 -1
  281. package/dist/applescript/account-scripts.d.ts +0 -21
  282. package/dist/applescript/account-scripts.d.ts.map +0 -1
  283. package/dist/applescript/account-scripts.js +0 -180
  284. package/dist/applescript/account-scripts.js.map +0 -1
  285. package/dist/applescript/calendar-manager.d.ts +0 -44
  286. package/dist/applescript/calendar-manager.d.ts.map +0 -1
  287. package/dist/applescript/calendar-manager.js +0 -92
  288. package/dist/applescript/calendar-manager.js.map +0 -1
  289. package/dist/applescript/calendar-writer.d.ts +0 -36
  290. package/dist/applescript/calendar-writer.d.ts.map +0 -1
  291. package/dist/applescript/calendar-writer.js +0 -94
  292. package/dist/applescript/calendar-writer.js.map +0 -1
  293. package/dist/applescript/content-readers.d.ts +0 -114
  294. package/dist/applescript/content-readers.d.ts.map +0 -1
  295. package/dist/applescript/content-readers.js +0 -328
  296. package/dist/applescript/content-readers.js.map +0 -1
  297. package/dist/applescript/executor.d.ts +0 -60
  298. package/dist/applescript/executor.d.ts.map +0 -1
  299. package/dist/applescript/executor.js +0 -173
  300. package/dist/applescript/executor.js.map +0 -1
  301. package/dist/applescript/index.d.ts +0 -20
  302. package/dist/applescript/index.d.ts.map +0 -1
  303. package/dist/applescript/index.js +0 -29
  304. package/dist/applescript/index.js.map +0 -1
  305. package/dist/applescript/mail-sender.d.ts +0 -38
  306. package/dist/applescript/mail-sender.d.ts.map +0 -1
  307. package/dist/applescript/mail-sender.js +0 -67
  308. package/dist/applescript/mail-sender.js.map +0 -1
  309. package/dist/applescript/parser.d.ts +0 -235
  310. package/dist/applescript/parser.d.ts.map +0 -1
  311. package/dist/applescript/parser.js +0 -496
  312. package/dist/applescript/parser.js.map +0 -1
  313. package/dist/applescript/repository.d.ts +0 -64
  314. package/dist/applescript/repository.d.ts.map +0 -1
  315. package/dist/applescript/repository.js +0 -444
  316. package/dist/applescript/repository.js.map +0 -1
  317. package/dist/applescript/scripts.d.ts +0 -265
  318. package/dist/applescript/scripts.d.ts.map +0 -1
  319. package/dist/applescript/scripts.js +0 -1483
  320. package/dist/applescript/scripts.js.map +0 -1
  321. package/dist/parsers/olk15.d.ts +0 -87
  322. package/dist/parsers/olk15.d.ts.map +0 -1
  323. package/dist/parsers/olk15.js +0 -368
  324. package/dist/parsers/olk15.js.map +0 -1
  325. package/dist/tools/accounts.d.ts +0 -37
  326. package/dist/tools/accounts.d.ts.map +0 -1
  327. package/dist/tools/accounts.js +0 -68
  328. package/dist/tools/accounts.js.map +0 -1
  329. package/dist/tools/calendar-apple.d.ts +0 -39
  330. package/dist/tools/calendar-apple.d.ts.map +0 -1
  331. package/dist/tools/calendar-apple.js +0 -159
  332. package/dist/tools/calendar-apple.js.map +0 -1
  333. package/dist/tools/mail-apple.d.ts +0 -40
  334. package/dist/tools/mail-apple.d.ts.map +0 -1
  335. package/dist/tools/mail-apple.js +0 -146
  336. package/dist/tools/mail-apple.js.map +0 -1
  337. package/dist/tools/notes.d.ts +0 -86
  338. package/dist/tools/notes.d.ts.map +0 -1
  339. package/dist/tools/notes.js +0 -202
  340. package/dist/tools/notes.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"calendar-apple.d.ts","sourceRoot":"","sources":["../../src/tools/calendar-apple.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAEV,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAGjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAMvD;;;;GAIG;AACH,qBAAa,kBAAkB;IAE3B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAFf,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,eAAe,GAAG,IAAI,EACtC,eAAe,EAAE,gBAAgB,GAAG,IAAI;IAG3D,aAAa,IAAI,UAAU;IAI3B,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,UAAU;IAIhD,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,UAAU;IAQ5C,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,UAAU;IAIpD,WAAW,CAAC,MAAM,EAAE,sBAAsB,GAAG,UAAU;IA+CvD,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,UAAU;IA6BxD,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,UAAU;IAoBlD,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,UAAU;CAsCnD"}
@@ -1,159 +0,0 @@
1
- /**
2
- * Copyright (c) 2026 JBC Tech Solutions, LLC
3
- * Licensed under the MIT License. See LICENSE file in the project root.
4
- */
5
- function jsonResult(data) {
6
- return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
7
- }
8
- /**
9
- * AppleScript calendar tools. Each method mirrors the extracted inline
10
- * AppleScript case body and returns an MCP `ToolResult`, including the
11
- * write-capability null checks.
12
- */
13
- export class AppleCalendarTools {
14
- calendarTools;
15
- calendarWriter;
16
- calendarManager;
17
- constructor(calendarTools, calendarWriter, calendarManager) {
18
- this.calendarTools = calendarTools;
19
- this.calendarWriter = calendarWriter;
20
- this.calendarManager = calendarManager;
21
- }
22
- listCalendars() {
23
- return jsonResult(this.calendarTools.listCalendars({}));
24
- }
25
- listEvents(params) {
26
- return jsonResult(this.calendarTools.listEvents(params));
27
- }
28
- getEvent(params) {
29
- const result = this.calendarTools.getEvent(params);
30
- if (result == null) {
31
- return { content: [{ type: 'text', text: 'Event not found' }], isError: true };
32
- }
33
- return jsonResult(result);
34
- }
35
- searchEvents(params) {
36
- return jsonResult(this.calendarTools.searchEvents(params));
37
- }
38
- createEvent(params) {
39
- if (this.calendarWriter == null) {
40
- return {
41
- content: [{ type: 'text', text: 'Event creation is not available' }],
42
- isError: true,
43
- };
44
- }
45
- const writerParams = {
46
- title: params.title,
47
- startDate: params.start_date,
48
- endDate: params.end_date,
49
- };
50
- if (params.calendar_id != null)
51
- writerParams.calendarId = params.calendar_id;
52
- if (params.location != null)
53
- writerParams.location = params.location;
54
- if (params.description != null)
55
- writerParams.description = params.description;
56
- if (params.is_all_day != null)
57
- writerParams.isAllDay = params.is_all_day;
58
- if (params.recurrence != null) {
59
- const rec = params.recurrence;
60
- const recConfig = {
61
- frequency: rec.pattern.type,
62
- interval: rec.pattern.interval,
63
- };
64
- const mut = recConfig;
65
- if (rec.pattern.daysOfWeek != null)
66
- mut.daysOfWeek = rec.pattern.daysOfWeek;
67
- if (rec.range.type === 'endDate' && rec.range.endDate != null)
68
- mut.endDate = rec.range.endDate;
69
- if (rec.range.type === 'numbered' && rec.range.numberOfOccurrences != null)
70
- mut.endAfterCount = rec.range.numberOfOccurrences;
71
- writerParams.recurrence = recConfig;
72
- }
73
- const created = this.calendarWriter.createEvent(writerParams);
74
- const result = {
75
- id: created.id,
76
- title: params.title,
77
- start_date: params.start_date,
78
- end_date: params.end_date,
79
- calendar_id: created.calendarId,
80
- location: params.location ?? null,
81
- description: params.description ?? null,
82
- is_all_day: params.is_all_day,
83
- is_recurring: params.recurrence != null,
84
- };
85
- return jsonResult(result);
86
- }
87
- respondToEvent(params) {
88
- if (this.calendarManager == null) {
89
- return {
90
- content: [{ type: 'text', text: 'Event response is not available' }],
91
- isError: true,
92
- };
93
- }
94
- const result = this.calendarManager.respondToEvent(params.event_id, params.response, params.send_response, params.comment);
95
- const responseText = params.response === 'accept'
96
- ? 'accepted'
97
- : params.response === 'decline'
98
- ? 'declined'
99
- : 'tentatively accepted';
100
- return {
101
- content: [{
102
- type: 'text',
103
- text: `Successfully ${responseText} event ${result.eventId}`,
104
- }],
105
- };
106
- }
107
- deleteEvent(params) {
108
- if (this.calendarManager == null) {
109
- return {
110
- content: [{ type: 'text', text: 'Event deletion is not available' }],
111
- isError: true,
112
- };
113
- }
114
- const applyTo = params.apply_to ?? 'this_instance';
115
- this.calendarManager.deleteEvent(params.event_id, applyTo);
116
- const deleteText = applyTo === 'all_in_series' ? ' (entire series)' : '';
117
- return {
118
- content: [{
119
- type: 'text',
120
- text: `Successfully deleted event ${params.event_id}${deleteText}`,
121
- }],
122
- };
123
- }
124
- updateEvent(params) {
125
- if (this.calendarManager == null) {
126
- return {
127
- content: [{ type: 'text', text: 'Event update is not available' }],
128
- isError: true,
129
- };
130
- }
131
- // Validate date ordering if both dates are provided
132
- if (params.start != null && params.end != null) {
133
- if (new Date(params.start).getTime() >= new Date(params.end).getTime()) {
134
- return {
135
- content: [{ type: 'text', text: 'start_date must be before end_date' }],
136
- isError: true,
137
- };
138
- }
139
- }
140
- const updates = {
141
- ...(params.subject != null && { title: params.subject }),
142
- ...(params.start != null && { startDate: params.start }),
143
- ...(params.end != null && { endDate: params.end }),
144
- ...(params.location != null && { location: params.location }),
145
- ...(params.body != null && { description: params.body }),
146
- ...(params.is_all_day != null && { isAllDay: params.is_all_day }),
147
- };
148
- const applyTo = params.apply_to ?? 'this_instance';
149
- const result = this.calendarManager.updateEvent(params.event_id, updates, applyTo);
150
- const seriesSuffix = applyTo === 'all_in_series' ? ' (entire series)' : '';
151
- return {
152
- content: [{
153
- type: 'text',
154
- text: `Successfully updated event ${result.id}${seriesSuffix}. Updated fields: ${result.updatedFields.join(', ')}`,
155
- }],
156
- };
157
- }
158
- }
159
- //# sourceMappingURL=calendar-apple.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"calendar-apple.js","sourceRoot":"","sources":["../../src/tools/calendar-apple.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAiCH,SAAS,UAAU,CAAC,IAAa;IAC/B,OAAO,EAA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AC;oBACR,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,8BAA8B,MAAM,CAAC,EAAE,GAAG,YAAY,qBAAqB,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;iBACnH,CAAC;SACH,CAAC;IACJ,CAAC;CACF"}
@@ -1,40 +0,0 @@
1
- /**
2
- * Copyright (c) 2026 JBC Tech Solutions, LLC
3
- * Licensed under the MIT License. See LICENSE file in the project root.
4
- */
5
- /**
6
- * AppleScript-backend mail tools (v3 registry-driven architecture, U2 — dual
7
- * backend). Holds the mail READ logic that previously lived inline in the
8
- * `handleAppleScriptToolCall` switch, so the registry handlers stay thin and
9
- * branch on `ctx.backend`.
10
- *
11
- * The advertised (canonical) schemas are Graph-shaped (Graph is the default
12
- * backend). This backend receives the superset params and maps only the fields
13
- * it supports, exactly as the pre-registry dispatch did.
14
- */
15
- import type { MailTools } from './mail.js';
16
- import type { ListFoldersToolParams, ListEmailsParams, SearchEmailsParams, GetEmailParams, GetEmailsParams, GetUnreadCountParams, ListAttachmentsParams, DownloadAttachmentParams } from './mail.js';
17
- import type { IAccountRepository, IMailSender } from '../applescript/index.js';
18
- import type { ToolResult } from '../registry/types.js';
19
- import type { SendEmailParams } from './mail.js';
20
- /**
21
- * AppleScript mail tools. Each method mirrors the extracted inline AppleScript
22
- * case body and returns an MCP `ToolResult`.
23
- */
24
- export declare class AppleMailTools {
25
- private readonly mailTools;
26
- private readonly accountRepository;
27
- private readonly mailSender;
28
- constructor(mailTools: MailTools, accountRepository: IAccountRepository, mailSender: IMailSender | null);
29
- /** Single-shot send via the AppleScript mail sender (Graph uses two-phase). */
30
- sendEmail(params: SendEmailParams): ToolResult;
31
- listFolders(params: ListFoldersToolParams): ToolResult;
32
- listEmails(params: ListEmailsParams): ToolResult;
33
- searchEmails(params: SearchEmailsParams): ToolResult;
34
- getEmail(params: GetEmailParams): ToolResult;
35
- getEmails(params: GetEmailsParams): ToolResult;
36
- getUnreadCount(params: GetUnreadCountParams): ToolResult;
37
- listAttachments(params: ListAttachmentsParams): ToolResult;
38
- downloadAttachment(params: DownloadAttachmentParams): ToolResult;
39
- }
40
- //# sourceMappingURL=mail-apple.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mail-apple.d.ts","sourceRoot":"","sources":["../../src/tools/mail-apple.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EACV,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,wBAAwB,EACzB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAA6B,MAAM,yBAAyB,CAAC;AAC1G,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AA0CjD;;;GAGG;AACH,qBAAa,cAAc;IAEvB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAFV,SAAS,EAAE,SAAS,EACpB,iBAAiB,EAAE,kBAAkB,EACrC,UAAU,EAAE,WAAW,GAAG,IAAI;IAGjD,+EAA+E;IAC/E,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,UAAU;IAiC9C,WAAW,CAAC,MAAM,EAAE,qBAAqB,GAAG,UAAU;IAmCtD,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,UAAU;IAIhD,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,UAAU;IAIpD,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,UAAU;IAQ5C,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,UAAU;IAS9C,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,UAAU;IAIxD,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,UAAU;IAI1D,kBAAkB,CAAC,MAAM,EAAE,wBAAwB,GAAG,UAAU;CAGjE"}
@@ -1,146 +0,0 @@
1
- /**
2
- * Copyright (c) 2026 JBC Tech Solutions, LLC
3
- * Licensed under the MIT License. See LICENSE file in the project root.
4
- */
5
- function jsonResult(data) {
6
- return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
7
- }
8
- /**
9
- * Resolves an account_id parameter to an array of account IDs. Self-contained
10
- * copy of the legacy dispatch helper (the original stays in index.ts, where it
11
- * is still used by the account tools).
12
- *
13
- * - undefined → [defaultAccountId]
14
- * - "all" → all account IDs
15
- * - number → [number]
16
- * - number[] → number[]
17
- */
18
- function resolveAccountIds(accountId, accountRepository) {
19
- if (accountId === undefined) {
20
- const defaultId = accountRepository.getDefaultAccountId();
21
- return defaultId !== null ? [defaultId] : [];
22
- }
23
- if (accountId === 'all') {
24
- const accounts = accountRepository.listAccounts();
25
- return accounts.map(acc => acc.id);
26
- }
27
- if (typeof accountId === 'number') {
28
- return [accountId];
29
- }
30
- if (Array.isArray(accountId)) {
31
- return accountId;
32
- }
33
- const defaultId = accountRepository.getDefaultAccountId();
34
- return defaultId !== null ? [defaultId] : [];
35
- }
36
- /**
37
- * AppleScript mail tools. Each method mirrors the extracted inline AppleScript
38
- * case body and returns an MCP `ToolResult`.
39
- */
40
- export class AppleMailTools {
41
- mailTools;
42
- accountRepository;
43
- mailSender;
44
- constructor(mailTools, accountRepository, mailSender) {
45
- this.mailTools = mailTools;
46
- this.accountRepository = accountRepository;
47
- this.mailSender = mailSender;
48
- }
49
- /** Single-shot send via the AppleScript mail sender (Graph uses two-phase). */
50
- sendEmail(params) {
51
- if (this.mailSender == null) {
52
- return { content: [{ type: 'text', text: 'Email sending is not available' }], isError: true };
53
- }
54
- let sendParams = {
55
- to: params.to,
56
- subject: params.subject,
57
- body: params.body,
58
- bodyType: params.body_type ?? 'plain',
59
- };
60
- if (params.cc != null)
61
- sendParams = { ...sendParams, cc: params.cc };
62
- if (params.bcc != null)
63
- sendParams = { ...sendParams, bcc: params.bcc };
64
- if (params.reply_to != null)
65
- sendParams = { ...sendParams, replyTo: params.reply_to };
66
- if (params.attachments != null) {
67
- sendParams = {
68
- ...sendParams,
69
- attachments: params.attachments.map((a) => (a.name != null ? { path: a.path, name: a.name } : { path: a.path })),
70
- };
71
- }
72
- if (params.inline_images != null) {
73
- sendParams = {
74
- ...sendParams,
75
- inlineImages: params.inline_images.map((img) => ({ path: img.path, contentId: img.content_id })),
76
- };
77
- }
78
- if (params.account_id != null)
79
- sendParams = { ...sendParams, accountId: params.account_id };
80
- const sent = this.mailSender.sendEmail(sendParams);
81
- return {
82
- content: [{ type: 'text', text: JSON.stringify({ message_id: sent.messageId, sent_at: sent.sentAt, status: 'sent' }, null, 2) }],
83
- };
84
- }
85
- listFolders(params) {
86
- const accountIds = resolveAccountIds(params.account_id, this.accountRepository);
87
- // If querying multiple accounts, use grouped format
88
- if (accountIds.length > 1 || params.account_id === 'all') {
89
- const foldersWithAccount = this.accountRepository.listMailFoldersByAccounts(accountIds);
90
- const accounts = this.accountRepository.listAccounts();
91
- // Group folders by account
92
- const groupedByAccount = accountIds.map(accountId => {
93
- const account = accounts.find(a => a.id === accountId);
94
- const folders = foldersWithAccount
95
- .filter(f => f.accountId === accountId)
96
- .map(f => ({
97
- id: f.id,
98
- name: f.name,
99
- unreadCount: f.unreadCount,
100
- messageCount: f.messageCount,
101
- }));
102
- return {
103
- account_id: accountId,
104
- account_name: account?.name ?? null,
105
- account_email: account?.email ?? null,
106
- folders,
107
- };
108
- });
109
- return jsonResult({ accounts: groupedByAccount });
110
- }
111
- // Single account - use existing format for backward compatibility
112
- return jsonResult(this.mailTools.listFolders({}));
113
- }
114
- listEmails(params) {
115
- return jsonResult(this.mailTools.listEmails(params));
116
- }
117
- searchEmails(params) {
118
- return jsonResult(this.mailTools.searchEmails(params));
119
- }
120
- getEmail(params) {
121
- const result = this.mailTools.getEmail(params);
122
- if (result == null) {
123
- return { content: [{ type: 'text', text: 'Email not found' }], isError: true };
124
- }
125
- return jsonResult(result);
126
- }
127
- getEmails(params) {
128
- const results = params.email_ids.map((id) => {
129
- const email = this.mailTools.getEmail({ email_id: id, include_body: params.include_body, strip_html: params.strip_html });
130
- if (email == null)
131
- return { id, error: 'Not found' };
132
- return email;
133
- });
134
- return jsonResult({ emails: results });
135
- }
136
- getUnreadCount(params) {
137
- return jsonResult(this.mailTools.getUnreadCount(params));
138
- }
139
- listAttachments(params) {
140
- return jsonResult(this.mailTools.listAttachments(params));
141
- }
142
- downloadAttachment(params) {
143
- return jsonResult(this.mailTools.downloadAttachment(params));
144
- }
145
- }
146
- //# sourceMappingURL=mail-apple.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mail-apple.js","sourceRoot":"","sources":["../../src/tools/mail-apple.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA4BH,SAAS,UAAU,CAAC,IAAa;IAC/B,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AAC9E,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,iBAAiB,CACxB,SAAgD,EAChD,iBAAqC;IAErC,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,MAAM,SAAS,GAAG,iBAAiB,CAAC,mBAAmB,EAAE,CAAC;QAC1D,OAAO,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/C,CAAC;IAED,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;QACxB,MAAM,QAAQ,GAAG,iBAAiB,CAAC,YAAY,EAAE,CAAC;QAClD,OAAO,QAAQ,CAAC,GAAG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C;QACf,CAAC,CAAC,CAAC;QACH,OAAO,UAAU,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,cAAc,CAAC,MAA4B;QACzC,OAAO,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED,eAAe,CAAC,MAA6B;QAC3C,OAAO,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5D,CAAC;IAED,kBAAkB,CAAC,MAAgC;QACjD,OAAO,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/D,CAAC;CACF"}
@@ -1,86 +0,0 @@
1
- /**
2
- * Copyright (c) 2026 JBC Tech Solutions, LLC
3
- * Licensed under the MIT License. See LICENSE file in the project root.
4
- */
5
- /**
6
- * Notes-related MCP tools.
7
- *
8
- * Provides tools for listing, searching, and getting notes.
9
- */
10
- import { z } from 'zod';
11
- import type { IRepository } from '../database/repository.js';
12
- import type { NoteSummary, Note } from '../types/index.js';
13
- import type { ToolDefinition } from '../registry/types.js';
14
- declare module '../registry/types.js' {
15
- interface AppleScriptToolsets {
16
- notes: NotesTools;
17
- }
18
- }
19
- export declare const ListNotesInput: z.ZodObject<{
20
- limit: z.ZodDefault<z.ZodNumber>;
21
- offset: z.ZodDefault<z.ZodNumber>;
22
- }, z.core.$strict>;
23
- export declare const GetNoteInput: z.ZodObject<{
24
- note_id: z.ZodNumber;
25
- }, z.core.$strict>;
26
- export declare const SearchNotesInput: z.ZodObject<{
27
- query: z.ZodString;
28
- limit: z.ZodDefault<z.ZodNumber>;
29
- }, z.core.$strict>;
30
- export type ListNotesParams = z.infer<typeof ListNotesInput>;
31
- export type GetNoteParams = z.infer<typeof GetNoteInput>;
32
- export type SearchNotesParams = z.infer<typeof SearchNotesInput>;
33
- /**
34
- * Interface for reading note content from data files.
35
- */
36
- export interface INoteContentReader {
37
- /**
38
- * Reads note details from the given data file path.
39
- */
40
- readNoteDetails(dataFilePath: string | null): NoteDetails | null;
41
- }
42
- /**
43
- * Note details from content file.
44
- */
45
- export interface NoteDetails {
46
- readonly title: string | null;
47
- readonly body: string | null;
48
- readonly preview: string | null;
49
- readonly createdDate: string | null;
50
- readonly categories: readonly string[];
51
- }
52
- /**
53
- * Default note content reader that returns null.
54
- */
55
- export declare const nullNoteContentReader: INoteContentReader;
56
- /**
57
- * Notes tools implementation with dependency injection.
58
- */
59
- export declare class NotesTools {
60
- private readonly repository;
61
- private readonly contentReader;
62
- constructor(repository: IRepository, contentReader?: INoteContentReader);
63
- /**
64
- * Lists notes with pagination.
65
- */
66
- listNotes(params: ListNotesParams): NoteSummary[];
67
- /**
68
- * Gets a single note by ID.
69
- */
70
- getNote(params: GetNoteParams): Note | null;
71
- /**
72
- * Searches notes by content (requires content reader).
73
- */
74
- searchNotes(params: SearchNotesParams): NoteSummary[];
75
- }
76
- /**
77
- * Creates notes tools with the given repository.
78
- */
79
- export declare function createNotesTools(repository: IRepository, contentReader?: INoteContentReader): NotesTools;
80
- /**
81
- * Registry tool definitions for the notes domain. Each handler branches on the
82
- * active backend: AppleScript delegates to NotesTools; Graph returns the
83
- * unsupported message (matching the pre-registry dispatch behavior exactly).
84
- */
85
- export declare function notesToolDefinitions(): ToolDefinition[];
86
- //# sourceMappingURL=notes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"notes.d.ts","sourceRoot":"","sources":["../../src/tools/notes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAW,MAAM,2BAA2B,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAI3D,OAAO,KAAK,EAAe,cAAc,EAAc,MAAM,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ACH,OAAO,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,GAAG,IAAI;IAY3C;;OAEG;IACH,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,WAAW,EAAE;CAuBtD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,WAAW,EACvB,aAAa,GAAE,kBAA0C,GACxD,UAAU,CAEZ;AAYD;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,cAAc,EAAE,CAkDvD"}
@@ -1,202 +0,0 @@
1
- /**
2
- * Copyright (c) 2026 JBC Tech Solutions, LLC
3
- * Licensed under the MIT License. See LICENSE file in the project root.
4
- */
5
- /**
6
- * Notes-related MCP tools.
7
- *
8
- * Provides tools for listing, searching, and getting notes.
9
- */
10
- import { z } from 'zod';
11
- import { appleTimestampToIso } from '../utils/dates.js';
12
- import { defineTool } from '../registry/define-tool.js';
13
- import { requireAppleScriptToolset } from '../registry/context.js';
14
- // =============================================================================
15
- // Input Schemas
16
- // =============================================================================
17
- export const ListNotesInput = z.strictObject({
18
- limit: z
19
- .number()
20
- .int()
21
- .min(1)
22
- .max(100)
23
- .default(50)
24
- .describe('Maximum number of notes to return (1-100)'),
25
- offset: z.number().int().min(0).default(0).describe('Number of notes to skip'),
26
- });
27
- export const GetNoteInput = z.strictObject({
28
- note_id: z.number().int().positive().describe('The note ID to retrieve'),
29
- });
30
- export const SearchNotesInput = z.strictObject({
31
- query: z.string().min(1).describe('Search query for note content'),
32
- limit: z
33
- .number()
34
- .int()
35
- .min(1)
36
- .max(100)
37
- .default(50)
38
- .describe('Maximum number of notes to return (1-100)'),
39
- });
40
- /**
41
- * Default note content reader that returns null.
42
- */
43
- export const nullNoteContentReader = {
44
- readNoteDetails: () => null,
45
- };
46
- // =============================================================================
47
- // Transformers
48
- // =============================================================================
49
- /**
50
- * Transforms a database note row to NoteSummary.
51
- */
52
- function transformNoteSummary(row, details) {
53
- return {
54
- id: row.id,
55
- folderId: row.folderId,
56
- title: details?.title ?? null,
57
- preview: details?.preview ?? null,
58
- modifiedDate: appleTimestampToIso(row.modifiedDate),
59
- };
60
- }
61
- /**
62
- * Transforms a database note row to full Note.
63
- */
64
- function transformNote(row, details) {
65
- const summary = transformNoteSummary(row, details);
66
- return {
67
- ...summary,
68
- body: details?.body ?? null,
69
- createdDate: details?.createdDate ?? null,
70
- categories: details?.categories ?? [],
71
- };
72
- }
73
- // =============================================================================
74
- // Notes Tools Class
75
- // =============================================================================
76
- /**
77
- * Notes tools implementation with dependency injection.
78
- */
79
- export class NotesTools {
80
- repository;
81
- contentReader;
82
- constructor(repository, contentReader = nullNoteContentReader) {
83
- this.repository = repository;
84
- this.contentReader = contentReader;
85
- }
86
- /**
87
- * Lists notes with pagination.
88
- */
89
- listNotes(params) {
90
- const { limit, offset } = params;
91
- const rows = this.repository.listNotes(limit, offset);
92
- return rows.map((row) => {
93
- const details = this.contentReader.readNoteDetails(row.dataFilePath);
94
- return transformNoteSummary(row, details);
95
- });
96
- }
97
- /**
98
- * Gets a single note by ID.
99
- */
100
- getNote(params) {
101
- const { note_id } = params;
102
- const row = this.repository.getNote(note_id);
103
- if (row == null) {
104
- return null;
105
- }
106
- const details = this.contentReader.readNoteDetails(row.dataFilePath);
107
- return transformNote(row, details);
108
- }
109
- /**
110
- * Searches notes by content (requires content reader).
111
- */
112
- searchNotes(params) {
113
- const { query, limit } = params;
114
- const queryLower = query.toLowerCase();
115
- // Get all notes and filter by content (from content reader)
116
- const rows = this.repository.listNotes(limit * 2, 0); // Fetch more to filter
117
- const results = [];
118
- for (const row of rows) {
119
- if (results.length >= limit)
120
- break;
121
- const details = this.contentReader.readNoteDetails(row.dataFilePath);
122
- const searchText = [details?.title ?? '', details?.body ?? '', details?.preview ?? '']
123
- .join(' ')
124
- .toLowerCase();
125
- if (searchText.includes(queryLower)) {
126
- results.push(transformNoteSummary(row, details));
127
- }
128
- }
129
- return results;
130
- }
131
- }
132
- /**
133
- * Creates notes tools with the given repository.
134
- */
135
- export function createNotesTools(repository, contentReader = nullNoteContentReader) {
136
- return new NotesTools(repository, contentReader);
137
- }
138
- // =============================================================================
139
- // Registry Definitions (v3 registry-driven architecture, U2 — dual backend)
140
- // =============================================================================
141
- const NOTES_UNSUPPORTED = 'Notes are not supported by Microsoft Graph API';
142
- function jsonResult(data) {
143
- return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
144
- }
145
- /**
146
- * Registry tool definitions for the notes domain. Each handler branches on the
147
- * active backend: AppleScript delegates to NotesTools; Graph returns the
148
- * unsupported message (matching the pre-registry dispatch behavior exactly).
149
- */
150
- export function notesToolDefinitions() {
151
- const tools = (ctx) => requireAppleScriptToolset(ctx, 'notes');
152
- return [
153
- defineTool({
154
- name: 'list_notes',
155
- description: 'List notes with pagination',
156
- input: ListNotesInput,
157
- annotations: { readOnlyHint: true },
158
- destructive: false,
159
- presets: ['notes'],
160
- backends: ['graph', 'applescript'],
161
- handler: (ctx, params) => {
162
- if (ctx.backend === 'graph')
163
- return jsonResult({ notes: [], message: NOTES_UNSUPPORTED });
164
- return jsonResult(tools(ctx).listNotes(params));
165
- },
166
- }),
167
- defineTool({
168
- name: 'get_note',
169
- description: 'Get note details',
170
- input: GetNoteInput,
171
- annotations: { readOnlyHint: true },
172
- destructive: false,
173
- presets: ['notes'],
174
- backends: ['graph', 'applescript'],
175
- handler: (ctx, params) => {
176
- if (ctx.backend === 'graph') {
177
- return { content: [{ type: 'text', text: NOTES_UNSUPPORTED }], isError: true };
178
- }
179
- const result = tools(ctx).getNote(params);
180
- if (result == null) {
181
- return { content: [{ type: 'text', text: 'Note not found' }], isError: true };
182
- }
183
- return jsonResult(result);
184
- },
185
- }),
186
- defineTool({
187
- name: 'search_notes',
188
- description: 'Search notes by content',
189
- input: SearchNotesInput,
190
- annotations: { readOnlyHint: true },
191
- destructive: false,
192
- presets: ['notes'],
193
- backends: ['graph', 'applescript'],
194
- handler: (ctx, params) => {
195
- if (ctx.backend === 'graph')
196
- return jsonResult({ notes: [], message: NOTES_UNSUPPORTED });
197
- return jsonResult(tools(ctx).searchNotes(params));
198
- },
199
- }),
200
- ];
201
- }
202
- //# sourceMappingURL=notes.js.map