@chronary/toolkit 1.0.1 → 1.2.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.
package/dist/index.cjs CHANGED
@@ -133,72 +133,94 @@ __export(schemas_exports, {
133
133
  UpdateWebhookSchema: () => UpdateWebhookSchema
134
134
  });
135
135
  var import_zod = require("zod");
136
+ var WEBHOOK_EVENT_TYPES = [
137
+ "agent.created",
138
+ "agent.updated",
139
+ "event.created",
140
+ "event.updated",
141
+ "event.deleted",
142
+ "event.started",
143
+ "event.ended",
144
+ "event.reminder",
145
+ "event.hold_created",
146
+ "event.hold_expired",
147
+ "event.hold_released",
148
+ "event.hold_confirmed",
149
+ "proposal.created",
150
+ "proposal.responded",
151
+ "proposal.confirmed",
152
+ "proposal.expired",
153
+ "proposal.cancelled",
154
+ "webhook.deactivated"
155
+ ];
156
+ var WEBHOOK_DELIVERY_STATUSES = ["pending", "delivered", "failed"];
136
157
  var ListCalendarsSchema = import_zod.z.object({
137
- agent_id: import_zod.z.string().optional().describe("Filter calendars by agent ID"),
138
- include: import_zod.z.enum(["all"]).optional().describe('Set to "all" to include soft-deleted calendars'),
139
- limit: import_zod.z.number().int().min(1).max(200).optional().describe("Max results per page (default 50)"),
140
- offset: import_zod.z.number().int().min(0).optional().describe("Pagination offset (default 0)")
158
+ agent_id: import_zod.z.string().optional().describe("Filter to calendars owned by this agent. Org keys only \u2014 agent-scoped keys are always limited to their own agent and ignore this."),
159
+ include: import_zod.z.enum(["all"]).optional().describe('Pass "all" to include calendars across all agents (org keys only)'),
160
+ limit: import_zod.z.number().int().min(1).max(200).default(50).describe("Max results to return"),
161
+ offset: import_zod.z.number().int().min(0).default(0).describe("Pagination offset")
141
162
  });
142
163
  var GetCalendarSchema = import_zod.z.object({
143
- calendar_id: import_zod.z.string().describe("The calendar ID to retrieve")
164
+ calendar_id: import_zod.z.string().describe("Calendar ID to fetch")
144
165
  });
