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