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