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