@chronary/toolkit 0.1.3 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -15,166 +15,372 @@ var TOOL_NAMES = [
15
15
  "get_event",
16
16
  "create_event",
17
17
  "update_event",
18
- "delete_event",
19
- "check_availability",
18
+ "cancel_event",
19
+ "confirm_event",
20
+ "release_event",
21
+ "create_agent",
22
+ "list_agents",
23
+ "get_agent",
24
+ "update_agent",
25
+ "delete_agent",
26
+ "get_availability",
27
+ "find_meeting_time",
28
+ "get_calendar_context",
29
+ "create_proposal",
30
+ "list_proposals",
31
+ "get_proposal",
32
+ "respond_to_proposal",
33
+ "resolve_proposal",
34
+ "cancel_proposal",
35
+ "set_availability_rules",
36
+ "get_availability_rules",
37
+ "clear_availability_rules",
20
38
  "list_webhooks",
21
39
  "get_webhook",
22
40
  "create_webhook",
23
41
  "update_webhook",
24
42
  "delete_webhook",
43
+ "list_webhook_deliveries",
25
44
  "list_ical_subscriptions",
26
45
  "get_ical_subscription",
27
- "create_ical_subscription",
46
+ "subscribe_ical",
28
47
  "update_ical_subscription",
29
48
  "delete_ical_subscription",
30
49
  "sync_ical_subscription",
50
+ "create_scoped_key",
51
+ "list_scoped_keys",
52
+ "revoke_scoped_key",
53
+ "get_audit_log",
54
+ "accept_terms",
31
55
  "get_usage"
32
56
  ];
33
57
 
34
58
  // src/schemas.ts
35
59
  var schemas_exports = {};
36
60
  __export(schemas_exports, {
37
- CheckAvailabilitySchema: () => CheckAvailabilitySchema,
61
+ AcceptTermsSchema: () => AcceptTermsSchema,
62
+ CancelEventSchema: () => CancelEventSchema,
63
+ CancelProposalSchema: () => CancelProposalSchema,
64
+ ClearAvailabilityRulesSchema: () => ClearAvailabilityRulesSchema,
65
+ ConfirmEventSchema: () => ConfirmEventSchema,
66
+ CreateAgentSchema: () => CreateAgentSchema,
38
67
  CreateCalendarSchema: () => CreateCalendarSchema,
39
68
  CreateEventSchema: () => CreateEventSchema,
40
- CreateICalSubscriptionSchema: () => CreateICalSubscriptionSchema,
69
+ CreateProposalSchema: () => CreateProposalSchema,
70
+ CreateScopedKeySchema: () => CreateScopedKeySchema,
41
71
  CreateWebhookSchema: () => CreateWebhookSchema,
72
+ DeleteAgentSchema: () => DeleteAgentSchema,
42
73
  DeleteCalendarSchema: () => DeleteCalendarSchema,
43
- DeleteEventSchema: () => DeleteEventSchema,
44
74
  DeleteICalSubscriptionSchema: () => DeleteICalSubscriptionSchema,
45
75
  DeleteWebhookSchema: () => DeleteWebhookSchema,
76
+ FindMeetingTimeSchema: () => FindMeetingTimeSchema,
77
+ GetAgentSchema: () => GetAgentSchema,
78
+ GetAuditLogSchema: () => GetAuditLogSchema,
79
+ GetAvailabilityRulesSchema: () => GetAvailabilityRulesSchema,
80
+ GetAvailabilitySchema: () => GetAvailabilitySchema,
81
+ GetCalendarContextSchema: () => GetCalendarContextSchema,
46
82
  GetCalendarSchema: () => GetCalendarSchema,
47
83
  GetEventSchema: () => GetEventSchema,
48
84
  GetICalSubscriptionSchema: () => GetICalSubscriptionSchema,
85
+ GetProposalSchema: () => GetProposalSchema,
49
86
  GetUsageSchema: () => GetUsageSchema,
50
87
  GetWebhookSchema: () => GetWebhookSchema,
88
+ ListAgentsSchema: () => ListAgentsSchema,
51
89
  ListCalendarsSchema: () => ListCalendarsSchema,
52
90
  ListEventsSchema: () => ListEventsSchema,
53
91
  ListICalSubscriptionsSchema: () => ListICalSubscriptionsSchema,
92
+ ListProposalsSchema: () => ListProposalsSchema,
93
+ ListScopedKeysSchema: () => ListScopedKeysSchema,
94
+ ListWebhookDeliveriesSchema: () => ListWebhookDeliveriesSchema,
54
95
  ListWebhooksSchema: () => ListWebhooksSchema,
96
+ ReleaseEventSchema: () => ReleaseEventSchema,
97
+ ResolveProposalSchema: () => ResolveProposalSchema,
98
+ RespondToProposalSchema: () => RespondToProposalSchema,
99
+ RevokeScopedKeySchema: () => RevokeScopedKeySchema,
100
+ SetAvailabilityRulesSchema: () => SetAvailabilityRulesSchema,
101
+ SubscribeICalSchema: () => SubscribeICalSchema,
55
102
  SyncICalSubscriptionSchema: () => SyncICalSubscriptionSchema,
103
+ UpdateAgentSchema: () => UpdateAgentSchema,
56
104
  UpdateCalendarSchema: () => UpdateCalendarSchema,
57
105
  UpdateEventSchema: () => UpdateEventSchema,
58
106
  UpdateICalSubscriptionSchema: () => UpdateICalSubscriptionSchema,
59
107
  UpdateWebhookSchema: () => UpdateWebhookSchema
60
108
  });
61
109
  import { z } from "zod";
110
+ var WEBHOOK_EVENT_TYPES = [
111
+ "agent.created",
112
+ "agent.updated",
113
+ "event.created",
114
+ "event.updated",
115
+ "event.deleted",
116
+ "event.started",
117
+ "event.ended",
118
+ "event.reminder",
119
+ "event.hold_created",
120
+ "event.hold_expired",
121
+ "event.hold_released",
122
+ "event.hold_confirmed",
123
+ "proposal.created",
124
+ "proposal.responded",
125
+ "proposal.confirmed",
126
+ "proposal.expired",
127
+ "proposal.cancelled",
128
+ "webhook.deactivated"
129
+ ];
130
+ var WEBHOOK_DELIVERY_STATUSES = ["pending", "delivered", "failed"];
62
131
  var ListCalendarsSchema = z.object({
63
- agent_id: z.string().optional().describe("Filter calendars by agent ID"),
64
- include: z.enum(["all"]).optional().describe('Set to "all" to include soft-deleted calendars'),
65
- limit: z.number().int().min(1).max(200).optional().describe("Max results per page (default 50)"),
66
- offset: z.number().int().min(0).optional().describe("Pagination offset (default 0)")
132
+ include: z.enum(["all"]).optional().describe('Pass "all" to include calendars across all agents (org keys only)'),
133
+ limit: z.number().int().min(1).max(200).default(50).describe("Max results to return"),
134
+ offset: z.number().int().min(0).default(0).describe("Pagination offset")
67
135
  });
