Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,25 @@ export const ZoomMeetingSchema = z.object({
creation_source: z.string(),
pre_schedule: z.boolean(),
});

export const ZoomListMeetingsSchema = z.object({
page_size: z.number(),
total_records: z.number(),
next_page_token: z.string(),
meetings: z.array(
z.object({
uuid: z.string(),
id: z.number(),
host_id: z.string(),
topic: z.string(),
type: z.number(),
start_time: z.string(),
duration: z.number(),
timezone: z.string(),
agenda: z.string(),
created_at: z.string(),
join_url: z.string(),
supportGoLive: z.boolean(),
}),
),
});
15 changes: 15 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { zodToJsonSchema } from "zod-to-json-schema";
import {
createMeeting,
CreateMeetingOptionsSchema,
ListMeetingOptionsSchema,
listMeetings,
} from "./operations/meeting.js";
import { z } from "zod";
import { getAccessToken } from "./common/auth.js";
Expand All @@ -34,6 +36,11 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
description: "Create a meeting",
inputSchema: zodToJsonSchema(CreateMeetingOptionsSchema),
},
{
name: "list_meetings",
description: "List scheduled meetings",
inputSchema: zodToJsonSchema(ListMeetingOptionsSchema),
},
],
};
});
Expand All @@ -52,6 +59,14 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
};
}

case "list_meetings": {
const args = ListMeetingOptionsSchema.parse(request.params.arguments);
const result = await listMeetings(args, token.access_token);
return {
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
};
}
}
} catch (error) {
if (error instanceof z.ZodError) {
Expand Down
25 changes: 24 additions & 1 deletion operations/meeting.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { z } from "zod";
import { zoomRequest } from "../common/util.js";
import { ZoomMeetingSchema } from "../common/types.js";
import { ZoomListMeetingsSchema, ZoomMeetingSchema } from "../common/types.js";

export const CreateMeetingOptionsSchema = z.object({
agenda: z
Expand All @@ -16,7 +16,12 @@ export const CreateMeetingOptionsSchema = z.object({
topic: z.string().max(200).optional().describe("The meeting's topic."),
});

export const ListMeetingOptionsSchema = z.object({
type: z.string().optional().describe("The type of meeting."),
});

export type CreateMeetingOptions = z.infer<typeof CreateMeetingOptionsSchema>;
export type ListMeetingOptions = z.infer<typeof ListMeetingOptionsSchema>;

export async function createMeeting(
options: CreateMeetingOptions,
Expand All @@ -32,3 +37,21 @@ export async function createMeeting(
);
return ZoomMeetingSchema.parse(response);
}

export async function listMeetings(options: ListMeetingOptions, token: string) {
let url = "https://api.zoom.us/v2/users/me/meetings";
const params = new URLSearchParams();
Object.entries(options).forEach(([key, value]) => {
if (value !== undefined && value !== null) {
params.append(key, value.toString());
}
});
if (Array.from(params).length > 0) {
url += `?${params.toString()}`;
}
const response = await zoomRequest(url, {
method: "GET",
headers: { Authorization: `Bearer ${token}` },
});
return ZoomListMeetingsSchema.parse(response);
}