refactor: drop skill file, rework client
This commit was merged in pull request #3.
This commit is contained in:
+16
-4
@@ -1,20 +1,31 @@
|
||||
import { type McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
||||
import { z } from "zod/v4";
|
||||
import { EwsClient, loadConfig } from "../ews_client.ts";
|
||||
import { loadConfig } from "../utils/login.ts";
|
||||
import { EwsClient } from "../client/ews_client.ts";
|
||||
|
||||
export function registerFolderTools(server: McpServer): void {
|
||||
server.registerTool(
|
||||
"get_folders",
|
||||
{
|
||||
description: "List mail folders from the Exchange mailbox",
|
||||
description: "List mailbox folders from the Exchange mailbox.",
|
||||
inputSchema: z.object({
|
||||
parentFolderId: z.string().default("msgfolderroot").describe(
|
||||
"Parent folder to list children of (default: msgfolderroot)",
|
||||
"Parent folder to list children of."
|
||||
+ " Supports distinguished names (e.g. inbox, calendar)",
|
||||
),
|
||||
recursive: z.boolean().default(false).describe(
|
||||
"If True, traverse all subfolders recursively",
|
||||
"If true, recursively traverse all subfolders",
|
||||
),
|
||||
}),
|
||||
outputSchema: z.object({
|
||||
folders: z.array(z.object({
|
||||
name: z.string(),
|
||||
id: z.string(),
|
||||
totalCount: z.number(),
|
||||
unreadCount: z.number(),
|
||||
childFolderCount: z.number(),
|
||||
})),
|
||||
}),
|
||||
},
|
||||
async ({ parentFolderId, recursive }) => {
|
||||
try {
|
||||
@@ -23,6 +34,7 @@ export function registerFolderTools(server: McpServer): void {
|
||||
|
||||
return {
|
||||
content: [{ type: "text" as const, text: JSON.stringify(folders) }],
|
||||
structuredContent: { folders },
|
||||
};
|
||||
} catch (error: any) {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user