@jbctechsolutions/mcp-office365 2.5.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -57
- package/dist/approval/hash.d.ts +8 -8
- package/dist/approval/token-manager.d.ts +37 -19
- package/dist/approval/token-manager.d.ts.map +1 -1
- package/dist/approval/token-manager.js +133 -37
- package/dist/approval/token-manager.js.map +1 -1
- package/dist/approval/types.d.ts +7 -3
- package/dist/approval/types.d.ts.map +1 -1
- package/dist/cli.d.ts +21 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +100 -2
- package/dist/cli.js.map +1 -1
- package/dist/database/repository.d.ts +48 -48
- package/dist/database/repository.d.ts.map +1 -1
- package/dist/database/repository.js.map +1 -1
- package/dist/delta/mirror.d.ts +67 -0
- package/dist/delta/mirror.d.ts.map +1 -0
- package/dist/delta/mirror.js +183 -0
- package/dist/delta/mirror.js.map +1 -0
- package/dist/graph/auth/account-id.d.ts +19 -0
- package/dist/graph/auth/account-id.d.ts.map +1 -0
- package/dist/graph/auth/account-id.js +55 -0
- package/dist/graph/auth/account-id.js.map +1 -0
- package/dist/graph/auth/config.d.ts +1 -1
- package/dist/graph/auth/config.d.ts.map +1 -1
- package/dist/graph/auth/config.js +13 -1
- package/dist/graph/auth/config.js.map +1 -1
- package/dist/graph/auth/device-code-flow.d.ts +3 -1
- package/dist/graph/auth/device-code-flow.d.ts.map +1 -1
- package/dist/graph/auth/device-code-flow.js +42 -14
- package/dist/graph/auth/device-code-flow.js.map +1 -1
- package/dist/graph/auth/index.d.ts +1 -0
- package/dist/graph/auth/index.d.ts.map +1 -1
- package/dist/graph/auth/index.js +1 -0
- package/dist/graph/auth/index.js.map +1 -1
- package/dist/graph/auth/token-cache.js +2 -2
- package/dist/graph/auth/token-cache.js.map +1 -1
- package/dist/graph/client/graph-client.d.ts +141 -8
- package/dist/graph/client/graph-client.d.ts.map +1 -1
- package/dist/graph/client/graph-client.js +536 -48
- package/dist/graph/client/graph-client.js.map +1 -1
- package/dist/graph/client/immutable-id-middleware.d.ts +50 -0
- package/dist/graph/client/immutable-id-middleware.d.ts.map +1 -0
- package/dist/graph/client/immutable-id-middleware.js +137 -0
- package/dist/graph/client/immutable-id-middleware.js.map +1 -0
- package/dist/graph/content-readers.d.ts +0 -12
- package/dist/graph/content-readers.d.ts.map +1 -1
- package/dist/graph/content-readers.js +0 -21
- package/dist/graph/content-readers.js.map +1 -1
- package/dist/graph/index.d.ts +5 -6
- package/dist/graph/index.d.ts.map +1 -1
- package/dist/graph/index.js +5 -6
- package/dist/graph/index.js.map +1 -1
- package/dist/graph/mailbox-adapter.d.ts +15 -15
- package/dist/graph/mappers/contact-mapper.d.ts +4 -1
- package/dist/graph/mappers/contact-mapper.d.ts.map +1 -1
- package/dist/graph/mappers/contact-mapper.js +7 -3
- package/dist/graph/mappers/contact-mapper.js.map +1 -1
- package/dist/graph/mappers/email-mapper.d.ts.map +1 -1
- package/dist/graph/mappers/email-mapper.js +7 -4
- package/dist/graph/mappers/email-mapper.js.map +1 -1
- package/dist/graph/mappers/event-mapper.d.ts.map +1 -1
- package/dist/graph/mappers/event-mapper.js +6 -3
- package/dist/graph/mappers/event-mapper.js.map +1 -1
- package/dist/graph/mappers/folder-mapper.d.ts +0 -4
- package/dist/graph/mappers/folder-mapper.d.ts.map +1 -1
- package/dist/graph/mappers/folder-mapper.js +9 -19
- package/dist/graph/mappers/folder-mapper.js.map +1 -1
- package/dist/graph/mappers/index.d.ts +2 -2
- package/dist/graph/mappers/index.d.ts.map +1 -1
- package/dist/graph/mappers/index.js +2 -2
- package/dist/graph/mappers/index.js.map +1 -1
- package/dist/graph/mappers/task-mapper.d.ts +4 -2
- package/dist/graph/mappers/task-mapper.d.ts.map +1 -1
- package/dist/graph/mappers/task-mapper.js +7 -5
- package/dist/graph/mappers/task-mapper.js.map +1 -1
- package/dist/graph/mappers/utils.d.ts +0 -10
- package/dist/graph/mappers/utils.d.ts.map +1 -1
- package/dist/graph/mappers/utils.js +0 -19
- package/dist/graph/mappers/utils.js.map +1 -1
- package/dist/graph/repository.d.ts +409 -276
- package/dist/graph/repository.d.ts.map +1 -1
- package/dist/graph/repository.js +772 -1082
- package/dist/graph/repository.js.map +1 -1
- package/dist/ids/mint.d.ts +31 -0
- package/dist/ids/mint.d.ts.map +1 -0
- package/dist/ids/mint.js +36 -0
- package/dist/ids/mint.js.map +1 -0
- package/dist/ids/next-action.d.ts +29 -0
- package/dist/ids/next-action.d.ts.map +1 -0
- package/dist/ids/next-action.js +58 -0
- package/dist/ids/next-action.js.map +1 -0
- package/dist/ids/resolver.d.ts +31 -0
- package/dist/ids/resolver.d.ts.map +1 -0
- package/dist/ids/resolver.js +52 -0
- package/dist/ids/resolver.js.map +1 -0
- package/dist/ids/schema.d.ts +91 -0
- package/dist/ids/schema.d.ts.map +1 -0
- package/dist/ids/schema.js +131 -0
- package/dist/ids/schema.js.map +1 -0
- package/dist/ids/token.d.ts +62 -0
- package/dist/ids/token.d.ts.map +1 -0
- package/dist/ids/token.js +225 -0
- package/dist/ids/token.js.map +1 -0
- package/dist/index.d.ts +10 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +255 -5925
- package/dist/index.js.map +1 -1
- package/dist/parsers/index.d.ts +0 -1
- package/dist/parsers/index.d.ts.map +1 -1
- package/dist/parsers/index.js +0 -1
- package/dist/parsers/index.js.map +1 -1
- package/dist/registry/all-tools.d.ts +14 -0
- package/dist/registry/all-tools.d.ts.map +1 -0
- package/dist/registry/all-tools.js +68 -0
- package/dist/registry/all-tools.js.map +1 -0
- package/dist/registry/context.d.ts +19 -0
- package/dist/registry/context.d.ts.map +1 -0
- package/dist/registry/context.js +20 -0
- package/dist/registry/context.js.map +1 -0
- package/dist/registry/define-tool.d.ts +15 -0
- package/dist/registry/define-tool.d.ts.map +1 -0
- package/dist/registry/define-tool.js +8 -0
- package/dist/registry/define-tool.js.map +1 -0
- package/dist/registry/elicit-links.d.ts +35 -0
- package/dist/registry/elicit-links.d.ts.map +1 -0
- package/dist/registry/elicit-links.js +102 -0
- package/dist/registry/elicit-links.js.map +1 -0
- package/dist/registry/elicitor.d.ts +24 -0
- package/dist/registry/elicitor.d.ts.map +1 -0
- package/dist/registry/elicitor.js +51 -0
- package/dist/registry/elicitor.js.map +1 -0
- package/dist/registry/index.d.ts +13 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +8 -0
- package/dist/registry/index.js.map +1 -0
- package/dist/registry/registry.d.ts +73 -0
- package/dist/registry/registry.d.ts.map +1 -0
- package/dist/registry/registry.js +221 -0
- package/dist/registry/registry.js.map +1 -0
- package/dist/registry/types.d.ts +146 -0
- package/dist/registry/types.d.ts.map +1 -0
- package/dist/registry/types.js +6 -0
- package/dist/registry/types.js.map +1 -0
- package/dist/search/compiler.d.ts +49 -0
- package/dist/search/compiler.d.ts.map +1 -0
- package/dist/search/compiler.js +168 -0
- package/dist/search/compiler.js.map +1 -0
- package/dist/signature.js +2 -2
- package/dist/signature.js.map +1 -1
- package/dist/state/delta-store.d.ts +85 -0
- package/dist/state/delta-store.d.ts.map +1 -0
- package/dist/state/delta-store.js +124 -0
- package/dist/state/delta-store.js.map +1 -0
- package/dist/state/migrate.d.ts +23 -0
- package/dist/state/migrate.d.ts.map +1 -0
- package/dist/state/migrate.js +81 -0
- package/dist/state/migrate.js.map +1 -0
- package/dist/state/schema.d.ts +26 -0
- package/dist/state/schema.d.ts.map +1 -0
- package/dist/state/schema.js +77 -0
- package/dist/state/schema.js.map +1 -0
- package/dist/state/store.d.ts +155 -0
- package/dist/state/store.d.ts.map +1 -0
- package/dist/state/store.js +321 -0
- package/dist/state/store.js.map +1 -0
- package/dist/tools/calendar-graph.d.ts +41 -0
- package/dist/tools/calendar-graph.d.ts.map +1 -0
- package/dist/tools/calendar-graph.js +299 -0
- package/dist/tools/calendar-graph.js.map +1 -0
- package/dist/tools/calendar-permissions.d.ts +17 -7
- package/dist/tools/calendar-permissions.d.ts.map +1 -1
- package/dist/tools/calendar-permissions.js +60 -4
- package/dist/tools/calendar-permissions.js.map +1 -1
- package/dist/tools/calendar.d.ts +133 -82
- package/dist/tools/calendar.d.ts.map +1 -1
- package/dist/tools/calendar.js +249 -136
- package/dist/tools/calendar.js.map +1 -1
- package/dist/tools/categories.d.ts +14 -4
- package/dist/tools/categories.d.ts.map +1 -1
- package/dist/tools/categories.js +59 -2
- package/dist/tools/categories.js.map +1 -1
- package/dist/tools/checklist-items.d.ts +19 -9
- package/dist/tools/checklist-items.d.ts.map +1 -1
- package/dist/tools/checklist-items.js +71 -5
- package/dist/tools/checklist-items.js.map +1 -1
- package/dist/tools/contact-folders.d.ts +50 -0
- package/dist/tools/contact-folders.d.ts.map +1 -0
- package/dist/tools/contact-folders.js +136 -0
- package/dist/tools/contact-folders.js.map +1 -0
- package/dist/tools/contacts-graph.d.ts +45 -0
- package/dist/tools/contacts-graph.d.ts.map +1 -0
- package/dist/tools/contacts-graph.js +174 -0
- package/dist/tools/contacts-graph.js.map +1 -0
- package/dist/tools/contacts.d.ts +61 -30
- package/dist/tools/contacts.d.ts.map +1 -1
- package/dist/tools/contacts.js +150 -93
- package/dist/tools/contacts.js.map +1 -1
- package/dist/tools/excel.d.ts +20 -10
- package/dist/tools/excel.d.ts.map +1 -1
- package/dist/tools/excel.js +82 -6
- package/dist/tools/excel.js.map +1 -1
- package/dist/tools/focused-overrides.d.ts +14 -4
- package/dist/tools/focused-overrides.d.ts.map +1 -1
- package/dist/tools/focused-overrides.js +59 -2
- package/dist/tools/focused-overrides.js.map +1 -1
- package/dist/tools/index.d.ts +4 -5
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +4 -6
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/linked-resources.d.ts +17 -7
- package/dist/tools/linked-resources.d.ts.map +1 -1
- package/dist/tools/linked-resources.js +60 -4
- package/dist/tools/linked-resources.js.map +1 -1
- package/dist/tools/mail-graph.d.ts +38 -0
- package/dist/tools/mail-graph.d.ts.map +1 -0
- package/dist/tools/mail-graph.js +187 -0
- package/dist/tools/mail-graph.js.map +1 -0
- package/dist/tools/mail-rules.d.ts +20 -8
- package/dist/tools/mail-rules.d.ts.map +1 -1
- package/dist/tools/mail-rules.js +63 -7
- package/dist/tools/mail-rules.js.map +1 -1
- package/dist/tools/mail-send.d.ts +39 -27
- package/dist/tools/mail-send.d.ts.map +1 -1
- package/dist/tools/mail-send.js +249 -24
- package/dist/tools/mail-send.js.map +1 -1
- package/dist/tools/mail.d.ts +91 -68
- package/dist/tools/mail.d.ts.map +1 -1
- package/dist/tools/mail.js +232 -243
- package/dist/tools/mail.js.map +1 -1
- package/dist/tools/mailbox-organization.d.ts +51 -34
- package/dist/tools/mailbox-organization.d.ts.map +1 -1
- package/dist/tools/mailbox-organization.js +318 -35
- package/dist/tools/mailbox-organization.js.map +1 -1
- package/dist/tools/mailbox-settings.d.ts +59 -0
- package/dist/tools/mailbox-settings.d.ts.map +1 -0
- package/dist/tools/mailbox-settings.js +136 -0
- package/dist/tools/mailbox-settings.js.map +1 -0
- package/dist/tools/meetings.d.ts +24 -14
- package/dist/tools/meetings.d.ts.map +1 -1
- package/dist/tools/meetings.js +82 -6
- package/dist/tools/meetings.js.map +1 -1
- package/dist/tools/onedrive.d.ts +26 -16
- package/dist/tools/onedrive.d.ts.map +1 -1
- package/dist/tools/onedrive.js +140 -11
- package/dist/tools/onedrive.js.map +1 -1
- package/dist/tools/onenote.d.ts +63 -0
- package/dist/tools/onenote.d.ts.map +1 -0
- package/dist/tools/onenote.js +221 -0
- package/dist/tools/onenote.js.map +1 -0
- package/dist/tools/people.d.ts +10 -0
- package/dist/tools/people.d.ts.map +1 -1
- package/dist/tools/people.js +94 -0
- package/dist/tools/people.js.map +1 -1
- package/dist/tools/planner-visualization.d.ts +15 -5
- package/dist/tools/planner-visualization.d.ts.map +1 -1
- package/dist/tools/planner-visualization.js +58 -4
- package/dist/tools/planner-visualization.js.map +1 -1
- package/dist/tools/planner.d.ts +69 -39
- package/dist/tools/planner.d.ts.map +1 -1
- package/dist/tools/planner.js +231 -23
- package/dist/tools/planner.js.map +1 -1
- package/dist/tools/scheduling.d.ts +12 -0
- package/dist/tools/scheduling.d.ts.map +1 -1
- package/dist/tools/scheduling.js +38 -0
- package/dist/tools/scheduling.js.map +1 -1
- package/dist/tools/shared-mailbox.d.ts +164 -0
- package/dist/tools/shared-mailbox.d.ts.map +1 -0
- package/dist/tools/shared-mailbox.js +318 -0
- package/dist/tools/shared-mailbox.js.map +1 -0
- package/dist/tools/sharepoint-lists.d.ts +131 -0
- package/dist/tools/sharepoint-lists.d.ts.map +1 -0
- package/dist/tools/sharepoint-lists.js +246 -0
- package/dist/tools/sharepoint-lists.js.map +1 -0
- package/dist/tools/sharepoint.d.ts +24 -14
- package/dist/tools/sharepoint.d.ts.map +1 -1
- package/dist/tools/sharepoint.js +85 -9
- package/dist/tools/sharepoint.js.map +1 -1
- package/dist/tools/task-attachments.d.ts +17 -7
- package/dist/tools/task-attachments.d.ts.map +1 -1
- package/dist/tools/task-attachments.js +60 -4
- package/dist/tools/task-attachments.js.map +1 -1
- package/dist/tools/task-lists.d.ts +56 -0
- package/dist/tools/task-lists.d.ts.map +1 -0
- package/dist/tools/task-lists.js +155 -0
- package/dist/tools/task-lists.js.map +1 -0
- package/dist/tools/tasks-graph.d.ts +49 -0
- package/dist/tools/tasks-graph.d.ts.map +1 -0
- package/dist/tools/tasks-graph.js +193 -0
- package/dist/tools/tasks-graph.js.map +1 -0
- package/dist/tools/tasks.d.ts +121 -29
- package/dist/tools/tasks.d.ts.map +1 -1
- package/dist/tools/tasks.js +136 -84
- package/dist/tools/tasks.js.map +1 -1
- package/dist/tools/teams.d.ts +57 -46
- package/dist/tools/teams.d.ts.map +1 -1
- package/dist/tools/teams.js +288 -26
- package/dist/tools/teams.js.map +1 -1
- package/dist/tools/what-changed.d.ts +48 -0
- package/dist/tools/what-changed.d.ts.map +1 -0
- package/dist/tools/what-changed.js +149 -0
- package/dist/tools/what-changed.js.map +1 -0
- package/dist/types/calendar.d.ts +1 -1
- package/dist/types/calendar.d.ts.map +1 -1
- package/dist/types/calendar.js.map +1 -1
- package/dist/types/contacts.d.ts +1 -1
- package/dist/types/contacts.d.ts.map +1 -1
- package/dist/types/contacts.js.map +1 -1
- package/dist/types/mail.d.ts +1 -1
- package/dist/types/mail.d.ts.map +1 -1
- package/dist/types/mail.js.map +1 -1
- package/dist/utils/errors.d.ts +110 -38
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +239 -56
- package/dist/utils/errors.js.map +1 -1
- package/dist/visualization/types.d.ts +4 -4
- package/package.json +2 -3
- package/dist/applescript/account-repository.d.ts +0 -30
- package/dist/applescript/account-repository.d.ts.map +0 -1
- package/dist/applescript/account-repository.js +0 -38
- package/dist/applescript/account-repository.js.map +0 -1
- package/dist/applescript/account-scripts.d.ts +0 -21
- package/dist/applescript/account-scripts.d.ts.map +0 -1
- package/dist/applescript/account-scripts.js +0 -180
- package/dist/applescript/account-scripts.js.map +0 -1
- package/dist/applescript/calendar-manager.d.ts +0 -44
- package/dist/applescript/calendar-manager.d.ts.map +0 -1
- package/dist/applescript/calendar-manager.js +0 -92
- package/dist/applescript/calendar-manager.js.map +0 -1
- package/dist/applescript/calendar-writer.d.ts +0 -36
- package/dist/applescript/calendar-writer.d.ts.map +0 -1
- package/dist/applescript/calendar-writer.js +0 -94
- package/dist/applescript/calendar-writer.js.map +0 -1
- package/dist/applescript/content-readers.d.ts +0 -114
- package/dist/applescript/content-readers.d.ts.map +0 -1
- package/dist/applescript/content-readers.js +0 -328
- package/dist/applescript/content-readers.js.map +0 -1
- package/dist/applescript/executor.d.ts +0 -60
- package/dist/applescript/executor.d.ts.map +0 -1
- package/dist/applescript/executor.js +0 -173
- package/dist/applescript/executor.js.map +0 -1
- package/dist/applescript/index.d.ts +0 -20
- package/dist/applescript/index.d.ts.map +0 -1
- package/dist/applescript/index.js +0 -29
- package/dist/applescript/index.js.map +0 -1
- package/dist/applescript/mail-sender.d.ts +0 -38
- package/dist/applescript/mail-sender.d.ts.map +0 -1
- package/dist/applescript/mail-sender.js +0 -67
- package/dist/applescript/mail-sender.js.map +0 -1
- package/dist/applescript/parser.d.ts +0 -235
- package/dist/applescript/parser.d.ts.map +0 -1
- package/dist/applescript/parser.js +0 -496
- package/dist/applescript/parser.js.map +0 -1
- package/dist/applescript/repository.d.ts +0 -64
- package/dist/applescript/repository.d.ts.map +0 -1
- package/dist/applescript/repository.js +0 -444
- package/dist/applescript/repository.js.map +0 -1
- package/dist/applescript/scripts.d.ts +0 -265
- package/dist/applescript/scripts.d.ts.map +0 -1
- package/dist/applescript/scripts.js +0 -1483
- package/dist/applescript/scripts.js.map +0 -1
- package/dist/parsers/olk15.d.ts +0 -87
- package/dist/parsers/olk15.d.ts.map +0 -1
- package/dist/parsers/olk15.js +0 -368
- package/dist/parsers/olk15.js.map +0 -1
- package/dist/tools/notes.d.ts +0 -74
- package/dist/tools/notes.d.ts.map +0 -1
- package/dist/tools/notes.js +0 -136
- package/dist/tools/notes.js.map +0 -1
|
@@ -10,21 +10,27 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { z } from 'zod';
|
|
12
12
|
import type { ApprovalTokenManager } from '../approval/index.js';
|
|
13
|
+
import type { ToolDefinition } from '../registry/types.js';
|
|
14
|
+
declare module '../registry/types.js' {
|
|
15
|
+
interface GraphToolsets {
|
|
16
|
+
checklistItems: ChecklistItemsTools;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
13
19
|
export declare const ListChecklistItemsInput: z.ZodObject<{
|
|
14
|
-
task_id: z.
|
|
20
|
+
task_id: z.ZodString;
|
|
15
21
|
}, z.core.$strict>;
|
|
16
22
|
export declare const CreateChecklistItemInput: z.ZodObject<{
|
|
17
|
-
task_id: z.
|
|
23
|
+
task_id: z.ZodString;
|
|
18
24
|
display_name: z.ZodString;
|
|
19
25
|
is_checked: z.ZodOptional<z.ZodBoolean>;
|
|
20
26
|
}, z.core.$strict>;
|
|
21
27
|
export declare const UpdateChecklistItemInput: z.ZodObject<{
|
|
22
|
-
checklist_item_id: z.
|
|
28
|
+
checklist_item_id: z.ZodString;
|
|
23
29
|
display_name: z.ZodOptional<z.ZodString>;
|
|
24
30
|
is_checked: z.ZodOptional<z.ZodBoolean>;
|
|
25
31
|
}, z.core.$strict>;
|
|
26
32
|
export declare const PrepareDeleteChecklistItemInput: z.ZodObject<{
|
|
27
|
-
checklist_item_id: z.
|
|
33
|
+
checklist_item_id: z.ZodString;
|
|
28
34
|
}, z.core.$strict>;
|
|
29
35
|
export declare const ConfirmDeleteChecklistItemInput: z.ZodObject<{
|
|
30
36
|
approval_token: z.ZodString;
|
|
@@ -35,18 +41,18 @@ export type UpdateChecklistItemParams = z.infer<typeof UpdateChecklistItemInput>
|
|
|
35
41
|
export type PrepareDeleteChecklistItemParams = z.infer<typeof PrepareDeleteChecklistItemInput>;
|
|
36
42
|
export type ConfirmDeleteChecklistItemParams = z.infer<typeof ConfirmDeleteChecklistItemInput>;
|
|
37
43
|
export interface IChecklistItemsRepository {
|
|
38
|
-
listChecklistItemsAsync(taskId:
|
|
39
|
-
id:
|
|
44
|
+
listChecklistItemsAsync(taskId: string): Promise<Array<{
|
|
45
|
+
id: string;
|
|
40
46
|
displayName: string;
|
|
41
47
|
isChecked: boolean;
|
|
42
48
|
createdDateTime: string;
|
|
43
49
|
}>>;
|
|
44
|
-
createChecklistItemAsync(taskId:
|
|
45
|
-
updateChecklistItemAsync(checklistItemId:
|
|
50
|
+
createChecklistItemAsync(taskId: string, displayName: string, isChecked?: boolean): Promise<string>;
|
|
51
|
+
updateChecklistItemAsync(checklistItemId: string, updates: {
|
|
46
52
|
displayName?: string;
|
|
47
53
|
isChecked?: boolean;
|
|
48
54
|
}): Promise<void>;
|
|
49
|
-
deleteChecklistItemAsync(checklistItemId:
|
|
55
|
+
deleteChecklistItemAsync(checklistItemId: string): Promise<void>;
|
|
50
56
|
}
|
|
51
57
|
/**
|
|
52
58
|
* Checklist item tools with two-phase approval for delete operations.
|
|
@@ -86,4 +92,8 @@ export declare class ChecklistItemsTools {
|
|
|
86
92
|
}>;
|
|
87
93
|
}>;
|
|
88
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Registry tool definitions for the checklist-items domain.
|
|
97
|
+
*/
|
|
98
|
+
export declare function checklistItemsToolDefinitions(): ToolDefinition[];
|
|
89
99
|
//# sourceMappingURL=checklist-items.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checklist-items.d.ts","sourceRoot":"","sources":["../../src/tools/checklist-items.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"checklist-items.d.ts","sourceRoot":"","sources":["../../src/tools/checklist-items.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAIjE,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAExE,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,aAAa;QACrB,cAAc,EAAE,mBAAmB,CAAC;KACrC;CACF;AAMD,eAAO,MAAM,uBAAuB;;kBAElC,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;kBAInC,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;kBAInC,CAAC;AAEH,eAAO,MAAM,+BAA+B;;kBAE1C,CAAC;AAEH,eAAO,MAAM,+BAA+B;;kBAE1C,CAAC;AAMH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAC/E,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AACjF,M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AAM,EAAE,yBAAyB,GAAG,OAAO,CAAC;QACpE,OAAO,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAChD,CAAC;IAUI,mBAAmB,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC;QACpE,OAAO,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAChD,CAAC;IAaF,0BAA0B,CAAC,MAAM,EAAE,gCAAgC,GAAG;QACpE,OAAO,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAChD;IAqBK,0BAA0B,CAAC,MAAM,EAAE,gCAAgC,GAAG,OAAO,CAAC;QAClF,OAAO,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAChD,CAAC;CA2CH;AAMD;;GAEG;AACH,wBAAgB,6BAA6B,IAAI,cAAc,EAAE,CAwDhE"}
|
|
@@ -9,24 +9,28 @@
|
|
|
9
9
|
* approval pattern for destructive delete operations.
|
|
10
10
|
*/
|
|
11
11
|
import { z } from 'zod';
|
|
12
|
+
import { Id } from '../ids/schema.js';
|
|
13
|
+
import { defineTool } from '../registry/define-tool.js';
|
|
14
|
+
import { approvalTokenLink } from '../registry/elicit-links.js';
|
|
15
|
+
import { requireGraphToolset } from '../registry/context.js';
|
|
12
16
|
// =============================================================================
|
|
13
17
|
// Input Schemas
|
|
14
18
|
// =============================================================================
|
|
15
19
|
export const ListChecklistItemsInput = z.strictObject({
|
|
16
|
-
task_id:
|
|
20
|
+
task_id: Id.task,
|
|
17
21
|
});
|
|
18
22
|
export const CreateChecklistItemInput = z.strictObject({
|
|
19
|
-
task_id:
|
|
23
|
+
task_id: Id.task,
|
|
20
24
|
display_name: z.string().min(1).describe('Checklist item text'),
|
|
21
25
|
is_checked: z.boolean().optional().describe('Whether the item is checked (default: false)'),
|
|
22
26
|
});
|
|
23
27
|
export const UpdateChecklistItemInput = z.strictObject({
|
|
24
|
-
checklist_item_id:
|
|
28
|
+
checklist_item_id: Id.checklistItem,
|
|
25
29
|
display_name: z.string().min(1).optional().describe('New text'),
|
|
26
30
|
is_checked: z.boolean().optional().describe('Toggle checked state'),
|
|
27
31
|
});
|
|
28
32
|
export const PrepareDeleteChecklistItemInput = z.strictObject({
|
|
29
|
-
checklist_item_id:
|
|
33
|
+
checklist_item_id: Id.checklistItem,
|
|
30
34
|
});
|
|
31
35
|
export const ConfirmDeleteChecklistItemInput = z.strictObject({
|
|
32
36
|
approval_token: z.string().describe('Approval token from prepare_delete_checklist_item'),
|
|
@@ -128,7 +132,7 @@ export class ChecklistItemsTools {
|
|
|
128
132
|
}],
|
|
129
133
|
};
|
|
130
134
|
}
|
|
131
|
-
await this.repo.deleteChecklistItemAsync(result.token.targetId);
|
|
135
|
+
await this.repo.deleteChecklistItemAsync((result.token.targetId));
|
|
132
136
|
return {
|
|
133
137
|
content: [{
|
|
134
138
|
type: 'text',
|
|
@@ -137,4 +141,66 @@ export class ChecklistItemsTools {
|
|
|
137
141
|
};
|
|
138
142
|
}
|
|
139
143
|
}
|
|
144
|
+
// =============================================================================
|
|
145
|
+
// Registry Definitions (v3 registry-driven architecture, U2)
|
|
146
|
+
// =============================================================================
|
|
147
|
+
/**
|
|
148
|
+
* Registry tool definitions for the checklist-items domain.
|
|
149
|
+
*/
|
|
150
|
+
export function checklistItemsToolDefinitions() {
|
|
151
|
+
const tools = (ctx) => requireGraphToolset(ctx, 'checklistItems');
|
|
152
|
+
return [
|
|
153
|
+
defineTool({
|
|
154
|
+
name: 'list_checklist_items',
|
|
155
|
+
description: 'List checklist items (subtasks) on a To Do task (Graph API)',
|
|
156
|
+
input: ListChecklistItemsInput,
|
|
157
|
+
annotations: { readOnlyHint: true, openWorldHint: true },
|
|
158
|
+
destructive: false,
|
|
159
|
+
presets: ['tasks'],
|
|
160
|
+
backends: ['graph'],
|
|
161
|
+
handler: (ctx, params) => tools(ctx).listChecklistItems(params),
|
|
162
|
+
}),
|
|
163
|
+
defineTool({
|
|
164
|
+
name: 'create_checklist_item',
|
|
165
|
+
description: 'Create a checklist item (subtask) on a To Do task (Graph API)',
|
|
166
|
+
input: CreateChecklistItemInput,
|
|
167
|
+
annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: true },
|
|
168
|
+
destructive: false,
|
|
169
|
+
presets: ['tasks'],
|
|
170
|
+
backends: ['graph'],
|
|
171
|
+
handler: (ctx, params) => tools(ctx).createChecklistItem(params),
|
|
172
|
+
}),
|
|
173
|
+
defineTool({
|
|
174
|
+
name: 'update_checklist_item',
|
|
175
|
+
description: 'Update a checklist item (toggle check, rename) on a To Do task (Graph API)',
|
|
176
|
+
input: UpdateChecklistItemInput,
|
|
177
|
+
annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: true },
|
|
178
|
+
destructive: false,
|
|
179
|
+
presets: ['tasks'],
|
|
180
|
+
backends: ['graph'],
|
|
181
|
+
handler: (ctx, params) => tools(ctx).updateChecklistItem(params),
|
|
182
|
+
}),
|
|
183
|
+
defineTool({
|
|
184
|
+
name: 'prepare_delete_checklist_item',
|
|
185
|
+
description: 'Prepare to delete a checklist item. Returns an approval token. Call confirm_delete_checklist_item to execute. (Graph API)',
|
|
186
|
+
input: PrepareDeleteChecklistItemInput,
|
|
187
|
+
annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: true },
|
|
188
|
+
destructive: true,
|
|
189
|
+
presets: ['tasks'],
|
|
190
|
+
backends: ['graph'],
|
|
191
|
+
handler: (ctx, params) => tools(ctx).prepareDeleteChecklistItem(params),
|
|
192
|
+
onElicit: approvalTokenLink('confirm_delete_checklist_item'),
|
|
193
|
+
}),
|
|
194
|
+
defineTool({
|
|
195
|
+
name: 'confirm_delete_checklist_item',
|
|
196
|
+
description: 'Confirm deletion of a checklist item with approval token (Graph API)',
|
|
197
|
+
input: ConfirmDeleteChecklistItemInput,
|
|
198
|
+
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: true },
|
|
199
|
+
destructive: true,
|
|
200
|
+
presets: ['tasks'],
|
|
201
|
+
backends: ['graph'],
|
|
202
|
+
handler: (ctx, params) => tools(ctx).confirmDeleteChecklistItem(params),
|
|
203
|
+
}),
|
|
204
|
+
];
|
|
205
|
+
}
|
|
140
206
|
//# sourceMappingURL=checklist-items.js.map
|
|
@@ -1 +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;
|
|
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;AACxB,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAS7D,gFAAgF;AAChF,gBAAgB;AAChB,gFAAgF;AAEhF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,YAAY,CAAC;IACpD,OAAO,EAAE,EAAE,CAAC,IAAI;CACjB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,YAAY,CAAC;IACrD,OAAO,EAAE,EAAE,CAAC,IAAI;IAChB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,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EAAE,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,0BAA0B,CAAC,MAAM,CAAC;YACvE,QAAQ,EAAE,iBAAiB,CAAC,+BAA+B,CAAC;SAC7D,CAAC;QACF,UAAU,CAAC;YACT,IAAI,EAAE,+BAA+B;YACrC,WAAW,EAAE,sEAAsE;YACnF,KAAK,EAAE,+BAA+B;YACtC,WAAW,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE;YAChF,WAAW,EAAE,IAAI;YACjB,OAAO,EAAE,CAAC,OAAO,CAAC;YAClB,QAAQ,EAAE,CAAC,OAAO,CAAC;YACnB,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,0BAA0B,CAAC,MAAM,CAAC;SACxE,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
* Graph-backend contact folder tools (v3 registry-driven architecture, U2).
|
|
7
|
+
* Holds the contact folder logic that previously lived inline in the
|
|
8
|
+
* `handleGraphToolCall` switch, with a two-phase approval pattern for the
|
|
9
|
+
* destructive delete operation.
|
|
10
|
+
*/
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
import type { GraphRepository } from '../graph/repository.js';
|
|
13
|
+
import type { ApprovalTokenManager } from '../approval/index.js';
|
|
14
|
+
import type { ToolDefinition, ToolResult } from '../registry/types.js';
|
|
15
|
+
declare module '../registry/types.js' {
|
|
16
|
+
interface GraphToolsets {
|
|
17
|
+
contactFolders: GraphContactFoldersTools;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export declare const ListContactFoldersInput: z.ZodObject<{}, z.core.$strict>;
|
|
21
|
+
export declare const CreateContactFolderInput: z.ZodObject<{
|
|
22
|
+
name: z.ZodString;
|
|
23
|
+
}, z.core.$strict>;
|
|
24
|
+
export declare const PrepareDeleteContactFolderInput: z.ZodObject<{
|
|
25
|
+
folder_id: z.ZodString;
|
|
26
|
+
}, z.core.$strict>;
|
|
27
|
+
export declare const ConfirmDeleteContactFolderInput: z.ZodObject<{
|
|
28
|
+
token_id: z.ZodString;
|
|
29
|
+
folder_id: z.ZodString;
|
|
30
|
+
}, z.core.$strict>;
|
|
31
|
+
export type CreateContactFolderParams = z.infer<typeof CreateContactFolderInput>;
|
|
32
|
+
export type PrepareDeleteContactFolderParams = z.infer<typeof PrepareDeleteContactFolderInput>;
|
|
33
|
+
export type ConfirmDeleteContactFolderParams = z.infer<typeof ConfirmDeleteContactFolderInput>;
|
|
34
|
+
/**
|
|
35
|
+
* Contact folder tools with two-phase approval for delete operations.
|
|
36
|
+
*/
|
|
37
|
+
export declare class GraphContactFoldersTools {
|
|
38
|
+
private readonly repository;
|
|
39
|
+
private readonly tokenManager;
|
|
40
|
+
constructor(repository: GraphRepository, tokenManager: ApprovalTokenManager);
|
|
41
|
+
listContactFolders(): Promise<ToolResult>;
|
|
42
|
+
createContactFolder(params: CreateContactFolderParams): Promise<ToolResult>;
|
|
43
|
+
prepareDeleteContactFolder(params: PrepareDeleteContactFolderParams): ToolResult;
|
|
44
|
+
confirmDeleteContactFolder(params: ConfirmDeleteContactFolderParams): Promise<ToolResult>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Registry tool definitions for the contact-folders domain.
|
|
48
|
+
*/
|
|
49
|
+
export declare function contactFoldersToolDefinitions(): ToolDefinition[];
|
|
50
|
+
//# sourceMappingURL=contact-folders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contact-folders.d.ts","sourceRoot":"","sources":["../../src/tools/contact-folders.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA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EAAE,CA8ChE"}
|
|
@@ -0,0 +1,136 @@
|
|
|
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
|
+
* Graph-backend contact folder tools (v3 registry-driven architecture, U2).
|
|
7
|
+
* Holds the contact folder logic that previously lived inline in the
|
|
8
|
+
* `handleGraphToolCall` switch, with a two-phase approval pattern for the
|
|
9
|
+
* destructive delete operation.
|
|
10
|
+
*/
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
import { Id } from '../ids/schema.js';
|
|
13
|
+
import { defineTool } from '../registry/define-tool.js';
|
|
14
|
+
import { tokenIdLink } from '../registry/elicit-links.js';
|
|
15
|
+
import { requireGraphToolset } from '../registry/context.js';
|
|
16
|
+
// =============================================================================
|
|
17
|
+
// Input Schemas
|
|
18
|
+
// =============================================================================
|
|
19
|
+
export const ListContactFoldersInput = z.strictObject({});
|
|
20
|
+
export const CreateContactFolderInput = z.strictObject({
|
|
21
|
+
name: z.string().min(1).describe('Contact folder name'),
|
|
22
|
+
});
|
|
23
|
+
export const PrepareDeleteContactFolderInput = z.strictObject({
|
|
24
|
+
folder_id: Id.contactFolder,
|
|
25
|
+
});
|
|
26
|
+
export const ConfirmDeleteContactFolderInput = z.strictObject({
|
|
27
|
+
token_id: z.string().uuid().describe('Approval token from prepare_delete_contact_folder'),
|
|
28
|
+
folder_id: Id.contactFolder,
|
|
29
|
+
});
|
|
30
|
+
// =============================================================================
|
|
31
|
+
// Contact Folders Tools
|
|
32
|
+
// =============================================================================
|
|
33
|
+
function jsonResult(data) {
|
|
34
|
+
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Contact folder tools with two-phase approval for delete operations.
|
|
38
|
+
*/
|
|
39
|
+
export class GraphContactFoldersTools {
|
|
40
|
+
repository;
|
|
41
|
+
tokenManager;
|
|
42
|
+
constructor(repository, tokenManager) {
|
|
43
|
+
this.repository = repository;
|
|
44
|
+
this.tokenManager = tokenManager;
|
|
45
|
+
}
|
|
46
|
+
async listContactFolders() {
|
|
47
|
+
const folders = await this.repository.listContactFoldersAsync();
|
|
48
|
+
return jsonResult({ contact_folders: folders });
|
|
49
|
+
}
|
|
50
|
+
async createContactFolder(params) {
|
|
51
|
+
const folderId = await this.repository.createContactFolderAsync(params.name);
|
|
52
|
+
return jsonResult({ id: folderId, name: params.name, status: 'created' });
|
|
53
|
+
}
|
|
54
|
+
prepareDeleteContactFolder(params) {
|
|
55
|
+
const token = this.tokenManager.generateToken({
|
|
56
|
+
operation: 'delete_contact_folder',
|
|
57
|
+
targetType: 'contact_folder',
|
|
58
|
+
targetId: params.folder_id,
|
|
59
|
+
targetHash: String(params.folder_id),
|
|
60
|
+
});
|
|
61
|
+
return jsonResult({
|
|
62
|
+
token_id: token.tokenId,
|
|
63
|
+
expires_at: new Date(token.expiresAt).toISOString(),
|
|
64
|
+
folder_id: params.folder_id,
|
|
65
|
+
action: `To confirm deleting contact folder ${params.folder_id}, call confirm_delete_contact_folder with the token_id and folder_id.`,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
async confirmDeleteContactFolder(params) {
|
|
69
|
+
const validation = this.tokenManager.consumeToken(params.token_id, 'delete_contact_folder', params.folder_id);
|
|
70
|
+
if (!validation.valid) {
|
|
71
|
+
const errorMessages = {
|
|
72
|
+
NOT_FOUND: 'Token not found or already used',
|
|
73
|
+
EXPIRED: 'Token has expired. Please call prepare_delete_contact_folder again.',
|
|
74
|
+
OPERATION_MISMATCH: 'Token was not generated for delete_contact_folder',
|
|
75
|
+
TARGET_MISMATCH: 'Token was generated for a different contact folder',
|
|
76
|
+
ALREADY_CONSUMED: 'Token has already been used',
|
|
77
|
+
};
|
|
78
|
+
return jsonResult({ success: false, error: errorMessages[validation.error ?? ''] ?? 'Invalid token' });
|
|
79
|
+
}
|
|
80
|
+
await this.repository.deleteContactFolderAsync(params.folder_id);
|
|
81
|
+
return jsonResult({ success: true, message: 'Contact folder deleted' });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// =============================================================================
|
|
85
|
+
// Registry Definitions (v3 registry-driven architecture, U2)
|
|
86
|
+
// =============================================================================
|
|
87
|
+
/**
|
|
88
|
+
* Registry tool definitions for the contact-folders domain.
|
|
89
|
+
*/
|
|
90
|
+
export function contactFoldersToolDefinitions() {
|
|
91
|
+
const tools = (ctx) => requireGraphToolset(ctx, 'contactFolders');
|
|
92
|
+
return [
|
|
93
|
+
defineTool({
|
|
94
|
+
name: 'list_contact_folders',
|
|
95
|
+
description: 'List all contact folders (Graph API)',
|
|
96
|
+
input: ListContactFoldersInput,
|
|
97
|
+
annotations: { readOnlyHint: true },
|
|
98
|
+
destructive: false,
|
|
99
|
+
presets: ['contacts'],
|
|
100
|
+
backends: ['graph'],
|
|
101
|
+
handler: (ctx) => tools(ctx).listContactFolders(),
|
|
102
|
+
}),
|
|
103
|
+
defineTool({
|
|
104
|
+
name: 'create_contact_folder',
|
|
105
|
+
description: 'Create a contact folder (Graph API)',
|
|
106
|
+
input: CreateContactFolderInput,
|
|
107
|
+
annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: true },
|
|
108
|
+
destructive: false,
|
|
109
|
+
presets: ['contacts'],
|
|
110
|
+
backends: ['graph'],
|
|
111
|
+
handler: (ctx, params) => tools(ctx).createContactFolder(params),
|
|
112
|
+
}),
|
|
113
|
+
defineTool({
|
|
114
|
+
name: 'prepare_delete_contact_folder',
|
|
115
|
+
description: 'Prepare to delete a contact folder. Returns an approval token. Call confirm_delete_contact_folder to execute. (Graph API)',
|
|
116
|
+
input: PrepareDeleteContactFolderInput,
|
|
117
|
+
annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: true },
|
|
118
|
+
destructive: true,
|
|
119
|
+
presets: ['contacts'],
|
|
120
|
+
backends: ['graph'],
|
|
121
|
+
handler: (ctx, params) => tools(ctx).prepareDeleteContactFolder(params),
|
|
122
|
+
onElicit: tokenIdLink('confirm_delete_contact_folder', ['folder_id']),
|
|
123
|
+
}),
|
|
124
|
+
defineTool({
|
|
125
|
+
name: 'confirm_delete_contact_folder',
|
|
126
|
+
description: 'Confirm contact folder deletion with approval token (Graph API)',
|
|
127
|
+
input: ConfirmDeleteContactFolderInput,
|
|
128
|
+
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: true },
|
|
129
|
+
destructive: true,
|
|
130
|
+
presets: ['contacts'],
|
|
131
|
+
backends: ['graph'],
|
|
132
|
+
handler: (ctx, params) => tools(ctx).confirmDeleteContactFolder(params),
|
|
133
|
+
}),
|
|
134
|
+
];
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=contact-folders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contact-folders.js","sourceRoot":"","sources":["../../src/tools/contact-folders.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAGtC,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAS7D,gFAAgF;AAChF,gBAAgB;AAChB,gFAAgF;AAEhF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;AAE1D,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,YAAY,CAAC;IACrD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,qBAAqB,CAAC;CACxD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,+BAA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ACnB,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,0BAA0B,CAAC,MAAM,CAAC;YACvE,QAAQ,EAAE,WAAW,CAAC,+BAA+B,EAAE,CAAC,WAAW,CAAC,CAAC;SACtE,CAAC;QACF,UAAU,CAAC;YACT,IAAI,EAAE,+BAA+B;YACrC,WAAW,EAAE,iEAAiE;YAC9E,KAAK,EAAE,+BAA+B;YACtC,WAAW,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE;YAChF,WAAW,EAAE,IAAI;YACjB,OAAO,EAAE,CAAC,UAAU,CAAC;YACrB,QAAQ,EAAE,CAAC,OAAO,CAAC;YACnB,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,0BAA0B,CAAC,MAAM,CAAC;SACxE,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
* Graph-backend contact tools (v3 registry-driven architecture, U2 — dual
|
|
7
|
+
* backend). Holds the contact logic that previously lived inline in the
|
|
8
|
+
* `handleGraphToolCall` switch, so the registry handlers stay thin and branch
|
|
9
|
+
* on `ctx.backend`.
|
|
10
|
+
*/
|
|
11
|
+
import type { GraphRepository } from '../graph/repository.js';
|
|
12
|
+
import type { GraphContentReaders } from '../graph/content-readers.js';
|
|
13
|
+
import type { ContactRow } from '../database/repository.js';
|
|
14
|
+
import type { ApprovalTokenManager } from '../approval/index.js';
|
|
15
|
+
import type { ToolResult } from '../registry/types.js';
|
|
16
|
+
import type { ListContactsParams, SearchContactsParams, GetContactParams, CreateContactParams, UpdateContactParams, PrepareDeleteContactParams, ConfirmDeleteContactParams, GetContactPhotoParams, SetContactPhotoParams } from './contacts.js';
|
|
17
|
+
/**
|
|
18
|
+
* Transforms a Graph contact row to the summary shape returned by the graph
|
|
19
|
+
* backend's contact tools.
|
|
20
|
+
*/
|
|
21
|
+
export declare function transformContactRow(row: ContactRow): {
|
|
22
|
+
id: string;
|
|
23
|
+
displayName: string | null;
|
|
24
|
+
sortName: string | null;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Graph contact tools. Each method mirrors the extracted inline graph case body
|
|
28
|
+
* and returns an MCP `ToolResult`.
|
|
29
|
+
*/
|
|
30
|
+
export declare class GraphContactsTools {
|
|
31
|
+
private readonly repository;
|
|
32
|
+
private readonly contentReaders;
|
|
33
|
+
private readonly tokenManager;
|
|
34
|
+
constructor(repository: GraphRepository, contentReaders: GraphContentReaders, tokenManager: ApprovalTokenManager);
|
|
35
|
+
listContacts(params: ListContactsParams): Promise<ToolResult>;
|
|
36
|
+
searchContacts(params: SearchContactsParams): Promise<ToolResult>;
|
|
37
|
+
getContact(params: GetContactParams): Promise<ToolResult>;
|
|
38
|
+
createContact(params: CreateContactParams): Promise<ToolResult>;
|
|
39
|
+
updateContact(params: UpdateContactParams): Promise<ToolResult>;
|
|
40
|
+
prepareDeleteContact(params: PrepareDeleteContactParams): Promise<ToolResult>;
|
|
41
|
+
confirmDeleteContact(params: ConfirmDeleteContactParams): Promise<ToolResult>;
|
|
42
|
+
getContactPhoto(params: GetContactPhotoParams): Promise<ToolResult>;
|
|
43
|
+
setContactPhoto(params: SetContactPhotoParams): Promise<ToolResult>;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=contacts-graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contacts-graph.d.ts","sourceRoot":"","sources":["../../src/tools/contacts-graph.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AAEH,OAAO,KAAK,EAA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B,CAAC,MAAM,EAAE,0BAA0B,GAAG,OAAO,CAAC,UAAU,CAAC;IA6B7E,oBAAoB,CAAC,MAAM,EAAE,0BAA0B,GAAG,OAAO,CAAC,UAAU,CAAC;IAmC7E,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,UAAU,CAAC;IAKnE,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,UAAU,CAAC;CAI1E"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 JBC Tech Solutions, LLC
|
|
3
|
+
* Licensed under the MIT License. See LICENSE file in the project root.
|
|
4
|
+
*/
|
|
5
|
+
import { nextActionFor } from '../ids/next-action.js';
|
|
6
|
+
import { hashContactForApproval } from '../approval/index.js';
|
|
7
|
+
function jsonResult(data) {
|
|
8
|
+
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Transforms a Graph contact row to the summary shape returned by the graph
|
|
12
|
+
* backend's contact tools.
|
|
13
|
+
*/
|
|
14
|
+
export function transformContactRow(row) {
|
|
15
|
+
return {
|
|
16
|
+
id: row.id,
|
|
17
|
+
displayName: row.displayName,
|
|
18
|
+
sortName: row.sortName,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Graph contact tools. Each method mirrors the extracted inline graph case body
|
|
23
|
+
* and returns an MCP `ToolResult`.
|
|
24
|
+
*/
|
|
25
|
+
export class GraphContactsTools {
|
|
26
|
+
repository;
|
|
27
|
+
contentReaders;
|
|
28
|
+
tokenManager;
|
|
29
|
+
constructor(repository, contentReaders, tokenManager) {
|
|
30
|
+
this.repository = repository;
|
|
31
|
+
this.contentReaders = contentReaders;
|
|
32
|
+
this.tokenManager = tokenManager;
|
|
33
|
+
}
|
|
34
|
+
async listContacts(params) {
|
|
35
|
+
const contacts = params.folder_id != null
|
|
36
|
+
? await this.repository.listContactsInFolderAsync(params.folder_id, params.limit)
|
|
37
|
+
: await this.repository.listContactsAsync(params.limit, params.offset);
|
|
38
|
+
return jsonResult({ contacts: contacts.map(transformContactRow), next: nextActionFor('contact') ?? undefined });
|
|
39
|
+
}
|
|
40
|
+
async searchContacts(params) {
|
|
41
|
+
const contacts = await this.repository.searchContactsAsync(params.query, params.limit);
|
|
42
|
+
return jsonResult({ contacts: contacts.map(transformContactRow), next: nextActionFor('contact') ?? undefined });
|
|
43
|
+
}
|
|
44
|
+
async getContact(params) {
|
|
45
|
+
const contact = await this.repository.getContactAsync(params.contact_id);
|
|
46
|
+
if (contact == null) {
|
|
47
|
+
return { content: [{ type: 'text', text: 'Contact not found' }], isError: true };
|
|
48
|
+
}
|
|
49
|
+
const details = await this.contentReaders.contact.readContactDetailsAsync(contact.dataFilePath);
|
|
50
|
+
return jsonResult({ ...transformContactRow(contact), ...details });
|
|
51
|
+
}
|
|
52
|
+
async createContact(params) {
|
|
53
|
+
const numericId = await this.repository.createContactAsync({
|
|
54
|
+
...(params.given_name != null ? { given_name: params.given_name } : {}),
|
|
55
|
+
...(params.surname != null ? { surname: params.surname } : {}),
|
|
56
|
+
...(params.email != null ? { email: params.email } : {}),
|
|
57
|
+
...(params.phone != null ? { phone: params.phone } : {}),
|
|
58
|
+
...(params.mobile_phone != null ? { mobile_phone: params.mobile_phone } : {}),
|
|
59
|
+
...(params.company != null ? { company: params.company } : {}),
|
|
60
|
+
...(params.job_title != null ? { job_title: params.job_title } : {}),
|
|
61
|
+
...(params.street_address != null ? { street_address: params.street_address } : {}),
|
|
62
|
+
...(params.city != null ? { city: params.city } : {}),
|
|
63
|
+
...(params.state != null ? { state: params.state } : {}),
|
|
64
|
+
...(params.postal_code != null ? { postal_code: params.postal_code } : {}),
|
|
65
|
+
...(params.country != null ? { country: params.country } : {}),
|
|
66
|
+
});
|
|
67
|
+
return jsonResult({
|
|
68
|
+
id: numericId,
|
|
69
|
+
given_name: params.given_name ?? null,
|
|
70
|
+
surname: params.surname ?? null,
|
|
71
|
+
email: params.email ?? null,
|
|
72
|
+
status: 'created',
|
|
73
|
+
next: nextActionFor('contact') ?? undefined,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
async updateContact(params) {
|
|
77
|
+
const updates = {};
|
|
78
|
+
if (params.given_name != null)
|
|
79
|
+
updates.givenName = params.given_name;
|
|
80
|
+
if (params.surname != null)
|
|
81
|
+
updates.surname = params.surname;
|
|
82
|
+
if (params.email != null)
|
|
83
|
+
updates.emailAddresses = [{ address: params.email }];
|
|
84
|
+
if (params.phone != null)
|
|
85
|
+
updates.businessPhones = [params.phone];
|
|
86
|
+
if (params.mobile_phone != null)
|
|
87
|
+
updates.mobilePhone = params.mobile_phone;
|
|
88
|
+
if (params.company != null)
|
|
89
|
+
updates.companyName = params.company;
|
|
90
|
+
if (params.job_title != null)
|
|
91
|
+
updates.jobTitle = params.job_title;
|
|
92
|
+
if (params.street_address != null || params.city != null || params.state != null || params.postal_code != null || params.country != null) {
|
|
93
|
+
const address = {};
|
|
94
|
+
if (params.street_address != null)
|
|
95
|
+
address.street = params.street_address;
|
|
96
|
+
if (params.city != null)
|
|
97
|
+
address.city = params.city;
|
|
98
|
+
if (params.state != null)
|
|
99
|
+
address.state = params.state;
|
|
100
|
+
if (params.postal_code != null)
|
|
101
|
+
address.postalCode = params.postal_code;
|
|
102
|
+
if (params.country != null)
|
|
103
|
+
address.countryOrRegion = params.country;
|
|
104
|
+
updates.businessAddress = address;
|
|
105
|
+
}
|
|
106
|
+
await this.repository.updateContactAsync(params.contact_id, updates);
|
|
107
|
+
return { content: [{ type: 'text', text: `Successfully updated contact ${params.contact_id}` }] };
|
|
108
|
+
}
|
|
109
|
+
async prepareDeleteContact(params) {
|
|
110
|
+
const contact = await this.repository.getContactAsync(params.contact_id);
|
|
111
|
+
if (contact == null) {
|
|
112
|
+
return { content: [{ type: 'text', text: 'Contact not found' }], isError: true };
|
|
113
|
+
}
|
|
114
|
+
const graphId = this.repository.getContactGraphId(params.contact_id);
|
|
115
|
+
const graphContact = await this.repository.getClient().getContact(graphId);
|
|
116
|
+
const hash = hashContactForApproval({
|
|
117
|
+
id: params.contact_id,
|
|
118
|
+
displayName: graphContact?.displayName ?? null,
|
|
119
|
+
emailAddress: graphContact?.emailAddresses?.[0]?.address ?? null,
|
|
120
|
+
});
|
|
121
|
+
const token = this.tokenManager.generateToken({
|
|
122
|
+
operation: 'delete_contact',
|
|
123
|
+
targetType: 'contact',
|
|
124
|
+
targetId: params.contact_id,
|
|
125
|
+
targetHash: hash,
|
|
126
|
+
});
|
|
127
|
+
return jsonResult({
|
|
128
|
+
token_id: token.tokenId,
|
|
129
|
+
expires_at: new Date(token.expiresAt).toISOString(),
|
|
130
|
+
contact: transformContactRow(contact),
|
|
131
|
+
action: 'This contact will be permanently deleted.',
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
async confirmDeleteContact(params) {
|
|
135
|
+
const graphId = this.repository.getContactGraphId(params.contact_id);
|
|
136
|
+
const graphContact = await this.repository.getClient().getContact(graphId);
|
|
137
|
+
const currentHash = hashContactForApproval({
|
|
138
|
+
id: params.contact_id,
|
|
139
|
+
displayName: graphContact?.displayName ?? null,
|
|
140
|
+
emailAddress: graphContact?.emailAddresses?.[0]?.address ?? null,
|
|
141
|
+
});
|
|
142
|
+
const validation = this.tokenManager.consumeToken(params.token_id, 'delete_contact', params.contact_id);
|
|
143
|
+
if (!validation.valid) {
|
|
144
|
+
const errorMessages = {
|
|
145
|
+
NOT_FOUND: 'Token not found or already used',
|
|
146
|
+
EXPIRED: 'Token has expired. Please call prepare_delete_contact again.',
|
|
147
|
+
OPERATION_MISMATCH: 'Token was not generated for delete_contact',
|
|
148
|
+
TARGET_MISMATCH: 'Token was generated for a different contact',
|
|
149
|
+
ALREADY_CONSUMED: 'Token has already been used',
|
|
150
|
+
};
|
|
151
|
+
return {
|
|
152
|
+
content: [{ type: 'text', text: errorMessages[validation.error ?? ''] ?? 'Invalid token' }],
|
|
153
|
+
isError: true,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
if (validation.token.targetHash !== currentHash) {
|
|
157
|
+
return {
|
|
158
|
+
content: [{ type: 'text', text: 'Contact has changed since prepare was called. Please call prepare_delete_contact again.' }],
|
|
159
|
+
isError: true,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
await this.repository.deleteContactAsync(params.contact_id);
|
|
163
|
+
return { content: [{ type: 'text', text: `Successfully deleted contact ${params.contact_id}` }] };
|
|
164
|
+
}
|
|
165
|
+
async getContactPhoto(params) {
|
|
166
|
+
const result = await this.repository.getContactPhotoAsync(params.contact_id);
|
|
167
|
+
return jsonResult({ success: true, file_path: result.filePath, content_type: result.contentType });
|
|
168
|
+
}
|
|
169
|
+
async setContactPhoto(params) {
|
|
170
|
+
await this.repository.setContactPhotoAsync(params.contact_id, params.file_path);
|
|
171
|
+
return jsonResult({ success: true, message: 'Contact photo updated' });
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=contacts-graph.js.map
|