68
136
  var GetCalendarSchema = z.object({
69
- calendar_id: z.string().describe("The calendar ID to retrieve")
137
+ calendar_id: z.string().describe("Calendar ID to fetch")
70
138
  });
71
139
  var CreateCalendarSchema = z.object({
72
- name: z.string().describe("Calendar name"),
73
- timezone: z.string().describe('IANA timezone (e.g., "America/New_York")'),
74
- agent_id: z.string().optional().describe("Agent ID to associate the calendar with"),
75
- metadata: z.record(z.unknown()).optional().describe("Arbitrary key-value metadata")
140
+ name: z.string().min(1).max(255).describe("Calendar name"),
141
+ agent_id: z.string().optional().describe("Agent ID to own this calendar (omit for org-level)"),
142
+ timezone: z.string().min(1).describe("IANA timezone (e.g. America/New_York)"),
143
+ 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.")
76
144
  });
77
145
  var UpdateCalendarSchema = z.object({
78
- calendar_id: z.string().describe("The calendar ID to update"),
79
- name: z.string().optional().describe("New calendar name"),
80
- timezone: z.string().optional().describe("New IANA timezone"),
81
- metadata: z.record(z.unknown()).optional().describe("Updated metadata")
146
+ calendar_id: z.string().describe("Calendar ID to update"),
147
+ name: z.string().min(1).max(255).optional().describe("New calendar name"),
148
+ timezone: z.string().min(1).optional().describe("New IANA timezone (e.g. America/New_York)"),
149
+ agent_status: z.enum(["idle", "working", "waiting", "error"]).optional().describe("Owning agent's status"),
150
+ 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"),
151
+ metadata: z.record(z.string(), z.unknown()).optional().describe("Arbitrary metadata (max 16KB)")
82
152
  });
83
153
  var DeleteCalendarSchema = z.object({
84
- calendar_id: z.string().describe("The calendar ID to delete")
154
+ calendar_id: z.string().describe("Calendar ID to delete")
85
155
  });
86
156
  var ListEventsSchema = z.object({
87
- calendar_id: z.string().optional().describe("Calendar ID to list events from (provide this or agent_id)"),
88
- agent_id: z.string().optional().describe("Agent ID to list events for (provide this or calendar_id)"),
89
- start_after: z.string().optional().describe("Only events starting after this ISO 8601 datetime"),
90
- start_before: z.string().optional().describe("Only events starting before this ISO 8601 datetime"),
91
- status: z.enum(["confirmed", "tentative", "cancelled"]).optional().describe("Filter by event status"),
92
- source: z.enum(["internal", "external_ical"]).optional().describe("Filter by event source"),
93
- limit: z.number().int().min(1).max(200).optional().describe("Max results per page (default 50)"),
94
- offset: z.number().int().min(0).optional().describe("Pagination offset (default 0)")
157
+ calendar_id: z.string().describe("Calendar ID to list events from"),
158
+ start_after: z.string().datetime().optional().describe("Filter events starting after this time"),
159
+ start_before: z.string().datetime().optional().describe("Filter events starting before this time"),
160
+ limit: z.number().int().min(1).max(200).default(50).describe("Max results to return"),
161
+ offset: z.number().int().min(0).default(0).describe("Pagination offset")
95
162
  });
96
163
  var GetEventSchema = z.object({
97
- calendar_id: z.string().describe("Calendar ID the event belongs to"),
98
- event_id: z.string().describe("The event ID to retrieve")
164
+ event_id: z.string().describe("Event ID to retrieve"),
165
+ calendar_id: z.string().describe("Calendar ID that owns the event. Required \u2014 the SDK is calendar-scoped (unlike the hosted MCP, which can resolve the calendar from event_id).")
99
166
  });
100
167
  var CreateEventSchema = z.object({
101
- calendar_id: z.string().describe("Calendar ID to create the event on"),
102
- title: z.string().describe("Event title"),
103
- start_time: z.string().describe("Start time in ISO 8601 format"),
104
- end_time: z.string().describe("End time in ISO 8601 format"),
105
- description: z.string().optional().describe("Event description"),
106
- all_day: z.boolean().optional().describe("Whether this is an all-day event"),
107
- status: z.enum(["confirmed", "tentative", "cancelled"]).optional().describe('Event status (default "confirmed")'),
108
- metadata: z.record(z.unknown()).optional().describe("Arbitrary key-value metadata")
168
+ calendar_id: z.string().describe("Calendar ID to add the event to"),
169
+ title: z.string().min(1).max(500).describe("Event title"),
170
+ start_time: z.string().datetime().describe("Start time (ISO 8601)"),
171
+ end_time: z.string().datetime().describe("End time (ISO 8601)"),
172
+ description: z.string().optional().describe("Optional event description"),
173
+ all_day: z.boolean().default(false).describe("Whether this is an all-day event"),
174
+ 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".'),
175
+ 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."),
176
+ 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.'),
177
+ 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.')
109
178
  });
110
179
  var UpdateEventSchema = z.object({
111
- calendar_id: z.string().describe("Calendar ID the event belongs to"),
112
- event_id: z.string().describe("The event ID to update"),
113
- title: z.string().optional().describe("New event title"),
114
- description: z.string().nullable().optional().describe("New description (null to clear)"),
115
- start_time: z.string().optional().describe("New start time in ISO 8601 format"),
116
- end_time: z.string().optional().describe("New end time in ISO 8601 format"),
180
+ event_id: z.string().describe("Event ID to update"),
181
+ calendar_id: z.string().describe("Calendar ID that owns the event. Required \u2014 the SDK is calendar-scoped (unlike the hosted MCP, which can resolve the calendar from event_id)."),
182
+ title: z.string().min(1).max(500).optional().describe("New event title"),
183
+ description: z.string().nullable().optional().describe("New description, or null to clear it"),
184
+ start_time: z.string().datetime().optional().describe("New start time (ISO 8601)"),
185
+ end_time: z.string().datetime().optional().describe("New end time (ISO 8601)"),
117
186
  all_day: z.boolean().optional().describe("Whether this is an all-day event"),
118
187
  status: z.enum(["confirmed", "tentative", "cancelled"]).optional().describe("New event status"),
119
- metadata: z.record(z.unknown()).optional().describe("Updated metadata")
188
+ metadata: z.record(z.string(), z.unknown()).optional().describe("Replacement metadata object"),
189
+ 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.")
120
190
  });
