This commit is contained in:
2026-07-10 16:36:22 +03:00
parent 990a8d09b6
commit 17a6f91b3f
7 changed files with 56 additions and 219 deletions
+19 -13
View File
@@ -12,31 +12,34 @@ export function registerEmailTools(server: McpServer): void {
server.registerTool(
"get_emails",
{
description: "Get emails from a mailbox folder",
description:
"Get emails from a mailbox folder. Supports optional text search via query/queryScope. Returns {emails, count} or {itemIds, count} if idsOnly. Defaults: folder=Inbox, limit=10, offset=0, includeBody=false, unreadOnly=false, idsOnly=false, queryScope=all. Note: idsOnly raises the limit to 500.",
inputSchema: z.object({
folder: z.string().default("Inbox").describe(
"Folder name (Inbox, Sent, Drafts, Deleted, Junk, or custom)",
"Folder name (Inbox, Sent, Drafts, Deleted, Junk, or custom). Supports Russian folder names",
),
limit: z.number().default(10).describe(
"Maximum number of emails to return (default 10, max 50)",
"Maximum number of emails to return. Default: 10. Max 50 (max 500 if idsOnly=true)",
),
offset: z.number().default(0).describe(
"Number of emails to skip for pagination",
"Number of emails to skip for pagination. Default: 0",
),
includeBody: z.boolean().default(false).describe(
"If True, fetch full body for each email (slower)",
"If true, fetches full email body for each email (slower). Default: false",
),
unreadOnly: z.boolean().default(false).describe(
"If True, only return unread emails",
"If true, only return unread emails. Default: false",
),
idsOnly: z.boolean().default(false).describe(
"If True, return only item IDs and dates (max limit 500)",
"If true, return only item IDs, dates, and subjects — faster with higher limit of 500. Default: false",
),
query: z.string().optional().describe(
"Optional text to search for within the folder",
),
queryScope: z.enum(["all", "subject", "body", "from"]).default("all")
.describe("Where to search (only used when query is set)"),
.describe(
"Scope for text search. Values: all (subject+body), subject, body, from. Only used when query is set. Default: all",
),
}),
},
async (
@@ -177,7 +180,8 @@ export function registerEmailTools(server: McpServer): void {
server.registerTool(
"get_email",
{
description: "Get a single email with full body and details",
description:
"Get a single email with full body and details by Exchange ItemId. Returns the full Email object (subject, from, to, cc, body, date, attachments, etc.).",
inputSchema: z.object({
itemId: z.string().describe(
"The Exchange ItemId of the email to retrieve",
@@ -207,13 +211,14 @@ export function registerEmailTools(server: McpServer): void {
server.registerTool(
"mark_email_read",
{
description: "Mark one or more emails as read or unread",
description:
"Mark one or more emails as read or unread by their Exchange ItemIds. Returns {success, message} or {error}.",
inputSchema: z.object({
itemIds: z.array(z.string()).describe(
"List of Exchange ItemIds to update",
),
isRead: z.boolean().default(true).describe(
"True to mark as read, False to mark as unread",
"True to mark as read, false to mark as unread. Default: true",
),
}),
},
@@ -261,11 +266,12 @@ export function registerEmailTools(server: McpServer): void {
server.registerTool(
"download_attachments",
{
description: "Download all file attachments from an email to disk",
description:
"Download all file attachments from an email to disk. Inline (embedded) attachments are skipped — only standalone file attachments are downloaded. Returns {success, downloaded, count} or {success, downloaded, count, errors}.",
inputSchema: z.object({
itemId: z.string().describe("The Exchange ItemId of the email"),
targetFolder: z.string().default("/tmp/attachments").describe(
"Local directory to save files (default /tmp/attachments)",
"Local directory to save files. Default: /tmp/attachments",
),
}),
},