@jbctechsolutions/mcp-office365 2.5.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 (339) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +667 -0
  3. package/dist/applescript/account-repository.d.ts +30 -0
  4. package/dist/applescript/account-repository.d.ts.map +1 -0
  5. package/dist/applescript/account-repository.js +38 -0
  6. package/dist/applescript/account-repository.js.map +1 -0
  7. package/dist/applescript/account-scripts.d.ts +21 -0
  8. package/dist/applescript/account-scripts.d.ts.map +1 -0
  9. package/dist/applescript/account-scripts.js +180 -0
  10. package/dist/applescript/account-scripts.js.map +1 -0
  11. package/dist/applescript/calendar-manager.d.ts +44 -0
  12. package/dist/applescript/calendar-manager.d.ts.map +1 -0
  13. package/dist/applescript/calendar-manager.js +92 -0
  14. package/dist/applescript/calendar-manager.js.map +1 -0
  15. package/dist/applescript/calendar-writer.d.ts +36 -0
  16. package/dist/applescript/calendar-writer.d.ts.map +1 -0
  17. package/dist/applescript/calendar-writer.js +94 -0
  18. package/dist/applescript/calendar-writer.js.map +1 -0
  19. package/dist/applescript/content-readers.d.ts +114 -0
  20. package/dist/applescript/content-readers.d.ts.map +1 -0
  21. package/dist/applescript/content-readers.js +328 -0
  22. package/dist/applescript/content-readers.js.map +1 -0
  23. package/dist/applescript/executor.d.ts +60 -0
  24. package/dist/applescript/executor.d.ts.map +1 -0
  25. package/dist/applescript/executor.js +173 -0
  26. package/dist/applescript/executor.js.map +1 -0
  27. package/dist/applescript/index.d.ts +20 -0
  28. package/dist/applescript/index.d.ts.map +1 -0
  29. package/dist/applescript/index.js +29 -0
  30. package/dist/applescript/index.js.map +1 -0
  31. package/dist/applescript/mail-sender.d.ts +38 -0
  32. package/dist/applescript/mail-sender.d.ts.map +1 -0
  33. package/dist/applescript/mail-sender.js +67 -0
  34. package/dist/applescript/mail-sender.js.map +1 -0
  35. package/dist/applescript/parser.d.ts +235 -0
  36. package/dist/applescript/parser.d.ts.map +1 -0
  37. package/dist/applescript/parser.js +496 -0
  38. package/dist/applescript/parser.js.map +1 -0
  39. package/dist/applescript/repository.d.ts +64 -0
  40. package/dist/applescript/repository.d.ts.map +1 -0
  41. package/dist/applescript/repository.js +444 -0
  42. package/dist/applescript/repository.js.map +1 -0
  43. package/dist/applescript/scripts.d.ts +265 -0
  44. package/dist/applescript/scripts.d.ts.map +1 -0
  45. package/dist/applescript/scripts.js +1483 -0
  46. package/dist/applescript/scripts.js.map +1 -0
  47. package/dist/approval/hash.d.ts +87 -0
  48. package/dist/approval/hash.d.ts.map +1 -0
  49. package/dist/approval/hash.js +102 -0
  50. package/dist/approval/hash.js.map +1 -0
  51. package/dist/approval/index.d.ts +13 -0
  52. package/dist/approval/index.d.ts.map +1 -0
  53. package/dist/approval/index.js +7 -0
  54. package/dist/approval/index.js.map +1 -0
  55. package/dist/approval/token-manager.d.ts +51 -0
  56. package/dist/approval/token-manager.d.ts.map +1 -0
  57. package/dist/approval/token-manager.js +111 -0
  58. package/dist/approval/token-manager.js.map +1 -0
  59. package/dist/approval/types.d.ts +44 -0
  60. package/dist/approval/types.d.ts.map +1 -0
  61. package/dist/approval/types.js +6 -0
  62. package/dist/approval/types.js.map +1 -0
  63. package/dist/cli.d.ts +30 -0
  64. package/dist/cli.d.ts.map +1 -0
  65. package/dist/cli.js +143 -0
  66. package/dist/cli.js.map +1 -0
  67. package/dist/config.d.ts +27 -0
  68. package/dist/config.d.ts.map +1 -0
  69. package/dist/config.js +42 -0
  70. package/dist/config.js.map +1 -0
  71. package/dist/database/connection.d.ts +77 -0
  72. package/dist/database/connection.d.ts.map +1 -0
  73. package/dist/database/connection.js +130 -0
  74. package/dist/database/connection.js.map +1 -0
  75. package/dist/database/index.d.ts +11 -0
  76. package/dist/database/index.d.ts.map +1 -0
  77. package/dist/database/index.js +11 -0
  78. package/dist/database/index.js.map +1 -0
  79. package/dist/database/queries.d.ts +93 -0
  80. package/dist/database/queries.d.ts.map +1 -0
  81. package/dist/database/queries.js +430 -0
  82. package/dist/database/queries.js.map +1 -0
  83. package/dist/database/repository.d.ts +198 -0
  84. package/dist/database/repository.d.ts.map +1 -0
  85. package/dist/database/repository.js +199 -0
  86. package/dist/database/repository.js.map +1 -0
  87. package/dist/graph/attachments.d.ts +72 -0
  88. package/dist/graph/attachments.d.ts.map +1 -0
  89. package/dist/graph/attachments.js +207 -0
  90. package/dist/graph/attachments.js.map +1 -0
  91. package/dist/graph/auth/config.d.ts +34 -0
  92. package/dist/graph/auth/config.d.ts.map +1 -0
  93. package/dist/graph/auth/config.js +78 -0
  94. package/dist/graph/auth/config.js.map +1 -0
  95. package/dist/graph/auth/device-code-flow.d.ts +55 -0
  96. package/dist/graph/auth/device-code-flow.d.ts.map +1 -0
  97. package/dist/graph/auth/device-code-flow.js +180 -0
  98. package/dist/graph/auth/device-code-flow.js.map +1 -0
  99. package/dist/graph/auth/index.d.ts +13 -0
  100. package/dist/graph/auth/index.d.ts.map +1 -0
  101. package/dist/graph/auth/index.js +13 -0
  102. package/dist/graph/auth/index.js.map +1 -0
  103. package/dist/graph/auth/token-cache.d.ts +41 -0
  104. package/dist/graph/auth/token-cache.d.ts.map +1 -0
  105. package/dist/graph/auth/token-cache.js +105 -0
  106. package/dist/graph/auth/token-cache.js.map +1 -0
  107. package/dist/graph/client/batch.d.ts +38 -0
  108. package/dist/graph/client/batch.d.ts.map +1 -0
  109. package/dist/graph/client/batch.js +33 -0
  110. package/dist/graph/client/batch.js.map +1 -0
  111. package/dist/graph/client/cache.d.ts +64 -0
  112. package/dist/graph/client/cache.d.ts.map +1 -0
  113. package/dist/graph/client/cache.js +108 -0
  114. package/dist/graph/client/cache.js.map +1 -0
  115. package/dist/graph/client/graph-client.d.ts +630 -0
  116. package/dist/graph/client/graph-client.d.ts.map +1 -0
  117. package/dist/graph/client/graph-client.js +1771 -0
  118. package/dist/graph/client/graph-client.js.map +1 -0
  119. package/dist/graph/client/index.d.ts +12 -0
  120. package/dist/graph/client/index.d.ts.map +1 -0
  121. package/dist/graph/client/index.js +12 -0
  122. package/dist/graph/client/index.js.map +1 -0
  123. package/dist/graph/content-readers.d.ts +106 -0
  124. package/dist/graph/content-readers.d.ts.map +1 -0
  125. package/dist/graph/content-readers.js +321 -0
  126. package/dist/graph/content-readers.js.map +1 -0
  127. package/dist/graph/index.d.ts +18 -0
  128. package/dist/graph/index.d.ts.map +1 -0
  129. package/dist/graph/index.js +23 -0
  130. package/dist/graph/index.js.map +1 -0
  131. package/dist/graph/mailbox-adapter.d.ts +30 -0
  132. package/dist/graph/mailbox-adapter.d.ts.map +1 -0
  133. package/dist/graph/mailbox-adapter.js +59 -0
  134. package/dist/graph/mailbox-adapter.js.map +1 -0
  135. package/dist/graph/mappers/contact-mapper.d.ts +14 -0
  136. package/dist/graph/mappers/contact-mapper.d.ts.map +1 -0
  137. package/dist/graph/mappers/contact-mapper.js +20 -0
  138. package/dist/graph/mappers/contact-mapper.js.map +1 -0
  139. package/dist/graph/mappers/email-mapper.d.ts +14 -0
  140. package/dist/graph/mappers/email-mapper.d.ts.map +1 -0
  141. package/dist/graph/mappers/email-mapper.js +44 -0
  142. package/dist/graph/mappers/email-mapper.js.map +1 -0
  143. package/dist/graph/mappers/event-mapper.d.ts +14 -0
  144. package/dist/graph/mappers/event-mapper.d.ts.map +1 -0
  145. package/dist/graph/mappers/event-mapper.js +31 -0
  146. package/dist/graph/mappers/event-mapper.js.map +1 -0
  147. package/dist/graph/mappers/folder-mapper.d.ts +22 -0
  148. package/dist/graph/mappers/folder-mapper.d.ts.map +1 -0
  149. package/dist/graph/mappers/folder-mapper.js +51 -0
  150. package/dist/graph/mappers/folder-mapper.js.map +1 -0
  151. package/dist/graph/mappers/index.d.ts +16 -0
  152. package/dist/graph/mappers/index.d.ts.map +1 -0
  153. package/dist/graph/mappers/index.js +16 -0
  154. package/dist/graph/mappers/index.js.map +1 -0
  155. package/dist/graph/mappers/task-mapper.d.ts +20 -0
  156. package/dist/graph/mappers/task-mapper.d.ts.map +1 -0
  157. package/dist/graph/mappers/task-mapper.js +27 -0
  158. package/dist/graph/mappers/task-mapper.js.map +1 -0
  159. package/dist/graph/mappers/utils.d.ts +97 -0
  160. package/dist/graph/mappers/utils.d.ts.map +1 -0
  161. package/dist/graph/mappers/utils.js +186 -0
  162. package/dist/graph/mappers/utils.js.map +1 -0
  163. package/dist/graph/repository.d.ts +1104 -0
  164. package/dist/graph/repository.d.ts.map +1 -0
  165. package/dist/graph/repository.js +2999 -0
  166. package/dist/graph/repository.js.map +1 -0
  167. package/dist/index.d.ts +21 -0
  168. package/dist/index.d.ts.map +1 -0
  169. package/dist/index.js +6052 -0
  170. package/dist/index.js.map +1 -0
  171. package/dist/parsers/html-stripper.d.ts +41 -0
  172. package/dist/parsers/html-stripper.d.ts.map +1 -0
  173. package/dist/parsers/html-stripper.js +179 -0
  174. package/dist/parsers/html-stripper.js.map +1 -0
  175. package/dist/parsers/index.d.ts +12 -0
  176. package/dist/parsers/index.d.ts.map +1 -0
  177. package/dist/parsers/index.js +12 -0
  178. package/dist/parsers/index.js.map +1 -0
  179. package/dist/parsers/olk15.d.ts +87 -0
  180. package/dist/parsers/olk15.d.ts.map +1 -0
  181. package/dist/parsers/olk15.js +368 -0
  182. package/dist/parsers/olk15.js.map +1 -0
  183. package/dist/signature.d.ts +22 -0
  184. package/dist/signature.d.ts.map +1 -0
  185. package/dist/signature.js +89 -0
  186. package/dist/signature.js.map +1 -0
  187. package/dist/tools/calendar-permissions.d.ts +79 -0
  188. package/dist/tools/calendar-permissions.d.ts.map +1 -0
  189. package/dist/tools/calendar-permissions.js +121 -0
  190. package/dist/tools/calendar-permissions.js.map +1 -0
  191. package/dist/tools/calendar.d.ts +208 -0
  192. package/dist/tools/calendar.d.ts.map +1 -0
  193. package/dist/tools/calendar.js +247 -0
  194. package/dist/tools/calendar.js.map +1 -0
  195. package/dist/tools/categories.d.ts +94 -0
  196. package/dist/tools/categories.d.ts.map +1 -0
  197. package/dist/tools/categories.js +117 -0
  198. package/dist/tools/categories.js.map +1 -0
  199. package/dist/tools/checklist-items.d.ts +89 -0
  200. package/dist/tools/checklist-items.d.ts.map +1 -0
  201. package/dist/tools/checklist-items.js +140 -0
  202. package/dist/tools/checklist-items.js.map +1 -0
  203. package/dist/tools/contacts.d.ts +94 -0
  204. package/dist/tools/contacts.d.ts.map +1 -0
  205. package/dist/tools/contacts.js +134 -0
  206. package/dist/tools/contacts.js.map +1 -0
  207. package/dist/tools/excel.d.ts +96 -0
  208. package/dist/tools/excel.d.ts.map +1 -0
  209. package/dist/tools/excel.js +165 -0
  210. package/dist/tools/excel.js.map +1 -0
  211. package/dist/tools/focused-overrides.d.ts +70 -0
  212. package/dist/tools/focused-overrides.d.ts.map +1 -0
  213. package/dist/tools/focused-overrides.js +117 -0
  214. package/dist/tools/focused-overrides.js.map +1 -0
  215. package/dist/tools/index.d.ts +22 -0
  216. package/dist/tools/index.d.ts.map +1 -0
  217. package/dist/tools/index.js +34 -0
  218. package/dist/tools/index.js.map +1 -0
  219. package/dist/tools/linked-resources.d.ts +74 -0
  220. package/dist/tools/linked-resources.d.ts.map +1 -0
  221. package/dist/tools/linked-resources.js +122 -0
  222. package/dist/tools/linked-resources.js.map +1 -0
  223. package/dist/tools/mail-rules.d.ts +98 -0
  224. package/dist/tools/mail-rules.d.ts.map +1 -0
  225. package/dist/tools/mail-rules.js +169 -0
  226. package/dist/tools/mail-rules.js.map +1 -0
  227. package/dist/tools/mail-send.d.ts +314 -0
  228. package/dist/tools/mail-send.d.ts.map +1 -0
  229. package/dist/tools/mail-send.js +555 -0
  230. package/dist/tools/mail-send.js.map +1 -0
  231. package/dist/tools/mail.d.ts +127 -0
  232. package/dist/tools/mail.d.ts.map +1 -0
  233. package/dist/tools/mail.js +311 -0
  234. package/dist/tools/mail.js.map +1 -0
  235. package/dist/tools/mailbox-organization.d.ts +301 -0
  236. package/dist/tools/mailbox-organization.d.ts.map +1 -0
  237. package/dist/tools/mailbox-organization.js +541 -0
  238. package/dist/tools/mailbox-organization.js.map +1 -0
  239. package/dist/tools/meetings.d.ts +114 -0
  240. package/dist/tools/meetings.d.ts.map +1 -0
  241. package/dist/tools/meetings.js +110 -0
  242. package/dist/tools/meetings.js.map +1 -0
  243. package/dist/tools/notes.d.ts +74 -0
  244. package/dist/tools/notes.d.ts.map +1 -0
  245. package/dist/tools/notes.js +136 -0
  246. package/dist/tools/notes.js.map +1 -0
  247. package/dist/tools/onedrive.d.ts +194 -0
  248. package/dist/tools/onedrive.d.ts.map +1 -0
  249. package/dist/tools/onedrive.js +257 -0
  250. package/dist/tools/onedrive.js.map +1 -0
  251. package/dist/tools/people.d.ts +129 -0
  252. package/dist/tools/people.d.ts.map +1 -0
  253. package/dist/tools/people.js +195 -0
  254. package/dist/tools/people.js.map +1 -0
  255. package/dist/tools/planner-visualization.d.ts +91 -0
  256. package/dist/tools/planner-visualization.d.ts.map +1 -0
  257. package/dist/tools/planner-visualization.js +192 -0
  258. package/dist/tools/planner-visualization.js.map +1 -0
  259. package/dist/tools/planner.d.ts +288 -0
  260. package/dist/tools/planner.d.ts.map +1 -0
  261. package/dist/tools/planner.js +368 -0
  262. package/dist/tools/planner.js.map +1 -0
  263. package/dist/tools/scheduling.d.ts +49 -0
  264. package/dist/tools/scheduling.d.ts.map +1 -0
  265. package/dist/tools/scheduling.js +115 -0
  266. package/dist/tools/scheduling.js.map +1 -0
  267. package/dist/tools/sharepoint.d.ts +115 -0
  268. package/dist/tools/sharepoint.d.ts.map +1 -0
  269. package/dist/tools/sharepoint.js +99 -0
  270. package/dist/tools/sharepoint.js.map +1 -0
  271. package/dist/tools/task-attachments.d.ts +74 -0
  272. package/dist/tools/task-attachments.d.ts.map +1 -0
  273. package/dist/tools/task-attachments.js +122 -0
  274. package/dist/tools/task-attachments.js.map +1 -0
  275. package/dist/tools/tasks.d.ts +74 -0
  276. package/dist/tools/tasks.d.ts.map +1 -0
  277. package/dist/tools/tasks.js +126 -0
  278. package/dist/tools/tasks.js.map +1 -0
  279. package/dist/tools/teams.d.ts +389 -0
  280. package/dist/tools/teams.d.ts.map +1 -0
  281. package/dist/tools/teams.js +546 -0
  282. package/dist/tools/teams.js.map +1 -0
  283. package/dist/types/calendar.d.ts +60 -0
  284. package/dist/types/calendar.d.ts.map +1 -0
  285. package/dist/types/calendar.js +15 -0
  286. package/dist/types/calendar.js.map +1 -0
  287. package/dist/types/contacts.d.ts +96 -0
  288. package/dist/types/contacts.d.ts.map +1 -0
  289. package/dist/types/contacts.js +41 -0
  290. package/dist/types/contacts.js.map +1 -0
  291. package/dist/types/index.d.ts +15 -0
  292. package/dist/types/index.d.ts.map +1 -0
  293. package/dist/types/index.js +16 -0
  294. package/dist/types/index.js.map +1 -0
  295. package/dist/types/mail.d.ts +108 -0
  296. package/dist/types/mail.d.ts.map +1 -0
  297. package/dist/types/mail.js +40 -0
  298. package/dist/types/mail.js.map +1 -0
  299. package/dist/types/notes.d.ts +26 -0
  300. package/dist/types/notes.d.ts.map +1 -0
  301. package/dist/types/notes.js +6 -0
  302. package/dist/types/notes.js.map +1 -0
  303. package/dist/types/tasks.d.ts +31 -0
  304. package/dist/types/tasks.d.ts.map +1 -0
  305. package/dist/types/tasks.js +6 -0
  306. package/dist/types/tasks.js.map +1 -0
  307. package/dist/utils/dates.d.ts +66 -0
  308. package/dist/utils/dates.d.ts.map +1 -0
  309. package/dist/utils/dates.js +94 -0
  310. package/dist/utils/dates.js.map +1 -0
  311. package/dist/utils/errors.d.ts +218 -0
  312. package/dist/utils/errors.d.ts.map +1 -0
  313. package/dist/utils/errors.js +306 -0
  314. package/dist/utils/errors.js.map +1 -0
  315. package/dist/utils/index.d.ts +10 -0
  316. package/dist/utils/index.d.ts.map +1 -0
  317. package/dist/utils/index.js +10 -0
  318. package/dist/utils/index.js.map +1 -0
  319. package/dist/visualization/html.d.ts +26 -0
  320. package/dist/visualization/html.d.ts.map +1 -0
  321. package/dist/visualization/html.js +306 -0
  322. package/dist/visualization/html.js.map +1 -0
  323. package/dist/visualization/markdown.d.ts +25 -0
  324. package/dist/visualization/markdown.d.ts.map +1 -0
  325. package/dist/visualization/markdown.js +186 -0
  326. package/dist/visualization/markdown.js.map +1 -0
  327. package/dist/visualization/mermaid.d.ts +25 -0
  328. package/dist/visualization/mermaid.d.ts.map +1 -0
  329. package/dist/visualization/mermaid.js +158 -0
  330. package/dist/visualization/mermaid.js.map +1 -0
  331. package/dist/visualization/svg.d.ts +25 -0
  332. package/dist/visualization/svg.d.ts.map +1 -0
  333. package/dist/visualization/svg.js +282 -0
  334. package/dist/visualization/svg.js.map +1 -0
  335. package/dist/visualization/types.d.ts +43 -0
  336. package/dist/visualization/types.d.ts.map +1 -0
  337. package/dist/visualization/types.js +34 -0
  338. package/dist/visualization/types.js.map +1 -0
  339. package/package.json +88 -0
