@sam2kb/m365-mcp 1.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/.env.example +11 -0
- package/LICENSE +21 -0
- package/README.md +257 -0
- package/SKILL.md +59 -0
- package/dist/auth-cli.d.ts +13 -0
- package/dist/auth-cli.js +127 -0
- package/dist/auth-cli.js.map +1 -0
- package/dist/auth.d.ts +44 -0
- package/dist/auth.js +288 -0
- package/dist/auth.js.map +1 -0
- package/dist/graph.d.ts +32 -0
- package/dist/graph.js +189 -0
- package/dist/graph.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +152 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/calendar.d.ts +236 -0
- package/dist/tools/calendar.js +255 -0
- package/dist/tools/calendar.js.map +1 -0
- package/dist/tools/contacts.d.ts +207 -0
- package/dist/tools/contacts.js +169 -0
- package/dist/tools/contacts.js.map +1 -0
- package/dist/tools/files.d.ts +135 -0
- package/dist/tools/files.js +127 -0
- package/dist/tools/files.js.map +1 -0
- package/dist/tools/mail.d.ts +300 -0
- package/dist/tools/mail.js +233 -0
- package/dist/tools/mail.js.map +1 -0
- package/dist/tools/tasks.d.ts +171 -0
- package/dist/tools/tasks.js +129 -0
- package/dist/tools/tasks.js.map +1 -0
- package/dist/tools/teams.d.ts +71 -0
- package/dist/tools/teams.js +75 -0
- package/dist/tools/teams.js.map +1 -0
- package/dist/tools/users.d.ts +55 -0
- package/dist/tools/users.js +64 -0
- package/dist/tools/users.js.map +1 -0
- package/dist/types.d.ts +197 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +48 -0
- package/tsconfig.json +19 -0
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mail tools — list, read, send, reply, search, move, delete, folders
|
|
3
|
+
*/
|
|
4
|
+
import type { GraphClient } from "../graph.js";
|
|
5
|
+
export declare function registerMailTools(client: GraphClient): {
|
|
6
|
+
mail_list(args: {
|
|
7
|
+
folder?: string;
|
|
8
|
+
top?: number;
|
|
9
|
+
filter?: string;
|
|
10
|
+
search?: string;
|
|
11
|
+
}): Promise<string>;
|
|
12
|
+
mail_read(args: {
|
|
13
|
+
messageId: string;
|
|
14
|
+
}): Promise<string>;
|
|
15
|
+
mail_send(args: {
|
|
16
|
+
to: string;
|
|
17
|
+
subject: string;
|
|
18
|
+
body?: string;
|
|
19
|
+
cc?: string;
|
|
20
|
+
bcc?: string;
|
|
21
|
+
html?: boolean;
|
|
22
|
+
}): Promise<string>;
|
|
23
|
+
mail_reply(args: {
|
|
24
|
+
messageId: string;
|
|
25
|
+
body: string;
|
|
26
|
+
replyAll?: boolean;
|
|
27
|
+
}): Promise<string>;
|
|
28
|
+
mail_search(args: {
|
|
29
|
+
query: string;
|
|
30
|
+
top?: number;
|
|
31
|
+
}): Promise<string>;
|
|
32
|
+
mail_move(args: {
|
|
33
|
+
messageId: string;
|
|
34
|
+
folderId: string;
|
|
35
|
+
}): Promise<string>;
|
|
36
|
+
mail_delete(args: {
|
|
37
|
+
messageId: string;
|
|
38
|
+
}): Promise<string>;
|
|
39
|
+
mail_mark_read(args: {
|
|
40
|
+
messageId: string;
|
|
41
|
+
isRead: boolean;
|
|
42
|
+
}): Promise<string>;
|
|
43
|
+
mail_folders(): Promise<string>;
|
|
44
|
+
};
|
|
45
|
+
export declare const mailToolSchemas: ({
|
|
46
|
+
name: string;
|
|
47
|
+
description: string;
|
|
48
|
+
inputSchema: {
|
|
49
|
+
type: string;
|
|
50
|
+
properties: {
|
|
51
|
+
folder: {
|
|
52
|
+
type: string;
|
|
53
|
+
description: string;
|
|
54
|
+
};
|
|
55
|
+
top: {
|
|
56
|
+
type: string;
|
|
57
|
+
description: string;
|
|
58
|
+
default?: undefined;
|
|
59
|
+
};
|
|
60
|
+
filter: {
|
|
61
|
+
type: string;
|
|
62
|
+
description: string;
|
|
63
|
+
};
|
|
64
|
+
search: {
|
|
65
|
+
type: string;
|
|
66
|
+
description: string;
|
|
67
|
+
};
|
|
68
|
+
messageId?: undefined;
|
|
69
|
+
to?: undefined;
|
|
70
|
+
subject?: undefined;
|
|
71
|
+
body?: undefined;
|
|
72
|
+
cc?: undefined;
|
|
73
|
+
bcc?: undefined;
|
|
74
|
+
html?: undefined;
|
|
75
|
+
replyAll?: undefined;
|
|
76
|
+
query?: undefined;
|
|
77
|
+
folderId?: undefined;
|
|
78
|
+
isRead?: undefined;
|
|
79
|
+
};
|
|
80
|
+
required?: undefined;
|
|
81
|
+
};
|
|
82
|
+
} | {
|
|
83
|
+
name: string;
|
|
84
|
+
description: string;
|
|
85
|
+
inputSchema: {
|
|
86
|
+
type: string;
|
|
87
|
+
properties: {
|
|
88
|
+
messageId: {
|
|
89
|
+
type: string;
|
|
90
|
+
description: string;
|
|
91
|
+
};
|
|
92
|
+
folder?: undefined;
|
|
93
|
+
top?: undefined;
|
|
94
|
+
filter?: undefined;
|
|
95
|
+
search?: undefined;
|
|
96
|
+
to?: undefined;
|
|
97
|
+
subject?: undefined;
|
|
98
|
+
body?: undefined;
|
|
99
|
+
cc?: undefined;
|
|
100
|
+
bcc?: undefined;
|
|
101
|
+
html?: undefined;
|
|
102
|
+
replyAll?: undefined;
|
|
103
|
+
query?: undefined;
|
|
104
|
+
folderId?: undefined;
|
|
105
|
+
isRead?: undefined;
|
|
106
|
+
};
|
|
107
|
+
required: string[];
|
|
108
|
+
};
|
|
109
|
+
} | {
|
|
110
|
+
name: string;
|
|
111
|
+
description: string;
|
|
112
|
+
inputSchema: {
|
|
113
|
+
type: string;
|
|
114
|
+
properties: {
|
|
115
|
+
to: {
|
|
116
|
+
type: string;
|
|
117
|
+
description: string;
|
|
118
|
+
};
|
|
119
|
+
subject: {
|
|
120
|
+
type: string;
|
|
121
|
+
description: string;
|
|
122
|
+
};
|
|
123
|
+
body: {
|
|
124
|
+
type: string;
|
|
125
|
+
description: string;
|
|
126
|
+
};
|
|
127
|
+
cc: {
|
|
128
|
+
type: string;
|
|
129
|
+
description: string;
|
|
130
|
+
};
|
|
131
|
+
bcc: {
|
|
132
|
+
type: string;
|
|
133
|
+
description: string;
|
|
134
|
+
};
|
|
135
|
+
html: {
|
|
136
|
+
type: string;
|
|
137
|
+
description: string;
|
|
138
|
+
default: boolean;
|
|
139
|
+
};
|
|
140
|
+
folder?: undefined;
|
|
141
|
+
top?: undefined;
|
|
142
|
+
filter?: undefined;
|
|
143
|
+
search?: undefined;
|
|
144
|
+
messageId?: undefined;
|
|
145
|
+
replyAll?: undefined;
|
|
146
|
+
query?: undefined;
|
|
147
|
+
folderId?: undefined;
|
|
148
|
+
isRead?: undefined;
|
|
149
|
+
};
|
|
150
|
+
required: string[];
|
|
151
|
+
};
|
|
152
|
+
} | {
|
|
153
|
+
name: string;
|
|
154
|
+
description: string;
|
|
155
|
+
inputSchema: {
|
|
156
|
+
type: string;
|
|
157
|
+
properties: {
|
|
158
|
+
messageId: {
|
|
159
|
+
type: string;
|
|
160
|
+
description: string;
|
|
161
|
+
};
|
|
162
|
+
body: {
|
|
163
|
+
type: string;
|
|
164
|
+
description: string;
|
|
165
|
+
};
|
|
166
|
+
replyAll: {
|
|
167
|
+
type: string;
|
|
168
|
+
description: string;
|
|
169
|
+
};
|
|
170
|
+
folder?: undefined;
|
|
171
|
+
top?: undefined;
|
|
172
|
+
filter?: undefined;
|
|
173
|
+
search?: undefined;
|
|
174
|
+
to?: undefined;
|
|
175
|
+
subject?: undefined;
|
|
176
|
+
cc?: undefined;
|
|
177
|
+
bcc?: undefined;
|
|
178
|
+
html?: undefined;
|
|
179
|
+
query?: undefined;
|
|
180
|
+
folderId?: undefined;
|
|
181
|
+
isRead?: undefined;
|
|
182
|
+
};
|
|
183
|
+
required: string[];
|
|
184
|
+
};
|
|
185
|
+
} | {
|
|
186
|
+
name: string;
|
|
187
|
+
description: string;
|
|
188
|
+
inputSchema: {
|
|
189
|
+
type: string;
|
|
190
|
+
properties: {
|
|
191
|
+
query: {
|
|
192
|
+
type: string;
|
|
193
|
+
description: string;
|
|
194
|
+
};
|
|
195
|
+
top: {
|
|
196
|
+
type: string;
|
|
197
|
+
description: string;
|
|
198
|
+
default: number;
|
|
199
|
+
};
|
|
200
|
+
folder?: undefined;
|
|
201
|
+
filter?: undefined;
|
|
202
|
+
search?: undefined;
|
|
203
|
+
messageId?: undefined;
|
|
204
|
+
to?: undefined;
|
|
205
|
+
subject?: undefined;
|
|
206
|
+
body?: undefined;
|
|
207
|
+
cc?: undefined;
|
|
208
|
+
bcc?: undefined;
|
|
209
|
+
html?: undefined;
|
|
210
|
+
replyAll?: undefined;
|
|
211
|
+
folderId?: undefined;
|
|
212
|
+
isRead?: undefined;
|
|
213
|
+
};
|
|
214
|
+
required: string[];
|
|
215
|
+
};
|
|
216
|
+
} | {
|
|
217
|
+
name: string;
|
|
218
|
+
description: string;
|
|
219
|
+
inputSchema: {
|
|
220
|
+
type: string;
|
|
221
|
+
properties: {
|
|
222
|
+
messageId: {
|
|
223
|
+
type: string;
|
|
224
|
+
description: string;
|
|
225
|
+
};
|
|
226
|
+
folderId: {
|
|
227
|
+
type: string;
|
|
228
|
+
description: string;
|
|
229
|
+
};
|
|
230
|
+
folder?: undefined;
|
|
231
|
+
top?: undefined;
|
|
232
|
+
filter?: undefined;
|
|
233
|
+
search?: undefined;
|
|
234
|
+
to?: undefined;
|
|
235
|
+
subject?: undefined;
|
|
236
|
+
body?: undefined;
|
|
237
|
+
cc?: undefined;
|
|
238
|
+
bcc?: undefined;
|
|
239
|
+
html?: undefined;
|
|
240
|
+
replyAll?: undefined;
|
|
241
|
+
query?: undefined;
|
|
242
|
+
isRead?: undefined;
|
|
243
|
+
};
|
|
244
|
+
required: string[];
|
|
245
|
+
};
|
|
246
|
+
} | {
|
|
247
|
+
name: string;
|
|
248
|
+
description: string;
|
|
249
|
+
inputSchema: {
|
|
250
|
+
type: string;
|
|
251
|
+
properties: {
|
|
252
|
+
messageId: {
|
|
253
|
+
type: string;
|
|
254
|
+
description: string;
|
|
255
|
+
};
|
|
256
|
+
isRead: {
|
|
257
|
+
type: string;
|
|
258
|
+
description: string;
|
|
259
|
+
};
|
|
260
|
+
folder?: undefined;
|
|
261
|
+
top?: undefined;
|
|
262
|
+
filter?: undefined;
|
|
263
|
+
search?: undefined;
|
|
264
|
+
to?: undefined;
|
|
265
|
+
subject?: undefined;
|
|
266
|
+
body?: undefined;
|
|
267
|
+
cc?: undefined;
|
|
268
|
+
bcc?: undefined;
|
|
269
|
+
html?: undefined;
|
|
270
|
+
replyAll?: undefined;
|
|
271
|
+
query?: undefined;
|
|
272
|
+
folderId?: undefined;
|
|
273
|
+
};
|
|
274
|
+
required: string[];
|
|
275
|
+
};
|
|
276
|
+
} | {
|
|
277
|
+
name: string;
|
|
278
|
+
description: string;
|
|
279
|
+
inputSchema: {
|
|
280
|
+
type: string;
|
|
281
|
+
properties: {
|
|
282
|
+
folder?: undefined;
|
|
283
|
+
top?: undefined;
|
|
284
|
+
filter?: undefined;
|
|
285
|
+
search?: undefined;
|
|
286
|
+
messageId?: undefined;
|
|
287
|
+
to?: undefined;
|
|
288
|
+
subject?: undefined;
|
|
289
|
+
body?: undefined;
|
|
290
|
+
cc?: undefined;
|
|
291
|
+
bcc?: undefined;
|
|
292
|
+
html?: undefined;
|
|
293
|
+
replyAll?: undefined;
|
|
294
|
+
query?: undefined;
|
|
295
|
+
folderId?: undefined;
|
|
296
|
+
isRead?: undefined;
|
|
297
|
+
};
|
|
298
|
+
required?: undefined;
|
|
299
|
+
};
|
|
300
|
+
})[];
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mail tools — list, read, send, reply, search, move, delete, folders
|
|
3
|
+
*/
|
|
4
|
+
export function registerMailTools(client) {
|
|
5
|
+
const user = "/me";
|
|
6
|
+
return {
|
|
7
|
+
// ── list ─────────────────────────────────────────────────────
|
|
8
|
+
async mail_list(args) {
|
|
9
|
+
const folder = args.folder || "inbox";
|
|
10
|
+
const top = args.top || 20;
|
|
11
|
+
let path = `${user}/mailFolders/${encodeURIComponent(folder)}/messages?$top=${top}&$orderby=receivedDateTime desc&$select=id,subject,from,receivedDateTime,isRead,bodyPreview,hasAttachments,importance,webLink`;
|
|
12
|
+
if (args.filter)
|
|
13
|
+
path += `&$filter=${encodeURIComponent(args.filter)}`;
|
|
14
|
+
if (args.search)
|
|
15
|
+
path += `&$search="${encodeURIComponent(args.search)}"`;
|
|
16
|
+
const msgs = await client.getAll(path, 10, top);
|
|
17
|
+
return JSON.stringify(msgs.map((m) => ({
|
|
18
|
+
id: m.id,
|
|
19
|
+
subject: m.subject,
|
|
20
|
+
from: m.from?.emailAddress?.address,
|
|
21
|
+
received: m.receivedDateTime,
|
|
22
|
+
isRead: m.isRead,
|
|
23
|
+
hasAttachments: m.hasAttachments,
|
|
24
|
+
importance: m.importance,
|
|
25
|
+
preview: m.bodyPreview?.slice(0, 200),
|
|
26
|
+
})), null, 2);
|
|
27
|
+
},
|
|
28
|
+
// ── read ─────────────────────────────────────────────────────
|
|
29
|
+
async mail_read(args) {
|
|
30
|
+
const messageId = encodeURIComponent(args.messageId);
|
|
31
|
+
const m = await client.get(`${user}/messages/${messageId}`);
|
|
32
|
+
return JSON.stringify({
|
|
33
|
+
id: m.id,
|
|
34
|
+
subject: m.subject,
|
|
35
|
+
from: m.from?.emailAddress,
|
|
36
|
+
to: m.toRecipients?.map((r) => r.emailAddress),
|
|
37
|
+
cc: m.ccRecipients?.map((r) => r.emailAddress),
|
|
38
|
+
received: m.receivedDateTime,
|
|
39
|
+
isRead: m.isRead,
|
|
40
|
+
importance: m.importance,
|
|
41
|
+
hasAttachments: m.hasAttachments,
|
|
42
|
+
body: m.body?.content?.slice(0, 10_000),
|
|
43
|
+
webLink: m.webLink,
|
|
44
|
+
}, null, 2);
|
|
45
|
+
},
|
|
46
|
+
// ── send ─────────────────────────────────────────────────────
|
|
47
|
+
async mail_send(args) {
|
|
48
|
+
const toList = args.to.split(",").map((s) => ({
|
|
49
|
+
emailAddress: { address: s.trim() },
|
|
50
|
+
}));
|
|
51
|
+
const msg = {
|
|
52
|
+
subject: args.subject,
|
|
53
|
+
body: {
|
|
54
|
+
contentType: args.html ? "HTML" : "Text",
|
|
55
|
+
content: args.body || "",
|
|
56
|
+
},
|
|
57
|
+
toRecipients: toList,
|
|
58
|
+
};
|
|
59
|
+
if (args.cc) {
|
|
60
|
+
msg.ccRecipients = args.cc.split(",").map((s) => ({
|
|
61
|
+
emailAddress: { address: s.trim() },
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
if (args.bcc) {
|
|
65
|
+
msg.bccRecipients = args.bcc.split(",").map((s) => ({
|
|
66
|
+
emailAddress: { address: s.trim() },
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
await client.post(`${user}/sendMail`, { message: msg });
|
|
70
|
+
return JSON.stringify({ success: true, to: args.to, subject: args.subject });
|
|
71
|
+
},
|
|
72
|
+
// ── reply ────────────────────────────────────────────────────
|
|
73
|
+
async mail_reply(args) {
|
|
74
|
+
const messageId = encodeURIComponent(args.messageId);
|
|
75
|
+
await client.post(args.replyAll
|
|
76
|
+
? `${user}/messages/${messageId}/replyAll`
|
|
77
|
+
: `${user}/messages/${messageId}/reply`, { comment: args.body });
|
|
78
|
+
return JSON.stringify({ success: true });
|
|
79
|
+
},
|
|
80
|
+
// ── search ───────────────────────────────────────────────────
|
|
81
|
+
async mail_search(args) {
|
|
82
|
+
const top = args.top || 20;
|
|
83
|
+
const path = `${user}/messages?$search="${encodeURIComponent(args.query)}"&$top=${top}&$orderby=receivedDateTime desc`;
|
|
84
|
+
const msgs = await client.getAll(path, 10, top);
|
|
85
|
+
return JSON.stringify(msgs.map((m) => ({
|
|
86
|
+
id: m.id,
|
|
87
|
+
subject: m.subject,
|
|
88
|
+
from: m.from?.emailAddress?.address,
|
|
89
|
+
received: m.receivedDateTime,
|
|
90
|
+
preview: m.bodyPreview,
|
|
91
|
+
})), null, 2);
|
|
92
|
+
},
|
|
93
|
+
// ── move ─────────────────────────────────────────────────────
|
|
94
|
+
async mail_move(args) {
|
|
95
|
+
const messageId = encodeURIComponent(args.messageId);
|
|
96
|
+
await client.post(`${user}/messages/${messageId}/move`, { destinationId: args.folderId });
|
|
97
|
+
return JSON.stringify({ success: true });
|
|
98
|
+
},
|
|
99
|
+
// ── delete ───────────────────────────────────────────────────
|
|
100
|
+
async mail_delete(args) {
|
|
101
|
+
const messageId = encodeURIComponent(args.messageId);
|
|
102
|
+
await client.delete(`${user}/messages/${messageId}`);
|
|
103
|
+
return JSON.stringify({ success: true });
|
|
104
|
+
},
|
|
105
|
+
// ── mark read / unread ───────────────────────────────────────
|
|
106
|
+
async mail_mark_read(args) {
|
|
107
|
+
const messageId = encodeURIComponent(args.messageId);
|
|
108
|
+
await client.patch(`${user}/messages/${messageId}`, {
|
|
109
|
+
isRead: args.isRead,
|
|
110
|
+
});
|
|
111
|
+
return JSON.stringify({ success: true, isRead: args.isRead });
|
|
112
|
+
},
|
|
113
|
+
// ── list folders ─────────────────────────────────────────────
|
|
114
|
+
async mail_folders() {
|
|
115
|
+
const folders = await client.getAll(`${user}/mailFolders?$select=id,displayName,childFolderCount,totalItemCount,unreadItemCount`);
|
|
116
|
+
return JSON.stringify(folders.map((f) => ({
|
|
117
|
+
id: f.id,
|
|
118
|
+
name: f.displayName,
|
|
119
|
+
total: f.totalItemCount,
|
|
120
|
+
unread: f.unreadItemCount,
|
|
121
|
+
childFolders: f.childFolderCount,
|
|
122
|
+
})), null, 2);
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
export const mailToolSchemas = [
|
|
127
|
+
{
|
|
128
|
+
name: "m365_mail_list",
|
|
129
|
+
description: "List emails from your mailbox with optional folder, filter, and search",
|
|
130
|
+
inputSchema: {
|
|
131
|
+
type: "object",
|
|
132
|
+
properties: {
|
|
133
|
+
folder: { type: "string", description: "Folder name: inbox, sentitems, drafts, etc." },
|
|
134
|
+
top: { type: "number", description: "Number of emails (max 100 per page, paginated)" },
|
|
135
|
+
filter: { type: "string", description: "OData filter, e.g. isRead eq false" },
|
|
136
|
+
search: { type: "string", description: "Search query within folder" },
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
name: "m365_mail_read",
|
|
142
|
+
description: "Read a specific email by ID, including full body",
|
|
143
|
+
inputSchema: {
|
|
144
|
+
type: "object",
|
|
145
|
+
properties: {
|
|
146
|
+
messageId: { type: "string", description: "Email message ID" },
|
|
147
|
+
},
|
|
148
|
+
required: ["messageId"],
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: "m365_mail_send",
|
|
153
|
+
description: "Send an email from your account",
|
|
154
|
+
inputSchema: {
|
|
155
|
+
type: "object",
|
|
156
|
+
properties: {
|
|
157
|
+
to: { type: "string", description: "Recipient email(s), comma-separated" },
|
|
158
|
+
subject: { type: "string", description: "Email subject" },
|
|
159
|
+
body: { type: "string", description: "Email body (plain text or HTML)" },
|
|
160
|
+
cc: { type: "string", description: "CC recipients, comma-separated" },
|
|
161
|
+
bcc: { type: "string", description: "BCC recipients, comma-separated" },
|
|
162
|
+
html: { type: "boolean", description: "Set true if body is HTML", default: false },
|
|
163
|
+
},
|
|
164
|
+
required: ["to", "subject"],
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: "m365_mail_reply",
|
|
169
|
+
description: "Reply to an email",
|
|
170
|
+
inputSchema: {
|
|
171
|
+
type: "object",
|
|
172
|
+
properties: {
|
|
173
|
+
messageId: { type: "string", description: "ID of email to reply to" },
|
|
174
|
+
body: { type: "string", description: "Reply body text" },
|
|
175
|
+
replyAll: { type: "boolean", description: "Reply to all recipients" },
|
|
176
|
+
},
|
|
177
|
+
required: ["messageId", "body"],
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
name: "m365_mail_search",
|
|
182
|
+
description: "Search emails across all folders",
|
|
183
|
+
inputSchema: {
|
|
184
|
+
type: "object",
|
|
185
|
+
properties: {
|
|
186
|
+
query: { type: "string", description: "Search query (supports KQL)" },
|
|
187
|
+
top: { type: "number", description: "Max results", default: 20 },
|
|
188
|
+
},
|
|
189
|
+
required: ["query"],
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
name: "m365_mail_move",
|
|
194
|
+
description: "Move an email to a different folder",
|
|
195
|
+
inputSchema: {
|
|
196
|
+
type: "object",
|
|
197
|
+
properties: {
|
|
198
|
+
messageId: { type: "string", description: "Email message ID" },
|
|
199
|
+
folderId: { type: "string", description: "Destination folder ID (use m365_mail_folders to list)" },
|
|
200
|
+
},
|
|
201
|
+
required: ["messageId", "folderId"],
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
name: "m365_mail_delete",
|
|
206
|
+
description: "Delete an email (moves to Deleted Items)",
|
|
207
|
+
inputSchema: {
|
|
208
|
+
type: "object",
|
|
209
|
+
properties: {
|
|
210
|
+
messageId: { type: "string", description: "Email message ID" },
|
|
211
|
+
},
|
|
212
|
+
required: ["messageId"],
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
name: "m365_mail_mark_read",
|
|
217
|
+
description: "Mark an email as read or unread",
|
|
218
|
+
inputSchema: {
|
|
219
|
+
type: "object",
|
|
220
|
+
properties: {
|
|
221
|
+
messageId: { type: "string", description: "Email message ID" },
|
|
222
|
+
isRead: { type: "boolean", description: "True = mark read, False = mark unread" },
|
|
223
|
+
},
|
|
224
|
+
required: ["messageId", "isRead"],
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
name: "m365_mail_folders",
|
|
229
|
+
description: "List all mail folders with counts",
|
|
230
|
+
inputSchema: { type: "object", properties: {} },
|
|
231
|
+
},
|
|
232
|
+
];
|
|
233
|
+
//# sourceMappingURL=mail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mail.js","s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