@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/mastra.cjs CHANGED
@@ -29,72 +29,94 @@ var import_sdk2 = require("@chronary/sdk");
29
29
 
30
30
  // src/schemas.ts
31
31
  var import_zod = require("zod");
32
+ var WEBHOOK_EVENT_TYPES = [
33
+ "agent.created",
34
+ "agent.updated",
35
+ "event.created",
36
+ "event.updated",
37
+ "event.deleted",
38
+ "event.started",
39
+ "event.ended",
40
+ "event.reminder",
41
+ "event.hold_created",
42
+ "event.hold_expired",
43
+ "event.hold_released",
44
+ "event.hold_confirmed",
45
+ "proposal.created",
46
+ "proposal.responded",
47
+ "proposal.confirmed",
48
+ "proposal.expired",
49
+ "proposal.cancelled",
50
+ "webhook.deactivated"
51
+ ];
52
+ var WEBHOOK_DELIVERY_STATUSES = ["pending", "delivered", "failed"];
32
53
  var ListCalendarsSchema = import_zod.z.object({
33
- agent_id: import_zod.z.string().optional().describe("Filter calendars by agent ID"),
34
- include: import_zod.z.enum(["all"]).optional().describe('Set to "all" to include soft-deleted calendars'),
35
- limit: import_zod.z.number().int().min(1).max(200).optional().describe("Max results per page (default 50)"),
36
- offset: import_zod.z.number().int().min(0).optional().describe("Pagination offset (default 0)")
54
+ 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."),
55
+ include: import_zod.z.enum(["all"]).optional().describe('Pass "all" to include calendars across all agents (org keys only)'),
56
+ limit: import_zod.z.number().int().min(1).max(200).default(50).describe("Max results to return"),
57
+ offset: import_zod.z.number().int().min(0).default(0).describe("Pagination offset")
37
58
  });
38
59
  var GetCalendarSchema = import_zod.z.object({
39
- calendar_id: import_zod.z.string().describe("The calendar ID to retrieve")
60
+ calendar_id: import_zod.z.string().describe("Calendar ID to fetch")
40
61
  });
41
62
  var CreateCalendarSchema = import_zod.z.object({
42
- name: import_zod.z.string().describe("Calendar name"),
43
- timezone: import_zod.z.string().describe('IANA timezone (e.g., "America/New_York")'),
44
- agent_id: import_zod.z.string().optional().describe("Agent ID to associate the calendar with"),
45
- 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."),
46
- metadata: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional().describe("Arbitrary key-value metadata")
63
+ name: import_zod.z.string().min(1).max(255).describe("Calendar name"),
64
+ agent_id: import_zod.z.string().optional().describe("Agent ID to own this calendar (omit for org-level)"),
65
+ timezone: import_zod.z.string().min(1).describe("IANA timezone (e.g. America/New_York)"),
66
+ 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.")
47
67
  });
48
68
  var UpdateCalendarSchema = import_zod.z.object({
49
- calendar_id: import_zod.z.string().describe("The calendar ID to update"),
50
- name: import_zod.z.string().optional().describe("New calendar name"),
51
- timezone: import_zod.z.string().optional().describe("New IANA timezone"),
52
- 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."),
53
- metadata: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional().describe("Updated metadata")
69
+ calendar_id: import_zod.z.string().describe("Calendar ID to update"),
70
+ name: import_zod.z.string().min(1).max(255).optional().describe("New calendar name"),
71
+ timezone: import_zod.z.string().min(1).optional().describe("New IANA timezone (e.g. America/New_York)"),
72
+ agent_status: import_zod.z.enum(["idle", "working", "waiting", "error"]).optional().describe("Owning agent's status"),
73
+ 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"),
74
+ metadata: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional().describe("Arbitrary metadata (max 16KB)")
54
75
  });
55
76
  var DeleteCalendarSchema = import_zod.z.object({
56
- calendar_id: import_zod.z.string().describe("The calendar ID to delete")
77
+ calendar_id: import_zod.z.string().describe("Calendar ID to delete")
57
78
  });
58
79
  var ListEventsSchema = import_zod.z.object({
59
- calendar_id: import_zod.z.string().optional().describe("Calendar ID to list events from (provide this or agent_id)"),
60
- agent_id: import_zod.z.string().optional().describe("Agent ID to list events for (provide this or calendar_id)"),
61
- start_after: import_zod.z.string().optional().describe("Only events starting after this ISO 8601 datetime"),
62
- start_before: import_zod.z.string().optional().describe("Only events starting before this ISO 8601 datetime"),
63
- status: import_zod.z.enum(["confirmed", "tentative", "cancelled"]).optional().describe("Filter by event status"),
64
- source: import_zod.z.enum(["internal", "external_ical"]).optional().describe("Filter by event source"),
65
- limit: import_zod.z.number().int().min(1).max(200).optional().describe("Max results per page (default 50)"),
66
- offset: import_zod.z.number().int().min(0).optional().describe("Pagination offset (default 0)")
80
+ calendar_id: import_zod.z.string().optional().describe("Calendar ID to list events from. Provide this or agent_id."),
81
+ 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."),
82
+ start_after: import_zod.z.string().datetime().optional().describe("Only events starting after this ISO 8601 time"),
83
+ start_before: import_zod.z.string().datetime().optional().describe("Only events starting before this ISO 8601 time"),
84
+ status: import_zod.z.enum(["confirmed", "tentative", "cancelled", "hold"]).optional().describe("Filter by event status"),
85
+ 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)'),
86
+ limit: import_zod.z.number().int().min(1).max(200).default(50).describe("Max results to return"),
87
+ offset: import_zod.z.number().int().min(0).default(0).describe("Pagination offset")
67
88
  });