121
- var DeleteEventSchema = z.object({
122
- calendar_id: z.string().describe("Calendar ID the event belongs to"),
123
- event_id: z.string().describe("The event ID to delete")
191
+ var CancelEventSchema = z.object({
192
+ event_id: z.string().describe("Event ID to cancel"),
193
+ calendar_id: z.string().describe("Calendar ID that owns the event. Required \u2014 the SDK is calendar-scoped (unlike the hosted MCP, which can resolve the calendar from event_id).")
124
194
  });
125
- var CheckAvailabilitySchema = z.object({
126
- agents: z.array(z.string()).min(1).describe("Agent IDs to check availability for"),
127
- start: z.string().describe("Start of time range in ISO 8601 format"),
128
- end: z.string().describe("End of time range in ISO 8601 format"),
129
- slot_duration: z.enum(["15m", "30m", "45m", "1h", "2h"]).optional().describe('Duration of availability slots (default "30m")'),
130
- calendars: z.array(z.string()).optional().describe("Specific calendar IDs to check (default: all agent calendars)"),
131
- include_busy: z.boolean().optional().describe("Include busy blocks in response")
195
+ var ConfirmEventSchema = z.object({
196
+ event_id: z.string().describe("Event ID of the hold to confirm")
132
197
  });
133
- var ListWebhooksSchema = z.object({
134
- limit: z.number().int().min(1).max(100).optional().describe("Max results per page (default 20)"),
198
+ var ReleaseEventSchema = z.object({
199
+ event_id: z.string().describe("Event ID of the hold to release")
200
+ });
201
+ var CreateAgentSchema = z.object({
202
+ name: z.string().min(1).max(255).describe("Display name for the agent"),
203
+ type: z.enum(["ai", "human", "resource"]).describe("Agent type"),
204
+ description: z.string().optional().describe("Optional description")
205
+ });
206
+ var ListAgentsSchema = z.object({
207
+ type: z.enum(["ai", "human", "resource"]).optional().describe("Filter by agent type"),
208
+ status: z.enum(["active", "paused", "decommissioned"]).optional().describe("Filter by status"),
209
+ limit: z.number().int().min(1).max(200).default(50).describe("Max results to return"),
210
+ offset: z.number().int().min(0).default(0).describe("Pagination offset")
211
+ });
212
+ var GetAgentSchema = z.object({
213
+ agent_id: z.string().describe("Agent ID to fetch")
214
+ });
215
+ var UpdateAgentSchema = z.object({
216
+ agent_id: z.string().describe("Agent ID to update"),
217
+ name: z.string().min(1).max(255).optional().describe("New display name"),
218
+ description: z.string().nullable().optional().describe("New description (null to clear)"),
219
+ metadata: z.record(z.string(), z.unknown()).optional().describe("Arbitrary metadata (max 16KB)"),
220
+ status: z.enum(["active", "paused"]).optional().describe("Operational status")
221
+ });
222
+ var DeleteAgentSchema = z.object({
223
+ agent_id: z.string().describe("Agent ID to decommission")
224
+ });
225
+ var GetAvailabilitySchema = z.object({
226
+ agent_id: z.string().describe("Agent ID to check availability for"),
227
+ start: z.string().datetime().optional().describe("Range start (ISO 8601). Alias: start_time."),
228
+ end: z.string().datetime().optional().describe("Range end (ISO 8601). Alias: end_time."),
229
+ start_time: z.string().datetime().optional().describe("Alias for `start` (matches REST events naming)."),
230
+ end_time: z.string().datetime().optional().describe("Alias for `end` (matches REST events naming)."),
231
+ 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"),
232
+ include_busy: z.boolean().default(false).describe("Include busy blocks in response")
233
+ });
234
+ var FindMeetingTimeSchema = z.object({
235
+ 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."),
236
+ agent_ids: z.array(z.string()).min(1).optional().describe("Alias for `agents` (matches REST/scheduling-proposal naming)."),
237
+ start: z.string().datetime().optional().describe("Search range start (ISO 8601). Alias: start_time."),
238
+ end: z.string().datetime().optional().describe("Search range end (ISO 8601). Alias: end_time."),
239
+ start_time: z.string().datetime().optional().describe("Alias for `start` (matches REST events naming)."),
240
+ end_time: z.string().datetime().optional().describe("Alias for `end` (matches REST events naming)."),
241
+ 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"),
242
+ calendars: z.array(z.string()).optional().describe("Additional shared calendar IDs to treat as busy"),
243
+ include_busy: z.boolean().default(false).describe("Include per-agent busy blocks in response")
244
+ });
245
+ var GetCalendarContextSchema = z.object({
246
+ calendar_id: z.string().describe("Calendar ID")
247
+ });
248
+ var proposalSlotSchema = z.object({
249
+ start_time: z.string().datetime(),
250
+ end_time: z.string().datetime(),
251
+ weight: z.number().min(0).max(10).default(1).optional(),
252
+ calendar_id: z.string().optional()
253
+ });
254
+ var CreateProposalSchema = z.object({
255
+ title: z.string().min(1).max(500).describe("Short description of what the meeting is about"),
256
+ description: z.string().max(5e3).optional().describe("Longer context/agenda"),
257
+ organizer_agent_id: z.string().describe("Agent ID proposing the meeting"),
258
+ participant_agent_ids: z.array(z.string()).min(1).max(50).describe("Agent IDs invited to respond"),
259
+ calendar_id: z.string().describe("Calendar the resolved event will be created on"),
260
+ slots: z.array(proposalSlotSchema).min(1).max(20).describe("Candidate time slots (up to 20)"),
261
+ expires_at: z.string().datetime().optional().describe("Auto-cancel cutoff if unresolved")
262
+ });
263
+ var ListProposalsSchema = z.object({
264
+ status: z.enum(["pending", "confirmed", "expired", "cancelled"]).optional().describe("Filter by proposal status"),
265
+ organizer_agent_id: z.string().optional().describe("Filter by organizer agent"),
266
+ limit: z.number().int().min(1).max(200).optional().describe("Max results (default 50)"),
135
267
  offset: z.number().int().min(0).optional().describe("Pagination offset (default 0)")
136
268
  });
269
+ var GetProposalSchema = z.object({
270
+ proposal_id: z.string().describe("Proposal to fetch")
271
+ });
272
+ var RespondToProposalSchema = z.object({
273
+ proposal_id: z.string().describe("Proposal to respond to"),
274
+ agent_id: z.string().describe("Participant agent responding"),
275
+ response: z.enum(["accept", "decline", "counter"]).describe("Decision from this agent"),
276
+ selected_slot_id: z.string().optional().describe('Required when response is "accept"'),
277
+ counter_slots: z.array(proposalSlotSchema).max(20).optional().describe('Alternative slots when response is "counter"'),
278
+ message: z.string().max(2e3).optional().describe("Optional note for the organizer")
279
+ });
280
+ var ResolveProposalSchema = z.object({
281
+ proposal_id: z.string().describe("Proposal to resolve")
282
+ });
283
+ var CancelProposalSchema = z.object({
284
+ proposal_id: z.string().describe("Proposal to cancel")
285
+ });
286
+ var timeOfDay = z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, "must be HH:MM in 24-hour time");
287
+ var workingHoursDaySchema = z.object({
288
+ start: timeOfDay,
289
+ end: timeOfDay
290
+ });
291
+ var workingHoursSchema = z.object({
292
+ mon: workingHoursDaySchema.optional(),
293
+ tue: workingHoursDaySchema.optional(),
294
+ wed: workingHoursDaySchema.optional(),
295
+ thu: workingHoursDaySchema.optional(),
296
+ fri: workingHoursDaySchema.optional(),
297
+ sat: workingHoursDaySchema.optional(),
298
+ sun: workingHoursDaySchema.optional()
299
+ }).nullable();
300
+ var SetAvailabilityRulesSchema = z.object({
301
+ calendar_id: z.string().describe("Calendar to configure"),
302
+ buffer_before_minutes: z.number().int().min(0).max(120).default(0).describe("Minutes of buffer before each event (0\u2013120)"),
303
+ buffer_after_minutes: z.number().int().min(0).max(120).default(0).describe("Minutes of buffer after each event (0\u2013120)"),
304
+ 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."),
305
+ timezone: z.string().min(1).max(64).default("UTC").describe("IANA timezone used to interpret working_hours (e.g. America/New_York)")
306
+ });
307
+ var GetAvailabilityRulesSchema = z.object({
308
+ calendar_id: z.string().describe("Calendar to read")
309
+ });
310
+ var ClearAvailabilityRulesSchema = z.object({
311
+ calendar_id: z.string().describe("Calendar whose rules should be cleared")
312
+ });
313
+ var CreateScopedKeySchema = z.object({
314
+ agent_id: z.string().regex(/^agt_/).describe("Agent ID this key is scoped to"),
315
+ label: z.string().min(1).max(100).optional().describe("Human-readable label for the key")
316
+ });
317
+ var ListScopedKeysSchema = z.object({});
318
+ var RevokeScopedKeySchema = z.object({
319
+ key_id: z.string().describe("ID of the scoped key to revoke")
320
+ });
321
+ var GetAuditLogSchema = z.object({
322
+ from: z.string().datetime({ offset: true }).optional().describe("Start of the window (ISO 8601). Silently clamped to the plan retention window if older."),
323
+ to: z.string().datetime({ offset: true }).optional().describe("End of the window (ISO 8601)"),
324
+ action: z.string().min(1).max(64).optional().describe("Filter by action name (e.g. event.created)"),
325
+ actor_key_prefix: z.string().min(1).max(32).optional().describe("Filter by the API key prefix that performed the action"),
326
+ cursor: z.string().min(1).max(256).optional().describe("Opaque pagination cursor from a previous response"),
327
+ limit: z.number().int().min(1).max(200).optional().describe("Max results to return (default 50)")
328
+ });
329
+ var AcceptTermsSchema = z.object({
330
+ tos_version: z.string().min(1).describe("The terms-of-service version to accept; must match the current version")
331
+ });
332
+ var ListWebhooksSchema = z.object({
333
+ limit: z.number().int().min(1).max(100).default(20).describe("Max results to return"),
334
+ offset: z.number().int().min(0).default(0).describe("Pagination offset")
335
+ });
137
336
  var GetWebhookSchema = z.object({
138
- webhook_id: z.string().describe("The webhook ID to retrieve")
337
+ webhook_id: z.string().describe("Webhook subscription to fetch")
139
338
  });
140
339
  var CreateWebhookSchema = z.object({
141
- url: z.string().describe("HTTPS URL to receive webhook payloads"),
142
- events: z.array(z.string()).describe('Event types to subscribe to (e.g., ["event.created", "event.updated"])')
340
+ url: z.string().url().describe("HTTPS endpoint that will receive event deliveries"),
341
+ events: z.array(z.enum(WEBHOOK_EVENT_TYPES)).min(1).describe("Event types to subscribe to")
143
342
  });
144
343
  var UpdateWebhookSchema = z.object({
145
- webhook_id: z.string().describe("The webhook ID to update"),
146
- url: z.string().optional().describe("New webhook URL"),
147
- events: z.array(z.string()).optional().describe("New event type subscriptions"),
148
- active: z.boolean().optional().describe("Enable or disable the webhook")
344
+ webhook_id: z.string().describe("Webhook subscription to update"),
345
+ url: z.string().url().optional().describe("New HTTPS delivery endpoint"),
346
+ events: z.array(z.enum(WEBHOOK_EVENT_TYPES)).min(1).optional().describe("Replacement set of event types to subscribe to"),
347
+ active: z.boolean().optional().describe("Set false to pause deliveries, true to resume")
149
348
  });
150
349
  var DeleteWebhookSchema = z.object({
151
- webhook_id: z.string().describe("The webhook ID to delete")
350
+ webhook_id: z.string().describe("Webhook subscription to delete")
351
+ });
352
+ var ListWebhookDeliveriesSchema = z.object({
353
+ webhook_id: z.string().describe("Webhook subscription whose deliveries to list"),
354
+ limit: z.number().int().min(1).max(100).default(20).describe("Max results to return"),
355
+ offset: z.number().int().min(0).default(0).describe("Pagination offset"),
356
+ status: z.enum(WEBHOOK_DELIVERY_STATUSES).optional().describe("Filter to a single delivery status"),
357
+ include_payload: z.boolean().optional().describe("Include the full event payload sent on each delivery")
152
358
  });
153
359
  var ListICalSubscriptionsSchema = z.object({
154
- agent_id: z.string().describe("Agent ID to list subscriptions for"),
360
+ agent_id: z.string().describe("Agent ID whose iCal subscriptions to list"),
155
361
  status: z.enum(["active", "error", "paused"]).optional().describe("Filter by subscription status"),
156
- limit: z.number().int().min(1).max(200).optional().describe("Max results per page (default 50)"),
157
- offset: z.number().int().min(0).optional().describe("Pagination offset (default 0)")
362
+ limit: z.number().int().min(1).max(200).default(50).describe("Max results to return"),
363
+ offset: z.number().int().min(0).default(0).describe("Pagination offset")
158
364
  });
159
365
  var GetICalSubscriptionSchema = z.object({
160
- subscription_id: z.string().describe("The iCal subscription ID to retrieve")
366
+ subscription_id: z.string().describe("iCal subscription ID to fetch")
161
367
  });
162
- var CreateICalSubscriptionSchema = z.object({
163
- agent_id: z.string().describe("Agent ID to create the subscription for"),
164
- calendar_id: z.string().describe("Calendar ID to import events into"),
165
- url: z.string().describe("HTTPS URL of the iCal feed to subscribe to"),
166
- label: z.string().optional().describe("Human-readable label for the subscription")
368
+ var SubscribeICalSchema = z.object({
369
+ agent_id: z.string().describe("Agent ID that will own this subscription"),
370
+ calendar_id: z.string().describe("Calendar ID to sync external events into"),
371
+ url: z.string().url().describe("HTTPS URL of the iCal feed (.ics) to subscribe to"),
372
+ label: z.string().optional().describe("Optional label for this subscription")
167
373
  });
168
374
  var UpdateICalSubscriptionSchema = z.object({
169
- subscription_id: z.string().describe("The iCal subscription ID to update"),
170
- label: z.string().optional().describe("New label"),
171
- url: z.string().optional().describe("New iCal feed URL")
375
+ subscription_id: z.string().describe("iCal subscription ID to update"),
376
+ label: z.string().min(1).max(255).optional().describe("New label for this subscription"),
377
+ url: z.string().url().startsWith("https://", "URL must use HTTPS").optional().describe("New HTTPS URL of the iCal feed (.ics)")
172
378
  });
173
379
  var DeleteICalSubscriptionSchema = z.object({
174
- subscription_id: z.string().describe("The iCal subscription ID to delete")
380
+ subscription_id: z.string().describe("iCal subscription ID to delete")
175
381
  });
176
382
  var SyncICalSubscriptionSchema = z.object({
177
- subscription_id: z.string().describe("The iCal subscription ID to sync immediately")
383
+ subscription_id: z.string().describe("iCal subscription ID to sync")
178
384
  });
179
385
  var GetUsageSchema = z.object({});
180
386
 
@@ -204,7 +410,7 @@ async function fetchPage(iterator, offset, limit) {
204
410
  }
205
411
  var listCalendars = safeFunc(async (ctx) => {
206
412
  const { client, params } = ctx;
207
- const iter = client.calendars.list({ agentId: params.agent_id, include: params.include, limit: params.limit });
413
+ const iter = client.calendars.list({ include: params.include, limit: params.limit });
208
414
  return fetchPage(iter, params.offset, params.limit);
209
415
  });
210
416
  var getCalendar = safeFunc(async (ctx) => {
@@ -216,6 +422,7 @@ var createCalendar = safeFunc(async (ctx) => {
216
422
  name: params.name,
217
423
  timezone: params.timezone,
218
424
  agentId: params.agent_id,
425
+ default_reminders: params.default_reminders,
219
426
  metadata: params.metadata
220
427
  });
221
428
  });
@@ -232,11 +439,8 @@ var listEvents = safeFunc(async (ctx) => {
232
439
  const { client, params } = ctx;
233
440
  const iter = client.events.list({
234
441
  calendarId: params.calendar_id,
235
- agentId: params.agent_id,
236
442
  start_after: params.start_after,
237
443
  start_before: params.start_before,
238
- status: params.status,
239
- source: params.source,
240
444
  limit: params.limit
241
445
  });
242
446
  return fetchPage(iter, params.offset, params.limit);
@@ -254,12 +458,117 @@ var updateEvent = safeFunc(async (ctx) => {
254
458
  const { calendar_id, event_id, ...updates } = params;
255
459
  return client.events.update(calendar_id, event_id, updates);
256
460
  });
257
- var deleteEvent = safeFunc(async (ctx) => {
461
+ var cancelEvent = safeFunc(async (ctx) => {
258
462
  await ctx.client.events.delete(ctx.params.calendar_id, ctx.params.event_id);
259
463
  return void 0;
260
464
  });
261
- var checkAvailability = safeFunc(async (ctx) => {
262
- return ctx.client.availability.check(ctx.params);
465
+ var confirmEvent = safeFunc(async (ctx) => {
466
+ return ctx.client.events.confirm(ctx.params.event_id);
467
+ });
468
+ var releaseEvent = safeFunc(async (ctx) => {
469
+ return ctx.client.events.release(ctx.params.event_id);
470
+ });
471
+ var createAgent = safeFunc(async (ctx) => {
472
+ return ctx.client.agents.create(ctx.params);
473
+ });
474
+ var listAgents = safeFunc(async (ctx) => {
475
+ const { client, params } = ctx;
476
+ const iter = client.agents.list({ type: params.type, status: params.status, limit: params.limit });
477
+ return fetchPage(iter, params.offset, params.limit);
478
+ });
479
+ var getAgent = safeFunc(async (ctx) => {
480
+ return ctx.client.agents.get(ctx.params.agent_id);
481
+ });
482
+ var updateAgent = safeFunc(async (ctx) => {
483
+ const { client, params } = ctx;
484
+ const { agent_id, ...updates } = params;
485
+ return client.agents.update(agent_id, updates);
486
+ });
487
+ var deleteAgent = safeFunc(async (ctx) => {
488
+ await ctx.client.agents.delete(ctx.params.agent_id);
489
+ return void 0;
490
+ });
491
+ var getAvailability = safeFunc(async (ctx) => {
492
+ const { client, params } = ctx;
493
+ const start = params.start ?? params.start_time;
494
+ const end = params.end ?? params.end_time;
495
+ if (!start || !end) {
496
+ throw new Error("start (or start_time) and end (or end_time) are required");
497
+ }
498
+ return client.availability.forAgent(params.agent_id, {
499
+ start,
500
+ end,
501
+ slot_duration: params.slot_duration,
502
+ include_busy: params.include_busy
503
+ });
504
+ });
505
+ var findMeetingTime = safeFunc(async (ctx) => {
506
+ const { client, params } = ctx;
507
+ const agents = params.agents ?? params.agent_ids;
508
+ const start = params.start ?? params.start_time;
509
+ const end = params.end ?? params.end_time;
510
+ if (!agents || !start || !end) {
511
+ throw new Error("agents (or agent_ids), start (or start_time), and end (or end_time) are required");
512
+ }
513
+ return client.availability.check({
514
+ agents,
515
+ start,
516
+ end,
517
+ slot_duration: params.slot_duration,
518
+ calendars: params.calendars,
519
+ include_busy: params.include_busy
520
+ });
521
+ });
522
+ var getCalendarContext = safeFunc(async (ctx) => {
523
+ return ctx.client.calendars.getContext(ctx.params.calendar_id);
524
+ });
525
+ var createProposal = safeFunc(async (ctx) => {
526
+ return ctx.client.scheduling.create(ctx.params);
527
+ });
528
+ var listProposals = safeFunc(async (ctx) => {
529
+ const { client, params } = ctx;
530
+ const iter = client.scheduling.list({
531
+ status: params.status,
532
+ organizer_agent_id: params.organizer_agent_id,
533
+ limit: params.limit
534
+ });
535
+ return fetchPage(iter, params.offset, params.limit);
536
+ });
537
+ var getProposal = safeFunc(async (ctx) => {
538
+ return ctx.client.scheduling.get(ctx.params.proposal_id);
539
+ });
540
+ var respondToProposal = safeFunc(async (ctx) => {
541
+ const { client, params } = ctx;
542
+ const { proposal_id, ...body } = params;
543
+ return client.scheduling.respond(proposal_id, body);
544
+ });
545
+ var resolveProposal = safeFunc(async (ctx) => {
546
+ return ctx.client.scheduling.resolve(ctx.params.proposal_id);
547
+ });
548
+ var cancelProposal = safeFunc(async (ctx) => {
549
+ return ctx.client.scheduling.cancel(ctx.params.proposal_id);
550
+ });
551
+ var setAvailabilityRules = safeFunc(async (ctx) => {
552
+ const { client, params } = ctx;
553
+ const { calendar_id, ...rules } = params;
554
+ return client.calendars.setAvailabilityRules(calendar_id, rules);
555
+ });
556
+ var getAvailabilityRules = safeFunc(async (ctx) => {
557
+ return ctx.client.calendars.getAvailabilityRules(ctx.params.calendar_id);
558
+ });
559
+ var clearAvailabilityRules = safeFunc(async (ctx) => {
560
+ await ctx.client.calendars.deleteAvailabilityRules(ctx.params.calendar_id);
561
+ return void 0;
562
+ });
563
+ var createScopedKey = safeFunc(async (ctx) => {
564
+ return ctx.client.keys.create(ctx.params);
565
+ });
566
+ var listScopedKeys = safeFunc(async (ctx) => {
567
+ return ctx.client.keys.list();
568
+ });
569
+ var revokeScopedKey = safeFunc(async (ctx) => {
570
+ await ctx.client.keys.delete(ctx.params.key_id);
571
+ return void 0;
263
572
  });
264
573
  var listWebhooks = safeFunc(async (ctx) => {
265
574
  const { client, params } = ctx;
@@ -281,6 +590,17 @@ var deleteWebhook = safeFunc(async (ctx) => {
281
590
  await ctx.client.webhooks.delete(ctx.params.webhook_id);
282
591
  return void 0;
283
592
  });
593
+ var listWebhookDeliveries = safeFunc(async (ctx) => {
594
+ const { client, params } = ctx;
595
+ const { webhook_id, ...query } = params;
596
+ return client.webhooks.listDeliveries(webhook_id, query);
597
+ });
598
+ var getAuditLog = safeFunc(async (ctx) => {
599
+ return ctx.client.auditLog.list(ctx.params);
600
+ });
601
+ var acceptTerms = safeFunc(async (ctx) => {
602
+ return ctx.client.terms.accept(ctx.params);
603
+ });
284
604
  var listICalSubscriptions = safeFunc(async (ctx) => {
285
605
  const { client, params } = ctx;
286
606
  const iter = client.icalSubscriptions.list({
@@ -293,7 +613,7 @@ var listICalSubscriptions = safeFunc(async (ctx) => {
293
613
  var getICalSubscription = safeFunc(async (ctx) => {
294
614
  return ctx.client.icalSubscriptions.get(ctx.params.subscription_id);
295
615
  });
296
- var createICalSubscription = safeFunc(async (ctx) => {
616
+ var subscribeICal = safeFunc(async (ctx) => {
297
617
  const { client, params } = ctx;
298
618
  const { agent_id, ...subParams } = params;
299
619
  return client.icalSubscriptions.create(agent_id, subParams);
@@ -324,12 +644,19 @@ var HOSTED_API_MCP_TOOL_NAMES = [
324
644
  "create_calendar",
325
645
  "create_event",
326
646
  "list_events",
647
+ "get_event",
648
+ "update_event",
327
649
  "get_availability",
328
650
  "find_meeting_time",
329
651
  "cancel_event",
330
652
  "confirm_event",
331
653
  "release_event",
332
654
  "subscribe_ical",
655
+ "list_ical_subscriptions",
656
+ "get_ical_subscription",
657
+ "update_ical_subscription",
658
+ "delete_ical_subscription",
659
+ "sync_ical_subscription",
333
660
  "get_calendar_context",
334
661
  "create_proposal",
335
662
  "list_proposals",
@@ -339,41 +666,60 @@ var HOSTED_API_MCP_TOOL_NAMES = [
339
666
  "cancel_proposal",
340
667
  "set_availability_rules",
341
668
  "get_availability_rules",
342
- "clear_availability_rules"
669
+ "clear_availability_rules",
670
+ "create_scoped_key",
671
+ "list_scoped_keys",
672
+ "revoke_scoped_key",
673
+ "create_webhook",
674
+ "list_webhooks",
675
+ "get_webhook",
676
+ "update_webhook",
677
+ "delete_webhook",
678
+ "list_webhook_deliveries",
679
+ "get_agent",
680
+ "update_agent",
681
+ "delete_agent",
682
+ "list_calendars",
683
+ "get_calendar",
684
+ "update_calendar",
685
+ "delete_calendar",
686
+ "get_usage",
687
+ "get_audit_log",
688
+ "accept_terms"
343
689
  ];
344
690
  var TOOL_DEFINITIONS = [
345
691
  // ── Calendars ──────────────────────────────────────────────────
346
692
  {
347
693
  name: "list_calendars",
348
- description: "List calendars, optionally filtered by agent. Returns paginated results.",
694
+ 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.",
349
695
  schema: ListCalendarsSchema,
350
696
  annotations: { title: "List Calendars", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
351
697
  execute: createExecutor(listCalendars)
352
698
  },
353
699
  {
354
700
  name: "get_calendar",
355
- description: "Get a calendar by its ID, including its name, timezone, and iCal feed URL.",
701
+ 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.",
356
702
  schema: GetCalendarSchema,
357
703
  annotations: { title: "Get Calendar", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
358
704
  execute: createExecutor(getCalendar)
359
705
  },
360
706
  {
361
707
  name: "create_calendar",
362
- description: "Create a new calendar. Specify a name and IANA timezone. Optionally scope it to an agent.",
708
+ 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.',
363
709
  schema: CreateCalendarSchema,
364
710
  annotations: { title: "Create Calendar", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
365
711
  execute: createExecutor(createCalendar)
366
712
  },
367
713
  {
368
714
  name: "update_calendar",
369
- description: "Update a calendar's name, timezone, or metadata.",
715
+ description: "Update a calendar's name, timezone, agent status, default reminders, or metadata. Agent-scoped keys may only update calendars owned by their agent.",
370
716
  schema: UpdateCalendarSchema,
371
717
  annotations: { title: "Update Calendar", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
372
718
  execute: createExecutor(updateCalendar)
373
719
  },
374
720
  {
375
721
  name: "delete_calendar",
376
- description: "Permanently delete a calendar and all its events.",
722
+ 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.",
377
723
  schema: DeleteCalendarSchema,
378
724
  annotations: { title: "Delete Calendar", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
379
725
  execute: createExecutor(deleteCalendar)
@@ -381,130 +727,305 @@ var TOOL_DEFINITIONS = [
381
727
  // ── Events ─────────────────────────────────────────────────────
382
728
  {
383
729
  name: "list_events",
384
- description: "List events on a calendar or for an agent. Supports date range and status filters. Provide calendar_id or agent_id.",
730
+ description: "List all events on a calendar, including internally created events and externally synced events from iCal subscriptions (e.g. Google Calendar, Outlook). Use start_after and start_before to query a specific time window.",
385
731
  schema: ListEventsSchema,
386
732
  annotations: { title: "List Events", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
387
733
  execute: createExecutor(listEvents)
388
734
  },
389
735
  {
390
736
  name: "get_event",
391
- description: "Get a specific event by its calendar ID and event ID.",
737
+ 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.",
392
738
  schema: GetEventSchema,
393
739
  annotations: { title: "Get Event", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
394
740
  execute: createExecutor(getEvent)
395
741
  },
396
742
  {
397
743
  name: "create_event",
398
- 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.",
744
+ 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.`,
399
745
  schema: CreateEventSchema,
400
746
  annotations: { title: "Create Event", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
401
747
  execute: createExecutor(createEvent)
402
748
  },
403
749
  {
404
750
  name: "update_event",
405
- description: "Update an existing event's title, times, status, or other properties.",
751
+ 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.",
406
752
  schema: UpdateEventSchema,
407
753
  annotations: { title: "Update Event", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
408
754
  execute: createExecutor(updateEvent)
409
755
  },
410
756
  {
411
- name: "delete_event",
412
- description: "Delete an event from a calendar. This frees the agent's availability during that time.",
413
- schema: DeleteEventSchema,
414
- annotations: { title: "Delete Event", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
415
- execute: createExecutor(deleteEvent)
757
+ name: "cancel_event",
758
+ 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.",
759
+ schema: CancelEventSchema,
760
+ annotations: { title: "Cancel Event", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
761
+ execute: createExecutor(cancelEvent)
762
+ },
763
+ {
764
+ name: "confirm_event",
765
+ 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.',
766
+ schema: ConfirmEventSchema,
767
+ annotations: { title: "Confirm Event", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
768
+ execute: createExecutor(confirmEvent)
769
+ },
770
+ {
771
+ name: "release_event",
772
+ description: 'Manually release a held event before its hold_expires_at. The event must currently have status="hold". Frees the slot for other agents to book.',
773
+ schema: ReleaseEventSchema,
774
+ annotations: { title: "Release Event", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
775
+ execute: createExecutor(releaseEvent)
776
+ },
777
+ // ── Agents ─────────────────────────────────────────────────────
778
+ {
779
+ name: "create_agent",
780
+ description: "Register your agent (AI assistant, human participant, or resource) with Chronary so it can own calendars, events, and webhooks.",
781
+ schema: CreateAgentSchema,
782
+ annotations: { title: "Create Agent", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
783
+ execute: createExecutor(createAgent)
784
+ },
785
+ {
786
+ name: "list_agents",
787
+ description: "List all agents in your organization",
788
+ schema: ListAgentsSchema,
789
+ annotations: { title: "List Agents", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
790
+ execute: createExecutor(listAgents)
791
+ },
792
+ {
793
+ name: "get_agent",
794
+ 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.",
795
+ schema: GetAgentSchema,
796
+ annotations: { title: "Get Agent", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
797
+ execute: createExecutor(getAgent)
798
+ },
799
+ {
800
+ name: "update_agent",
801
+ 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.",
802
+ schema: UpdateAgentSchema,
803
+ annotations: { title: "Update Agent", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
804
+ execute: createExecutor(updateAgent)
805
+ },
806
+ {
807
+ name: "delete_agent",
808
+ 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.",
809
+ schema: DeleteAgentSchema,
810
+ annotations: { title: "Delete Agent", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
811
+ execute: createExecutor(deleteAgent)
416
812
  },
417
813
  // ── Availability ───────────────────────────────────────────────
418
814
  {
419
- name: "check_availability",
420
- description: "Check free/busy availability across one or more agents within a time range. Returns available time slots and optionally busy blocks.",
421
- schema: CheckAvailabilitySchema,
422
- annotations: { title: "Check Availability", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
423
- execute: createExecutor(checkAvailability)
815
+ name: "get_availability",
816
+ 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).",
817
+ schema: GetAvailabilitySchema,
818
+ annotations: { title: "Get Availability", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
819
+ execute: createExecutor(getAvailability)
820
+ },
821
+ {
822
+ name: "find_meeting_time",
823
+ 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).",
824
+ schema: FindMeetingTimeSchema,
825
+ annotations: { title: "Find Meeting Time", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
826
+ execute: createExecutor(findMeetingTime)
827
+ },
828
+ // ── Calendar context ───────────────────────────────────────────
829
+ {
830
+ name: "get_calendar_context",
831
+ 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.`,
832
+ schema: GetCalendarContextSchema,
833
+ annotations: { title: "Get Calendar Context", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
834
+ execute: createExecutor(getCalendarContext)
835
+ },
836
+ // ── Scheduling proposals ───────────────────────────────────────
837
+ {
838
+ name: "create_proposal",
839
+ 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.",
840
+ schema: CreateProposalSchema,
841
+ annotations: { title: "Create Proposal", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
842
+ execute: createExecutor(createProposal)
843
+ },
844
+ {
845
+ name: "list_proposals",
846
+ description: "List scheduling proposals for the org. Filter by status (pending|confirmed|expired|cancelled) or organizer_agent_id. Requires an org-level API key.",
847
+ schema: ListProposalsSchema,
848
+ annotations: { title: "List Proposals", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
849
+ execute: createExecutor(listProposals)
850
+ },
851
+ {
852
+ name: "get_proposal",
853
+ description: "Get a scheduling proposal by id, including its slots and per-participant responses. Requires an org-level API key.",
854
+ schema: GetProposalSchema,
855
+ annotations: { title: "Get Proposal", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
856
+ execute: createExecutor(getProposal)
857
+ },
858
+ {
859
+ name: "respond_to_proposal",
860
+ 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.',
861
+ schema: RespondToProposalSchema,
862
+ annotations: { title: "Respond To Proposal", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
863
+ execute: createExecutor(respondToProposal)
864
+ },
865
+ {
866
+ name: "resolve_proposal",
867
+ 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.',
868
+ schema: ResolveProposalSchema,
869
+ annotations: { title: "Resolve Proposal", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
870
+ execute: createExecutor(resolveProposal)
871
+ },
872
+ {
873
+ name: "cancel_proposal",
874
+ description: 'Cancel an open proposal. Fires a proposal.cancelled webhook with reason="organizer_cancelled". Requires an org-level API key. Pro plan only.',
875
+ schema: CancelProposalSchema,
876
+ annotations: { title: "Cancel Proposal", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
877
+ execute: createExecutor(cancelProposal)
878
+ },
879
+ // ── Availability rules ─────────────────────────────────────────
880
+ {
881
+ name: "set_availability_rules",
882
+ 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.",
883
+ schema: SetAvailabilityRulesSchema,
884
+ annotations: { title: "Set Availability Rules", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
885
+ execute: createExecutor(setAvailabilityRules)
886
+ },
887
+ {
888
+ name: "get_availability_rules",
889
+ description: "Read the buffer times and working-hours rules configured on a calendar. Returns the rules row, or an error if none are set.",
890
+ schema: GetAvailabilityRulesSchema,
891
+ annotations: { title: "Get Availability Rules", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
892
+ execute: createExecutor(getAvailabilityRules)
893
+ },
894
+ {
895
+ name: "clear_availability_rules",
896
+ 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.",
897
+ schema: ClearAvailabilityRulesSchema,
898
+ annotations: { title: "Clear Availability Rules", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
899
+ execute: createExecutor(clearAvailabilityRules)
424
900
  },
425
901
  // ── Webhooks ───────────────────────────────────────────────────
426
902
  {
427
903
  name: "list_webhooks",
428
- description: "List all webhook subscriptions for the organization.",
904
+ 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.",
429
905
  schema: ListWebhooksSchema,
430
906
  annotations: { title: "List Webhooks", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
431
907
  execute: createExecutor(listWebhooks)
432
908
  },
433
909
  {
434
910
  name: "get_webhook",
435
- description: "Get a webhook subscription by its ID.",
911
+ 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.",
436
912
  schema: GetWebhookSchema,
437
913
  annotations: { title: "Get Webhook", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
438
914
  execute: createExecutor(getWebhook)
439
915
  },
440
916
  {
441
917
  name: "create_webhook",
442
- description: "Create a webhook subscription to receive event notifications at a URL. Payloads are signed with HMAC-SHA256.",
918
+ 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.",
443
919
  schema: CreateWebhookSchema,
444
920
  annotations: { title: "Create Webhook", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
445
921
  execute: createExecutor(createWebhook)
446
922
  },
447
923
  {
448
924
  name: "update_webhook",
449
- description: "Update a webhook's URL, subscribed events, or active status.",
925
+ 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.",
450
926
  schema: UpdateWebhookSchema,
451
927
  annotations: { title: "Update Webhook", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
452
928
  execute: createExecutor(updateWebhook)
453
929
  },
454
930
  {
455
931
  name: "delete_webhook",
456
- description: "Delete a webhook subscription. No further events will be delivered to this URL.",
932
+ description: "Permanently delete a webhook subscription. This frees its endpoint slot against the per-plan cap. Requires an org-level API key.",
457
933
  schema: DeleteWebhookSchema,
458
934
  annotations: { title: "Delete Webhook", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
459
935
  execute: createExecutor(deleteWebhook)
460
936
  },
937
+ {
938
+ name: "list_webhook_deliveries",
939
+ description: "List delivery attempts for a webhook subscription, with per-status counts (pending/delivered/failed). Use this to debug failing deliveries. Requires an org-level API key.",
940
+ schema: ListWebhookDeliveriesSchema,
941
+ annotations: { title: "List Webhook Deliveries", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
942
+ execute: createExecutor(listWebhookDeliveries)
943
+ },
461
944
  // ── iCal Subscriptions ─────────────────────────────────────────
462
945
  {
463
946
  name: "list_ical_subscriptions",
464
- description: "List external calendar imports (iCal subscriptions) for an agent.",
947
+ description: "List an agent's external iCal feed subscriptions (e.g. linked Google Calendar / Outlook feeds), including their sync status and last sync time.",
465
948
  schema: ListICalSubscriptionsSchema,
466
949
  annotations: { title: "List iCal Subscriptions", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
467
950
  execute: createExecutor(listICalSubscriptions)
468
951
  },
469
952
  {
470
953
  name: "get_ical_subscription",
471
- description: "Get an iCal subscription by its ID, including sync status and last error.",
954
+ description: "Get a single external iCal feed subscription by id, including its sync status, last sync time, and last error.",
472
955
  schema: GetICalSubscriptionSchema,
473
956
  annotations: { title: "Get iCal Subscription", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
474
957
  execute: createExecutor(getICalSubscription)
475
958
  },
476
959
  {
477
- name: "create_ical_subscription",
478
- description: "Import an external calendar by subscribing to an iCal feed URL. Events are synced every 30 minutes.",
479
- schema: CreateICalSubscriptionSchema,
480
- annotations: { title: "Create iCal Subscription", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
481
- execute: createExecutor(createICalSubscription)
960
+ name: "subscribe_ical",
961
+ 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).",
962
+ schema: SubscribeICalSchema,
963
+ annotations: { title: "Subscribe iCal", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
964
+ execute: createExecutor(subscribeICal)
482
965
  },
483
966
  {
484
967
  name: "update_ical_subscription",
485
- description: "Update an iCal subscription's label or feed URL.",
968
+ 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.",
486
969
  schema: UpdateICalSubscriptionSchema,
487
970
  annotations: { title: "Update iCal Subscription", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
488
971
  execute: createExecutor(updateICalSubscription)
489
972
  },
490
973
  {
491
974
  name: "delete_ical_subscription",
492
- description: "Remove an external calendar import. Previously synced events remain on the calendar.",
975
+ description: "Delete an external iCal feed subscription. Events previously synced from the feed are no longer refreshed.",
493
976
  schema: DeleteICalSubscriptionSchema,
494
977
  annotations: { title: "Delete iCal Subscription", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
495
978
  execute: createExecutor(deleteICalSubscription)
496
979
  },
497
980
  {
498
981
  name: "sync_ical_subscription",
499
- description: "Trigger an immediate sync of an iCal subscription instead of waiting for the next 30-minute poll.",
982
+ 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.",
500
983
  schema: SyncICalSubscriptionSchema,
501
984
  annotations: { title: "Sync iCal Subscription", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
502
985
  execute: createExecutor(syncICalSubscription)
503
986
  },
987
+ // ── Scoped keys ────────────────────────────────────────────────
988
+ {
989
+ name: "create_scoped_key",
990
+ 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.",
991
+ schema: CreateScopedKeySchema,
992
+ annotations: { title: "Create Scoped Key", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
993
+ execute: createExecutor(createScopedKey)
994
+ },
995
+ {
996
+ name: "list_scoped_keys",
997
+ 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.",
998
+ schema: ListScopedKeysSchema,
999
+ annotations: { title: "List Scoped Keys", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
1000
+ execute: createExecutor(listScopedKeys)
1001
+ },
1002
+ {
1003
+ name: "revoke_scoped_key",
1004
+ description: "Revoke an agent-scoped API key by ID. The key stops authenticating immediately and cannot be un-revoked. Requires an org-level API key.",
1005
+ schema: RevokeScopedKeySchema,
1006
+ annotations: { title: "Revoke Scoped Key", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
1007
+ execute: createExecutor(revokeScopedKey)
1008
+ },
1009
+ // ── Audit log ──────────────────────────────────────────────────
1010
+ {
1011
+ name: "get_audit_log",
1012
+ 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.",
1013
+ schema: GetAuditLogSchema,
1014
+ annotations: { title: "Get Audit Log", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
1015
+ execute: createExecutor(getAuditLog)
1016
+ },
1017
+ // ── Terms ──────────────────────────────────────────────────────
1018
+ {
1019
+ name: "accept_terms",
1020
+ 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.",
1021
+ schema: AcceptTermsSchema,
1022
+ annotations: { title: "Accept Terms", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
1023
+ execute: createExecutor(acceptTerms)
1024
+ },
504
1025
  // ── Usage ──────────────────────────────────────────────────────
505
1026
  {
506
1027
  name: "get_usage",
507
- description: "Get quota and usage statistics for the current billing period.",
1028
+ 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.",
508
1029
  schema: GetUsageSchema,
509
1030
  annotations: { title: "Get Usage", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
510
1031
  execute: createExecutor(getUsage)