refactor: drop skill file, rework client #3
+1
-11
@@ -377,7 +377,7 @@ ${restriction}
|
||||
return folders;
|
||||
}
|
||||
|
||||
extractEmailSummary(item: any): Email {
|
||||
extractEmail(item: any): Email {
|
||||
const itemType = item["@_xsi_type"] ?? item.__type ?? "";
|
||||
const isMeeting =
|
||||
/MeetingRequest|MeetingResponse|MeetingCancellation|CalendarItem/i.test(
|
||||
@@ -429,12 +429,6 @@ ${restriction}
|
||||
email.end = item.End ?? item.EndWallClock ?? "";
|
||||
}
|
||||
|
||||
return email;
|
||||
}
|
||||
|
||||
extractEmailDetails(item: any): Email {
|
||||
const email = this.extractEmailSummary(item);
|
||||
|
||||
const bodyVal = item.Body?.Value ?? item.Body?.["#text"] ?? "";
|
||||
const bodyType = item.Body?.["@_BodyType"] ?? item.Body?.BodyType ?? "Text";
|
||||
|
||||
@@ -476,10 +470,6 @@ ${restriction}
|
||||
isInline: a.IsInline === "true" || a.IsInline === true,
|
||||
}));
|
||||
|
||||
const isMeeting =
|
||||
/MeetingRequest|MeetingResponse|MeetingCancellation|CalendarItem/i.test(
|
||||
item["@_xsi_type"] ?? "",
|
||||
);
|
||||
if (isMeeting) {
|
||||
email.location = item.Location ?? item.EnhancedLocation?.DisplayName
|
||||
?? "";
|
||||
|
||||
+2
-2
@@ -73,7 +73,7 @@ export function registerCalendarTools(server: McpServer): void {
|
||||
};
|
||||
|
||||
if (includeBody && event.itemId) {
|
||||
const details = client.extractEmailDetails(item);
|
||||
const details = client.extractEmail(item);
|
||||
event.body = details.body;
|
||||
event.requiredAttendees = details.requiredAttendees ?? [];
|
||||
event.optionalAttendees = details.optionalAttendees ?? [];
|
||||
@@ -138,7 +138,7 @@ export function registerCalendarTools(server: McpServer): void {
|
||||
try {
|
||||
const client = new EwsClient(loadConfig());
|
||||
const item = await client.getItem(itemId);
|
||||
const email = client.extractEmailDetails(item);
|
||||
const email = client.extractEmail(item);
|
||||
const attachments = email.attachments ?? [];
|
||||
|
||||
const fileAttachments = attachments.filter(
|
||||
|
||||
+3
-13
@@ -139,17 +139,7 @@ export function registerEmailTools(server: McpServer): void {
|
||||
|
||||
const emails = [];
|
||||
for (const item of items) {
|
||||
const email = client.extractEmailSummary(item);
|
||||
|
||||
if (includeBody && email.itemId) {
|
||||
const details = client.extractEmailDetails(item);
|
||||
email.to = details.to;
|
||||
email.cc = details.cc;
|
||||
email.body = details.body;
|
||||
email.hasLinks = details.hasLinks;
|
||||
}
|
||||
|
||||
emails.push(email);
|
||||
emails.push(client.extractEmail(item));
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -205,7 +195,7 @@ export function registerEmailTools(server: McpServer): void {
|
||||
try {
|
||||
const client = getClient();
|
||||
const item = await client.getItem(itemId);
|
||||
const email = client.extractEmailDetails(item);
|
||||
const email = client.extractEmail(item);
|
||||
|
||||
return {
|
||||
content: [{ type: "text" as const, text: JSON.stringify(email) }],
|
||||
@@ -326,7 +316,7 @@ export function registerEmailTools(server: McpServer): void {
|
||||
try {
|
||||
const client = new EwsClient(loadConfig());
|
||||
const item = await client.getItem(itemId);
|
||||
const email = client.extractEmailDetails(item);
|
||||
const email = client.extractEmail(item);
|
||||
const attachments = email.attachments ?? [];
|
||||
|
||||
const fileAttachments = attachments.filter(
|
||||
|
||||
Reference in New Issue
Block a user