@chronary/toolkit 1.3.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -76,6 +76,28 @@ var UpdateCalendarSchema = import_zod.z.object({
76
76
  var DeleteCalendarSchema = import_zod.z.object({
77
77
  calendar_id: import_zod.z.string().describe("Calendar ID to delete")
78
78
  });
79
+ var ListBookingPagesSchema = import_zod.z.object({
80
+ limit: import_zod.z.number().int().min(1).max(200).default(50).describe("Max results to return"),
81
+ offset: import_zod.z.number().int().min(0).default(0).describe("Pagination offset")
82
+ });
83
+ var GetBookingPageSchema = import_zod.z.object({
84
+ booking_page_id: import_zod.z.string().describe("Booking page ID to fetch (bkp_...)")
85
+ });
86
+ var CreateBookingPageSchema = import_zod.z.object({
87
+ calendar_id: import_zod.z.string().describe("Calendar a booking resolves to (from create_calendar/list_calendars)."),
88
+ title: import_zod.z.string().min(1).max(200).describe("Meeting title shown on the page."),
89
+ description: import_zod.z.string().max(2e3).optional().describe("Optional description shown to the booker."),
90
+ duration_minutes: import_zod.z.number().int().min(5).max(480).optional().describe("Slot length in minutes (default 30)."),
91
+ buffer_minutes: import_zod.z.number().int().min(0).max(120).optional().describe("Padding before/after existing events (default 0)."),
92
+ window_days: import_zod.z.number().int().min(1).max(365).optional().describe("How far ahead bookings are allowed (default 14)."),
93
+ min_notice_minutes: import_zod.z.number().int().min(0).max(40320).optional().describe("Minimum lead time before a bookable slot (default 0)."),
94
+ timezone: import_zod.z.string().min(1).max(64).optional().describe("IANA timezone for display + working hours (default UTC)."),
95
+ availability_constraints: import_zod.z.record(import_zod.z.string(), import_zod.z.object({ start: import_zod.z.string(), end: import_zod.z.string() })).nullable().optional().describe('Weekly working hours, e.g. {"mon":{"start":"09:00","end":"17:00"}}. Omit/null for any time in the window.'),
96
+ active: import_zod.z.boolean().optional().describe("Whether the page accepts bookings (default true).")
97
+ });
98
+ var DeleteBookingPageSchema = import_zod.z.object({
99
+ booking_page_id: import_zod.z.string().describe("Booking page ID to delete (bkp_...)")
100
+ });
79
101
  var ListEventsSchema = import_zod.z.object({
80
102
  calendar_id: import_zod.z.string().optional().describe("Calendar ID to list events from. Provide this or agent_id."),
81
103
  agent_id: import_zod.z.string().optional().describe("Agent ID to list events for across all of the agent's calendars. Provide this or calendar_id."),
@@ -174,6 +196,15 @@ var FindMeetingTimeSchema = import_zod.z.object({
174
196
  calendars: import_zod.z.array(import_zod.z.string()).optional().describe("Additional shared calendar IDs to treat as busy"),
175
197
  include_busy: import_zod.z.boolean().default(false).describe("Include per-agent busy blocks in response")
176
198
  });
199
+ var CreateConnectionLinkSchema = import_zod.z.object({
200
+ calendar_id: import_zod.z.string().startsWith("cal_").describe("Chronary calendar whose owning agent will receive authorized availability"),
201
+ capabilities: import_zod.z.array(import_zod.z.enum(["availability", "publishing"])).min(1).max(2).default(["availability"]).describe("Request opaque availability and optional publishing permission"),
202
+ publication_policy: import_zod.z.enum(["none", "confirmed", "confirmed_tentative"]).default("none").describe("Desired event publishing policy; a human still selects the destination")
203
+ });
204
+ var GetConnectionLinkSchema = import_zod.z.object({
205
+ connection_link_id: import_zod.z.string().startsWith("csl_").describe("Connection setup link ID")
206
+ });
207
+ var CancelConnectionLinkSchema = GetConnectionLinkSchema;
177
208
  var GetCalendarContextSchema = import_zod.z.object({
178
209
  calendar_id: import_zod.z.string().describe("Calendar ID")
179
210
  });
@@ -367,6 +398,33 @@ var deleteCalendar = safeFunc(async (ctx) => {
367
398
  await ctx.client.calendars.delete(ctx.params.calendar_id);
368
399
  return void 0;
369
400
  });
401
+ var listBookingPages = safeFunc(async (ctx) => {
402
+ const { client, params } = ctx;
403
+ const iter = client.bookingPages.list({ limit: params.limit });
404
+ return fetchPage(iter, params.offset, params.limit);
405
+ });
406
+ var getBookingPage = safeFunc(async (ctx) => {
407
+ return ctx.client.bookingPages.get(ctx.params.booking_page_id);
408
+ });
409
+ var createBookingPage = safeFunc(async (ctx) => {
410
+ const { client, params } = ctx;
411
+ return client.bookingPages.create({
412
+ calendar_id: params.calendar_id,
413
+ title: params.title,
414
+ description: params.description,
415
+ duration_minutes: params.duration_minutes,
416
+ buffer_minutes: params.buffer_minutes,
417
+ window_days: params.window_days,
418
+ min_notice_minutes: params.min_notice_minutes,
419
+ timezone: params.timezone,
420
+ availability_constraints: params.availability_constraints,
421
+ active: params.active
422
+ });
423
+ });
424
+ var deleteBookingPage = safeFunc(async (ctx) => {
425
+ await ctx.client.bookingPages.delete(ctx.params.booking_page_id);
426
+ return void 0;
427
+ });
370
428
  var listEvents = safeFunc(async (ctx) => {
371
429
  const { client, params } = ctx;
372
430
  if (!params.calendar_id && !params.agent_id) {
@@ -470,6 +528,15 @@ var findMeetingTime = safeFunc(async (ctx) => {
470
528
  include_busy: params.include_busy
471
529
  });
472
530
  });
531
+ var createConnectionLink = safeFunc(async (ctx) => {
532
+ const { calendar_id, ...params } = ctx.params;
533
+ return ctx.client.connectionLinks.create(calendar_id, params);
534
+ });
535
+ var getConnectionLink = safeFunc(async (ctx) => ctx.client.connectionLinks.get(ctx.params.connection_link_id));
536
+ var cancelConnectionLink = safeFunc(async (ctx) => {
537
+ await ctx.client.connectionLinks.cancel(ctx.params.connection_link_id);
538
+ return { cancelled: true, id: ctx.params.connection_link_id };
539
+ });
473
540
  var getCalendarContext = safeFunc(async (ctx) => {
474
541
  return ctx.client.calendars.getContext(ctx.params.calendar_id);
475
542
  });
@@ -599,6 +666,9 @@ var HOSTED_API_MCP_TOOL_NAMES = [
599
666
  "update_event",
600
667
  "get_availability",
601
668
  "find_meeting_time",
669
+ "create_connection_link",
670
+ "get_connection_link",
671
+ "cancel_connection_link",
602
672
  "cancel_event",
603
673
  "confirm_event",
604
674
  "release_event",
@@ -634,6 +704,10 @@ var HOSTED_API_MCP_TOOL_NAMES = [
634
704
  "get_calendar",
635
705
  "update_calendar",
636
706
  "delete_calendar",
707
+ "create_booking_page",
708
+ "list_booking_pages",
709
+ "get_booking_page",
710
+ "delete_booking_page",
637
711
  "get_usage",
638
712
  "get_audit_log",
639
713
  "accept_terms"
@@ -675,6 +749,35 @@ var TOOL_DEFINITIONS = [
675
749
  annotations: { title: "Delete Calendar", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
676
750
  execute: createExecutor(deleteCalendar)
677
751
  },
752
+ // ── Booking pages ──────────────────────────────────────────────
753
+ {
754
+ name: "create_booking_page",
755
+ description: "Create a public booking page (Calendly-style scheduling link) for a calendar. Returns a booking_url to send to a human; when they pick a slot, a confirmed event is created on the calendar and an event.created webhook fires with a booking_page_id field. Set availability_constraints to restrict to weekly working hours; existing calendar events always block slots.",
756
+ schema: CreateBookingPageSchema,
757
+ annotations: { title: "Create Booking Page", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
758
+ execute: createExecutor(createBookingPage)
759
+ },
760
+ {
761
+ name: "list_booking_pages",
762
+ description: "List booking pages in the org. Agent-scoped keys see only pages on their own agent's calendars.",
763
+ schema: ListBookingPagesSchema,
764
+ annotations: { title: "List Booking Pages", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
765
+ execute: createExecutor(listBookingPages)
766
+ },
767
+ {
768
+ name: "get_booking_page",
769
+ description: "Fetch a single booking page by ID, including its public booking_url and settings.",
770
+ schema: GetBookingPageSchema,
771
+ annotations: { title: "Get Booking Page", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
772
+ execute: createExecutor(getBookingPage)
773
+ },
774
+ {
775
+ name: "delete_booking_page",
776
+ description: "Delete (deactivate) a booking page. Its hosted URL stops resolving; already-booked events are unaffected.",
777
+ schema: DeleteBookingPageSchema,
778
+ annotations: { title: "Delete Booking Page", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
779
+ execute: createExecutor(deleteBookingPage)
780
+ },
678
781
  // ── Events ─────────────────────────────────────────────────────
679
782
  {
680
783
  name: "list_events",
@@ -764,18 +867,39 @@ var TOOL_DEFINITIONS = [
764
867
  // ── Availability ───────────────────────────────────────────────
765
868
  {
766
869
  name: "get_availability",
767
- description: "Check when a single agent is free within a time range. Accepts `start`/`end` (preferred \u2014 matches the underlying availability service) or `start_time`/`end_time` (aliases that match the REST events schema).",
870
+ description: "Check when a single agent is free across Chronary and authorized human calendars. This tool is fail-closed: always inspect availability_state and warnings before using slots.",
768
871
  schema: GetAvailabilitySchema,
769
872
  annotations: { title: "Get Availability", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
770
873
  execute: createExecutor(getAvailability)
771
874
  },
772
875
  {
773
876
  name: "find_meeting_time",
774
- description: "Find time slots when multiple agents are all free simultaneously. Accepts `agents`/`start`/`end` (preferred \u2014 matches the availability service) or `agent_ids`/`start_time`/`end_time` (aliases that match the REST/scheduling-proposal naming).",
877
+ description: "Find time when multiple agents are free across Chronary and their authorized human calendars. This tool is fail-closed: always inspect availability_state and warnings before using slots.",
775
878
  schema: FindMeetingTimeSchema,
776
879
  annotations: { title: "Find Meeting Time", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
777
880
  execute: createExecutor(findMeetingTime)
778
881
  },
882
+ {
883
+ name: "create_connection_link",
884
+ description: "Request human setup of Google Calendar or Microsoft Outlook for a Chronary calendar. Give setup_url to a human; agents never receive provider credentials or event data. The secret URL is returned only once.",
885
+ schema: CreateConnectionLinkSchema,
886
+ annotations: { title: "Create Human Calendar Setup Link", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
887
+ execute: createExecutor(createConnectionLink)
888
+ },
889
+ {
890
+ name: "get_connection_link",
891
+ description: "Poll provider-neutral human-calendar setup status. The bearer setup URL and provider data are never returned by polling.",
892
+ schema: GetConnectionLinkSchema,
893
+ annotations: { title: "Get Human Calendar Setup Status", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
894
+ execute: createExecutor(getConnectionLink)
895
+ },
896
+ {
897
+ name: "cancel_connection_link",
898
+ description: "Cancel a pending human-calendar setup request and invalidate its setup URL.",
899
+ schema: CancelConnectionLinkSchema,
900
+ annotations: { title: "Cancel Human Calendar Setup Link", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
901
+ execute: createExecutor(cancelConnectionLink)
902
+ },
779
903
  // ── Calendar context ───────────────────────────────────────────
780
904
  {
781
905
  name: "get_calendar_context",