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