@chronary/toolkit 0.1.3 → 1.0.1

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.
package/dist/index.js CHANGED
@@ -15,44 +15,92 @@ var TOOL_NAMES = [
15
15
  "get_event",
16
16
  "create_event",
17
17
  "update_event",
18
- "delete_event",
19
- "check_availability",
18
+ "cancel_event",
19
+ "confirm_event",
20
+ "release_event",
21
+ "create_agent",
22
+ "list_agents",
23
+ "get_agent",
24
+ "update_agent",
25
+ "delete_agent",
26
+ "get_availability",
27
+ "find_meeting_time",
28
+ "get_calendar_context",
29
+ "create_proposal",
30
+ "list_proposals",
31
+ "get_proposal",
32
+ "respond_to_proposal",
33
+ "resolve_proposal",
34
+ "cancel_proposal",
35
+ "set_availability_rules",
36
+ "get_availability_rules",
37
+ "clear_availability_rules",
20
38
  "list_webhooks",
21
39
  "get_webhook",
22
40
  "create_webhook",
23
41
  "update_webhook",
24
42
  "delete_webhook",
43
+ "list_webhook_deliveries",
25
44
  "list_ical_subscriptions",
26
45
  "get_ical_subscription",
27
- "create_ical_subscription",
46
+ "subscribe_ical",
28
47
  "update_ical_subscription",
29
48
  "delete_ical_subscription",
30
49
  "sync_ical_subscription",
50
+ "create_scoped_key",
51
+ "list_scoped_keys",
52
+ "revoke_scoped_key",
53
+ "get_audit_log",
54
+ "accept_terms",
31
55
  "get_usage"
32
56
  ];
33
57
 
34
58
  // src/schemas.ts
35
59
  var schemas_exports = {};