145
166
  var CreateCalendarSchema = import_zod.z.object({
146
- name: import_zod.z.string().describe("Calendar name"),
147
- timezone: import_zod.z.string().describe('IANA timezone (e.g., "America/New_York")'),
148
- agent_id: import_zod.z.string().optional().describe("Agent ID to associate the calendar with"),
149
- default_reminders: import_zod.z.array(import_zod.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."),
150
- metadata: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional().describe("Arbitrary key-value metadata")
167
+ name: import_zod.z.string().min(1).max(255).describe("Calendar name"),
168
+ agent_id: import_zod.z.string().optional().describe("Agent ID to own this calendar (omit for org-level)"),
169
+ timezone: import_zod.z.string().min(1).describe("IANA timezone (e.g. America/New_York)"),
170
+ default_reminders: import_zod.z.array(import_zod.z.number().int().min(1).max(40320)).max(5).nullable().optional().describe("Default reminder offsets in minutes before start, inherited by events on this calendar that don't set their own. Omit or null to use the system default (10 min); [] for no reminders.")
151
171
  });
152
172
  var UpdateCalendarSchema = import_zod.z.object({
153
- calendar_id: import_zod.z.string().describe("The calendar ID to update"),
154
- name: import_zod.z.string().optional().describe("New calendar name"),
155
- timezone: import_zod.z.string().optional().describe("New IANA timezone"),
156
- default_reminders: import_zod.z.array(import_zod.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."),
157
- metadata: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional().describe("Updated metadata")
173
+ calendar_id: import_zod.z.string().describe("Calendar ID to update"),
174
+ name: import_zod.z.string().min(1).max(255).optional().describe("New calendar name"),
175
+ timezone: import_zod.z.string().min(1).optional().describe("New IANA timezone (e.g. America/New_York)"),
176
+ agent_status: import_zod.z.enum(["idle", "working", "waiting", "error"]).optional().describe("Owning agent's status"),
177
+ default_reminders: import_zod.z.array(import_zod.z.number().int().min(1).max(40320)).max(5).nullable().optional().describe("Default reminder offsets in minutes; null for system default, [] for none"),
178
+ metadata: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional().describe("Arbitrary metadata (max 16KB)")
158
179
  });
159
180
  var DeleteCalendarSchema = import_zod.z.object({
160
- calendar_id: import_zod.z.string().describe("The calendar ID to delete")
181
+ calendar_id: import_zod.z.string().describe("Calendar ID to delete")
161
182
  });
162
183
  var ListEventsSchema = import_zod.z.object({
163
- calendar_id: import_zod.z.string().optional().describe("Calendar ID to list events from (provide this or agent_id)"),
164
- agent_id: import_zod.z.string().optional().describe("Agent ID to list events for (provide this or calendar_id)"),
165
- start_after: import_zod.z.string().optional().describe("Only events starting after this ISO 8601 datetime"),
166
- start_before: import_zod.z.string().optional().describe("Only events starting before this ISO 8601 datetime"),
167
- status: import_zod.z.enum(["confirmed", "tentative", "cancelled"]).optional().describe("Filter by event status"),
168
- source: import_zod.z.enum(["internal", "external_ical"]).optional().describe("Filter by event source"),
169
- limit: import_zod.z.number().int().min(1).max(200).optional().describe("Max results per page (default 50)"),
170
- offset: import_zod.z.number().int().min(0).optional().describe("Pagination offset (default 0)")
184
+ calendar_id: import_zod.z.string().optional().describe("Calendar ID to list events from. Provide this or agent_id."),
185
+ 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."),
186
+ start_after: import_zod.z.string().datetime().optional().describe("Only events starting after this ISO 8601 time"),
187
+ start_before: import_zod.z.string().datetime().optional().describe("Only events starting before this ISO 8601 time"),
188
+ status: import_zod.z.enum(["confirmed", "tentative", "cancelled", "hold"]).optional().describe("Filter by event status"),
189
+ source: import_zod.z.enum(["internal", "external_ical"]).optional().describe('Filter by source: "internal" (created via the API) or "external_ical" (synced from an iCal subscription)'),
190
+ limit: import_zod.z.number().int().min(1).max(200).default(50).describe("Max results to return"),
191
+ offset: import_zod.z.number().int().min(0).default(0).describe("Pagination offset")
171
192
  });
172
193
  var GetEventSchema = import_zod.z.object({
173
- calendar_id: import_zod.z.string().describe("Calendar ID the event belongs to"),
174
- event_id: import_zod.z.string().describe("The event ID to retrieve")
194
+ event_id: import_zod.z.string().describe("Event ID to retrieve"),
195
+ calendar_id: import_zod.z.string().optional().describe("Calendar ID that owns the event. Optional \u2014 if omitted the calendar is resolved from the event.")
175
196
  });
176
197
  var CreateEventSchema = import_zod.z.object({
177
- calendar_id: import_zod.z.string().describe("Calendar ID to create the event on"),
178
- title: import_zod.z.string().describe("Event title"),
179
- start_time: import_zod.z.string().describe("Start time in ISO 8601 format"),
180
- end_time: import_zod.z.string().describe("End time in ISO 8601 format"),
181
- description: import_zod.z.string().optional().describe("Event description"),
182
- all_day: import_zod.z.boolean().optional().describe("Whether this is an all-day event"),
183
- status: import_zod.z.enum(["confirmed", "tentative", "cancelled"]).optional().describe('Event status (default "confirmed")'),
184
- reminders: import_zod.z.array(import_zod.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."),
185
- metadata: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional().describe("Arbitrary key-value metadata")
198
+ calendar_id: import_zod.z.string().describe("Calendar ID to add the event to"),
199
+ title: import_zod.z.string().min(1).max(500).describe("Event title"),
200
+ start_time: import_zod.z.string().datetime().describe("Start time (ISO 8601)"),
201
+ end_time: import_zod.z.string().datetime().describe("End time (ISO 8601)"),
202
+ description: import_zod.z.string().optional().describe("Optional event description"),
203
+ all_day: import_zod.z.boolean().default(false).describe("Whether this is an all-day event"),
204
+ status: import_zod.z.enum(["confirmed", "tentative", "hold"]).optional().describe('Event status. "hold" creates a tentative reservation that auto-expires at hold_expires_at. Defaults to "confirmed".'),
205
+ reminders: import_zod.z.array(import_zod.z.number().int().min(1).max(40320)).max(5).nullable().optional().describe("Reminder offsets in minutes before start_time (e.g. [10, 1440]). Each fires an event.reminder webhook and shows as an alarm in the iCal feed. Omit or null to inherit the calendar default (then the system default of 10 min); [] for no reminders."),
206
+ hold_expires_at: import_zod.z.string().datetime().optional().describe('Required when status="hold". ISO 8601 timestamp 30s-15min in the future. Auto-releases the hold when reached.'),
207
+ hold_priority: import_zod.z.number().int().min(0).max(100).optional().describe('Only valid with status="hold". Higher-priority overlapping holds pre-empt lower-priority ones. Defaults to 0.')
186
208
  });
187
209
  var UpdateEventSchema = import_zod.z.object({
188
- calendar_id: import_zod.z.string().describe("Calendar ID the event belongs to"),
189
- event_id: import_zod.z.string().describe("The event ID to update"),
190
- title: import_zod.z.string().optional().describe("New event title"),
191
- description: import_zod.z.string().nullable().optional().describe("New description (null to clear)"),
192
- start_time: import_zod.z.string().optional().describe("New start time in ISO 8601 format"),
193
- end_time: import_zod.z.string().optional().describe("New end time in ISO 8601 format"),
210
+ event_id: import_zod.z.string().describe("Event ID to update"),
211
+ calendar_id: import_zod.z.string().optional().describe("Calendar ID that owns the event. Optional \u2014 if omitted the calendar is resolved from the event."),
212
+ title: import_zod.z.string().min(1).max(500).optional().describe("New event title"),
213
+ description: import_zod.z.string().nullable().optional().describe("New description, or null to clear it"),
214
+ start_time: import_zod.z.string().datetime().optional().describe("New start time (ISO 8601)"),
215
+ end_time: import_zod.z.string().datetime().optional().describe("New end time (ISO 8601)"),
194
216
  all_day: import_zod.z.boolean().optional().describe("Whether this is an all-day event"),
195
217
  status: import_zod.z.enum(["confirmed", "tentative", "cancelled"]).optional().describe("New event status"),
196
- reminders: import_zod.z.array(import_zod.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."),
197
- metadata: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional().describe("Updated metadata")
218
+ metadata: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional().describe("Replacement metadata object"),
219
+ reminders: import_zod.z.array(import_zod.z.number().int().min(1).max(40320)).max(5).nullable().optional().describe("Reminder offsets in minutes before start_time. Omit to leave unchanged, null to inherit the calendar default, [] for no reminders.")
198
220
  });
199
221
  var CancelEventSchema = import_zod.z.object({
200
- calendar_id: import_zod.z.string().describe("Calendar ID that owns the event"),
201
- event_id: import_zod.z.string().describe("Event ID to cancel")
222
+ event_id: import_zod.z.string().describe("Event ID to cancel"),
223
+ calendar_id: import_zod.z.string().optional().describe("Calendar ID that owns the event. Optional \u2014 if omitted the calendar is resolved from the event. Matches the asymmetry with confirm_event / release_event which never required this arg.")
202
224
  });
203
225
  var ConfirmEventSchema = import_zod.z.object({
204
226
  event_id: import_zod.z.string().describe("Event ID of the hold to confirm")
@@ -209,14 +231,13 @@ var ReleaseEventSchema = import_zod.z.object({
209
231
  var CreateAgentSchema = import_zod.z.object({
210
232
  name: import_zod.z.string().min(1).max(255).describe("Display name for the agent"),
211
233
  type: import_zod.z.enum(["ai", "human", "resource"]).describe("Agent type"),
212
- description: import_zod.z.string().optional().describe("Optional description"),
213
- metadata: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional().describe("Arbitrary key-value metadata")
234
+ description: import_zod.z.string().optional().describe("Optional description")
214
235
  });
215
236
  var ListAgentsSchema = import_zod.z.object({
216
237
  type: import_zod.z.enum(["ai", "human", "resource"]).optional().describe("Filter by agent type"),
217
238
  status: import_zod.z.enum(["active", "paused", "decommissioned"]).optional().describe("Filter by status"),
218
- limit: import_zod.z.number().int().min(1).max(200).optional().describe("Max results per page (default 50)"),
219
- offset: import_zod.z.number().int().min(0).optional().describe("Pagination offset (default 0)")
239
+ limit: import_zod.z.number().int().min(1).max(200).default(50).describe("Max results to return"),
240
+ offset: import_zod.z.number().int().min(0).default(0).describe("Pagination offset")
220
241
  });
221
242
  var GetAgentSchema = import_zod.z.object({
222
243
  agent_id: import_zod.z.string().describe("Agent ID to fetch")
@@ -233,27 +254,32 @@ var DeleteAgentSchema = import_zod.z.object({
233
254
  });
234
255
  var GetAvailabilitySchema = import_zod.z.object({
235
256
  agent_id: import_zod.z.string().describe("Agent ID to check availability for"),
236
- start: import_zod.z.string().describe("Range start (ISO 8601)"),
237
- end: import_zod.z.string().describe("Range end (ISO 8601)"),
238
- slot_duration: import_zod.z.enum(["15m", "30m", "45m", "1h", "2h"]).optional().describe('Minimum slot duration required (default "30m")'),
239
- include_busy: import_zod.z.boolean().optional().describe("Include busy blocks in response")
257
+ start: import_zod.z.string().datetime().optional().describe("Range start (ISO 8601). Alias: start_time."),
258
+ end: import_zod.z.string().datetime().optional().describe("Range end (ISO 8601). Alias: end_time."),
259
+ start_time: import_zod.z.string().datetime().optional().describe("Alias for `start` (matches REST events naming)."),
260
+ end_time: import_zod.z.string().datetime().optional().describe("Alias for `end` (matches REST events naming)."),
261
+ slot_duration: import_zod.z.enum(["15m", "30m", "45m", "1h", "2h"]).default("30m").describe("Minimum slot duration required \u2014 only free blocks at least this long are returned"),
262
+ include_busy: import_zod.z.boolean().default(false).describe("Include busy blocks in response")
240
263
  });
241
264
  var FindMeetingTimeSchema = import_zod.z.object({
242
- agents: import_zod.z.array(import_zod.z.string()).min(1).describe("Array of agent IDs to find common free time for. All agents must be free during the returned slots."),
243
- start: import_zod.z.string().describe("Search range start (ISO 8601)"),
244
- end: import_zod.z.string().describe("Search range end (ISO 8601)"),
245
- slot_duration: import_zod.z.enum(["15m", "30m", "45m", "1h", "2h"]).optional().describe('Minimum slot duration required (default "30m")'),
265
+ agents: import_zod.z.array(import_zod.z.string()).min(1).optional().describe("Array of agent IDs to find common free time for. All agents must be free during the returned slots. Alias: agent_ids."),
266
+ agent_ids: import_zod.z.array(import_zod.z.string()).min(1).optional().describe("Alias for `agents` (matches REST/scheduling-proposal naming)."),
267
+ start: import_zod.z.string().datetime().optional().describe("Search range start (ISO 8601). Alias: start_time."),
268
+ end: import_zod.z.string().datetime().optional().describe("Search range end (ISO 8601). Alias: end_time."),
269
+ start_time: import_zod.z.string().datetime().optional().describe("Alias for `start` (matches REST events naming)."),
270
+ end_time: import_zod.z.string().datetime().optional().describe("Alias for `end` (matches REST events naming)."),
271
+ slot_duration: import_zod.z.enum(["15m", "30m", "45m", "1h", "2h"]).default("30m").describe("Minimum slot duration required \u2014 only free blocks at least this long are returned"),
246
272
  calendars: import_zod.z.array(import_zod.z.string()).optional().describe("Additional shared calendar IDs to treat as busy"),
247
- include_busy: import_zod.z.boolean().optional().describe("Include per-agent busy blocks in response")
273
+ include_busy: import_zod.z.boolean().default(false).describe("Include per-agent busy blocks in response")
248
274
  });
249
275
  var GetCalendarContextSchema = import_zod.z.object({
250
276
  calendar_id: import_zod.z.string().describe("Calendar ID")
251
277
  });
252
278
  var proposalSlotSchema = import_zod.z.object({
253
- start_time: import_zod.z.string().describe("Slot start (ISO 8601)"),
254
- end_time: import_zod.z.string().describe("Slot end (ISO 8601)"),
255
- weight: import_zod.z.number().min(0).max(10).optional().describe("Preference weight (default 1.0)"),
256
- calendar_id: import_zod.z.string().optional().describe("Override calendar for this slot")
279
+ start_time: import_zod.z.string().datetime(),
280
+ end_time: import_zod.z.string().datetime(),
281
+ weight: import_zod.z.number().min(0).max(10).default(1).optional(),
282
+ calendar_id: import_zod.z.string().optional()
257
283
  });
258
284
  var CreateProposalSchema = import_zod.z.object({
259
285
  title: import_zod.z.string().min(1).max(500).describe("Short description of what the meeting is about"),
@@ -262,7 +288,7 @@ var CreateProposalSchema = import_zod.z.object({
262
288
  participant_agent_ids: import_zod.z.array(import_zod.z.string()).min(1).max(50).describe("Agent IDs invited to respond"),
263
289
  calendar_id: import_zod.z.string().describe("Calendar the resolved event will be created on"),
264
290
  slots: import_zod.z.array(proposalSlotSchema).min(1).max(20).describe("Candidate time slots (up to 20)"),
265
- expires_at: import_zod.z.string().optional().describe("Auto-cancel cutoff if unresolved (ISO 8601)")
291
+ expires_at: import_zod.z.string().datetime().optional().describe("Auto-cancel cutoff if unresolved")
266
292
  });
267
293
  var ListProposalsSchema = import_zod.z.object({
268
294
  status: import_zod.z.enum(["pending", "confirmed", "expired", "cancelled"]).optional().describe("Filter by proposal status"),
@@ -287,10 +313,11 @@ var ResolveProposalSchema = import_zod.z.object({
287
313
  var CancelProposalSchema = import_zod.z.object({
288
314
  proposal_id: import_zod.z.string().describe("Proposal to cancel")
289
315
  });
316
+ var timeOfDay = import_zod.z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, "must be HH:MM in 24-hour time");
290
317
  var workingHoursDaySchema = import_zod.z.object({
291
- start: import_zod.z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, "must be HH:MM in 24-hour time"),
292
- end: import_zod.z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, "must be HH:MM in 24-hour time")
293
- });
318
+ start: timeOfDay,
319
+ end: timeOfDay
320
+ }).refine((v) => v.end > v.start, "end must be after start").describe("A single day's working hours window");
294
321
  var workingHoursSchema = import_zod.z.object({
295
322
  mon: workingHoursDaySchema.optional(),
296
323
  tue: workingHoursDaySchema.optional(),
@@ -299,13 +326,13 @@ var workingHoursSchema = import_zod.z.object({
299
326
  fri: workingHoursDaySchema.optional(),
300
327
  sat: workingHoursDaySchema.optional(),
301
328
  sun: workingHoursDaySchema.optional()
302
- }).nullable();
329
+ }).refine((v) => Object.keys(v).length > 0, "at least one day must be specified").nullable();
303
330
  var SetAvailabilityRulesSchema = import_zod.z.object({
304
331
  calendar_id: import_zod.z.string().describe("Calendar to configure"),
305
- buffer_before_minutes: import_zod.z.number().int().min(0).max(120).optional().describe("Minutes of buffer before each event (0\u2013120)"),
306
- buffer_after_minutes: import_zod.z.number().int().min(0).max(120).optional().describe("Minutes of buffer after each event (0\u2013120)"),
307
- 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."),
308
- timezone: import_zod.z.string().min(1).max(64).optional().describe("IANA timezone used to interpret working_hours (e.g. America/New_York)")
332
+ buffer_before_minutes: import_zod.z.number().int().min(0).max(120).default(0).describe("Minutes of buffer before each event (0\u2013120)"),
333
+ buffer_after_minutes: import_zod.z.number().int().min(0).max(120).default(0).describe("Minutes of buffer after each event (0\u2013120)"),
334
+ working_hours: workingHoursSchema.default(null).describe("Per-day working hours map in the calendar's timezone; omit keys for off-days. Pass null to remove any working-hours constraint."),
335
+ timezone: import_zod.z.string().min(1).max(64).default("UTC").describe("IANA timezone used to interpret working_hours (e.g. America/New_York)")
309
336
  });
310
337
  var GetAvailabilityRulesSchema = import_zod.z.object({
311
338
  calendar_id: import_zod.z.string().describe("Calendar to read")
@@ -322,8 +349,8 @@ var RevokeScopedKeySchema = import_zod.z.object({
322
349
  key_id: import_zod.z.string().describe("ID of the scoped key to revoke")
323
350
  });
324
351
  var GetAuditLogSchema = import_zod.z.object({
325
- from: import_zod.z.string().optional().describe("Start of the window (ISO 8601). Silently clamped to the plan retention window if older."),
326
- to: import_zod.z.string().optional().describe("End of the window (ISO 8601)"),
352
+ from: import_zod.z.string().datetime({ offset: true }).optional().describe("Start of the window (ISO 8601). Silently clamped to the plan retention window if older."),
353
+ to: import_zod.z.string().datetime({ offset: true }).optional().describe("End of the window (ISO 8601)"),
327
354
  action: import_zod.z.string().min(1).max(64).optional().describe("Filter by action name (e.g. event.created)"),
328
355
  actor_key_prefix: import_zod.z.string().min(1).max(32).optional().describe("Filter by the API key prefix that performed the action"),
329
356
  cursor: import_zod.z.string().min(1).max(256).optional().describe("Opaque pagination cursor from a previous response"),
@@ -333,33 +360,40 @@ var AcceptTermsSchema = import_zod.z.object({
333
360
  tos_version: import_zod.z.string().min(1).describe("The terms-of-service version to accept; must match the current version")
334
361
  });
335
362
  var ListWebhooksSchema = import_zod.z.object({
336
- limit: import_zod.z.number().int().min(1).max(100).optional().describe("Max results per page (default 20)"),
337
- offset: import_zod.z.number().int().min(0).optional().describe("Pagination offset (default 0)")
363
+ limit: import_zod.z.number().int().min(1).max(100).default(20).describe("Max results to return"),
364
+ offset: import_zod.z.number().int().min(0).default(0).describe("Pagination offset")
338
365
  });
339
366
  var GetWebhookSchema = import_zod.z.object({
340
- webhook_id: import_zod.z.string().describe("The webhook ID to retrieve")
367
+ webhook_id: import_zod.z.string().describe("Webhook subscription to fetch")
341
368
  });
342
369
  var CreateWebhookSchema = import_zod.z.object({
343
- url: import_zod.z.string().describe("HTTPS URL to receive webhook payloads"),
344
- events: import_zod.z.array(import_zod.z.string()).describe('Event types to subscribe to (e.g., ["event.created", "event.updated"])')
370
+ url: import_zod.z.string().url().describe("HTTPS endpoint that will receive event deliveries"),
371
+ events: import_zod.z.array(import_zod.z.enum(WEBHOOK_EVENT_TYPES)).min(1).describe("Event types to subscribe to")
345
372
  });
346
373
  var UpdateWebhookSchema = import_zod.z.object({
347
- webhook_id: import_zod.z.string().describe("The webhook ID to update"),
348
- url: import_zod.z.string().optional().describe("New webhook URL"),
349
- events: import_zod.z.array(import_zod.z.string()).optional().describe("New event type subscriptions"),
350
- active: import_zod.z.boolean().optional().describe("Enable or disable the webhook")
374
+ webhook_id: import_zod.z.string().describe("Webhook subscription to update"),
375
+ url: import_zod.z.string().url().optional().describe("New HTTPS delivery endpoint"),
376
+ events: import_zod.z.array(import_zod.z.enum(WEBHOOK_EVENT_TYPES)).min(1).optional().describe("Replacement set of event types to subscribe to"),
377
+ active: import_zod.z.boolean().optional().describe("Set false to pause deliveries, true to resume")
351
378
  });
352
379
  var DeleteWebhookSchema = import_zod.z.object({
353
- webhook_id: import_zod.z.string().describe("The webhook ID to delete")
380
+ webhook_id: import_zod.z.string().describe("Webhook subscription to delete")
381
+ });
382
+ var ListWebhookDeliveriesSchema = import_zod.z.object({
383
+ webhook_id: import_zod.z.string().describe("Webhook subscription whose deliveries to list"),
384
+ limit: import_zod.z.number().int().min(1).max(100).default(20).describe("Max results to return"),
385
+ offset: import_zod.z.number().int().min(0).default(0).describe("Pagination offset"),
386
+ status: import_zod.z.enum(WEBHOOK_DELIVERY_STATUSES).optional().describe("Filter to a single delivery status"),
387
+ include_payload: import_zod.z.boolean().optional().describe("Include the full event payload sent on each delivery")
354
388
  });
355
389
  var ListICalSubscriptionsSchema = import_zod.z.object({
356
- agent_id: import_zod.z.string().describe("Agent ID to list subscriptions for"),
390
+ agent_id: import_zod.z.string().describe("Agent ID whose iCal subscriptions to list"),
357
391
  status: import_zod.z.enum(["active", "error", "paused"]).optional().describe("Filter by subscription status"),
358
- limit: import_zod.z.number().int().min(1).max(200).optional().describe("Max results per page (default 50)"),
359
- offset: import_zod.z.number().int().min(0).optional().describe("Pagination offset (default 0)")
392
+ limit: import_zod.z.number().int().min(1).max(200).default(50).describe("Max results to return"),
393
+ offset: import_zod.z.number().int().min(0).default(0).describe("Pagination offset")
360
394
  });
361
395
  var GetICalSubscriptionSchema = import_zod.z.object({
362
- subscription_id: import_zod.z.string().describe("The iCal subscription ID to retrieve")
396
+ subscription_id: import_zod.z.string().describe("iCal subscription ID to fetch")
363
397
  });
364
398
  var SubscribeICalSchema = import_zod.z.object({
365
399
  agent_id: import_zod.z.string().describe("Agent ID that will own this subscription"),
@@ -367,23 +401,16 @@ var SubscribeICalSchema = import_zod.z.object({
367
401
  url: import_zod.z.string().url().describe("HTTPS URL of the iCal feed (.ics) to subscribe to"),
368
402
  label: import_zod.z.string().optional().describe("Optional label for this subscription")
369
403
  });
370
- var ListWebhookDeliveriesSchema = import_zod.z.object({
371
- webhook_id: import_zod.z.string().describe("Webhook subscription whose deliveries to list"),
372
- limit: import_zod.z.number().int().min(1).max(100).optional().describe("Max results to return (default 20)"),
373
- offset: import_zod.z.number().int().min(0).optional().describe("Pagination offset (default 0)"),
374
- status: import_zod.z.enum(["pending", "delivered", "failed"]).optional().describe("Filter to a single delivery status"),
375
- include_payload: import_zod.z.boolean().optional().describe("Include the full event payload sent on each delivery")
376
- });
377
404
  var UpdateICalSubscriptionSchema = import_zod.z.object({
378
- subscription_id: import_zod.z.string().describe("The iCal subscription ID to update"),
379
- label: import_zod.z.string().optional().describe("New label"),
380
- url: import_zod.z.string().optional().describe("New iCal feed URL")
405
+ subscription_id: import_zod.z.string().describe("iCal subscription ID to update"),
406
+ label: import_zod.z.string().min(1).max(255).optional().describe("New label for this subscription"),
407
+ url: import_zod.z.string().url().startsWith("https://", "URL must use HTTPS").optional().describe("New HTTPS URL of the iCal feed (.ics)")
381
408
  });
382
409
  var DeleteICalSubscriptionSchema = import_zod.z.object({
383
- subscription_id: import_zod.z.string().describe("The iCal subscription ID to delete")
410
+ subscription_id: import_zod.z.string().describe("iCal subscription ID to delete")
384
411
  });
385
412
  var SyncICalSubscriptionSchema = import_zod.z.object({
386
- subscription_id: import_zod.z.string().describe("The iCal subscription ID to sync immediately")
413
+ subscription_id: import_zod.z.string().describe("iCal subscription ID to sync")
387
414
  });
388
415
  var GetUsageSchema = import_zod.z.object({});
389
416
 
@@ -440,6 +467,9 @@ var deleteCalendar = safeFunc(async (ctx) => {
440
467
  });
441
468
  var listEvents = safeFunc(async (ctx) => {
442
469
  const { client, params } = ctx;
470
+ if (!params.calendar_id && !params.agent_id) {
471
+ throw new Error("Provide calendar_id or agent_id");
472
+ }
443
473
  const iter = client.events.list({
444
474
  calendarId: params.calendar_id,
445
475
  agentId: params.agent_id,
@@ -452,7 +482,8 @@ var listEvents = safeFunc(async (ctx) => {
452
482
  return fetchPage(iter, params.offset, params.limit);
453
483
  });
454
484
  var getEvent = safeFunc(async (ctx) => {
455
- return ctx.client.events.get(ctx.params.calendar_id, ctx.params.event_id);
485
+ const { calendar_id, event_id } = ctx.params;
486
+ return calendar_id ? ctx.client.events.get(calendar_id, event_id) : ctx.client.events.getById(event_id);
456
487
  });
457
488
  var createEvent = safeFunc(async (ctx) => {
458
489
  const { client, params } = ctx;
@@ -462,10 +493,15 @@ var createEvent = safeFunc(async (ctx) => {
462
493
  var updateEvent = safeFunc(async (ctx) => {
463
494
  const { client, params } = ctx;
464
495
  const { calendar_id, event_id, ...updates } = params;
465
- return client.events.update(calendar_id, event_id, updates);
496
+ return calendar_id ? client.events.update(calendar_id, event_id, updates) : client.events.updateById(event_id, updates);
466
497
  });
467
498
  var cancelEvent = safeFunc(async (ctx) => {
468
- await ctx.client.events.delete(ctx.params.calendar_id, ctx.params.event_id);
499
+ const { calendar_id, event_id } = ctx.params;
500
+ if (calendar_id) {
501
+ await ctx.client.events.delete(calendar_id, event_id);
502
+ } else {
503
+ await ctx.client.events.deleteById(event_id);
504
+ }
469
505
  return void 0;
470
506
  });
471
507
  var confirmEvent = safeFunc(async (ctx) => {
@@ -496,15 +532,34 @@ var deleteAgent = safeFunc(async (ctx) => {
496
532
  });
497
533
  var getAvailability = safeFunc(async (ctx) => {
498
534
  const { client, params } = ctx;
535
+ const start = params.start ?? params.start_time;
536
+ const end = params.end ?? params.end_time;
537
+ if (!start || !end) {
538
+ throw new Error("start (or start_time) and end (or end_time) are required");
539
+ }
499
540
  return client.availability.forAgent(params.agent_id, {
500
- start: params.start,
501
- end: params.end,
541
+ start,
542
+ end,
502
543
  slot_duration: params.slot_duration,
503
544
  include_busy: params.include_busy
504
545
  });
505
546
  });
506
547
  var findMeetingTime = safeFunc(async (ctx) => {
507
- return ctx.client.availability.check(ctx.params);
548
+ const { client, params } = ctx;
549
+ const agents = params.agents ?? params.agent_ids;
550
+ const start = params.start ?? params.start_time;
551
+ const end = params.end ?? params.end_time;
552
+ if (!agents || !start || !end) {
553
+ throw new Error("agents (or agent_ids), start (or start_time), and end (or end_time) are required");
554
+ }
555
+ return client.availability.check({
556
+ agents,
557
+ start,
558
+ end,
559
+ slot_duration: params.slot_duration,
560
+ calendars: params.calendars,
561
+ include_busy: params.include_busy
562
+ });
508
563
  });
509
564
  var getCalendarContext = safeFunc(async (ctx) => {
510
565
  return ctx.client.calendars.getContext(ctx.params.calendar_id);
@@ -678,35 +733,35 @@ var TOOL_DEFINITIONS = [
678
733
  // ── Calendars ──────────────────────────────────────────────────
679
734
  {
680
735
  name: "list_calendars",
681
- description: "List calendars, optionally filtered by agent. Returns paginated results.",
736
+ description: "List calendars in the org. Org-level API keys see every calendar (agent-owned and shared); agent-scoped keys see only their own agent's calendars. Use this to discover calendar IDs before creating or listing events.",
682
737
  schema: ListCalendarsSchema,
683
738
  annotations: { title: "List Calendars", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
684
739
  execute: createExecutor(listCalendars)
685
740
  },
686
741
  {
687
742
  name: "get_calendar",
688
- description: "Get a calendar by its ID, including its name, timezone, and iCal feed URL.",
743
+ description: "Fetch a single calendar by ID, including its name, timezone, agent status, and default reminders. Agent-scoped keys may only read calendars owned by their agent.",
689
744
  schema: GetCalendarSchema,
690
745
  annotations: { title: "Get Calendar", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
691
746
  execute: createExecutor(getCalendar)
692
747
  },
693
748
  {
694
749
  name: "create_calendar",
695
- description: "Create a new calendar. Specify a name and IANA timezone. Optionally scope it to an agent.",
750
+ description: 'Create a calendar to hold events and track availability. Calendars are required before creating events \u2014 call this first when setting up a new agent. An agent can have multiple calendars (e.g. "Work", "Personal"). Org-level calendars (no agent_id) can be used as shared resources like meeting rooms.',
696
751
  schema: CreateCalendarSchema,
697
752
  annotations: { title: "Create Calendar", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
698
753
  execute: createExecutor(createCalendar)
699
754
  },
700
755
  {
701
756
  name: "update_calendar",
702
- description: "Update a calendar's name, timezone, or metadata.",
757
+ description: "Update a calendar's name, timezone, agent status, default reminders, or metadata. Agent-scoped keys may only update calendars owned by their agent.",
703
758
  schema: UpdateCalendarSchema,
704
759
  annotations: { title: "Update Calendar", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
705
760
  execute: createExecutor(updateCalendar)
706
761
  },
707
762
  {
708
763
  name: "delete_calendar",
709
- description: "Permanently delete a calendar and all its events.",
764
+ description: "Delete a calendar (soft delete). Its events are no longer returned and it stops contributing to availability. Agent-scoped keys may only delete calendars owned by their agent.",
710
765
  schema: DeleteCalendarSchema,
711
766
  annotations: { title: "Delete Calendar", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
712
767
  execute: createExecutor(deleteCalendar)
@@ -714,42 +769,42 @@ var TOOL_DEFINITIONS = [
714
769
  // ── Events ─────────────────────────────────────────────────────
715
770
  {
716
771
  name: "list_events",
717
- description: "List events on a calendar or for an agent. Supports date range and status filters. Provide calendar_id or agent_id.",
772
+ description: "List events on a calendar or across an agent's calendars, including internally created events and externally synced events from iCal subscriptions (e.g. Google Calendar, Outlook). Provide `calendar_id` OR `agent_id`. Narrow with `start_after`/`start_before` (time window), `status`, and `source`.",
718
773
  schema: ListEventsSchema,
719
774
  annotations: { title: "List Events", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
720
775
  execute: createExecutor(listEvents)
721
776
  },
722
777
  {
723
778
  name: "get_event",
724
- description: "Get a specific event by its calendar ID and event ID.",
779
+ description: "Retrieve a single event by ID, including its title, times, status, location, reminders, and metadata. Works for both internally created events and externally synced iCal events. `calendar_id` is optional \u2014 if omitted the calendar is resolved from the event. Provide `calendar_id` to fail fast on cross-calendar typos.",
725
780
  schema: GetEventSchema,
726
781
  annotations: { title: "Get Event", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
727
782
  execute: createExecutor(getEvent)
728
783
  },
729
784
  {
730
785
  name: "create_event",
731
- description: "Create a new event on a calendar. The event blocks the agent's availability during the specified time window and appears in availability queries.",
786
+ description: `Create a booking, appointment, meeting, hold, or any scheduled event on a calendar. The calendar_id comes from create_calendar or list_events. Once created, this event blocks the agent's availability during that time and appears in availability queries. Use status="hold" with hold_expires_at to tentatively reserve a slot that auto-releases on TTL.`,
732
787
  schema: CreateEventSchema,
733
788
  annotations: { title: "Create Event", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
734
789
  execute: createExecutor(createEvent)
735
790
  },
736
791
  {
737
792
  name: "update_event",
738
- description: "Update an existing event's title, times, status, or other properties.",
793
+ description: "Reschedule or edit an event \u2014 change its title, description, start/end times, location, status, reminders, or metadata. Use this to move an appointment to a new time or update its details. Provide only the fields you want to change. Holds cannot be edited via this tool (use confirm_event / release_event). External iCal events are read-only. `calendar_id` is optional \u2014 if omitted it is resolved from the event.",
739
794
  schema: UpdateEventSchema,
740
795
  annotations: { title: "Update Event", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
741
796
  execute: createExecutor(updateEvent)
742
797
  },
743
798
  {
744
799
  name: "cancel_event",
745
- description: "Delete or cancel an event from a calendar. The event is marked cancelled and excluded from future availability calculations.",
800
+ description: "Delete or cancel an event from a calendar. Use this to remove, cancel, or delete any scheduled event or appointment. The event is marked cancelled and excluded from future availability calculations. `calendar_id` is optional \u2014 if omitted the calendar is looked up from the event. Provide `calendar_id` to fail fast on cross-calendar typos.",
746
801
  schema: CancelEventSchema,
747
802
  annotations: { title: "Cancel Event", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
748
803
  execute: createExecutor(cancelEvent)
749
804
  },
750
805
  {
751
806
  name: "confirm_event",
752
- 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.',
807
+ 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. After confirmation, event.started and event.ended lifecycle webhooks fire at the scheduled times.',
753
808
  schema: ConfirmEventSchema,
754
809
  annotations: { title: "Confirm Event", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
755
810
  execute: createExecutor(confirmEvent)
@@ -771,28 +826,28 @@ var TOOL_DEFINITIONS = [
771
826
  },
772
827
  {
773
828
  name: "list_agents",
774
- description: "List all agents in your organization. Returns paginated results.",
829
+ description: "List all agents in your organization",
775
830
  schema: ListAgentsSchema,
776
831
  annotations: { title: "List Agents", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
777
832
  execute: createExecutor(listAgents)
778
833
  },
779
834
  {
780
835
  name: "get_agent",
781
- description: "Fetch a single agent by ID. An agent represents an AI assistant, human, or shared resource (e.g. a meeting room).",
836
+ description: "Fetch a single agent by ID. An agent represents an AI assistant, human, or shared resource (e.g. a meeting room). Agent-scoped API keys may only read their own agent.",
782
837
  schema: GetAgentSchema,
783
838
  annotations: { title: "Get Agent", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
784
839
  execute: createExecutor(getAgent)
785
840
  },
786
841
  {
787
842
  name: "update_agent",
788
- description: "Update an agent's name, description, metadata, or status (active/paused). Requires an org-level API key.",
843
+ description: "Update an agent's name, description, metadata, or status (active/paused). Requires an org-level API key \u2014 agent-scoped keys cannot mutate agents.",
789
844
  schema: UpdateAgentSchema,
790
845
  annotations: { title: "Update Agent", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
791
846
  execute: createExecutor(updateAgent)
792
847
  },
793
848
  {
794
849
  name: "delete_agent",
795
- description: "Decommission an agent. This marks the agent as decommissioned and revokes all of its scoped API keys. Requires an org-level API key.",
850
+ description: "Decommission an agent. This marks the agent as decommissioned and revokes all of its scoped API keys. Requires an org-level API key \u2014 agent-scoped keys cannot delete agents.",
796
851
  schema: DeleteAgentSchema,
797
852
  annotations: { title: "Delete Agent", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
798
853
  execute: createExecutor(deleteAgent)
@@ -800,14 +855,14 @@ var TOOL_DEFINITIONS = [
800
855
  // ── Availability ───────────────────────────────────────────────
801
856
  {
802
857
  name: "get_availability",
803
- description: "Check when a single agent is free within a time range. Returns available time slots and optionally busy blocks.",
858
+ 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).",
804
859
  schema: GetAvailabilitySchema,
805
860
  annotations: { title: "Get Availability", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
806
861
  execute: createExecutor(getAvailability)
807
862
  },
808
863
  {
809
864
  name: "find_meeting_time",
810
- description: "Find time slots when multiple agents are all free simultaneously. All agents must be free during the returned slots.",
865
+ 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).",
811
866
  schema: FindMeetingTimeSchema,
812
867
  annotations: { title: "Find Meeting Time", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
813
868
  execute: createExecutor(findMeetingTime)
@@ -815,7 +870,7 @@ var TOOL_DEFINITIONS = [
815
870
  // ── Calendar context ───────────────────────────────────────────
816
871
  {
817
872
  name: "get_calendar_context",
818
- 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.",
873
+ description: `Get a calendar's temporal context in a single call: the current event (if one is happening now), the next upcoming event, recent past events, a short upcoming window, and the owning agent's status (idle/working/waiting/error). Use this to answer "what is this agent doing right now?" without issuing multiple list_events queries.`,
819
874
  schema: GetCalendarContextSchema,
820
875
  annotations: { title: "Get Calendar Context", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
821
876
  execute: createExecutor(getCalendarContext)
@@ -823,14 +878,14 @@ var TOOL_DEFINITIONS = [
823
878
  // ── Scheduling proposals ───────────────────────────────────────
824
879
  {
825
880
  name: "create_proposal",
826
- 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.",
881
+ description: "Create a scheduling proposal \u2014 send a set of candidate time slots to one or more participant agents so they can accept, decline, or counter-propose. The organizer agent owns the proposal; once every participant responds, the system auto-resolves to the highest-scoring slot (or cancels if all decline). Requires an org-level API key. Pro plan only.",
827
882
  schema: CreateProposalSchema,
828
883
  annotations: { title: "Create Proposal", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
829
884
  execute: createExecutor(createProposal)
830
885
  },
831
886
  {
832
887
  name: "list_proposals",
833
- description: "List scheduling proposals for the org. Filter by status or organizer_agent_id. Requires an org-level API key.",
888
+ description: "List scheduling proposals for the org. Filter by status (pending|confirmed|expired|cancelled) or organizer_agent_id. Requires an org-level API key.",
834
889
  schema: ListProposalsSchema,
835
890
  annotations: { title: "List Proposals", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
836
891
  execute: createExecutor(listProposals)
@@ -844,14 +899,14 @@ var TOOL_DEFINITIONS = [
844
899
  },
845
900
  {
846
901
  name: "respond_to_proposal",
847
- 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.",
902
+ description: 'Submit a response (accept / decline / counter) on behalf of one participant agent to an open proposal. An "accept" requires the slot id from the proposal; a "counter" can suggest alternative slots. When all participants have responded the proposal auto-resolves \u2014 no separate resolve call needed in the normal flow. Requires an org-level API key. Pro plan only.',
848
903
  schema: RespondToProposalSchema,
849
904
  annotations: { title: "Respond To Proposal", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
850
905
  execute: createExecutor(respondToProposal)
851
906
  },
852
907
  {
853
908
  name: "resolve_proposal",
854
- 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.",
909
+ description: 'Force-resolve an open proposal using responses collected so far. Picks the highest-scoring slot among those accepted by the most participants and creates a confirmed calendar event. If every response was "decline", the proposal is cancelled instead. Use when you want to close out a proposal without waiting for every participant. Requires an org-level API key. Pro plan only.',
855
910
  schema: ResolveProposalSchema,
856
911
  annotations: { title: "Resolve Proposal", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
857
912
  execute: createExecutor(resolveProposal)
@@ -866,7 +921,7 @@ var TOOL_DEFINITIONS = [
866
921
  // ── Availability rules ─────────────────────────────────────────
867
922
  {
868
923
  name: "set_availability_rules",
869
- 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.",
924
+ description: "Set or replace the availability rules on a calendar \u2014 buffer times before/after events and optional per-day working hours. When these rules are set, every availability query on this calendar automatically applies them (busy-block expansion for buffers, masking outside working hours). Upsert: overwrites any existing rules.",
870
925
  schema: SetAvailabilityRulesSchema,
871
926
  annotations: { title: "Set Availability Rules", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
872
927
  execute: createExecutor(setAvailabilityRules)
@@ -880,7 +935,7 @@ var TOOL_DEFINITIONS = [
880
935
  },
881
936
  {
882
937
  name: "clear_availability_rules",
883
- description: "Remove the availability rules from a calendar, reverting to the default (no buffers, no working-hours mask).",
938
+ description: "Remove the availability rules from a calendar, reverting to the default (no buffers, no working-hours mask). Returns the deleted row, or an error if none were set.",
884
939
  schema: ClearAvailabilityRulesSchema,
885
940
  annotations: { title: "Clear Availability Rules", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
886
941
  execute: createExecutor(clearAvailabilityRules)
@@ -888,35 +943,35 @@ var TOOL_DEFINITIONS = [
888
943
  // ── Webhooks ───────────────────────────────────────────────────
889
944
  {
890
945
  name: "list_webhooks",
891
- description: "List all webhook subscriptions for the organization.",
946
+ description: "List the org's webhook subscriptions with their subscribed event types and active state. Signing secrets are never returned. Requires an org-level API key.",
892
947
  schema: ListWebhooksSchema,
893
948
  annotations: { title: "List Webhooks", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
894
949
  execute: createExecutor(listWebhooks)
895
950
  },
896
951
  {
897
952
  name: "get_webhook",
898
- description: "Get a webhook subscription by its ID.",
953
+ description: "Get a single webhook subscription by id, including its subscribed event types and active state. The signing secret is never returned. Requires an org-level API key.",
899
954
  schema: GetWebhookSchema,
900
955
  annotations: { title: "Get Webhook", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
901
956
  execute: createExecutor(getWebhook)
902
957
  },
903
958
  {
904
959
  name: "create_webhook",
905
- description: "Create a webhook subscription to receive event notifications at a URL. Payloads are signed with HMAC-SHA256.",
960
+ description: "Create a webhook subscription so the org receives HTTP POST notifications when events occur (e.g. event.created, proposal.confirmed). The signing secret is returned ONCE in this response \u2014 store it to verify the HMAC-SHA256 signature on delivered payloads. Requires an org-level API key.",
906
961
  schema: CreateWebhookSchema,
907
962
  annotations: { title: "Create Webhook", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
908
963
  execute: createExecutor(createWebhook)
909
964
  },
910
965
  {
911
966
  name: "update_webhook",
912
- description: "Update a webhook's URL, subscribed events, or active status.",
967
+ description: "Update a webhook subscription \u2014 change its delivery URL, the set of subscribed event types, or pause/resume it via active. At least one field must be supplied. Requires an org-level API key.",
913
968
  schema: UpdateWebhookSchema,
914
969
  annotations: { title: "Update Webhook", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
915
970
  execute: createExecutor(updateWebhook)
916
971
  },
917
972
  {
918
973
  name: "delete_webhook",
919
- description: "Delete a webhook subscription. No further events will be delivered to this URL.",
974
+ description: "Permanently delete a webhook subscription. This frees its endpoint slot against the per-plan cap. Requires an org-level API key.",
920
975
  schema: DeleteWebhookSchema,
921
976
  annotations: { title: "Delete Webhook", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
922
977
  execute: createExecutor(deleteWebhook)
@@ -931,42 +986,42 @@ var TOOL_DEFINITIONS = [
931
986
  // ── iCal Subscriptions ─────────────────────────────────────────
932
987
  {
933
988
  name: "list_ical_subscriptions",
934
- description: "List external calendar imports (iCal subscriptions) for an agent.",
989
+ description: "List an agent's external iCal feed subscriptions (e.g. linked Google Calendar / Outlook feeds), including their sync status and last sync time.",
935
990
  schema: ListICalSubscriptionsSchema,
936
991
  annotations: { title: "List iCal Subscriptions", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
937
992
  execute: createExecutor(listICalSubscriptions)
938
993
  },
939
994
  {
940
995
  name: "get_ical_subscription",
941
- description: "Get an iCal subscription by its ID, including sync status and last error.",
996
+ description: "Get a single external iCal feed subscription by id, including its sync status, last sync time, and last error.",
942
997
  schema: GetICalSubscriptionSchema,
943
998
  annotations: { title: "Get iCal Subscription", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
944
999
  execute: createExecutor(getICalSubscription)
945
1000
  },
946
1001
  {
947
1002
  name: "subscribe_ical",
948
- 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.",
1003
+ 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. The target calendar must be owned by the specified agent \u2014 create the calendar with that agent_id first (org-level calendars without an agent_id cannot host external iCal subscriptions; create a dedicated per-agent calendar for sync targets).",
949
1004
  schema: SubscribeICalSchema,
950
1005
  annotations: { title: "Subscribe iCal", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
951
1006
  execute: createExecutor(subscribeICal)
952
1007
  },
953
1008
  {
954
1009
  name: "update_ical_subscription",
955
- description: "Update an iCal subscription's label or feed URL.",
1010
+ description: "Update an external iCal feed subscription \u2014 change its label or its feed URL. Changing the URL forces a full re-sync on the next poll.",
956
1011
  schema: UpdateICalSubscriptionSchema,
957
1012
  annotations: { title: "Update iCal Subscription", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
958
1013
  execute: createExecutor(updateICalSubscription)
959
1014
  },
960
1015
  {
961
1016
  name: "delete_ical_subscription",
962
- description: "Remove an external calendar import. Previously synced events remain on the calendar.",
1017
+ description: "Delete an external iCal feed subscription. Events previously synced from the feed are no longer refreshed.",
963
1018
  schema: DeleteICalSubscriptionSchema,
964
1019
  annotations: { title: "Delete iCal Subscription", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
965
1020
  execute: createExecutor(deleteICalSubscription)
966
1021
  },
967
1022
  {
968
1023
  name: "sync_ical_subscription",
969
- description: "Trigger an immediate sync of an iCal subscription instead of waiting for the next 30-minute poll.",
1024
+ description: "Trigger an immediate sync of an external iCal feed subscription instead of waiting for the next scheduled poll. Returns once the sync has been queued.",
970
1025
  schema: SyncICalSubscriptionSchema,
971
1026
  annotations: { title: "Sync iCal Subscription", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
972
1027
  execute: createExecutor(syncICalSubscription)
@@ -974,14 +1029,14 @@ var TOOL_DEFINITIONS = [
974
1029
  // ── Scoped keys ────────────────────────────────────────────────
975
1030
  {
976
1031
  name: "create_scoped_key",
977
- 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.",
1032
+ description: "Create an agent-scoped API key (chr_ak_*) that can only act on behalf of a single agent. Use this to self-provision or rotate per-agent credentials. The plaintext key is returned exactly once in the response \u2014 store it immediately, it cannot be retrieved later. Requires an org-level API key.",
978
1033
  schema: CreateScopedKeySchema,
979
1034
  annotations: { title: "Create Scoped Key", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
980
1035
  execute: createExecutor(createScopedKey)
981
1036
  },
982
1037
  {
983
1038
  name: "list_scoped_keys",
984
- 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.",
1039
+ description: "List all live (non-revoked) agent-scoped API keys for this org. Returns key metadata only (id, prefix, agent_id, label, created_at) \u2014 never the plaintext secret. Requires an org-level API key.",
985
1040
  schema: ListScopedKeysSchema,
986
1041
  annotations: { title: "List Scoped Keys", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
987
1042
  execute: createExecutor(listScopedKeys)
@@ -996,7 +1051,7 @@ var TOOL_DEFINITIONS = [
996
1051
  // ── Audit log ──────────────────────────────────────────────────
997
1052
  {
998
1053
  name: "get_audit_log",
999
- 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.",
1054
+ 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 (chr_sk_*); agent-scoped keys cannot read the org-wide audit log.",
1000
1055
  schema: GetAuditLogSchema,
1001
1056
  annotations: { title: "Get Audit Log", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
1002
1057
  execute: createExecutor(getAuditLog)
@@ -1004,7 +1059,7 @@ var TOOL_DEFINITIONS = [
1004
1059
  // ── Terms ──────────────────────────────────────────────────────
1005
1060
  {
1006
1061
  name: "accept_terms",
1007
- 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.",
1062
+ 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 \u2014 a material ToS bump otherwise leaves MCP-only agents stuck without a console session. Pass the current tos_version (read it from GET /v1/auth/terms/current). Requires an org-level API key (chr_sk_*); agent-scoped keys cannot accept org-wide terms.",
1008
1063
  schema: AcceptTermsSchema,
1009
1064
  annotations: { title: "Accept Terms", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
1010
1065
  execute: createExecutor(acceptTerms)
@@ -1012,7 +1067,7 @@ var TOOL_DEFINITIONS = [
1012
1067
  // ── Usage ──────────────────────────────────────────────────────
1013
1068
  {
1014
1069
  name: "get_usage",
1015
- description: "Get quota and usage statistics for the current billing period.",
1070
+ description: "Get the calling org's current-period usage and plan limits (agents, calendars, events, API calls, webhooks, availability queries, iCal subscriptions, proposals, scoped keys, holds, cross-calendar queries). Requires an org-level API key (chr_sk_*); agent-scoped keys cannot read org-wide usage.",
1016
1071
  schema: GetUsageSchema,
1017
1072
  annotations: { title: "Get Usage", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
1018
1073
  execute: createExecutor(getUsage)