68
89
  var GetEventSchema = import_zod.z.object({
69
- calendar_id: import_zod.z.string().describe("Calendar ID the event belongs to"),
70
- event_id: import_zod.z.string().describe("The event ID to retrieve")
90
+ event_id: import_zod.z.string().describe("Event ID to retrieve"),
91
+ 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.")
71
92
  });
72
93
  var CreateEventSchema = import_zod.z.object({
73
- calendar_id: import_zod.z.string().describe("Calendar ID to create the event on"),
74
- title: import_zod.z.string().describe("Event title"),
75
- start_time: import_zod.z.string().describe("Start time in ISO 8601 format"),
76
- end_time: import_zod.z.string().describe("End time in ISO 8601 format"),
77
- description: import_zod.z.string().optional().describe("Event description"),
78
- all_day: import_zod.z.boolean().optional().describe("Whether this is an all-day event"),
79
- status: import_zod.z.enum(["confirmed", "tentative", "cancelled"]).optional().describe('Event status (default "confirmed")'),
80
- 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."),
81
- metadata: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional().describe("Arbitrary key-value metadata")
94
+ calendar_id: import_zod.z.string().describe("Calendar ID to add the event to"),
95
+ title: import_zod.z.string().min(1).max(500).describe("Event title"),
96
+ start_time: import_zod.z.string().datetime().describe("Start time (ISO 8601)"),
97
+ end_time: import_zod.z.string().datetime().describe("End time (ISO 8601)"),
98
+ description: import_zod.z.string().optional().describe("Optional event description"),
99
+ all_day: import_zod.z.boolean().default(false).describe("Whether this is an all-day event"),
100
+ 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".'),
101
+ 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."),
102
+ 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.'),
103
+ 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.')
82
104
  });
83
105
  var UpdateEventSchema = import_zod.z.object({
84
- calendar_id: import_zod.z.string().describe("Calendar ID the event belongs to"),
85
- event_id: import_zod.z.string().describe("The event ID to update"),
86
- title: import_zod.z.string().optional().describe("New event title"),
87
- description: import_zod.z.string().nullable().optional().describe("New description (null to clear)"),
88
- start_time: import_zod.z.string().optional().describe("New start time in ISO 8601 format"),
89
- end_time: import_zod.z.string().optional().describe("New end time in ISO 8601 format"),
106
+ event_id: import_zod.z.string().describe("Event ID to update"),
107
+ 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."),
108
+ title: import_zod.z.string().min(1).max(500).optional().describe("New event title"),
109
+ description: import_zod.z.string().nullable().optional().describe("New description, or null to clear it"),
110
+ start_time: import_zod.z.string().datetime().optional().describe("New start time (ISO 8601)"),
111
+ end_time: import_zod.z.string().datetime().optional().describe("New end time (ISO 8601)"),
90
112
  all_day: import_zod.z.boolean().optional().describe("Whether this is an all-day event"),
91
113
  status: import_zod.z.enum(["confirmed", "tentative", "cancelled"]).optional().describe("New event status"),
92
- 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."),
93
- metadata: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional().describe("Updated metadata")
114
+ metadata: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional().describe("Replacement metadata object"),
115
+ 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.")
94
116
  });
95
117
  var CancelEventSchema = import_zod.z.object({
96
- calendar_id: import_zod.z.string().describe("Calendar ID that owns the event"),
97
- event_id: import_zod.z.string().describe("Event ID to cancel")
118
+ event_id: import_zod.z.string().describe("Event ID to cancel"),
119
+ 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.")
98
120
  });
