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