refactor: drop skill file, rework client
This commit was merged in pull request #3.
This commit is contained in:
+52
-11
@@ -1,25 +1,38 @@
|
||||
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 registerAvailabilityTools(server: McpServer): void {
|
||||
server.registerTool(
|
||||
"find_free_time",
|
||||
{
|
||||
description: "Find free time slots in your own calendar",
|
||||
description: "Find free time slots in your own calendar."
|
||||
+ " Queries your free/busy status and returns available slots"
|
||||
+ " within working hours that meet the minimum duration.",
|
||||
inputSchema: z.object({
|
||||
startDate: z.string().describe("Start date in YYYY-MM-DD format"),
|
||||
endDate: z.string().optional().describe(
|
||||
"End date in YYYY-MM-DD format (defaults to startDate)",
|
||||
"End date in YYYY-MM-DD format",
|
||||
),
|
||||
durationMinutes: z.number().default(30).describe(
|
||||
"Minimum slot duration in minutes (default 30)",
|
||||
"Minimum slot duration in minutes",
|
||||
),
|
||||
startHour: z.number().default(9).describe(
|
||||
"Working day start hour (0-23, default 9)",
|
||||
"Working day start hour (0-23)",
|
||||
),
|
||||
endHour: z.number().default(18).describe(
|
||||
"Working day end hour (0-23, default 18)",
|
||||
"Working day end hour (0-23)",
|
||||
),
|
||||
}),
|
||||
outputSchema: z.object({
|
||||
freeSlots: z.record(
|
||||
z.string(),
|
||||
z.array(z.object({
|
||||
start: z.string(),
|
||||
end: z.string(),
|
||||
durationMinutes: z.number(),
|
||||
})),
|
||||
),
|
||||
}),
|
||||
},
|
||||
@@ -79,6 +92,7 @@ export function registerAvailabilityTools(server: McpServer): void {
|
||||
type: "text" as const,
|
||||
text: JSON.stringify({ freeSlots }),
|
||||
}],
|
||||
structuredContent: { freeSlots },
|
||||
};
|
||||
} catch (error: any) {
|
||||
return {
|
||||
@@ -94,23 +108,45 @@ export function registerAvailabilityTools(server: McpServer): void {
|
||||
server.registerTool(
|
||||
"find_meeting_time",
|
||||
{
|
||||
description: "Find meeting times that work for multiple people",
|
||||
description: "Find common free time for multiple attendees."
|
||||
+ " Queries free/busy for all attendees"
|
||||
+ " and returns slots where everyone is available.",
|
||||
inputSchema: z.object({
|
||||
emails: z.string().describe(
|
||||
"Comma-separated email addresses of attendees",
|
||||
),
|
||||
startDate: z.string().describe("Start date in YYYY-MM-DD format"),
|
||||
endDate: z.string().optional().describe(
|
||||
"End date in YYYY-MM-DD format (defaults to startDate)",
|
||||
"End date in YYYY-MM-DD format",
|
||||
),
|
||||
durationMinutes: z.number().default(30).describe(
|
||||
"Minimum slot duration in minutes (default 30)",
|
||||
"Minimum slot duration in minutes",
|
||||
),
|
||||
startHour: z.number().default(9).describe(
|
||||
"Working day start hour (0-23, default 9)",
|
||||
"Working day start hour (0-23)",
|
||||
),
|
||||
endHour: z.number().default(18).describe(
|
||||
"Working day end hour (0-23, default 18)",
|
||||
"Working day end hour (0-23)",
|
||||
),
|
||||
}),
|
||||
outputSchema: z.object({
|
||||
period: z.object({
|
||||
start: z.string(),
|
||||
end: z.string(),
|
||||
}),
|
||||
attendees: z.array(z.object({
|
||||
email: z.string(),
|
||||
busySlots: z.number().optional(),
|
||||
freeSlots: z.number().optional(),
|
||||
calendarEvents: z.number().optional(),
|
||||
})),
|
||||
freeSlots: z.record(
|
||||
z.string(),
|
||||
z.array(z.object({
|
||||
start: z.string(),
|
||||
end: z.string(),
|
||||
durationMinutes: z.number(),
|
||||
})),
|
||||
),
|
||||
}),
|
||||
},
|
||||
@@ -192,6 +228,11 @@ export function registerAvailabilityTools(server: McpServer): void {
|
||||
freeSlots: freeByDate,
|
||||
}),
|
||||
}],
|
||||
structuredContent: {
|
||||
period: { start: startDate, end: ed },
|
||||
attendees: attendeeInfo,
|
||||
freeSlots: freeByDate,
|
||||
},
|
||||
};
|
||||
} catch (error: any) {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user