99
121
  var ConfirmEventSchema = import_zod.z.object({
100
122
  event_id: import_zod.z.string().describe("Event ID of the hold to confirm")
@@ -105,14 +127,13 @@ var ReleaseEventSchema = import_zod.z.object({
105
127
  var CreateAgentSchema = import_zod.z.object({
106
128
  name: import_zod.z.string().min(1).max(255).describe("Display name for the agent"),
107
129
  type: import_zod.z.enum(["ai", "human", "resource"]).describe("Agent type"),
108
- description: import_zod.z.string().optional().describe("Optional description"),
109
- metadata: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional().describe("Arbitrary key-value metadata")
130
+ description: import_zod.z.string().optional().describe("Optional description")
110
131
  });
111
132
  var ListAgentsSchema = import_zod.z.object({
112
133
  type: import_zod.z.enum(["ai", "human", "resource"]).optional().describe("Filter by agent type"),
113
134
  status: import_zod.z.enum(["active", "paused", "decommissioned"]).optional().describe("Filter by status"),
114
- limit: import_zod.z.number().int().min(1).max(200).optional().describe("Max results per page (default 50)"),
115
- offset: import_zod.z.number().int().min(0).optional().describe("Pagination offset (default 0)")
135
+ limit: import_zod.z.number().int().min(1).max(200).default(50).describe("Max results to return"),
136
+ offset: import_zod.z.number().int().min(0).default(0).describe("Pagination offset")
116
137
  });
117
138
  var GetAgentSchema = import_zod.z.object({
118
139
  agent_id: import_zod.z.string().describe("Agent ID to fetch")
@@ -129,27 +150,32 @@ var DeleteAgentSchema = import_zod.z.object({
129
150
  });
130
151
  var GetAvailabilitySchema = import_zod.z.object({
131
152
  agent_id: import_zod.z.string().describe("Agent ID to check availability for"),
132
- start: import_zod.z.string().describe("Range start (ISO 8601)"),
133
- end: import_zod.z.string().describe("Range end (ISO 8601)"),
134
- slot_duration: import_zod.z.enum(["15m", "30m", "45m", "1h", "2h"]).optional().describe('Minimum slot duration required (default "30m")'),
135
- include_busy: import_zod.z.boolean().optional().describe("Include busy blocks in response")
153
+ start: import_zod.z.string().datetime().optional().describe("Range start (ISO 8601). Alias: start_time."),
154
+ end: import_zod.z.string().datetime().optional().describe("Range end (ISO 8601). Alias: end_time."),
155
+ start_time: import_zod.z.string().datetime().optional().describe("Alias for `start` (matches REST events naming)."),
156
+ end_time: import_zod.z.string().datetime().optional().describe("Alias for `end` (matches REST events naming)."),
157
+ 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"),
158
+ include_busy: import_zod.z.boolean().default(false).describe("Include busy blocks in response")
136
159
  });
137
160
  var FindMeetingTimeSchema = import_zod.z.object({
138
- 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."),
139
- start: import_zod.z.string().describe("Search range start (ISO 8601)"),
140
- end: import_zod.z.string().describe("Search range end (ISO 8601)"),
141
- slot_duration: import_zod.z.enum(["15m", "30m", "45m", "1h", "2h"]).optional().describe('Minimum slot duration required (default "30m")'),
161
+ 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."),
162
+ agent_ids: import_zod.z.array(import_zod.z.string()).min(1).optional().describe("Alias for `agents` (matches REST/scheduling-proposal naming)."),
163
+ start: import_zod.z.string().datetime().optional().describe("Search range start (ISO 8601). Alias: start_time."),
164
+ end: import_zod.z.string().datetime().optional().describe("Search range end (ISO 8601). Alias: end_time."),
165
+ start_time: import_zod.z.string().datetime().optional().describe("Alias for `start` (matches REST events naming)."),
166
+ end_time: import_zod.z.string().datetime().optional().describe("Alias for `end` (matches REST events naming)."),
167
+ 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"),
142
168
  calendars: import_zod.z.array(import_zod.z.string()).optional().describe("Additional shared calendar IDs to treat as busy"),
143
- include_busy: import_zod.z.boolean().optional().describe("Include per-agent busy blocks in response")
169
+ include_busy: import_zod.z.boolean().default(false).describe("Include per-agent busy blocks in response")
144
170
  });
145
171
  var GetCalendarContextSchema = import_zod.z.object({
146
172
  calendar_id: import_zod.z.string().describe("Calendar ID")
147
173
  });
148
174
  var proposalSlotSchema = import_zod.z.object({
149
- start_time: import_zod.z.string().describe("Slot start (ISO 8601)"),
150
- end_time: import_zod.z.string().describe("Slot end (ISO 8601)"),
151
- weight: import_zod.z.number().min(0).max(10).optional().describe("Preference weight (default 1.0)"),
152
- calendar_id: import_zod.z.string().optional().describe("Override calendar for this slot")
175
+ start_time: import_zod.z.string().datetime(),
176
+ end_time: import_zod.z.string().datetime(),
177
+ weight: import_zod.z.number().min(0).max(10).default(1).optional(),
178
+ calendar_id: import_zod.z.string().optional()
153
179
  });
154
180
  var CreateProposalSchema = import_zod.z.object({
155
181
  title: import_zod.z.string().min(1).max(500).describe("Short description of what the meeting is about"),
@@ -158,7 +184,7 @@ var CreateProposalSchema = import_zod.z.object({
158
184
  participant_agent_ids: import_zod.z.array(import_zod.z.string()).min(1).max(50).describe("Agent IDs invited to respond"),
159
185
  calendar_id: import_zod.z.string().describe("Calendar the resolved event will be created on"),
160
186
  slots: import_zod.z.array(proposalSlotSchema).min(1).max(20).describe("Candidate time slots (up to 20)"),
161
- expires_at: import_zod.z.string().optional().describe("Auto-cancel cutoff if unresolved (ISO 8601)")
187
+ expires_at: import_zod.z.string().datetime().optional().describe("Auto-cancel cutoff if unresolved")
162
188
  });
163
189
  var ListProposalsSchema = import_zod.z.object({
164
190
  status: import_zod.z.enum(["pending", "confirmed", "expired", "cancelled"]).optional().describe("Filter by proposal status"),
@@ -183,10 +209,11 @@ var ResolveProposalSchema = import_zod.z.object({
183
209
  var CancelProposalSchema = import_zod.z.object({
184
210
  proposal_id: import_zod.z.string().describe("Proposal to cancel")
185
211
  });
212
+ var timeOfDay = import_zod.z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, "must be HH:MM in 24-hour time");
186
213
  var workingHoursDaySchema = import_zod.z.object({
187
- start: import_zod.z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, "must be HH:MM in 24-hour time"),
188
- end: import_zod.z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, "must be HH:MM in 24-hour time")
189
- });
214
+ start: timeOfDay,
215
+ end: timeOfDay
216
+ }).refine((v) => v.end > v.start, "end must be after start").describe("A single day's working hours window");
190
217
  var workingHoursSchema = import_zod.z.object({
191
218
  mon: workingHoursDaySchema.optional(),
192
219
  tue: workingHoursDaySchema.optional(),
@@ -195,13 +222,13 @@ var workingHoursSchema = import_zod.z.object({
195
222
  fri: workingHoursDaySchema.optional(),
196
223
  sat: workingHoursDaySchema.optional(),
197
224
  sun: workingHoursDaySchema.optional()
198
- }).nullable();
225
+ }).refine((v) => Object.keys(v).length > 0, "at least one day must be specified").nullable();
199
226
  var SetAvailabilityRulesSchema = import_zod.z.object({
200
227
  calendar_id: import_zod.z.string().describe("Calendar to configure"),
201
- buffer_before_minutes: import_zod.z.number().int().min(0).max(120).optional().describe("Minutes of buffer before each event (0\u2013120)"),
202
- buffer_after_minutes: import_zod.z.number().int().min(0).max(120).optional().describe("Minutes of buffer after each event (0\u2013120)"),
203
- 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."),
204
- timezone: import_zod.z.string().min(1).max(64).optional().describe("IANA timezone used to interpret working_hours (e.g. America/New_York)")
228
+ buffer_before_minutes: import_zod.z.number().int().min(0).max(120).default(0).describe("Minutes of buffer before each event (0\u2013120)"),
229
+ buffer_after_minutes: import_zod.z.number().int().min(0).max(120).default(0).describe("Minutes of buffer after each event (0\u2013120)"),
230
+ 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."),
231
+ timezone: import_zod.z.string().min(1).max(64).default("UTC").describe("IANA timezone used to interpret working_hours (e.g. America/New_York)")
205
232
  });
206
233
  var GetAvailabilityRulesSchema = import_zod.z.object({
207
234
  calendar_id: import_zod.z.string().describe("Calendar to read")
@@ -218,8 +245,8 @@ var RevokeScopedKeySchema = import_zod.z.object({
218
245
  key_id: import_zod.z.string().describe("ID of the scoped key to revoke")
219
246
  });
220
247
  var GetAuditLogSchema = import_zod.z.object({
221
- from: import_zod.z.string().optional().describe("Start of the window (ISO 8601). Silently clamped to the plan retention window if older."),
222
- to: import_zod.z.string().optional().describe("End of the window (ISO 8601)"),
248
+ 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."),
249
+ to: import_zod.z.string().datetime({ offset: true }).optional().describe("End of the window (ISO 8601)"),
223
250
  action: import_zod.z.string().min(1).max(64).optional().describe("Filter by action name (e.g. event.created)"),
224
251
  actor_key_prefix: import_zod.z.string().min(1).max(32).optional().describe("Filter by the API key prefix that performed the action"),
225
252
  cursor: import_zod.z.string().min(1).max(256).optional().describe("Opaque pagination cursor from a previous response"),
@@ -229,33 +256,40 @@ var AcceptTermsSchema = import_zod.z.object({
229
256
  tos_version: import_zod.z.string().min(1).describe("The terms-of-service version to accept; must match the current version")
230
257
  });
231
258
  var ListWebhooksSchema = import_zod.z.object({
232
- limit: import_zod.z.number().int().min(1).max(100).optional().describe("Max results per page (default 20)"),
233
- offset: import_zod.z.number().int().min(0).optional().describe("Pagination offset (default 0)")
259
+ limit: import_zod.z.number().int().min(1).max(100).default(20).describe("Max results to return"),
260
+ offset: import_zod.z.number().int().min(0).default(0).describe("Pagination offset")
234
261
  });
235
262
  var GetWebhookSchema = import_zod.z.object({
236
- webhook_id: import_zod.z.string().describe("The webhook ID to retrieve")
263
+ webhook_id: import_zod.z.string().describe("Webhook subscription to fetch")
237
264
  });
238
265
  var CreateWebhookSchema = import_zod.z.object({
239
- url: import_zod.z.string().describe("HTTPS URL to receive webhook payloads"),
240
- events: import_zod.z.array(import_zod.z.string()).describe('Event types to subscribe to (e.g., ["event.created", "event.updated"])')
266
+ url: import_zod.z.string().url().describe("HTTPS endpoint that will receive event deliveries"),
267
+ events: import_zod.z.array(import_zod.z.enum(WEBHOOK_EVENT_TYPES)).min(1).describe("Event types to subscribe to")
241
268
  });
242
269
  var UpdateWebhookSchema = import_zod.z.object({
243
- webhook_id: import_zod.z.string().describe("The webhook ID to update"),
244
- url: import_zod.z.string().optional().describe("New webhook URL"),
245
- events: import_zod.z.array(import_zod.z.string()).optional().describe("New event type subscriptions"),
246
- active: import_zod.z.boolean().optional().describe("Enable or disable the webhook")
270
+ webhook_id: import_zod.z.string().describe("Webhook subscription to update"),
271
+ url: import_zod.z.string().url().optional().describe("New HTTPS delivery endpoint"),
272
+ events: import_zod.z.array(import_zod.z.enum(WEBHOOK_EVENT_TYPES)).min(1).optional().describe("Replacement set of event types to subscribe to"),
273
+ active: import_zod.z.boolean().optional().describe("Set false to pause deliveries, true to resume")
247
274
  });
248
275
  var DeleteWebhookSchema = import_zod.z.object({
249
- webhook_id: import_zod.z.string().describe("The webhook ID to delete")
276
+ webhook_id: import_zod.z.string().describe("Webhook subscription to delete")
277
+ });
278
+ var ListWebhookDeliveriesSchema = import_zod.z.object({
279
+ webhook_id: import_zod.z.string().describe("Webhook subscription whose deliveries to list"),
280
+ limit: import_zod.z.number().int().min(1).max(100).default(20).describe("Max results to return"),
281
+ offset: import_zod.z.number().int().min(0).default(0).describe("Pagination offset"),
282
+ status: import_zod.z.enum(WEBHOOK_DELIVERY_STATUSES).optional().describe("Filter to a single delivery status"),
283
+ include_payload: import_zod.z.boolean().optional().describe("Include the full event payload sent on each delivery")
250
284
  });
251
285
  var ListICalSubscriptionsSchema = import_zod.z.object({
252
- agent_id: import_zod.z.string().describe("Agent ID to list subscriptions for"),
286
+ agent_id: import_zod.z.string().describe("Agent ID whose iCal subscriptions to list"),
253
287
  status: import_zod.z.enum(["active", "error", "paused"]).optional().describe("Filter by subscription status"),
254
- limit: import_zod.z.number().int().min(1).max(200).optional().describe("Max results per page (default 50)"),
255
- offset: import_zod.z.number().int().min(0).optional().describe("Pagination offset (default 0)")
288
+ limit: import_zod.z.number().int().min(1).max(200).default(50).describe("Max results to return"),
289
+ offset: import_zod.z.number().int().min(0).default(0).describe("Pagination offset")
256
290
  });
257
291
  var GetICalSubscriptionSchema = import_zod.z.object({
258
- subscription_id: import_zod.z.string().describe("The iCal subscription ID to retrieve")
292
+ subscription_id: import_zod.z.string().describe("iCal subscription ID to fetch")
259
293
  });
260
294
  var SubscribeICalSchema = import_zod.z.object({
261
295
  agent_id: import_zod.z.string().describe("Agent ID that will own this subscription"),
@@ -263,23 +297,16 @@ var SubscribeICalSchema = import_zod.z.object({
263
297
  url: import_zod.z.string().url().describe("HTTPS URL of the iCal feed (.ics) to subscribe to"),
264
298
  label: import_zod.z.string().optional().describe("Optional label for this subscription")
265
299
  });
266
- var ListWebhookDeliveriesSchema = import_zod.z.object({
267
- webhook_id: import_zod.z.string().describe("Webhook subscription whose deliveries to list"),
268
- limit: import_zod.z.number().int().min(1).max(100).optional().describe("Max results to return (default 20)"),
269
- offset: import_zod.z.number().int().min(0).optional().describe("Pagination offset (default 0)"),
270
- status: import_zod.z.enum(["pending", "delivered", "failed"]).optional().describe("Filter to a single delivery status"),
271
- include_payload: import_zod.z.boolean().optional().describe("Include the full event payload sent on each delivery")
272
- });
273
300
  var UpdateICalSubscriptionSchema = import_zod.z.object({
274
- subscription_id: import_zod.z.string().describe("The iCal subscription ID to update"),
275
- label: import_zod.z.string().optional().describe("New label"),
276
- url: import_zod.z.string().optional().describe("New iCal feed URL")
301
+ subscription_id: import_zod.z.string().describe("iCal subscription ID to update"),
302
+ label: import_zod.z.string().min(1).max(255).optional().describe("New label for this subscription"),
303
+ url: import_zod.z.string().url().startsWith("https://", "URL must use HTTPS").optional().describe("New HTTPS URL of the iCal feed (.ics)")
277
304
  });
278
305
  var DeleteICalSubscriptionSchema = import_zod.z.object({
279
- subscription_id: import_zod.z.string().describe("The iCal subscription ID to delete")
306
+ subscription_id: import_zod.z.string().describe("iCal subscription ID to delete")
280
307
  });
281
308
  var SyncICalSubscriptionSchema = import_zod.z.object({
282
- subscription_id: import_zod.z.string().describe("The iCal subscription ID to sync immediately")
309
+ subscription_id: import_zod.z.string().describe("iCal subscription ID to sync")
283
310
  });
284
311
  var GetUsageSchema = import_zod.z.object({});
285
312
 
@@ -336,6 +363,9 @@ var deleteCalendar = safeFunc(async (ctx) => {
336
363
  });
337
364
  var listEvents = safeFunc(async (ctx) => {
338
365
  const { client, params } = ctx;
366
+ if (!params.calendar_id && !params.agent_id) {
367
+ throw new Error("Provide calendar_id or agent_id");
368
+ }
339
369
  const iter = client.events.list({
340
370
  calendarId: params.calendar_id,
341
371
  agentId: params.agent_id,
@@ -348,7 +378,8 @@ var listEvents = safeFunc(async (ctx) => {
348
378
  return fetchPage(iter, params.offset, params.limit);
349
379
  });
350
380
  var getEvent = safeFunc(async (ctx) => {
351
- return ctx.client.events.get(ctx.params.calendar_id, ctx.params.event_id);
381
+ const { calendar_id, event_id } = ctx.params;
382
+ return calendar_id ? ctx.client.events.get(calendar_id, event_id) : ctx.client.events.getById(event_id);
352
383
  });
353
384
  var createEvent = safeFunc(async (ctx) => {
354
385
  const { client, params } = ctx;
@@ -358,10 +389,15 @@ var createEvent = safeFunc(async (ctx) => {
358
389
  var updateEvent = safeFunc(async (ctx) => {
359
390
  const { client, params } = ctx;
360
391
  const { calendar_id, event_id, ...updates } = params;
361
- return client.events.update(calendar_id, event_id, updates);
392
+ return calendar_id ? client.events.update(calendar_id, event_id, updates) : client.events.updateById(event_id, updates);
362
393
  });
363
394
  var cancelEvent = safeFunc(async (ctx) => {
364
- await ctx.client.events.delete(ctx.params.calendar_id, ctx.params.event_id);
395
+ const { calendar_id, event_id } = ctx.params;
396
+ if (calendar_id) {
397
+ await ctx.client.events.delete(calendar_id, event_id);
398
+ } else {
399
+ await ctx.client.events.deleteById(event_id);
400
+ }
365
401
  return void 0;
366
402
  });
367
403
  var confirmEvent = safeFunc(async (ctx) => {
@@ -392,15 +428,34 @@ var deleteAgent = safeFunc(async (ctx) => {
392
428
  });
393
429
  var getAvailability = safeFunc(async (ctx) => {
394
430
  const { client, params } = ctx;
431
+ const start = params.start ?? params.start_time;
432
+ const end = params.end ?? params.end_time;
433
+ if (!start || !end) {
434
+ throw new Error("start (or start_time) and end (or end_time) are required");
435
+ }
395
436
  return client.availability.forAgent(params.agent_id, {
396
- start: params.start,
397
- end: params.end,
437
+ start,
438
+ end,
398
439
  slot_duration: params.slot_duration,
399
440
  include_busy: params.include_busy
400
441
  });
401
442
  });
402
443
  var findMeetingTime = safeFunc(async (ctx) => {
403
- return ctx.client.availability.check(ctx.params);
444
+ const { client, params } = ctx;
445
+ const agents = params.agents ?? params.agent_ids;
446
+ const start = params.start ?? params.start_time;
447
+ const end = params.end ?? params.end_time;
448
+ if (!agents || !start || !end) {
449
+ throw new Error("agents (or agent_ids), start (or start_time), and end (or end_time) are required");
450
+ }
451
+ return client.availability.check({
452
+ agents,
453
+ start,
454
+ end,
455
+ slot_duration: params.slot_duration,
456
+ calendars: params.calendars,
457
+ include_busy: params.include_busy
458
+ });
404
459
  });
405
460
  var getCalendarContext = safeFunc(async (ctx) => {
406
461
  return ctx.client.calendars.getContext(ctx.params.calendar_id);
@@ -574,35 +629,35 @@ var TOOL_DEFINITIONS = [
574
629
  // ── Calendars ──────────────────────────────────────────────────
575
630
  {
576
631
  name: "list_calendars",
577
- description: "List calendars, optionally filtered by agent. Returns paginated results.",
632
+ 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.",
578
633
  schema: ListCalendarsSchema,
579
634
  annotations: { title: "List Calendars", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
580
635
  execute: createExecutor(listCalendars)
581
636
  },
582
637
  {
583
638
  name: "get_calendar",
584
- description: "Get a calendar by its ID, including its name, timezone, and iCal feed URL.",
639
+ 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.",
585
640
  schema: GetCalendarSchema,
586
641
  annotations: { title: "Get Calendar", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
587
642
  execute: createExecutor(getCalendar)
588
643
  },
589
644
  {
590
645
  name: "create_calendar",
591
- description: "Create a new calendar. Specify a name and IANA timezone. Optionally scope it to an agent.",
646
+ 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.',
592
647
  schema: CreateCalendarSchema,
593
648
  annotations: { title: "Create Calendar", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
594
649
  execute: createExecutor(createCalendar)
595
650
  },
596
651
  {
597
652
  name: "update_calendar",
598
- description: "Update a calendar's name, timezone, or metadata.",
653
+ description: "Update a calendar's name, timezone, agent status, default reminders, or metadata. Agent-scoped keys may only update calendars owned by their agent.",
599
654
  schema: UpdateCalendarSchema,
600
655
  annotations: { title: "Update Calendar", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
601
656
  execute: createExecutor(updateCalendar)
602
657
  },
603
658
  {
604
659
  name: "delete_calendar",
605
- description: "Permanently delete a calendar and all its events.",
660
+ 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.",
606
661
  schema: DeleteCalendarSchema,
607
662
  annotations: { title: "Delete Calendar", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
608
663
  execute: createExecutor(deleteCalendar)
@@ -610,42 +665,42 @@ var TOOL_DEFINITIONS = [
610
665
  // ── Events ─────────────────────────────────────────────────────
611
666
  {
612
667
  name: "list_events",
613
- description: "List events on a calendar or for an agent. Supports date range and status filters. Provide calendar_id or agent_id.",
668
+ 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`.",
614
669
  schema: ListEventsSchema,
615
670
  annotations: { title: "List Events", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
616
671
  execute: createExecutor(listEvents)
617
672
  },
618
673
  {
619
674
  name: "get_event",
620
- description: "Get a specific event by its calendar ID and event ID.",
675
+ 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.",
621
676
  schema: GetEventSchema,
622
677
  annotations: { title: "Get Event", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
623
678
  execute: createExecutor(getEvent)
624
679
  },
625
680
  {
626
681
  name: "create_event",
627
- 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.",
682
+ 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.`,
628
683
  schema: CreateEventSchema,
629
684
  annotations: { title: "Create Event", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
630
685
  execute: createExecutor(createEvent)
631
686
  },
632
687
  {
633
688
  name: "update_event",
634
- description: "Update an existing event's title, times, status, or other properties.",
689
+ 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.",
635
690
  schema: UpdateEventSchema,
636
691
  annotations: { title: "Update Event", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
637
692
  execute: createExecutor(updateEvent)
638
693
  },
639
694
  {
640
695
  name: "cancel_event",
641
- description: "Delete or cancel an event from a calendar. The event is marked cancelled and excluded from future availability calculations.",
696
+ 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.",
642
697
  schema: CancelEventSchema,
643
698
  annotations: { title: "Cancel Event", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
644
699
  execute: createExecutor(cancelEvent)
645
700
  },
646
701
  {
647
702
  name: "confirm_event",
648
- 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.',
703
+ 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.',
649
704
  schema: ConfirmEventSchema,
650
705
  annotations: { title: "Confirm Event", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
651
706
  execute: createExecutor(confirmEvent)
@@ -667,28 +722,28 @@ var TOOL_DEFINITIONS = [
667
722
  },
668
723
  {
669
724
  name: "list_agents",
670
- description: "List all agents in your organization. Returns paginated results.",
725
+ description: "List all agents in your organization",
671
726
  schema: ListAgentsSchema,
672
727
  annotations: { title: "List Agents", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
673
728
  execute: createExecutor(listAgents)
674
729
  },
675
730
  {
676
731
  name: "get_agent",
677
- description: "Fetch a single agent by ID. An agent represents an AI assistant, human, or shared resource (e.g. a meeting room).",
732
+ 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.",
678
733
  schema: GetAgentSchema,
679
734
  annotations: { title: "Get Agent", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
680
735
  execute: createExecutor(getAgent)
681
736
  },
682
737
  {
683
738
  name: "update_agent",
684
- description: "Update an agent's name, description, metadata, or status (active/paused). Requires an org-level API key.",
739
+ 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.",
685
740
  schema: UpdateAgentSchema,
686
741
  annotations: { title: "Update Agent", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
687
742
  execute: createExecutor(updateAgent)
688
743
  },
689
744
  {
690
745
  name: "delete_agent",
691
- description: "Decommission an agent. This marks the agent as decommissioned and revokes all of its scoped API keys. Requires an org-level API key.",
746
+ 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.",
692
747
  schema: DeleteAgentSchema,
693
748
  annotations: { title: "Delete Agent", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
694
749
  execute: createExecutor(deleteAgent)
@@ -696,14 +751,14 @@ var TOOL_DEFINITIONS = [
696
751
  // ── Availability ───────────────────────────────────────────────
697
752
  {
698
753
  name: "get_availability",
699
- description: "Check when a single agent is free within a time range. Returns available time slots and optionally busy blocks.",
754
+ 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).",
700
755
  schema: GetAvailabilitySchema,
701
756
  annotations: { title: "Get Availability", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
702
757
  execute: createExecutor(getAvailability)
703
758
  },
704
759
  {
705
760
  name: "find_meeting_time",
706
- description: "Find time slots when multiple agents are all free simultaneously. All agents must be free during the returned slots.",
761
+ 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).",
707
762
  schema: FindMeetingTimeSchema,
708
763
  annotations: { title: "Find Meeting Time", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
709
764
  execute: createExecutor(findMeetingTime)
@@ -711,7 +766,7 @@ var TOOL_DEFINITIONS = [
711
766
  // ── Calendar context ───────────────────────────────────────────
712
767
  {
713
768
  name: "get_calendar_context",
714
- 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.",
769
+ 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.`,
715
770
  schema: GetCalendarContextSchema,
716
771
  annotations: { title: "Get Calendar Context", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
717
772
  execute: createExecutor(getCalendarContext)
@@ -719,14 +774,14 @@ var TOOL_DEFINITIONS = [
719
774
  // ── Scheduling proposals ───────────────────────────────────────
720
775
  {
721
776
  name: "create_proposal",
722
- 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.",
777
+ 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.",
723
778
  schema: CreateProposalSchema,
724
779
  annotations: { title: "Create Proposal", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
725
780
  execute: createExecutor(createProposal)
726
781
  },
727
782
  {
728
783
  name: "list_proposals",
729
- description: "List scheduling proposals for the org. Filter by status or organizer_agent_id. Requires an org-level API key.",
784
+ description: "List scheduling proposals for the org. Filter by status (pending|confirmed|expired|cancelled) or organizer_agent_id. Requires an org-level API key.",
730
785
  schema: ListProposalsSchema,
731
786
  annotations: { title: "List Proposals", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
732
787
  execute: createExecutor(listProposals)
@@ -740,14 +795,14 @@ var TOOL_DEFINITIONS = [
740
795
  },
741
796
  {
742
797
  name: "respond_to_proposal",
743
- 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.",
798
+ 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.',
744
799
  schema: RespondToProposalSchema,
745
800
  annotations: { title: "Respond To Proposal", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
746
801
  execute: createExecutor(respondToProposal)
747
802
  },
748
803
  {
749
804
  name: "resolve_proposal",
750
- 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.",
805
+ 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.',
751
806
  schema: ResolveProposalSchema,
752
807
  annotations: { title: "Resolve Proposal", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
753
808
  execute: createExecutor(resolveProposal)
@@ -762,7 +817,7 @@ var TOOL_DEFINITIONS = [
762
817
  // ── Availability rules ─────────────────────────────────────────
763
818
  {
764
819
  name: "set_availability_rules",
765
- 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.",
820
+ 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.",
766
821
  schema: SetAvailabilityRulesSchema,
767
822
  annotations: { title: "Set Availability Rules", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
768
823
  execute: createExecutor(setAvailabilityRules)
@@ -776,7 +831,7 @@ var TOOL_DEFINITIONS = [
776
831
  },
777
832
  {
778
833
  name: "clear_availability_rules",
779
- description: "Remove the availability rules from a calendar, reverting to the default (no buffers, no working-hours mask).",
834
+ 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.",
780
835
  schema: ClearAvailabilityRulesSchema,
781
836
  annotations: { title: "Clear Availability Rules", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
782
837
  execute: createExecutor(clearAvailabilityRules)
@@ -784,35 +839,35 @@ var TOOL_DEFINITIONS = [
784
839
  // ── Webhooks ───────────────────────────────────────────────────
785
840
  {
786
841
  name: "list_webhooks",
787
- description: "List all webhook subscriptions for the organization.",
842
+ 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.",
788
843
  schema: ListWebhooksSchema,
789
844
  annotations: { title: "List Webhooks", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
790
845
  execute: createExecutor(listWebhooks)
791
846
  },
792
847
  {
793
848
  name: "get_webhook",
794
- description: "Get a webhook subscription by its ID.",
849
+ 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.",
795
850
  schema: GetWebhookSchema,
796
851
  annotations: { title: "Get Webhook", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
797
852
  execute: createExecutor(getWebhook)
798
853
  },
799
854
  {
800
855
  name: "create_webhook",
801
- description: "Create a webhook subscription to receive event notifications at a URL. Payloads are signed with HMAC-SHA256.",
856
+ 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.",
802
857
  schema: CreateWebhookSchema,
803
858
  annotations: { title: "Create Webhook", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
804
859
  execute: createExecutor(createWebhook)
805
860
  },
806
861
  {
807
862
  name: "update_webhook",
808
- description: "Update a webhook's URL, subscribed events, or active status.",
863
+ 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.",
809
864
  schema: UpdateWebhookSchema,
810
865
  annotations: { title: "Update Webhook", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
811
866
  execute: createExecutor(updateWebhook)
812
867
  },
813
868
  {
814
869
  name: "delete_webhook",
815
- description: "Delete a webhook subscription. No further events will be delivered to this URL.",
870
+ description: "Permanently delete a webhook subscription. This frees its endpoint slot against the per-plan cap. Requires an org-level API key.",
816
871
  schema: DeleteWebhookSchema,
817
872
  annotations: { title: "Delete Webhook", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
818
873
  execute: createExecutor(deleteWebhook)
@@ -827,42 +882,42 @@ var TOOL_DEFINITIONS = [
827
882
  // ── iCal Subscriptions ─────────────────────────────────────────
828
883
  {
829
884
  name: "list_ical_subscriptions",
830
- description: "List external calendar imports (iCal subscriptions) for an agent.",
885
+ description: "List an agent's external iCal feed subscriptions (e.g. linked Google Calendar / Outlook feeds), including their sync status and last sync time.",
831
886
  schema: ListICalSubscriptionsSchema,
832
887
  annotations: { title: "List iCal Subscriptions", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
833
888
  execute: createExecutor(listICalSubscriptions)
834
889
  },
835
890
  {
836
891
  name: "get_ical_subscription",
837
- description: "Get an iCal subscription by its ID, including sync status and last error.",
892
+ description: "Get a single external iCal feed subscription by id, including its sync status, last sync time, and last error.",
838
893
  schema: GetICalSubscriptionSchema,
839
894
  annotations: { title: "Get iCal Subscription", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
840
895
  execute: createExecutor(getICalSubscription)
841
896
  },
842
897
  {
843
898
  name: "subscribe_ical",
844
- 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.",
899
+ 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).",
845
900
  schema: SubscribeICalSchema,
846
901
  annotations: { title: "Subscribe iCal", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
847
902
  execute: createExecutor(subscribeICal)
848
903
  },
849
904
  {
850
905
  name: "update_ical_subscription",
851
- description: "Update an iCal subscription's label or feed URL.",
906
+ 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.",
852
907
  schema: UpdateICalSubscriptionSchema,
853
908
  annotations: { title: "Update iCal Subscription", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
854
909
  execute: createExecutor(updateICalSubscription)
855
910
  },
856
911
  {
857
912
  name: "delete_ical_subscription",
858
- description: "Remove an external calendar import. Previously synced events remain on the calendar.",
913
+ description: "Delete an external iCal feed subscription. Events previously synced from the feed are no longer refreshed.",
859
914
  schema: DeleteICalSubscriptionSchema,
860
915
  annotations: { title: "Delete iCal Subscription", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
861
916
  execute: createExecutor(deleteICalSubscription)
862
917
  },
863
918
  {
864
919
  name: "sync_ical_subscription",
865
- description: "Trigger an immediate sync of an iCal subscription instead of waiting for the next 30-minute poll.",
920
+ 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.",
866
921
  schema: SyncICalSubscriptionSchema,
867
922
  annotations: { title: "Sync iCal Subscription", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
868
923
  execute: createExecutor(syncICalSubscription)
@@ -870,14 +925,14 @@ var TOOL_DEFINITIONS = [
870
925
  // ── Scoped keys ────────────────────────────────────────────────
871
926
  {
872
927
  name: "create_scoped_key",
873
- 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.",
928
+ 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.",
874
929
  schema: CreateScopedKeySchema,
875
930
  annotations: { title: "Create Scoped Key", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
876
931
  execute: createExecutor(createScopedKey)
877
932
  },
878
933
  {
879
934
  name: "list_scoped_keys",
880
- 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.",
935
+ 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.",
881
936
  schema: ListScopedKeysSchema,
882
937
  annotations: { title: "List Scoped Keys", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
883
938
  execute: createExecutor(listScopedKeys)
@@ -892,7 +947,7 @@ var TOOL_DEFINITIONS = [
892
947
  // ── Audit log ──────────────────────────────────────────────────
893
948
  {
894
949
  name: "get_audit_log",
895
- 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.",
950
+ 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.",
896
951
  schema: GetAuditLogSchema,
897
952
  annotations: { title: "Get Audit Log", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
898
953
  execute: createExecutor(getAuditLog)
@@ -900,7 +955,7 @@ var TOOL_DEFINITIONS = [
900
955
  // ── Terms ──────────────────────────────────────────────────────
901
956
  {
902
957
  name: "accept_terms",
903
- 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.",
958
+ 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.",
904
959
  schema: AcceptTermsSchema,
905
960
  annotations: { title: "Accept Terms", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
906
961
  execute: createExecutor(acceptTerms)
@@ -908,7 +963,7 @@ var TOOL_DEFINITIONS = [
908
963
  // ── Usage ──────────────────────────────────────────────────────
909
964
  {
910
965
  name: "get_usage",
911
- description: "Get quota and usage statistics for the current billing period.",
966
+ 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.",
912
967
  schema: GetUsageSchema,
913
968
  annotations: { title: "Get Usage", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
914
969
  execute: createExecutor(getUsage)