@@ -0,0 +1,140 @@
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
+ * Checklist Item (subtask) MCP tools for Microsoft To Do.
7
+ *
8
+ * Provides tools for managing checklist items on To Do tasks with a two-phase
9
+ * approval pattern for destructive delete operations.
10
+ */
11
+ import { z } from 'zod';
12
+ // =============================================================================
13
+ // Input Schemas
14
+ // =============================================================================
15
+ export const ListChecklistItemsInput = z.strictObject({
16
+ task_id: z.number().int().positive().describe('Task ID from list_tasks or search_tasks'),
17
+ });
18
+ export const CreateChecklistItemInput = z.strictObject({
19
+ task_id: z.number().int().positive().describe('Task ID'),
20
+ display_name: z.string().min(1).describe('Checklist item text'),
21
+ is_checked: z.boolean().optional().describe('Whether the item is checked (default: false)'),
22
+ });
23
+ export const UpdateChecklistItemInput = z.strictObject({
24
+ checklist_item_id: z.number().int().positive().describe('Checklist item ID'),
25
+ display_name: z.string().min(1).optional().describe('New text'),
26
+ is_checked: z.boolean().optional().describe('Toggle checked state'),
27
+ });
28
+ export const PrepareDeleteChecklistItemInput = z.strictObject({
29
+ checklist_item_id: z.number().int().positive().describe('Checklist item ID to delete'),
30
+ });
31
+ export const ConfirmDeleteChecklistItemInput = z.strictObject({
32
+ approval_token: z.string().describe('Approval token from prepare_delete_checklist_item'),
33
+ });
34
+ // =============================================================================
35
+ // Checklist Items Tools
36
+ // =============================================================================
37
+ /**
38
+ * Checklist item tools with two-phase approval for delete operations.
39
+ */
40
+ export class ChecklistItemsTools {
41
+ repo;
42
+ tokenManager;
43
+ constructor(repo, tokenManager) {
44
+ this.repo = repo;
45
+ this.tokenManager = tokenManager;
46
+ }
47
+ async listChecklistItems(params) {
48
+ const items = await this.repo.listChecklistItemsAsync(params.task_id);
49
+ return {
50
+ content: [{
51
+ type: 'text',
52
+ text: JSON.stringify({ checklist_items: items }, null, 2),
53
+ }],
54
+ };
55
+ }
56
+ async createChecklistItem(params) {
57
+ const itemId = await this.repo.createChecklistItemAsync(params.task_id, params.display_name, params.is_checked);
58
+ return {
59
+ content: [{
60
+ type: 'text',
61
+ text: JSON.stringify({ success: true, checklist_item_id: itemId, message: 'Checklist item created' }, null, 2),
62
+ }],
63
+ };
64
+ }
65
+ async updateChecklistItem(params) {
66
+ const updates = {};
67
+ if (params.display_name != null)
68
+ updates.displayName = params.display_name;
69
+ if (params.is_checked != null)
70
+ updates.isChecked = params.is_checked;
71
+ await this.repo.updateChecklistItemAsync(params.checklist_item_id, updates);
72
+ return {
73
+ content: [{
74
+ type: 'text',
75
+ text: JSON.stringify({ success: true, message: 'Checklist item updated' }, null, 2),
76
+ }],
77
+ };
78
+ }
79
+ prepareDeleteChecklistItem(params) {
80
+ const token = this.tokenManager.generateToken({
81
+ operation: 'delete_checklist_item',
82
+ targetType: 'checklist_item',
83
+ targetId: params.checklist_item_id,
84
+ targetHash: String(params.checklist_item_id),
85
+ });
86
+ return {
87
+ content: [{
88
+ type: 'text',
89
+ text: JSON.stringify({
90
+ approval_token: token.tokenId,
91
+ expires_at: new Date(token.expiresAt).toISOString(),
92
+ checklist_item_id: params.checklist_item_id,
93
+ action: `To confirm deleting checklist item ${params.checklist_item_id}, call confirm_delete_checklist_item with the approval_token.`,
94
+ }, null, 2),
95
+ }],
96
+ };
97
+ }
98
+ async confirmDeleteChecklistItem(params) {
99
+ // Look up the token to get the targetId, then consume it
100
+ const token = this.tokenManager.lookupToken(params.approval_token);
101
+ if (token == null) {
102
+ return {
103
+ content: [{
104
+ type: 'text',
105
+ text: JSON.stringify({
106
+ success: false,
107
+ error: 'Token not found or already used',
108
+ }, null, 2),
109
+ }],
110
+ };
111
+ }
112
+ const result = this.tokenManager.consumeToken(params.approval_token, 'delete_checklist_item', token.targetId);
113
+ if (!result.valid) {
114
+ const errorMessages = {
115
+ NOT_FOUND: 'Token not found or already used',
116
+ EXPIRED: 'Token has expired. Please call prepare_delete_checklist_item again.',
117
+ OPERATION_MISMATCH: 'Token was not generated for delete_checklist_item',
118
+ TARGET_MISMATCH: 'Token was generated for a different checklist item',
119
+ ALREADY_CONSUMED: 'Token has already been used',
120
+ };
121
+ return {
122
+ content: [{
123
+ type: 'text',
124
+ text: JSON.stringify({
125
+ success: false,
126
+ error: errorMessages[result.error ?? ''] ?? 'Invalid token',
127
+ }, null, 2),
128
+ }],
129
+ };
130
+ }
131
+ await this.repo.deleteChecklistItemAsync(result.token.targetId);
132
+ return {
133
+ content: [{
134
+ type: 'text',
135
+ text: JSON.stringify({ success: true, message: 'Checklist item deleted' }, null, 2),
136
+ }],
137
+ };
138
+ }
139
+ }
140
+ //# sourceMappingURL=checklist-items.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checklist-items.js","sourceRoot":"","sources":["../../src/tools/checklist-items.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,gFAAgF;AAChF,gBAAgB;AAChB,gFAAgF;AAEhF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,YAAY,CAAC;IACpD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CA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MIT License. See LICENSE file in the project root.
4
+ */
5
+ /**
6
+ * Contact-related MCP tools.
7
+ *
8
+ * Provides tools for listing and searching contacts.
9
+ */
10
+ import { z } from 'zod';
11
+ import type { IRepository } from '../database/repository.js';
12
+ import type { ContactSummary, Contact } from '../types/index.js';
13
+ export declare const ListContactsInput: z.ZodObject<{
14
+ limit: z.ZodDefault<z.ZodNumber>;
15
+ offset: z.ZodDefault<z.ZodNumber>;
16
+ folder_id: z.ZodOptional<z.ZodNumber>;
17
+ }, z.core.$strict>;
18
+ export declare const SearchContactsInput: z.ZodObject<{
19
+ query: z.ZodString;
20
+ limit: z.ZodDefault<z.ZodNumber>;
21
+ }, z.core.$strict>;
22
+ export declare const GetContactInput: z.ZodObject<{
23
+ contact_id: z.ZodNumber;
24
+ }, z.core.$strict>;
25
+ export type ListContactsParams = z.infer<typeof ListContactsInput>;
26
+ export type SearchContactsParams = z.infer<typeof SearchContactsInput>;
27
+ export type GetContactParams = z.infer<typeof GetContactInput>;
28
+ /**
29
+ * Interface for reading contact content from data files.
30
+ */
31
+ export interface IContactContentReader {
32
+ /**
33
+ * Reads contact details from the given data file path.
34
+ */
35
+ readContactDetails(dataFilePath: string | null): ContactDetails | null;
36
+ }
37
+ /**
38
+ * Contact details from content file.
39
+ */
40
+ export interface ContactDetails {
41
+ readonly firstName: string | null;
42
+ readonly lastName: string | null;
43
+ readonly middleName: string | null;
44
+ readonly nickname: string | null;
45
+ readonly company: string | null;
46
+ readonly jobTitle: string | null;
47
+ readonly department: string | null;
48
+ readonly emails: readonly {
49
+ type: string;
50
+ address: string;
51
+ }[];
52
+ readonly phones: readonly {
53
+ type: string;
54
+ number: string;
55
+ }[];
56
+ readonly addresses: readonly {
57
+ type: string;
58
+ street: string | null;
59
+ city: string | null;
60
+ state: string | null;
61
+ postalCode: string | null;
62
+ country: string | null;
63
+ }[];
64
+ readonly notes: string | null;
65
+ }
66
+ /**
67
+ * Default contact content reader that returns null.
68
+ */
69
+ export declare const nullContactContentReader: IContactContentReader;
70
+ /**
71
+ * Contacts tools implementation with dependency injection.
72
+ */
73
+ export declare class ContactsTools {
74
+ private readonly repository;
75
+ private readonly contentReader;
76
+ constructor(repository: IRepository, contentReader?: IContactContentReader);
77
+ /**
78
+ * Lists contacts with pagination.
79
+ */
80
+ listContacts(params: ListContactsParams): ContactSummary[];
81
+ /**
82
+ * Searches contacts by name.
83
+ */
84
+ searchContacts(params: SearchContactsParams): ContactSummary[];
85
+ /**
86
+ * Gets a single contact by ID.
87
+ */
88
+ getContact(params: GetContactParams): Contact | null;
89
+ }
90
+ /**
91
+ * Creates contacts tools with the given repository.
92
+ */
93
+ export declare function createContactsTools(repository: IRepository, contentReader?: IContactContentReader): ContactsTools;
94
+ //# sourceMappingURL=contacts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contacts.d.ts","sourceRoot":"","sources":["../../src/tools/contacts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAc,MAAM,2BAA2B,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAoB,MAAM,mBAAmB,CAAC;AAMnF,eAAO,MAAM,iBAAiB;;;;kBAU5B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;kBAS9B,CAAC;AAEH,eAAO,MAAM,eAAe;;kBAE1B,CAAC;AAMH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AACnE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACvE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAM/D;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,kBAAkB,CAAC,YAAY,EAAE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AAC,aAAa;gBADb,UAAU,EAAE,WAAW,EACvB,aAAa,GAAE,qBAAgD;IAGlF;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,cAAc,EAAE;IAM1D;;OAEG;IACH,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,cAAc,EAAE;IAM9D;;OAEG;IACH,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,GAAG,IAAI;CAWrD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,WAAW,EACvB,aAAa,GAAE,qBAAgD,GAC9D,aAAa,CAEf"}
@@ -0,0 +1,134 @@
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
+ * Contact-related MCP tools.
7
+ *
8
+ * Provides tools for listing and searching contacts.
9
+ */
10
+ import { z } from 'zod';
11
+ // =============================================================================
12
+ // Input Schemas
13
+ // =============================================================================
14
+ export const ListContactsInput = z.strictObject({
15
+ limit: z
16
+ .number()
17
+ .int()
18
+ .min(1)
19
+ .max(100)
20
+ .default(50)
21
+ .describe('Maximum number of contacts to return (1-100)'),
22
+ offset: z.number().int().min(0).default(0).describe('Number of contacts to skip'),
23
+ folder_id: z.number().int().positive().optional().describe('Filter contacts by contact folder ID'),
24
+ });
25
+ export const SearchContactsInput = z.strictObject({
26
+ query: z.string().min(1).describe('Search query for contact names'),
27
+ limit: z
28
+ .number()
29
+ .int()
30
+ .min(1)
31
+ .max(100)
32
+ .default(50)
33
+ .describe('Maximum number of contacts to return (1-100)'),
34
+ });
35
+ export const GetContactInput = z.strictObject({
36
+ contact_id: z.number().int().positive().describe('The contact ID to retrieve'),
37
+ });
38
+ /**
39
+ * Default contact content reader that returns null.
40
+ */
41
+ export const nullContactContentReader = {
42
+ readContactDetails: () => null,
43
+ };
44
+ // =============================================================================
45
+ // Transformers
46
+ // =============================================================================
47
+ /**
48
+ * Transforms a database contact row to ContactSummary.
49
+ */
50
+ function transformContactSummary(row) {
51
+ return {
52
+ id: row.id,
53
+ folderId: row.folderId,
54
+ displayName: row.displayName,
55
+ sortName: row.sortName,
56
+ contactType: (row.contactType ?? 0),
57
+ };
58
+ }
59
+ /**
60
+ * Transforms a database contact row to full Contact.
61
+ */
62
+ function transformContact(row, details) {
63
+ const summary = transformContactSummary(row);
64
+ return {
65
+ ...summary,
66
+ firstName: details?.firstName ?? null,
67
+ lastName: details?.lastName ?? null,
68
+ middleName: details?.middleName ?? null,
69
+ nickname: details?.nickname ?? null,
70
+ company: details?.company ?? null,
71
+ jobTitle: details?.jobTitle ?? null,
72
+ department: details?.department ?? null,
73
+ emails: details?.emails?.map((e) => ({ type: e.type, address: e.address })) ?? [],
74
+ phones: details?.phones?.map((p) => ({ type: p.type, number: p.number })) ?? [],
75
+ addresses: details?.addresses?.map((a) => ({
76
+ type: a.type,
77
+ street: a.street,
78
+ city: a.city,
79
+ state: a.state,
80
+ postalCode: a.postalCode,
81
+ country: a.country,
82
+ })) ?? [],
83
+ notes: details?.notes ?? null,
84
+ };
85
+ }
86
+ // =============================================================================
87
+ // Contacts Tools Class
88
+ // =============================================================================
89
+ /**
90
+ * Contacts tools implementation with dependency injection.
91
+ */
92
+ export class ContactsTools {
93
+ repository;
94
+ contentReader;
95
+ constructor(repository, contentReader = nullContactContentReader) {
96
+ this.repository = repository;
97
+ this.contentReader = contentReader;
98
+ }
99
+ /**
100
+ * Lists contacts with pagination.
101
+ */
102
+ listContacts(params) {
103
+ const { limit, offset } = params;
104
+ const rows = this.repository.listContacts(limit, offset);
105
+ return rows.map(transformContactSummary);
106
+ }
107
+ /**
108
+ * Searches contacts by name.
109
+ */
110
+ searchContacts(params) {
111
+ const { query, limit } = params;
112
+ const rows = this.repository.searchContacts(query, limit);
113
+ return rows.map(transformContactSummary);
114
+ }
115
+ /**
116
+ * Gets a single contact by ID.
117
+ */
118
+ getContact(params) {
119
+ const { contact_id } = params;
120
+ const row = this.repository.getContact(contact_id);
121
+ if (row == null) {
122
+ return null;
123
+ }
124
+ const details = this.contentReader.readContactDetails(row.dataFilePath);
125
+ return transformContact(row, details);
126
+ }
127
+ }
128
+ /**
129
+ * Creates contacts tools with the given repository.
130
+ */
131
+ export function createContactsTools(repository, contentReader = nullContactContentReader) {
132
+ return new ContactsTools(repository, contentReader);
133
+ }
134
+ //# sourceMappingURL=contacts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contacts.js","sourceRoot":"","sources":["../../src/tools/contacts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,gFAAgF;AAChF,gBAAgB;AAChB,gFAAgF;AAEhF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,YAAY,CAAC;IAC9C,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,GAAG,CAAC;SACR,OAAO,CAAC,EAAE,CAAC;SACX,QAAQ,CAAC,8CAA8C,CAAC;IAC3D,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,4BAA4B,CAAC;IACjF,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sCAAsC,CAAC;CACnG,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,YAAY,CAAC;IAChD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,gCAAgC,CAAC;IACnE,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR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AC,CAAC;QACzD,OAAO,IAAI,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,cAAc,CAAC,MAA4B;QACzC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;QAChC,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC1D,OAAO,IAAI,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,MAAwB;QACjC,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;QAE9B,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QACnD,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;YAChB,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACxE,OAAO,gBAAgB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CACjC,UAAuB,EACvB,gBAAuC,wBAAwB;IAE/D,OAAO,IAAI,aAAa,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;AACtD,CAAC"}
@@ -0,0 +1,96 @@
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
+ * Excel Online (Workbook) MCP tools.
7
+ *
8
+ * Provides tools for reading and updating Excel workbooks stored in OneDrive
9
+ * or SharePoint via the Microsoft Graph API, with two-phase approval for
10
+ * range update operations.
11
+ */
12
+ import { z } from 'zod';
13
+ import type { ApprovalTokenManager } from '../approval/index.js';
14
+ export declare const ListWorksheetsInput: z.ZodObject<{
15
+ file_id: z.ZodNumber;
16
+ }, z.core.$strict>;
17
+ export declare const GetWorksheetRangeInput: z.ZodObject<{
18
+ file_id: z.ZodNumber;
19
+ worksheet_name: z.ZodString;
20
+ range: z.ZodString;
21
+ }, z.core.$strict>;
22
+ export declare const GetUsedRangeInput: z.ZodObject<{
23
+ file_id: z.ZodNumber;
24
+ worksheet_name: z.ZodString;
25
+ }, z.core.$strict>;
26
+ export declare const PrepareUpdateRangeInput: z.ZodObject<{
27
+ file_id: z.ZodNumber;
28
+ worksheet_name: z.ZodString;
29
+ range: z.ZodString;
30
+ values: z.ZodArray<z.ZodArray<z.ZodUnknown>>;
31
+ }, z.core.$strict>;
32
+ export declare const ConfirmUpdateRangeInput: z.ZodObject<{
33
+ approval_token: z.ZodString;
34
+ }, z.core.$strict>;
35
+ export declare const GetTableDataInput: z.ZodObject<{
36
+ file_id: z.ZodNumber;
37
+ table_name: z.ZodString;
38
+ }, z.core.$strict>;
39
+ export type ListWorksheetsParams = z.infer<typeof ListWorksheetsInput>;
40
+ export type GetWorksheetRangeParams = z.infer<typeof GetWorksheetRangeInput>;
41
+ export type GetUsedRangeParams = z.infer<typeof GetUsedRangeInput>;
42
+ export type PrepareUpdateRangeParams = z.infer<typeof PrepareUpdateRangeInput>;
43
+ export type ConfirmUpdateRangeParams = z.infer<typeof ConfirmUpdateRangeInput>;
44
+ export type GetTableDataParams = z.infer<typeof GetTableDataInput>;
45
+ export interface IExcelRepository {
46
+ listWorksheetsAsync(fileId: number): Promise<Record<string, unknown>[]>;
47
+ getWorksheetRangeAsync(fileId: number, worksheetName: string, range: string): Promise<Record<string, unknown>>;
48
+ getUsedRangeAsync(fileId: number, worksheetName: string): Promise<Record<string, unknown>>;
49
+ updateWorksheetRangeAsync(fileId: number, worksheetName: string, range: string, values: unknown[][]): Promise<Record<string, unknown>>;
50
+ getTableDataAsync(fileId: number, tableName: string): Promise<Record<string, unknown>[]>;
51
+ }
52
+ /**
53
+ * Excel Online tools with two-phase approval for range updates.
54
+ */
55
+ export declare class ExcelTools {
56
+ private readonly repo;
57
+ private readonly tokenManager;
58
+ constructor(repo: IExcelRepository, tokenManager: ApprovalTokenManager);
59
+ listWorksheets(params: ListWorksheetsParams): Promise<{
60
+ content: Array<{
61
+ type: 'text';
62
+ text: string;
63
+ }>;
64
+ }>;
65
+ getWorksheetRange(params: GetWorksheetRangeParams): Promise<{
66
+ content: Array<{
67
+ type: 'text';
68
+ text: string;
69
+ }>;
70
+ }>;
71
+ getUsedRange(params: GetUsedRangeParams): Promise<{
72
+ content: Array<{
73
+ type: 'text';
74
+ text: string;
75
+ }>;
76
+ }>;
77
+ getTableData(params: GetTableDataParams): Promise<{
78
+ content: Array<{
79
+ type: 'text';
80
+ text: string;
81
+ }>;
82
+ }>;
83
+ prepareUpdateRange(params: PrepareUpdateRangeParams): {
84
+ content: Array<{
85
+ type: 'text';
86
+ text: string;
87
+ }>;
88
+ };
89
+ confirmUpdateRange(params: ConfirmUpdateRangeParams): Promise<{
90
+ content: Array<{
91
+ type: 'text';
92
+ text: string;
93
+ }>;
94
+ }>;
95
+ }
96
+ //# sourceMappingURL=excel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"excel.d.ts","sourceRoot":"","sources":["../../src/tools/excel.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAMjE,eAAO,MAAM,mBAAmB;;kBAE9B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;kBAIjC,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;kBAG5B,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;kBAKlC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;kBAElC,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;kBAG5B,CAAC;AAMH,MAAM,MAAM,oBAAoB,GAAG,CAAC,C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 /**
2
+ * Copyright (c) 2026 JBC Tech Solutions, LLC
3
+ * Licensed under the MIT License. See LICENSE file in the project root.
4
+ */
5
+ /**
6
+ * Excel Online (Workbook) MCP tools.
7
+ *
8
+ * Provides tools for reading and updating Excel workbooks stored in OneDrive
9
+ * or SharePoint via the Microsoft Graph API, with two-phase approval for
10
+ * range update operations.
11
+ */
12
+ import { z } from 'zod';
13
+ // =============================================================================
14
+ // Input Schemas
15
+ // =============================================================================
16
+ export const ListWorksheetsInput = z.strictObject({
17
+ file_id: z.number().describe('Numeric ID of the Excel file (from OneDrive or SharePoint)'),
18
+ });
19
+ export const GetWorksheetRangeInput = z.strictObject({
20
+ file_id: z.number().describe('Numeric ID of the Excel file (from OneDrive or SharePoint)'),
21
+ worksheet_name: z.string().describe('Name of the worksheet'),
22
+ range: z.string().describe('Cell range e.g. "A1:D10"'),
23
+ });
24
+ export const GetUsedRangeInput = z.strictObject({
25
+ file_id: z.number().describe('Numeric ID of the Excel file (from OneDrive or SharePoint)'),
26
+ worksheet_name: z.string().describe('Name of the worksheet'),
27
+ });
28
+ export const PrepareUpdateRangeInput = z.strictObject({
29
+ file_id: z.number().describe('Numeric ID of the Excel file (from OneDrive or SharePoint)'),
30
+ worksheet_name: z.string().describe('Name of the worksheet'),
31
+ range: z.string().describe('Cell range e.g. "A1:D10"'),
32
+ values: z.array(z.array(z.unknown())).describe('2D array of cell values'),
33
+ });
34
+ export const ConfirmUpdateRangeInput = z.strictObject({
35
+ approval_token: z.string().describe('Approval token from prepare_update_range'),
36
+ });
37
+ export const GetTableDataInput = z.strictObject({
38
+ file_id: z.number().describe('Numeric ID of the Excel file (from OneDrive or SharePoint)'),
39
+ table_name: z.string().describe('Name of the Excel table'),
40
+ });
41
+ // =============================================================================
42
+ // Excel Tools
43
+ // =============================================================================
44
+ /**
45
+ * Excel Online tools with two-phase approval for range updates.
46
+ */
47
+ export class ExcelTools {
48
+ repo;
49
+ tokenManager;
50
+ constructor(repo, tokenManager) {
51
+ this.repo = repo;
52
+ this.tokenManager = tokenManager;
53
+ }
54
+ async listWorksheets(params) {
55
+ const worksheets = await this.repo.listWorksheetsAsync(params.file_id);
56
+ return {
57
+ content: [{
58
+ type: 'text',
59
+ text: JSON.stringify({ worksheets }, null, 2),
60
+ }],
61
+ };
62
+ }
63
+ async getWorksheetRange(params) {
64
+ const range = await this.repo.getWorksheetRangeAsync(params.file_id, params.worksheet_name, params.range);
65
+ return {
66
+ content: [{
67
+ type: 'text',
68
+ text: JSON.stringify({ range }, null, 2),
69
+ }],
70
+ };
71
+ }
72
+ async getUsedRange(params) {
73
+ const range = await this.repo.getUsedRangeAsync(params.file_id, params.worksheet_name);
74
+ return {
75
+ content: [{
76
+ type: 'text',
77
+ text: JSON.stringify({ range }, null, 2),
78
+ }],
79
+ };
80
+ }
81
+ async getTableData(params) {
82
+ const rows = await this.repo.getTableDataAsync(params.file_id, params.table_name);
83
+ return {
84
+ content: [{
85
+ type: 'text',
86
+ text: JSON.stringify({ rows }, null, 2),
87
+ }],
88
+ };
89
+ }
90
+ prepareUpdateRange(params) {
91
+ const token = this.tokenManager.generateToken({
92
+ operation: 'update_excel_range',
93
+ targetType: 'excel_range',
94
+ targetId: params.file_id,
95
+ targetHash: `${params.file_id}:${params.worksheet_name}:${params.range}`,
96
+ metadata: {
97
+ worksheet_name: params.worksheet_name,
98
+ range: params.range,
99
+ values: params.values,
100
+ },
101
+ });
102
+ return {
103
+ content: [{
104
+ type: 'text',
105
+ text: JSON.stringify({
106
+ approval_token: token.tokenId,
107
+ expires_at: new Date(token.expiresAt).toISOString(),
108
+ file_id: params.file_id,
109
+ worksheet_name: params.worksheet_name,
110
+ range: params.range,
111
+ cell_count: params.values.reduce((sum, row) => sum + row.length, 0),
112
+ action: `To confirm updating range ${params.range} in worksheet "${params.worksheet_name}", call confirm_update_range with the approval_token.`,
113
+ }, null, 2),
114
+ }],
115
+ };
116
+ }
117
+ async confirmUpdateRange(params) {
118
+ const token = this.tokenManager.lookupToken(params.approval_token);
119
+ if (token == null) {
120
+ return {
121
+ content: [{
122
+ type: 'text',
123
+ text: JSON.stringify({
124
+ success: false,
125
+ error: 'Token not found or already used',
126
+ }, null, 2),
127
+ }],
128
+ };
129
+ }
130
+ const result = this.tokenManager.consumeToken(params.approval_token, 'update_excel_range', token.targetId);
131
+ if (!result.valid) {
132
+ const errorMessages = {
133
+ NOT_FOUND: 'Token not found or already used',
134
+ EXPIRED: 'Token has expired. Please call prepare_update_range again.',
135
+ OPERATION_MISMATCH: 'Token was not generated for update_excel_range',
136
+ TARGET_MISMATCH: 'Token was generated for a different file',
137
+ ALREADY_CONSUMED: 'Token has already been used',
138
+ };
139
+ return {
140
+ content: [{
141
+ type: 'text',
142
+ text: JSON.stringify({
143
+ success: false,
144
+ error: errorMessages[result.error ?? ''] ?? 'Invalid token',
145
+ }, null, 2),
146
+ }],
147
+ };
148
+ }
149
+ const metadata = result.token.metadata;
150
+ const worksheetName = metadata['worksheet_name'];
151
+ const range = metadata['range'];
152
+ const values = metadata['values'];
153
+ await this.repo.updateWorksheetRangeAsync(result.token.targetId, worksheetName, range, values);
154
+ return {
155
+ content: [{
156
+ type: 'text',
157
+ text: JSON.stringify({
158
+ success: true,
159
+ message: `Range ${range} in worksheet "${worksheetName}" updated successfully`,
160
+ }, null, 2),
161
+ }],
162
+ };
163
+ }
164
+ }
165
+ //# sourceMappingURL=excel.js.map