w
This commit is contained in:
+18
-6
@@ -1,7 +1,7 @@
|
||||
import { type McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
||||
import { z } from "zod/v4";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { z } from "zod/v4";
|
||||
import { EwsClient, loadConfig } from "../ews_client.ts";
|
||||
|
||||
function getClient(): EwsClient {
|
||||
@@ -293,8 +293,12 @@ export function registerEmailTools(server: McpServer): void {
|
||||
{
|
||||
description: "Mark one or more emails as read or unread",
|
||||
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"),
|
||||
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",
|
||||
),
|
||||
}),
|
||||
},
|
||||
async ({ itemIds, isRead }) => {
|
||||
@@ -310,7 +314,10 @@ export function registerEmailTools(server: McpServer): void {
|
||||
|
||||
if (errors.length) {
|
||||
return {
|
||||
content: [{ type: "text" as const, text: JSON.stringify({ error: errors.join("; ") }) }],
|
||||
content: [{
|
||||
type: "text" as const,
|
||||
text: JSON.stringify({ error: errors.join("; ") }),
|
||||
}],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -391,7 +398,9 @@ export function registerEmailTools(server: McpServer): void {
|
||||
let counter = 1;
|
||||
let finalName = filename;
|
||||
while (usedNames.has(finalName.toLowerCase())) {
|
||||
finalName = extPart ? `${namePart}_${counter}${extPart}` : `${namePart}_${counter}`;
|
||||
finalName = extPart
|
||||
? `${namePart}_${counter}${extPart}`
|
||||
: `${namePart}_${counter}`;
|
||||
counter++;
|
||||
}
|
||||
usedNames.add(finalName.toLowerCase());
|
||||
@@ -406,7 +415,10 @@ export function registerEmailTools(server: McpServer): void {
|
||||
contentType: result.contentType,
|
||||
});
|
||||
} catch (e: any) {
|
||||
errors.push({ name: att.name || "unknown", error: e.message ?? String(e) });
|
||||
errors.push({
|
||||
name: att.name || "unknown",
|
||||
error: e.message ?? String(e),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user