36
60
  __export(schemas_exports, {
37
- CheckAvailabilitySchema: () => CheckAvailabilitySchema,
61
+ AcceptTermsSchema: () => AcceptTermsSchema,
62
+ CancelEventSchema: () => CancelEventSchema,
63
+ CancelProposalSchema: () => CancelProposalSchema,
64
+ ClearAvailabilityRulesSchema: () => ClearAvailabilityRulesSchema,
65
+ ConfirmEventSchema: () => ConfirmEventSchema,
66
+ CreateAgentSchema: () => CreateAgentSchema,
38
67
  CreateCalendarSchema: () => CreateCalendarSchema,
39
68
  CreateEventSchema: () => CreateEventSchema,
40
- CreateICalSubscriptionSchema: () => CreateICalSubscriptionSchema,
69
+ CreateProposalSchema: () => CreateProposalSchema,
70
+ CreateScopedKeySchema: () => CreateScopedKeySchema,
41
71
  CreateWebhookSchema: () => CreateWebhookSchema,
72
+ DeleteAgentSchema: () => DeleteAgentSchema,
42
73
  DeleteCalendarSchema: () => DeleteCalendarSchema,
43
- DeleteEventSchema: () => DeleteEventSchema,
44
74
  DeleteICalSubscriptionSchema: () => DeleteICalSubscriptionSchema,
45
75
  DeleteWebhookSchema: () => DeleteWebhookSchema,
76
+ FindMeetingTimeSchema: () => FindMeetingTimeSchema,
77
+ GetAgentSchema: () => GetAgentSchema,
78
+ GetAuditLogSchema: () => GetAuditLogSchema,
79
+ GetAvailabilityRulesSchema: () => GetAvailabilityRulesSchema,
80
+ GetAvailabilitySchema: () => GetAvailabilitySchema,
81
+ GetCalendarContextSchema: () => GetCalendarContextSchema,
46
82
  GetCalendarSchema: () => GetCalendarSchema,
47
83
  GetEventSchema: () => GetEventSchema,
48
84
  GetICalSubscriptionSchema: () => GetICalSubscriptionSchema,
85
+ GetProposalSchema: () => GetProposalSchema,
49
86
  GetUsageSchema: () => GetUsageSchema,
50
87
  GetWebhookSchema: () => GetWebhookSchema,
88
+ ListAgentsSchema: () => ListAgentsSchema,
51
89
  ListCalendarsSchema: () => ListCalendarsSchema,
52
90
  ListEventsSchema: () => ListEventsSchema,
53
91
  ListICalSubscriptionsSchema: () => ListICalSubscriptionsSchema,
92
+ ListProposalsSchema: () => ListProposalsSchema,
93
+ ListScopedKeysSchema: () => ListScopedKeysSchema,
94
+ ListWebhookDeliveriesSchema: () => ListWebhookDeliveriesSchema,
54
95
  ListWebhooksSchema: () => ListWebhooksSchema,
96
+ ReleaseEventSchema: () => ReleaseEventSchema,
97
+ ResolveProposalSchema: () => ResolveProposalSchema,
98
+ RespondToProposalSchema: () => RespondToProposalSchema,
99
+ RevokeScopedKeySchema: () => RevokeScopedKeySchema,
100
+ SetAvailabilityRulesSchema: () => SetAvailabilityRulesSchema,
101
+ SubscribeICalSchema: () => SubscribeICalSchema,
55
102
  SyncICalSubscriptionSchema: () => SyncICalSubscriptionSchema,
103
+ UpdateAgentSchema: () => UpdateAgentSchema,
56
104
  UpdateCalendarSchema: () => UpdateCalendarSchema,
57
105
  UpdateEventSchema: () => UpdateEventSchema,
58
106
  UpdateICalSubscriptionSchema: () => UpdateICalSubscriptionSchema,
@@ -72,13 +120,15 @@ var CreateCalendarSchema = z.object({
72
120
  name: z.string().describe("Calendar name"),
73
121
  timezone: z.string().describe('IANA timezone (e.g., "America/New_York")'),
74
122
  agent_id: z.string().optional().describe("Agent ID to associate the calendar with"),
75
- metadata: z.record(z.unknown()).optional().describe("Arbitrary key-value metadata")
123
+ default_reminders: z.array(z.number().int().min(1).max(40320)).max(5).nullable().optional().describe("Default reminder offsets in minutes before start, inherited by events that don't set their own (e.g. [10, 1440]). null/omit = system default (10 min); [] = no reminders. Max 5, each 1\u201340320."),
124
+ metadata: z.record(z.string(), z.unknown()).optional().describe("Arbitrary key-value metadata")
76
125
  });
77
126
  var UpdateCalendarSchema = z.object({
78
127
  calendar_id: z.string().describe("The calendar ID to update"),
79
128
  name: z.string().optional().describe("New calendar name"),
80
129
  timezone: z.string().optional().describe("New IANA timezone"),
81
- metadata: z.record(z.unknown()).optional().describe("Updated metadata")
130
+ default_reminders: z.array(z.number().int().min(1).max(40320)).max(5).nullable().optional().describe("New default reminder offsets in minutes before start. null = system default (10 min); [] = no reminders. Max 5, each 1\u201340320."),
131
+ metadata: z.record(z.string(), z.unknown()).optional().describe("Updated metadata")
82
132
  });
83
133
  var DeleteCalendarSchema = z.object({
84
134
  calendar_id: z.string().describe("The calendar ID to delete")
@@ -105,7 +155,8 @@ var CreateEventSchema = z.object({
105
155
  description: z.string().optional().describe("Event description"),
106
156
  all_day: z.boolean().optional().describe("Whether this is an all-day event"),
107
157
  status: z.enum(["confirmed", "tentative", "cancelled"]).optional().describe('Event status (default "confirmed")'),
108
- metadata: z.record(z.unknown()).optional().describe("Arbitrary key-value metadata")
158
+ reminders: z.array(z.number().int().min(1).max(40320)).max(5).nullable().optional().describe("Reminder offsets in minutes before start (e.g. [10, 1440]). Each fires an event.reminder webhook. null/omit = inherit calendar default (then 10 min); [] = no reminders. Max 5, each 1\u201340320."),
159
+ metadata: z.record(z.string(), z.unknown()).optional().describe("Arbitrary key-value metadata")
109
160
  });
110
161
  var UpdateEventSchema = z.object({
111
162
  calendar_id: z.string().describe("Calendar ID the event belongs to"),
@@ -116,20 +167,145 @@ var UpdateEventSchema = z.object({
116
167
  end_time: z.string().optional().describe("New end time in ISO 8601 format"),
117
168
  all_day: z.boolean().optional().describe("Whether this is an all-day event"),
118
169
  status: z.enum(["confirmed", "tentative", "cancelled"]).optional().describe("New event status"),
119
- metadata: z.record(z.unknown()).optional().describe("Updated metadata")
170
+ reminders: z.array(z.number().int().min(1).max(40320)).max(5).nullable().optional().describe("New reminder offsets in minutes before start. null = inherit calendar default; [] = no reminders. Max 5, each 1\u201340320."),
171
+ metadata: z.record(z.string(), z.unknown()).optional().describe("Updated metadata")
120
172
  });
121
- var DeleteEventSchema = z.object({
122
- calendar_id: z.string().describe("Calendar ID the event belongs to"),
123
- event_id: z.string().describe("The event ID to delete")
124
- });
125
- var CheckAvailabilitySchema = z.object({
126
- agents: z.array(z.string()).min(1).describe("Agent IDs to check availability for"),
127
- start: z.string().describe("Start of time range in ISO 8601 format"),
128
- end: z.string().describe("End of time range in ISO 8601 format"),
129
- slot_duration: z.enum(["15m", "30m", "45m", "1h", "2h"]).optional().describe('Duration of availability slots (default "30m")'),
130
- calendars: z.array(z.string()).optional().describe("Specific calendar IDs to check (default: all agent calendars)"),
173
+ var CancelEventSchema = z.object({
174
+ calendar_id: z.string().describe("Calendar ID that owns the event"),
175
+ event_id: z.string().describe("Event ID to cancel")
176
+ });
177
+ var ConfirmEventSchema = z.object({
178
+ event_id: z.string().describe("Event ID of the hold to confirm")
179
+ });
180
+ var ReleaseEventSchema = z.object({
181
+ event_id: z.string().describe("Event ID of the hold to release")
182
+ });
183
+ var CreateAgentSchema = z.object({
184
+ name: z.string().min(1).max(255).describe("Display name for the agent"),
185
+ type: z.enum(["ai", "human", "resource"]).describe("Agent type"),
186
+ description: z.string().optional().describe("Optional description"),
187
+ metadata: z.record(z.string(), z.unknown()).optional().describe("Arbitrary key-value metadata")
188
+ });
189
+ var ListAgentsSchema = z.object({
190
+ type: z.enum(["ai", "human", "resource"]).optional().describe("Filter by agent type"),
191
+ status: z.enum(["active", "paused", "decommissioned"]).optional().describe("Filter by status"),
192
+ limit: z.number().int().min(1).max(200).optional().describe("Max results per page (default 50)"),
193
+ offset: z.number().int().min(0).optional().describe("Pagination offset (default 0)")
194
+ });
195
+ var GetAgentSchema = z.object({
196
+ agent_id: z.string().describe("Agent ID to fetch")
197
+ });
198
+ var UpdateAgentSchema = z.object({
199
+ agent_id: z.string().describe("Agent ID to update"),
200
+ name: z.string().min(1).max(255).optional().describe("New display name"),
201
+ description: z.string().nullable().optional().describe("New description (null to clear)"),
202
+ metadata: z.record(z.string(), z.unknown()).optional().describe("Arbitrary metadata (max 16KB)"),
203
+ status: z.enum(["active", "paused"]).optional().describe("Operational status")
204
+ });
205
+ var DeleteAgentSchema = z.object({
206
+ agent_id: z.string().describe("Agent ID to decommission")
207
+ });
208
+ var GetAvailabilitySchema = z.object({
209
+ agent_id: z.string().describe("Agent ID to check availability for"),
210
+ start: z.string().describe("Range start (ISO 8601)"),
211
+ end: z.string().describe("Range end (ISO 8601)"),
212
+ slot_duration: z.enum(["15m", "30m", "45m", "1h", "2h"]).optional().describe('Minimum slot duration required (default "30m")'),
131
213
  include_busy: z.boolean().optional().describe("Include busy blocks in response")
132
214
  });
215
+ var FindMeetingTimeSchema = z.object({
216
+ agents: z.array(z.string()).min(1).describe("Array of agent IDs to find common free time for. All agents must be free during the returned slots."),
217
+ start: z.string().describe("Search range start (ISO 8601)"),
218
+ end: z.string().describe("Search range end (ISO 8601)"),
219
+ slot_duration: z.enum(["15m", "30m", "45m", "1h", "2h"]).optional().describe('Minimum slot duration required (default "30m")'),
220
+ calendars: z.array(z.string()).optional().describe("Additional shared calendar IDs to treat as busy"),
221
+ include_busy: z.boolean().optional().describe("Include per-agent busy blocks in response")
222
+ });
223
+ var GetCalendarContextSchema = z.object({
224
+ calendar_id: z.string().describe("Calendar ID")
225
+ });
226
+ var proposalSlotSchema = z.object({
227
+ start_time: z.string().describe("Slot start (ISO 8601)"),
228
+ end_time: z.string().describe("Slot end (ISO 8601)"),
229
+ weight: z.number().min(0).max(10).optional().describe("Preference weight (default 1.0)"),
230
+ calendar_id: z.string().optional().describe("Override calendar for this slot")
231
+ });
232
+ var CreateProposalSchema = z.object({
233
+ title: z.string().min(1).max(500).describe("Short description of what the meeting is about"),
234
+ description: z.string().max(5e3).optional().describe("Longer context/agenda"),
235
+ organizer_agent_id: z.string().describe("Agent ID proposing the meeting"),
236
+ participant_agent_ids: z.array(z.string()).min(1).max(50).describe("Agent IDs invited to respond"),
237
+ calendar_id: z.string().describe("Calendar the resolved event will be created on"),
238
+ slots: z.array(proposalSlotSchema).min(1).max(20).describe("Candidate time slots (up to 20)"),
239
+ expires_at: z.string().optional().describe("Auto-cancel cutoff if unresolved (ISO 8601)")
240
+ });
241
+ var ListProposalsSchema = z.object({
242
+ status: z.enum(["pending", "confirmed", "expired", "cancelled"]).optional().describe("Filter by proposal status"),
243
+ organizer_agent_id: z.string().optional().describe("Filter by organizer agent"),
244
+ limit: z.number().int().min(1).max(200).optional().describe("Max results (default 50)"),
245
+ offset: z.number().int().min(0).optional().describe("Pagination offset (default 0)")
246
+ });
247
+ var GetProposalSchema = z.object({
248
+ proposal_id: z.string().describe("Proposal to fetch")
249
+ });
250
+ var RespondToProposalSchema = z.object({
251
+ proposal_id: z.string().describe("Proposal to respond to"),
252
+ agent_id: z.string().describe("Participant agent responding"),
253
+ response: z.enum(["accept", "decline", "counter"]).describe("Decision from this agent"),
254
+ selected_slot_id: z.string().optional().describe('Required when response is "accept"'),
255
+ counter_slots: z.array(proposalSlotSchema).max(20).optional().describe('Alternative slots when response is "counter"'),
256
+ message: z.string().max(2e3).optional().describe("Optional note for the organizer")
257
+ });
258
+ var ResolveProposalSchema = z.object({
259
+ proposal_id: z.string().describe("Proposal to resolve")
260
+ });
261
+ var CancelProposalSchema = z.object({
262
+ proposal_id: z.string().describe("Proposal to cancel")
263
+ });
264
+ var workingHoursDaySchema = z.object({
265
+ start: z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, "must be HH:MM in 24-hour time"),
266
+ end: z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, "must be HH:MM in 24-hour time")
267
+ });
268
+ var workingHoursSchema = z.object({
269
+ mon: workingHoursDaySchema.optional(),
270
+ tue: workingHoursDaySchema.optional(),
271
+ wed: workingHoursDaySchema.optional(),
272
+ thu: workingHoursDaySchema.optional(),
273
+ fri: workingHoursDaySchema.optional(),
274
+ sat: workingHoursDaySchema.optional(),
275
+ sun: workingHoursDaySchema.optional()
276
+ }).nullable();
277
+ var SetAvailabilityRulesSchema = z.object({
278
+ calendar_id: z.string().describe("Calendar to configure"),
279
+ buffer_before_minutes: z.number().int().min(0).max(120).optional().describe("Minutes of buffer before each event (0\u2013120)"),
280
+ buffer_after_minutes: z.number().int().min(0).max(120).optional().describe("Minutes of buffer after each event (0\u2013120)"),
281
+ working_hours: workingHoursSchema.optional().describe("Per-day working hours map in the calendar's timezone; omit keys for off-days. Pass null to remove any working-hours constraint."),
282
+ timezone: z.string().min(1).max(64).optional().describe("IANA timezone used to interpret working_hours (e.g. America/New_York)")
283
+ });
284
+ var GetAvailabilityRulesSchema = z.object({
285
+ calendar_id: z.string().describe("Calendar to read")
286
+ });
287
+ var ClearAvailabilityRulesSchema = z.object({
288
+ calendar_id: z.string().describe("Calendar whose rules should be cleared")
289
+ });
290
+ var CreateScopedKeySchema = z.object({
291
+ agent_id: z.string().regex(/^agt_/).describe("Agent ID this key is scoped to"),
292
+ label: z.string().min(1).max(100).optional().describe("Human-readable label for the key")
293
+ });
294
+ var ListScopedKeysSchema = z.object({});
295
+ var RevokeScopedKeySchema = z.object({
296
+ key_id: z.string().describe("ID of the scoped key to revoke")
297
+ });
298
+ var GetAuditLogSchema = z.object({
299
+ from: z.string().optional().describe("Start of the window (ISO 8601). Silently clamped to the plan retention window if older."),
300
+ to: z.string().optional().describe("End of the window (ISO 8601)"),
301
+ action: z.string().min(1).max(64).optional().describe("Filter by action name (e.g. event.created)"),
302
+ actor_key_prefix: z.string().min(1).max(32).optional().describe("Filter by the API key prefix that performed the action"),
303
+ cursor: z.string().min(1).max(256).optional().describe("Opaque pagination cursor from a previous response"),
304
+ limit: z.number().int().min(1).max(200).optional().describe("Max results to return (default 50)")
305
+ });
306
+ var AcceptTermsSchema = z.object({
307
+ tos_version: z.string().min(1).describe("The terms-of-service version to accept; must match the current version")
308
+ });
133
309
  var ListWebhooksSchema = z.object({
134
310
  limit: z.number().int().min(1).max(100).optional().describe("Max results per page (default 20)"),
135
311
  offset: z.number().int().min(0).optional().describe("Pagination offset (default 0)")
@@ -159,11 +335,18 @@ var ListICalSubscriptionsSchema = z.object({
159
335
  var GetICalSubscriptionSchema = z.object({
160
336
  subscription_id: z.string().describe("The iCal subscription ID to retrieve")
161
337
  });
162
- var CreateICalSubscriptionSchema = z.object({
163
- agent_id: z.string().describe("Agent ID to create the subscription for"),
164
- calendar_id: z.string().describe("Calendar ID to import events into"),
165
- url: z.string().describe("HTTPS URL of the iCal feed to subscribe to"),
166
- label: z.string().optional().describe("Human-readable label for the subscription")
338
+ var SubscribeICalSchema = z.object({
339
+ agent_id: z.string().describe("Agent ID that will own this subscription"),
340
+ calendar_id: z.string().describe("Calendar ID to sync external events into"),
341
+ url: z.string().url().describe("HTTPS URL of the iCal feed (.ics) to subscribe to"),
342
+ label: z.string().optional().describe("Optional label for this subscription")
343
+ });
344
+ var ListWebhookDeliveriesSchema = z.object({
345
+ webhook_id: z.string().describe("Webhook subscription whose deliveries to list"),
346
+ limit: z.number().int().min(1).max(100).optional().describe("Max results to return (default 20)"),
347
+ offset: z.number().int().min(0).optional().describe("Pagination offset (default 0)"),
348
+ status: z.enum(["pending", "delivered", "failed"]).optional().describe("Filter to a single delivery status"),
349
+ include_payload: z.boolean().optional().describe("Include the full event payload sent on each delivery")
167
350
  });
168
351
  var UpdateICalSubscriptionSchema = z.object({
169
352
  subscription_id: z.string().describe("The iCal subscription ID to update"),
@@ -216,6 +399,7 @@ var createCalendar = safeFunc(async (ctx) => {
216
399
  name: params.name,
217
400
  timezone: params.timezone,
218
401
  agentId: params.agent_id,
402
+ default_reminders: params.default_reminders,
219
403
  metadata: params.metadata
220
404
  });
221
405
  });
@@ -254,13 +438,99 @@ var updateEvent = safeFunc(async (ctx) => {
254
438
  const { calendar_id, event_id, ...updates } = params;
255
439
  return client.events.update(calendar_id, event_id, updates);
256
440
  });
257
- var deleteEvent = safeFunc(async (ctx) => {
441
+ var cancelEvent = safeFunc(async (ctx) => {
258
442
  await ctx.client.events.delete(ctx.params.calendar_id, ctx.params.event_id);
259
443
  return void 0;
260
444
  });
261
- var checkAvailability = safeFunc(async (ctx) => {
445
+ var confirmEvent = safeFunc(async (ctx) => {
446
+ return ctx.client.events.confirm(ctx.params.event_id);
447
+ });
448
+ var releaseEvent = safeFunc(async (ctx) => {
449
+ return ctx.client.events.release(ctx.params.event_id);
450
+ });
451
+ var createAgent = safeFunc(async (ctx) => {
452
+ return ctx.client.agents.create(ctx.params);
453
+ });
454
+ var listAgents = safeFunc(async (ctx) => {
455
+ const { client, params } = ctx;
456
+ const iter = client.agents.list({ type: params.type, status: params.status, limit: params.limit });
457
+ return fetchPage(iter, params.offset, params.limit);
458
+ });
459
+ var getAgent = safeFunc(async (ctx) => {
460
+ return ctx.client.agents.get(ctx.params.agent_id);
461
+ });
462
+ var updateAgent = safeFunc(async (ctx) => {
463
+ const { client, params } = ctx;
464
+ const { agent_id, ...updates } = params;
465
+ return client.agents.update(agent_id, updates);
466
+ });
467
+ var deleteAgent = safeFunc(async (ctx) => {
468
+ await ctx.client.agents.delete(ctx.params.agent_id);
469
+ return void 0;
470
+ });
471
+ var getAvailability = safeFunc(async (ctx) => {
472
+ const { client, params } = ctx;
473
+ return client.availability.forAgent(params.agent_id, {
474
+ start: params.start,
475
+ end: params.end,
476
+ slot_duration: params.slot_duration,
477
+ include_busy: params.include_busy
478
+ });
479
+ });
480
+ var findMeetingTime = safeFunc(async (ctx) => {
262
481
  return ctx.client.availability.check(ctx.params);
263
482
  });
483
+ var getCalendarContext = safeFunc(async (ctx) => {
484
+ return ctx.client.calendars.getContext(ctx.params.calendar_id);
485
+ });
486
+ var createProposal = safeFunc(async (ctx) => {
487
+ return ctx.client.scheduling.create(ctx.params);
488
+ });
489
+ var listProposals = safeFunc(async (ctx) => {
490
+ const { client, params } = ctx;
491
+ const iter = client.scheduling.list({
492
+ status: params.status,
493
+ organizer_agent_id: params.organizer_agent_id,
494
+ limit: params.limit
495
+ });
496
+ return fetchPage(iter, params.offset, params.limit);
497
+ });
498
+ var getProposal = safeFunc(async (ctx) => {
499
+ return ctx.client.scheduling.get(ctx.params.proposal_id);
500
+ });
501
+ var respondToProposal = safeFunc(async (ctx) => {
502
+ const { client, params } = ctx;
503
+ const { proposal_id, ...body } = params;
504
+ return client.scheduling.respond(proposal_id, body);
505
+ });
506
+ var resolveProposal = safeFunc(async (ctx) => {
507
+ return ctx.client.scheduling.resolve(ctx.params.proposal_id);
508
+ });
509
+ var cancelProposal = safeFunc(async (ctx) => {
510
+ return ctx.client.scheduling.cancel(ctx.params.proposal_id);
511
+ });
512
+ var setAvailabilityRules = safeFunc(async (ctx) => {
513
+ const { client, params } = ctx;
514
+ const { calendar_id, ...rules } = params;
515
+ return client.calendars.setAvailabilityRules(calendar_id, rules);
516
+ });
517
+ var getAvailabilityRules = safeFunc(async (ctx) => {
518
+ return ctx.client.calendars.getAvailabilityRules(ctx.params.calendar_id);
519
+ });
520
+ var clearAvailabilityRules = safeFunc(async (ctx) => {
521
+ await ctx.client.calendars.deleteAvailabilityRules(ctx.params.calendar_id);
522
+ return void 0;
523
+ });
524
+ var createScopedKey = safeFunc(async (ctx) => {
525
+ return ctx.client.keys.create(ctx.params);
526
+ });
527
+ var listScopedKeys = safeFunc(async (ctx) => {
528
+ return ctx.client.keys.list();
529
+ });
530
+ var revokeScopedKey = safeFunc(async (ctx) => {
531
+ await ctx.client.keys.delete(ctx.params.key_id);
532
+ return void 0;
533
+ });
264
534
  var listWebhooks = safeFunc(async (ctx) => {
265
535
  const { client, params } = ctx;
266
536
  const iter = client.webhooks.list({ limit: params.limit });
@@ -281,6 +551,17 @@ var deleteWebhook = safeFunc(async (ctx) => {
281
551
  await ctx.client.webhooks.delete(ctx.params.webhook_id);
282
552
  return void 0;
283
553
  });
554
+ var listWebhookDeliveries = safeFunc(async (ctx) => {
555
+ const { client, params } = ctx;
556
+ const { webhook_id, ...query } = params;
557
+ return client.webhooks.listDeliveries(webhook_id, query);
558
+ });
559
+ var getAuditLog = safeFunc(async (ctx) => {
560
+ return ctx.client.auditLog.list(ctx.params);
561
+ });
562
+ var acceptTerms = safeFunc(async (ctx) => {
563
+ return ctx.client.terms.accept(ctx.params);
564
+ });
284
565
  var listICalSubscriptions = safeFunc(async (ctx) => {
285
566
  const { client, params } = ctx;
286
567
  const iter = client.icalSubscriptions.list({
@@ -293,7 +574,7 @@ var listICalSubscriptions = safeFunc(async (ctx) => {
293
574
  var getICalSubscription = safeFunc(async (ctx) => {
294
575
  return ctx.client.icalSubscriptions.get(ctx.params.subscription_id);
295
576
  });
296
- var createICalSubscription = safeFunc(async (ctx) => {
577
+ var subscribeICal = safeFunc(async (ctx) => {
297
578
  const { client, params } = ctx;
298
579
  const { agent_id, ...subParams } = params;
299
580
  return client.icalSubscriptions.create(agent_id, subParams);
@@ -324,12 +605,19 @@ var HOSTED_API_MCP_TOOL_NAMES = [
324
605
  "create_calendar",
325
606
  "create_event",
326
607
  "list_events",
608
+ "get_event",
609
+ "update_event",
327
610
  "get_availability",
328
611
  "find_meeting_time",
329
612
  "cancel_event",
330
613
  "confirm_event",
331
614
  "release_event",
332
615
  "subscribe_ical",
616
+ "list_ical_subscriptions",
617
+ "get_ical_subscription",
618
+ "update_ical_subscription",
619
+ "delete_ical_subscription",
620
+ "sync_ical_subscription",
333
621
  "get_calendar_context",
334
622
  "create_proposal",
335
623
  "list_proposals",
@@ -339,7 +627,26 @@ var HOSTED_API_MCP_TOOL_NAMES = [
339
627
  "cancel_proposal",
340
628
  "set_availability_rules",
341
629
  "get_availability_rules",
342
- "clear_availability_rules"
630
+ "clear_availability_rules",
631
+ "create_scoped_key",
632
+ "list_scoped_keys",
633
+ "revoke_scoped_key",
634
+ "create_webhook",
635
+ "list_webhooks",
636
+ "get_webhook",
637
+ "update_webhook",
638
+ "delete_webhook",
639
+ "list_webhook_deliveries",
640
+ "get_agent",
641
+ "update_agent",
642
+ "delete_agent",
643
+ "list_calendars",
644
+ "get_calendar",
645
+ "update_calendar",
646
+ "delete_calendar",
647
+ "get_usage",
648
+ "get_audit_log",
649
+ "accept_terms"
343
650
  ];
344
651
  var TOOL_DEFINITIONS = [
345
652
  // ── Calendars ──────────────────────────────────────────────────
@@ -408,19 +715,149 @@ var TOOL_DEFINITIONS = [
408
715
  execute: createExecutor(updateEvent)
409
716
  },
410
717
  {
411
- name: "delete_event",
412
- description: "Delete an event from a calendar. This frees the agent's availability during that time.",
413
- schema: DeleteEventSchema,
414
- annotations: { title: "Delete Event", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
415
- execute: createExecutor(deleteEvent)
718
+ name: "cancel_event",
719
+ description: "Delete or cancel an event from a calendar. The event is marked cancelled and excluded from future availability calculations.",
720
+ schema: CancelEventSchema,
721
+ annotations: { title: "Cancel Event", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
722
+ execute: createExecutor(cancelEvent)
723
+ },
724
+ {
725
+ name: "confirm_event",
726
+ description: 'Promote a held event to a confirmed booking. The event must currently have status="hold" and its hold_expires_at must not have passed.',
727
+ schema: ConfirmEventSchema,
728
+ annotations: { title: "Confirm Event", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
729
+ execute: createExecutor(confirmEvent)
730
+ },
731
+ {
732
+ name: "release_event",
733
+ description: 'Manually release a held event before its hold_expires_at. The event must currently have status="hold". Frees the slot for other agents to book.',
734
+ schema: ReleaseEventSchema,
735
+ annotations: { title: "Release Event", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
736
+ execute: createExecutor(releaseEvent)
737
+ },
738
+ // ── Agents ─────────────────────────────────────────────────────
739
+ {
740
+ name: "create_agent",
741
+ description: "Register your agent (AI assistant, human participant, or resource) with Chronary so it can own calendars, events, and webhooks.",
742
+ schema: CreateAgentSchema,
743
+ annotations: { title: "Create Agent", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
744
+ execute: createExecutor(createAgent)
745
+ },
746
+ {
747
+ name: "list_agents",
748
+ description: "List all agents in your organization. Returns paginated results.",
749
+ schema: ListAgentsSchema,
750
+ annotations: { title: "List Agents", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
751
+ execute: createExecutor(listAgents)
752
+ },
753
+ {
754
+ name: "get_agent",
755
+ description: "Fetch a single agent by ID. An agent represents an AI assistant, human, or shared resource (e.g. a meeting room).",
756
+ schema: GetAgentSchema,
757
+ annotations: { title: "Get Agent", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
758
+ execute: createExecutor(getAgent)
759
+ },
760
+ {
761
+ name: "update_agent",
762
+ description: "Update an agent's name, description, metadata, or status (active/paused). Requires an org-level API key.",
763
+ schema: UpdateAgentSchema,
764
+ annotations: { title: "Update Agent", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
765
+ execute: createExecutor(updateAgent)
766
+ },
767
+ {
768
+ name: "delete_agent",
769
+ description: "Decommission an agent. This marks the agent as decommissioned and revokes all of its scoped API keys. Requires an org-level API key.",
770
+ schema: DeleteAgentSchema,
771
+ annotations: { title: "Delete Agent", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
772
+ execute: createExecutor(deleteAgent)
416
773
  },
417
774
  // ── Availability ───────────────────────────────────────────────
418
775
  {
419
- name: "check_availability",
420
- description: "Check free/busy availability across one or more agents within a time range. Returns available time slots and optionally busy blocks.",
421
- schema: CheckAvailabilitySchema,
422
- annotations: { title: "Check Availability", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
423
- execute: createExecutor(checkAvailability)
776
+ name: "get_availability",
777
+ description: "Check when a single agent is free within a time range. Returns available time slots and optionally busy blocks.",
778
+ schema: GetAvailabilitySchema,
779
+ annotations: { title: "Get Availability", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
780
+ execute: createExecutor(getAvailability)
781
+ },
782
+ {
783
+ name: "find_meeting_time",
784
+ description: "Find time slots when multiple agents are all free simultaneously. All agents must be free during the returned slots.",
785
+ schema: FindMeetingTimeSchema,
786
+ annotations: { title: "Find Meeting Time", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
787
+ execute: createExecutor(findMeetingTime)
788
+ },
789
+ // ── Calendar context ───────────────────────────────────────────
790
+ {
791
+ name: "get_calendar_context",
792
+ description: "Get a calendar's temporal context in a single call: the current event, the next upcoming event, recent past events, a short upcoming window, and the owning agent's status.",
793
+ schema: GetCalendarContextSchema,
794
+ annotations: { title: "Get Calendar Context", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
795
+ execute: createExecutor(getCalendarContext)
796
+ },
797
+ // ── Scheduling proposals ───────────────────────────────────────
798
+ {
799
+ name: "create_proposal",
800
+ description: "Create a scheduling proposal \u2014 send candidate time slots to one or more participant agents so they can accept, decline, or counter-propose. Requires an org-level API key. Pro plan only.",
801
+ schema: CreateProposalSchema,
802
+ annotations: { title: "Create Proposal", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
803
+ execute: createExecutor(createProposal)
804
+ },
805
+ {
806
+ name: "list_proposals",
807
+ description: "List scheduling proposals for the org. Filter by status or organizer_agent_id. Requires an org-level API key.",
808
+ schema: ListProposalsSchema,
809
+ annotations: { title: "List Proposals", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
810
+ execute: createExecutor(listProposals)
811
+ },
812
+ {
813
+ name: "get_proposal",
814
+ description: "Get a scheduling proposal by id, including its slots and per-participant responses. Requires an org-level API key.",
815
+ schema: GetProposalSchema,
816
+ annotations: { title: "Get Proposal", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
817
+ execute: createExecutor(getProposal)
818
+ },
819
+ {
820
+ name: "respond_to_proposal",
821
+ description: "Submit a response (accept / decline / counter) on behalf of one participant agent to an open proposal. Requires an org-level API key. Pro plan only.",
822
+ schema: RespondToProposalSchema,
823
+ annotations: { title: "Respond To Proposal", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
824
+ execute: createExecutor(respondToProposal)
825
+ },
826
+ {
827
+ name: "resolve_proposal",
828
+ description: "Force-resolve an open proposal using responses collected so far. Picks the highest-scoring slot and creates a confirmed calendar event. Requires an org-level API key. Pro plan only.",
829
+ schema: ResolveProposalSchema,
830
+ annotations: { title: "Resolve Proposal", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
831
+ execute: createExecutor(resolveProposal)
832
+ },
833
+ {
834
+ name: "cancel_proposal",
835
+ description: 'Cancel an open proposal. Fires a proposal.cancelled webhook with reason="organizer_cancelled". Requires an org-level API key. Pro plan only.',
836
+ schema: CancelProposalSchema,
837
+ annotations: { title: "Cancel Proposal", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
838
+ execute: createExecutor(cancelProposal)
839
+ },
840
+ // ── Availability rules ─────────────────────────────────────────
841
+ {
842
+ name: "set_availability_rules",
843
+ description: "Set or replace the availability rules on a calendar \u2014 buffer times before/after events and optional per-day working hours. Upsert: overwrites any existing rules.",
844
+ schema: SetAvailabilityRulesSchema,
845
+ annotations: { title: "Set Availability Rules", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
846
+ execute: createExecutor(setAvailabilityRules)
847
+ },
848
+ {
849
+ name: "get_availability_rules",
850
+ description: "Read the buffer times and working-hours rules configured on a calendar. Returns the rules row, or an error if none are set.",
851
+ schema: GetAvailabilityRulesSchema,
852
+ annotations: { title: "Get Availability Rules", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
853
+ execute: createExecutor(getAvailabilityRules)
854
+ },
855
+ {
856
+ name: "clear_availability_rules",
857
+ description: "Remove the availability rules from a calendar, reverting to the default (no buffers, no working-hours mask).",
858
+ schema: ClearAvailabilityRulesSchema,
859
+ annotations: { title: "Clear Availability Rules", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
860
+ execute: createExecutor(clearAvailabilityRules)
424
861
  },
425
862
  // ── Webhooks ───────────────────────────────────────────────────
426
863
  {
@@ -458,6 +895,13 @@ var TOOL_DEFINITIONS = [
458
895
  annotations: { title: "Delete Webhook", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
459
896
  execute: createExecutor(deleteWebhook)
460
897
  },
898
+ {
899
+ name: "list_webhook_deliveries",
900
+ description: "List delivery attempts for a webhook subscription, with per-status counts (pending/delivered/failed). Use this to debug failing deliveries. Requires an org-level API key.",
901
+ schema: ListWebhookDeliveriesSchema,
902
+ annotations: { title: "List Webhook Deliveries", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
903
+ execute: createExecutor(listWebhookDeliveries)
904
+ },
461
905
  // ── iCal Subscriptions ─────────────────────────────────────────
462
906
  {
463
907
  name: "list_ical_subscriptions",
@@ -474,11 +918,11 @@ var TOOL_DEFINITIONS = [
474
918
  execute: createExecutor(getICalSubscription)
475
919
  },
476
920
  {
477
- name: "create_ical_subscription",
478
- description: "Import an external calendar by subscribing to an iCal feed URL. Events are synced every 30 minutes.",
479
- schema: CreateICalSubscriptionSchema,
480
- annotations: { title: "Create iCal Subscription", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
481
- execute: createExecutor(createICalSubscription)
921
+ name: "subscribe_ical",
922
+ description: "Link an external iCal feed (e.g. a human's Google Calendar) to an agent's calendar so external events appear in availability calculations. Events are synced every 30 minutes.",
923
+ schema: SubscribeICalSchema,
924
+ annotations: { title: "Subscribe iCal", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
925
+ execute: createExecutor(subscribeICal)
482
926
  },
483
927
  {
484
928
  name: "update_ical_subscription",
@@ -501,6 +945,44 @@ var TOOL_DEFINITIONS = [
501
945
  annotations: { title: "Sync iCal Subscription", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
502
946
  execute: createExecutor(syncICalSubscription)
503
947
  },
948
+ // ── Scoped keys ────────────────────────────────────────────────
949
+ {
950
+ name: "create_scoped_key",
951
+ description: "Create an agent-scoped API key (chr_ak_*) that can only act on behalf of a single agent. The plaintext key is returned exactly once. Requires an org-level API key.",
952
+ schema: CreateScopedKeySchema,
953
+ annotations: { title: "Create Scoped Key", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
954
+ execute: createExecutor(createScopedKey)
955
+ },
956
+ {
957
+ name: "list_scoped_keys",
958
+ description: "List all live (non-revoked) agent-scoped API keys for this org. Returns key metadata only \u2014 never the plaintext secret. Requires an org-level API key.",
959
+ schema: ListScopedKeysSchema,
960
+ annotations: { title: "List Scoped Keys", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
961
+ execute: createExecutor(listScopedKeys)
962
+ },
963
+ {
964
+ name: "revoke_scoped_key",
965
+ description: "Revoke an agent-scoped API key by ID. The key stops authenticating immediately and cannot be un-revoked. Requires an org-level API key.",
966
+ schema: RevokeScopedKeySchema,
967
+ annotations: { title: "Revoke Scoped Key", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
968
+ execute: createExecutor(revokeScopedKey)
969
+ },
970
+ // ── Audit log ──────────────────────────────────────────────────
971
+ {
972
+ name: "get_audit_log",
973
+ description: "List audit-log entries for the calling org \u2014 mutating operations and auth-lifecycle events, newest first. Results are clamped to the plan's retention window. Requires an org-level API key.",
974
+ schema: GetAuditLogSchema,
975
+ annotations: { title: "Get Audit Log", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
976
+ execute: createExecutor(getAuditLog)
977
+ },
978
+ // ── Terms ──────────────────────────────────────────────────────
979
+ {
980
+ name: "accept_terms",
981
+ description: "Re-accept the current Chronary terms of service on behalf of the calling org. Use this when responses carry the Chronary-Terms-Upgrade-Required header. Requires an org-level API key.",
982
+ schema: AcceptTermsSchema,
983
+ annotations: { title: "Accept Terms", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
984
+ execute: createExecutor(acceptTerms)
985
+ },
504
986
  // ── Usage ──────────────────────────────────────────────────────
505
987
  {
506
988
  name: "get_usage",