refactor: drop skill file, rework client
This commit was merged in pull request #3.
This commit is contained in:
+27
-3
@@ -1,22 +1,45 @@
|
||||
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 registerPeopleTools(server: McpServer): void {
|
||||
server.registerTool(
|
||||
"find_person",
|
||||
{
|
||||
description: "Search for people in the corporate directory",
|
||||
description:
|
||||
"Search for people in the corporate directory (Active Directory)"
|
||||
+ " by name, email, or keyword.",
|
||||
inputSchema: z.object({
|
||||
query: z.string().describe(
|
||||
"Name, email address, or keyword to search for",
|
||||
),
|
||||
}),
|
||||
outputSchema: z.object({
|
||||
name: z.string(),
|
||||
email: z.string(),
|
||||
mailboxType: z.string(),
|
||||
firstName: z.string(),
|
||||
lastName: z.string(),
|
||||
jobTitle: z.string(),
|
||||
department: z.string(),
|
||||
company: z.string(),
|
||||
office: z.string(),
|
||||
alias: z.string(),
|
||||
manager: z.string(),
|
||||
managerEmail: z.string(),
|
||||
phones: z.record(z.string(), z.string()),
|
||||
address: z.string(),
|
||||
directReports: z.array(z.object({
|
||||
name: z.string(),
|
||||
email: z.string(),
|
||||
})),
|
||||
}),
|
||||
},
|
||||
async ({ query }) => {
|
||||
try {
|
||||
const client = new EwsClient(loadConfig());
|
||||
const resolutions = await client.resolveNames(query, true);
|
||||
const resolutions = await client.resolveNames(query);
|
||||
|
||||
const people = resolutions.map((r: any) => {
|
||||
const mailbox = r.Mailbox ?? {};
|
||||
@@ -84,6 +107,7 @@ export function registerPeopleTools(server: McpServer): void {
|
||||
|
||||
return {
|
||||
content: [{ type: "text" as const, text: JSON.stringify(people) }],
|
||||
structuredContent: { people },
|
||||
};
|
||||
} catch (error: any) {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user