@chronary/toolkit 1.5.3 → 1.6.1
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/CHANGELOG.md +22 -0
- package/README.md +2 -2
- package/dist/ai-sdk.cjs +291 -62
- package/dist/ai-sdk.cjs.map +1 -1
- package/dist/ai-sdk.d.cts +1 -1
- package/dist/ai-sdk.d.ts +1 -1
- package/dist/ai-sdk.js +291 -62
- package/dist/ai-sdk.js.map +1 -1
- package/dist/{base-DuHHyh4Q.d.cts → base-BL0efzXv.d.cts} +11 -3
- package/dist/{base-DuHHyh4Q.d.ts → base-BL0efzXv.d.ts} +11 -3
- package/dist/index.cjs +336 -64
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +230 -6
- package/dist/index.d.ts +230 -6
- package/dist/index.js +331 -63
- package/dist/index.js.map +1 -1
- package/dist/instructions-CQAfBjV3.d.cts +10 -0
- package/dist/instructions-CQAfBjV3.d.ts +10 -0
- package/dist/langchain.cjs +290 -61
- package/dist/langchain.cjs.map +1 -1
- package/dist/langchain.d.cts +3 -2
- package/dist/langchain.d.ts +3 -2
- package/dist/langchain.js +290 -61
- package/dist/langchain.js.map +1 -1
- package/dist/mastra.cjs +291 -62
- package/dist/mastra.cjs.map +1 -1
- package/dist/mastra.d.cts +3 -2
- package/dist/mastra.d.ts +3 -2
- package/dist/mastra.js +291 -62
- package/dist/mastra.js.map +1 -1
- package/dist/mcp.cjs +313 -68
- package/dist/mcp.cjs.map +1 -1
- package/dist/mcp.d.cts +4 -2
- package/dist/mcp.d.ts +4 -2
- package/dist/mcp.js +311 -67
- package/dist/mcp.js.map +1 -1
- package/dist/openai.cjs +290 -61
- package/dist/openai.cjs.map +1 -1
- package/dist/openai.d.cts +3 -2
- package/dist/openai.d.ts +3 -2
- package/dist/openai.js +290 -61
- package/dist/openai.js.map +1 -1
- package/package.json +4 -4
package/dist/openai.js
CHANGED
|
@@ -24,12 +24,15 @@ var WEBHOOK_EVENT_TYPES = [
|
|
|
24
24
|
"proposal.confirmed",
|
|
25
25
|
"proposal.expired",
|
|
26
26
|
"proposal.cancelled",
|
|
27
|
-
"webhook.deactivated"
|
|
27
|
+
"webhook.deactivated",
|
|
28
|
+
"org.plan_changed",
|
|
29
|
+
"calendar_connection.reauthorization_required",
|
|
30
|
+
"usage.threshold_crossed"
|
|
28
31
|
];
|
|
29
|
-
var WEBHOOK_DELIVERY_STATUSES = ["pending", "delivered", "failed"];
|
|
32
|
+
var WEBHOOK_DELIVERY_STATUSES = ["pending", "delivered", "failed", "dropped"];
|
|
30
33
|
var ListCalendarsSchema = z.object({
|
|
31
|
-
agent_id: z.string().optional().describe("Filter to calendars owned by this agent.
|
|
32
|
-
include: z.enum(["all"]).optional().describe('Pass "all" to include calendars across all agents (
|
|
34
|
+
agent_id: z.string().optional().describe("Filter to calendars owned by this agent. Organization keys only \u2014 Agent keys are always limited to their own agent and ignore this."),
|
|
35
|
+
include: z.enum(["all"]).optional().describe('Pass "all" to include calendars across all agents (Organization keys only)'),
|
|
33
36
|
limit: z.number().int().min(1).max(200).default(50).describe("Max results to return"),
|
|
34
37
|
offset: z.number().int().min(0).default(0).describe("Pagination offset")
|
|
35
38
|
});
|
|
@@ -39,13 +42,13 @@ var GetCalendarSchema = z.object({
|
|
|
39
42
|
var CreateCalendarSchema = z.object({
|
|
40
43
|
name: z.string().min(1).max(255).describe("Calendar name"),
|
|
41
44
|
agent_id: z.string().optional().describe("Agent ID to own this calendar (omit for org-level)"),
|
|
42
|
-
timezone: z.string().min(1).describe("IANA timezone (e.g. America/New_York)"),
|
|
45
|
+
timezone: z.string().min(1).max(64).describe("IANA timezone (e.g. America/New_York)"),
|
|
43
46
|
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.")
|
|
44
47
|
});
|
|
45
48
|
var UpdateCalendarSchema = z.object({
|
|
46
49
|
calendar_id: z.string().describe("Calendar ID to update"),
|
|
47
50
|
name: z.string().min(1).max(255).optional().describe("New calendar name"),
|
|
48
|
-
timezone: z.string().min(1).optional().describe("New IANA timezone (e.g. America/New_York)"),
|
|
51
|
+
timezone: z.string().min(1).max(64).optional().describe("New IANA timezone (e.g. America/New_York)"),
|
|
49
52
|
agent_status: z.enum(["idle", "working", "waiting", "error"]).optional().describe("Owning agent's status"),
|
|
50
53
|
default_reminders: z.array(z.number().int().min(1).max(40320)).max(5).nullable().optional().describe("Default reminder offsets in minutes; null for system default, [] for none"),
|
|
51
54
|
metadata: z.record(z.string(), z.unknown()).optional().describe("Arbitrary metadata (max 16KB)")
|
|
@@ -86,6 +89,18 @@ var ListEventsSchema = z.object({
|
|
|
86
89
|
offset: z.number().int().min(0).default(0).describe("Pagination offset"),
|
|
87
90
|
expand: z.boolean().default(false).describe("Expand recurring series into individual occurrence instances within the window. Requires both start_after and start_before (max 366 days apart). Instances carry recurringEventId + originalStartTime.")
|
|
88
91
|
});
|
|
92
|
+
var ListOrgEventsSchema = z.object({
|
|
93
|
+
calendar_ids: z.array(z.string()).max(50).optional().describe("Only these calendar IDs (at most 50)"),
|
|
94
|
+
agent_id: z.string().optional().describe("Only this agent's calendars"),
|
|
95
|
+
start_after: z.string().datetime().optional().describe("Only events starting at or after this ISO 8601 time"),
|
|
96
|
+
start_before: z.string().datetime().optional().describe("Only events starting at or before this ISO 8601 time"),
|
|
97
|
+
status: z.enum(["confirmed", "tentative", "cancelled", "hold"]).optional().describe("Filter by event status"),
|
|
98
|
+
source: z.enum(["internal", "external_ical"]).optional().describe('Filter by source: "internal" (created via the API) or "external_ical" (synced from an iCal subscription)'),
|
|
99
|
+
q: z.string().optional().describe("Case-insensitive title search. Requires start_after and start_before at most 31 days apart"),
|
|
100
|
+
expand: z.boolean().default(false).describe("Expand recurring series into individual occurrences within the window. Requires both start_after and start_before (max 366 days apart)."),
|
|
101
|
+
limit: z.number().int().min(1).max(100).default(50).describe("Max results to return (1-100)"),
|
|
102
|
+
offset: z.number().int().min(0).default(0).describe("Pagination offset")
|
|
103
|
+
});
|
|
89
104
|
var GetEventSchema = z.object({
|
|
90
105
|
event_id: z.string().describe("Event ID to retrieve"),
|
|
91
106
|
calendar_id: z.string().optional().describe("Calendar ID that owns the event. Optional \u2014 if omitted the calendar is resolved from the event.")
|
|
@@ -95,7 +110,7 @@ var CreateEventSchema = z.object({
|
|
|
95
110
|
title: z.string().min(1).max(500).describe("Event title"),
|
|
96
111
|
start_time: z.string().datetime().describe("Start time (ISO 8601)"),
|
|
97
112
|
end_time: z.string().datetime().describe("End time (ISO 8601)"),
|
|
98
|
-
description: z.string().optional().describe("Optional event description"),
|
|
113
|
+
description: z.string().max(1e4).optional().describe("Optional event description"),
|
|
99
114
|
all_day: z.boolean().default(false).describe("Whether this is an all-day event"),
|
|
100
115
|
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".'),
|
|
101
116
|
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."),
|
|
@@ -107,7 +122,7 @@ var UpdateEventSchema = z.object({
|
|
|
107
122
|
event_id: z.string().describe("Event ID to update"),
|
|
108
123
|
calendar_id: z.string().optional().describe("Calendar ID that owns the event. Optional \u2014 if omitted the calendar is resolved from the event."),
|
|
109
124
|
title: z.string().min(1).max(500).optional().describe("New event title"),
|
|
110
|
-
description: z.string().nullable().optional().describe("New description, or null to clear it"),
|
|
125
|
+
description: z.string().max(1e4).nullable().optional().describe("New description, or null to clear it"),
|
|
111
126
|
start_time: z.string().datetime().optional().describe("New start time (ISO 8601)"),
|
|
112
127
|
end_time: z.string().datetime().optional().describe("New end time (ISO 8601)"),
|
|
113
128
|
all_day: z.boolean().optional().describe("Whether this is an all-day event"),
|
|
@@ -130,7 +145,7 @@ var ReleaseEventSchema = z.object({
|
|
|
130
145
|
var CreateAgentSchema = z.object({
|
|
131
146
|
name: z.string().min(1).max(255).describe("Display name for the agent"),
|
|
132
147
|
type: z.enum(["ai", "human", "resource"]).describe("Agent type"),
|
|
133
|
-
description: z.string().optional().describe("Optional description")
|
|
148
|
+
description: z.string().max(5e3).optional().describe("Optional description")
|
|
134
149
|
});
|
|
135
150
|
var ListAgentsSchema = z.object({
|
|
136
151
|
type: z.enum(["ai", "human", "resource"]).optional().describe("Filter by agent type"),
|
|
@@ -144,7 +159,7 @@ var GetAgentSchema = z.object({
|
|
|
144
159
|
var UpdateAgentSchema = z.object({
|
|
145
160
|
agent_id: z.string().describe("Agent ID to update"),
|
|
146
161
|
name: z.string().min(1).max(255).optional().describe("New display name"),
|
|
147
|
-
description: z.string().nullable().optional().describe("New description (null to clear)"),
|
|
162
|
+
description: z.string().max(5e3).nullable().optional().describe("New description (null to clear)"),
|
|
148
163
|
metadata: z.record(z.string(), z.unknown()).optional().describe("Arbitrary metadata (max 16KB)"),
|
|
149
164
|
status: z.enum(["active", "paused"]).optional().describe("Operational status")
|
|
150
165
|
});
|
|
@@ -201,7 +216,7 @@ var CreateProposalSchema = z.object({
|
|
|
201
216
|
expires_at: z.string().datetime().optional().describe("Auto-cancel cutoff if unresolved")
|
|
202
217
|
});
|
|
203
218
|
var ListProposalsSchema = z.object({
|
|
204
|
-
status: z.enum(["pending", "confirmed", "expired", "cancelled"]).optional().describe("Filter by proposal status"),
|
|
219
|
+
status: z.enum(["pending", "resolving", "confirmed", "expired", "cancelled"]).optional().describe("Filter by proposal status"),
|
|
205
220
|
organizer_agent_id: z.string().optional().describe("Filter by organizer agent"),
|
|
206
221
|
limit: z.number().int().min(1).max(200).optional().describe("Max results (default 50)"),
|
|
207
222
|
offset: z.number().int().min(0).optional().describe("Pagination offset (default 0)")
|
|
@@ -252,7 +267,8 @@ var ClearAvailabilityRulesSchema = z.object({
|
|
|
252
267
|
});
|
|
253
268
|
var CreateScopedKeySchema = z.object({
|
|
254
269
|
agent_id: z.string().regex(/^agt_/).describe("Agent ID this key is scoped to"),
|
|
255
|
-
label: z.string().min(1).max(100).optional().describe("Human-readable label for the key")
|
|
270
|
+
label: z.string().min(1).max(100).optional().describe("Human-readable label for the key"),
|
|
271
|
+
expires_in: z.enum(["30d", "60d", "90d", "180d", "365d"]).optional().describe("When the key stops working, from now. Omit for a key that never expires. After it expires, requests fail with 401 key_expired.")
|
|
256
272
|
});
|
|
257
273
|
var ListScopedKeysSchema = z.object({});
|
|
258
274
|
var RevokeScopedKeySchema = z.object({
|
|
@@ -261,8 +277,14 @@ var RevokeScopedKeySchema = z.object({
|
|
|
261
277
|
var GetAuditLogSchema = z.object({
|
|
262
278
|
from: z.string().datetime({ offset: true }).optional().describe("Start of the window (ISO 8601). Silently clamped to the plan retention window if older."),
|
|
263
279
|
to: z.string().datetime({ offset: true }).optional().describe("End of the window (ISO 8601)"),
|
|
264
|
-
action: z.string().min(1).max(64).optional().describe("Filter by action name (e.g. event.
|
|
280
|
+
action: z.string().min(1).max(64).optional().describe("Filter by action name (e.g. event.create, agent_key.revoke). Legacy names are matched by their current names."),
|
|
265
281
|
actor_key_prefix: z.string().min(1).max(32).optional().describe("Filter by the API key prefix that performed the action"),
|
|
282
|
+
actor_type: z.enum(["session", "org_key", "agent_key", "system"]).optional().describe("Filter by who acted: session (console), org_key, agent_key or system"),
|
|
283
|
+
actor_id: z.string().min(1).max(64).optional().describe("Filter by actor id (an API key id, or the org id for console sessions)"),
|
|
284
|
+
request_id: z.string().min(1).max(64).optional().describe("Filter by request id (the X-Request-Id of the original call)"),
|
|
285
|
+
resource: z.string().max(64).regex(/^[a-z]{2,5}_[A-Za-z0-9_-]*$/).optional().describe("Filter by an entity id or id prefix the request touched (e.g. cal_abc123 or cal_)"),
|
|
286
|
+
status_class: z.enum(["2xx", "3xx", "4xx", "5xx"]).optional().describe("Filter by response status class: 2xx, 3xx, 4xx or 5xx"),
|
|
287
|
+
category: z.enum(["account", "keys", "agents", "calendars", "events", "scheduling", "webhooks", "human_calendars", "billing", "security"]).optional().describe("Filter by action category (e.g. keys, calendars, billing, security)"),
|
|
266
288
|
cursor: z.string().min(1).max(256).optional().describe("Opaque pagination cursor from a previous response"),
|
|
267
289
|
limit: z.number().int().min(1).max(200).optional().describe("Max results to return (default 50)")
|
|
268
290
|
});
|
|
@@ -277,12 +299,12 @@ var GetWebhookSchema = z.object({
|
|
|
277
299
|
webhook_id: z.string().describe("Webhook subscription to fetch")
|
|
278
300
|
});
|
|
279
301
|
var CreateWebhookSchema = z.object({
|
|
280
|
-
url: z.string().url().describe("HTTPS endpoint that will receive event deliveries"),
|
|
302
|
+
url: z.string().url().max(2048).describe("HTTPS endpoint that will receive event deliveries"),
|
|
281
303
|
events: z.array(z.enum(WEBHOOK_EVENT_TYPES)).min(1).describe("Event types to subscribe to")
|
|
282
304
|
});
|
|
283
305
|
var UpdateWebhookSchema = z.object({
|
|
284
306
|
webhook_id: z.string().describe("Webhook subscription to update"),
|
|
285
|
-
url: z.string().url().optional().describe("New HTTPS delivery endpoint"),
|
|
307
|
+
url: z.string().url().max(2048).optional().describe("New HTTPS delivery endpoint"),
|
|
286
308
|
events: z.array(z.enum(WEBHOOK_EVENT_TYPES)).min(1).optional().describe("Replacement set of event types to subscribe to"),
|
|
287
309
|
active: z.boolean().optional().describe("Set false to pause deliveries, true to resume")
|
|
288
310
|
});
|
|
@@ -292,9 +314,27 @@ var DeleteWebhookSchema = z.object({
|
|
|
292
314
|
var ListWebhookDeliveriesSchema = z.object({
|
|
293
315
|
webhook_id: z.string().describe("Webhook subscription whose deliveries to list"),
|
|
294
316
|
limit: z.number().int().min(1).max(100).default(20).describe("Max results to return"),
|
|
295
|
-
offset: z.number().int().min(0).default(0).describe("Pagination offset"),
|
|
317
|
+
offset: z.number().int().min(0).default(0).describe("Pagination offset. Cannot be combined with cursor"),
|
|
296
318
|
status: z.enum(WEBHOOK_DELIVERY_STATUSES).optional().describe("Filter to a single delivery status"),
|
|
297
|
-
include_payload: z.boolean().optional().describe("Include the full event payload sent on each delivery")
|
|
319
|
+
include_payload: z.boolean().optional().describe("Include the full event payload sent on each delivery"),
|
|
320
|
+
event_type: z.string().max(100).regex(/^[a-z_]+\.(?:[a-z_]+)?$/).optional().describe("An exact event type (event.created), or a prefix ending in a dot (event.) for a whole group"),
|
|
321
|
+
created_after: z.string().datetime().optional().describe("Only deliveries created at or after this time (ISO 8601, UTC)"),
|
|
322
|
+
created_before: z.string().datetime().optional().describe("Only deliveries created before this time (ISO 8601, UTC)"),
|
|
323
|
+
delivery_id: z.string().max(100).regex(/^whd_[A-Za-z0-9_-]+$/).optional().describe("Only the delivery with this id"),
|
|
324
|
+
is_test: z.boolean().optional().describe("true for test events only, false to leave them out"),
|
|
325
|
+
cursor: z.string().min(1).max(1024).optional().describe("The next_cursor from the previous page")
|
|
326
|
+
});
|
|
327
|
+
var GetWebhookDeliverySchema = z.object({
|
|
328
|
+
webhook_id: z.string().describe("Webhook subscription the delivery belongs to"),
|
|
329
|
+
delivery_id: z.string().describe("Delivery ID (whd_...) from list_webhook_deliveries")
|
|
330
|
+
});
|
|
331
|
+
var SendTestWebhookSchema = z.object({
|
|
332
|
+
webhook_id: z.string().describe("Webhook subscription to send the test event to"),
|
|
333
|
+
event_type: z.enum(WEBHOOK_EVENT_TYPES).describe("Event type whose sample payload to send")
|
|
334
|
+
});
|
|
335
|
+
var ReplayWebhookDeliverySchema = z.object({
|
|
336
|
+
webhook_id: z.string().describe("Webhook subscription the delivery belongs to"),
|
|
337
|
+
delivery_id: z.string().describe("Delivery to replay (whd_...)")
|
|
298
338
|
});
|
|
299
339
|
var ListICalSubscriptionsSchema = z.object({
|
|
300
340
|
agent_id: z.string().describe("Agent ID whose iCal subscriptions to list"),
|
|
@@ -308,13 +348,13 @@ var GetICalSubscriptionSchema = z.object({
|
|
|
308
348
|
var SubscribeICalSchema = z.object({
|
|
309
349
|
agent_id: z.string().describe("Agent ID that will own this subscription"),
|
|
310
350
|
calendar_id: z.string().describe("Calendar ID to sync external events into"),
|
|
311
|
-
url: z.string().url().describe("HTTPS URL of the iCal feed (.ics) to subscribe to"),
|
|
351
|
+
url: z.string().url().max(2048).describe("HTTPS URL of the iCal feed (.ics) to subscribe to"),
|
|
312
352
|
label: z.string().optional().describe("Optional label for this subscription")
|
|
313
353
|
});
|
|
314
354
|
var UpdateICalSubscriptionSchema = z.object({
|
|
315
355
|
subscription_id: z.string().describe("iCal subscription ID to update"),
|
|
316
356
|
label: z.string().min(1).max(255).optional().describe("New label for this subscription"),
|
|
317
|
-
url: z.string().url().refine((u) => u.startsWith("https://"), "URL must use HTTPS").optional().describe("New HTTPS URL of the iCal feed (.ics)")
|
|
357
|
+
url: z.string().url().max(2048).refine((u) => u.startsWith("https://"), "URL must use HTTPS").optional().describe("New HTTPS URL of the iCal feed (.ics)")
|
|
318
358
|
});
|
|
319
359
|
var DeleteICalSubscriptionSchema = z.object({
|
|
320
360
|
subscription_id: z.string().describe("iCal subscription ID to delete")
|
|
@@ -322,23 +362,53 @@ var DeleteICalSubscriptionSchema = z.object({
|
|
|
322
362
|
var SyncICalSubscriptionSchema = z.object({
|
|
323
363
|
subscription_id: z.string().describe("iCal subscription ID to sync")
|
|
324
364
|
});
|
|
365
|
+
var PauseICalSubscriptionSchema = z.object({
|
|
366
|
+
subscription_id: z.string().describe("iCal subscription ID to pause")
|
|
367
|
+
});
|
|
368
|
+
var ResumeICalSubscriptionSchema = z.object({
|
|
369
|
+
subscription_id: z.string().describe("iCal subscription ID to resume")
|
|
370
|
+
});
|
|
325
371
|
var GetUsageSchema = z.object({});
|
|
372
|
+
var GetUsageHistorySchema = z.object({
|
|
373
|
+
months: z.number().int().min(1).max(12).optional().describe("Number of UTC calendar months to return, 1-12 (default 6)")
|
|
374
|
+
});
|
|
375
|
+
var GetBillingSchema = z.object({});
|
|
376
|
+
var RequestUpgradeSchema = z.object({
|
|
377
|
+
interval: z.enum(["month", "year"]).optional().describe("Billing interval to request. Defaults to month."),
|
|
378
|
+
reason: z.string().max(500).optional().describe("Why the upgrade is needed (max 500 chars). Shown to your human as plain text."),
|
|
379
|
+
feature: z.string().optional().describe("Plan-gated feature that was blocked, e.g. scoped_keys (from a plan_required error)."),
|
|
380
|
+
metric: z.string().optional().describe("Quota metric that was exhausted, e.g. api_calls (from a quota_exceeded error).")
|
|
381
|
+
});
|
|
382
|
+
var GetUpgradeRequestSchema = z.object({
|
|
383
|
+
id: z.string().describe("Upgrade request ID (upr_...)")
|
|
384
|
+
});
|
|
385
|
+
var CancelUpgradeRequestSchema = GetUpgradeRequestSchema;
|
|
326
386
|
|
|
327
387
|
// src/safe.ts
|
|
328
388
|
import { ChronaryError } from "@chronary/sdk";
|
|
389
|
+
function toErrorPayload(err) {
|
|
390
|
+
if (err instanceof ChronaryError) {
|
|
391
|
+
const payload = {
|
|
392
|
+
error: err.errorType ?? err.name,
|
|
393
|
+
message: err.message
|
|
394
|
+
};
|
|
395
|
+
if (err.upgradeUrl !== void 0) payload.upgrade_url = err.upgradeUrl;
|
|
396
|
+
if (err.docsUrl !== void 0) payload.docs_url = err.docsUrl;
|
|
397
|
+
if (err.requiredPlan !== void 0) payload.required_plan = err.requiredPlan;
|
|
398
|
+
if (err.feature !== void 0) payload.feature = err.feature;
|
|
399
|
+
if (err.metric !== void 0) payload.metric = err.metric;
|
|
400
|
+
if (err.limit !== void 0) payload.limit = err.limit;
|
|
401
|
+
return payload;
|
|
402
|
+
}
|
|
403
|
+
return { error: "error", message: err instanceof Error ? err.message : String(err) };
|
|
404
|
+
}
|
|
329
405
|
function safeFunc(fn) {
|
|
330
406
|
return async (params) => {
|
|
331
407
|
try {
|
|
332
408
|
const result = await fn(params);
|
|
333
409
|
return { result: result ?? { success: true }, isError: false };
|
|
334
410
|
} catch (err) {
|
|
335
|
-
|
|
336
|
-
return { result: `${err.name}: ${err.message}`, isError: true };
|
|
337
|
-
}
|
|
338
|
-
return {
|
|
339
|
-
result: `Error: ${err instanceof Error ? err.message : String(err)}`,
|
|
340
|
-
isError: true
|
|
341
|
-
};
|
|
411
|
+
return { result: toErrorPayload(err), isError: true };
|
|
342
412
|
}
|
|
343
413
|
};
|
|
344
414
|
}
|
|
@@ -419,6 +489,21 @@ var listEvents = safeFunc(async (ctx) => {
|
|
|
419
489
|
});
|
|
420
490
|
return fetchPage(iter, params.offset, params.limit);
|
|
421
491
|
});
|
|
492
|
+
var listOrgEvents = safeFunc(async (ctx) => {
|
|
493
|
+
const { client, params } = ctx;
|
|
494
|
+
const iter = client.events.listAll({
|
|
495
|
+
calendar_id: params.calendar_ids,
|
|
496
|
+
agent_id: params.agent_id,
|
|
497
|
+
start_after: params.start_after,
|
|
498
|
+
start_before: params.start_before,
|
|
499
|
+
status: params.status,
|
|
500
|
+
source: params.source,
|
|
501
|
+
q: params.q,
|
|
502
|
+
expand: params.expand,
|
|
503
|
+
limit: params.limit
|
|
504
|
+
});
|
|
505
|
+
return fetchPage(iter, params.offset, params.limit);
|
|
506
|
+
});
|
|
422
507
|
var getEvent = safeFunc(async (ctx) => {
|
|
423
508
|
const { calendar_id, event_id } = ctx.params;
|
|
424
509
|
return calendar_id ? ctx.client.events.get(calendar_id, event_id) : ctx.client.events.getById(event_id);
|
|
@@ -590,6 +675,15 @@ var listWebhookDeliveries = safeFunc(async (ctx) => {
|
|
|
590
675
|
const { webhook_id, ...query } = params;
|
|
591
676
|
return client.webhooks.listDeliveries(webhook_id, query);
|
|
592
677
|
});
|
|
678
|
+
var getWebhookDelivery = safeFunc(async (ctx) => {
|
|
679
|
+
return ctx.client.webhooks.getDelivery(ctx.params.webhook_id, ctx.params.delivery_id);
|
|
680
|
+
});
|
|
681
|
+
var sendTestWebhook = safeFunc(async (ctx) => {
|
|
682
|
+
return ctx.client.webhooks.sendTest(ctx.params.webhook_id, { event_type: ctx.params.event_type });
|
|
683
|
+
});
|
|
684
|
+
var replayWebhookDelivery = safeFunc(async (ctx) => {
|
|
685
|
+
return ctx.client.webhooks.replayDelivery(ctx.params.webhook_id, ctx.params.delivery_id);
|
|
686
|
+
});
|
|
593
687
|
var getAuditLog = safeFunc(async (ctx) => {
|
|
594
688
|
return ctx.client.auditLog.list(ctx.params);
|
|
595
689
|
});
|
|
@@ -625,13 +719,49 @@ var deleteICalSubscription = safeFunc(async (ctx) => {
|
|
|
625
719
|
var syncICalSubscription = safeFunc(async (ctx) => {
|
|
626
720
|
return ctx.client.icalSubscriptions.sync(ctx.params.subscription_id);
|
|
627
721
|
});
|
|
722
|
+
var pauseICalSubscription = safeFunc(async (ctx) => {
|
|
723
|
+
return ctx.client.icalSubscriptions.pause(ctx.params.subscription_id);
|
|
724
|
+
});
|
|
725
|
+
var resumeICalSubscription = safeFunc(async (ctx) => {
|
|
726
|
+
return ctx.client.icalSubscriptions.resume(ctx.params.subscription_id);
|
|
727
|
+
});
|
|
628
728
|
var getUsage = safeFunc(async (ctx) => {
|
|
629
729
|
return ctx.client.usage.get();
|
|
630
730
|
});
|
|
731
|
+
var getUsageHistory = safeFunc(async (ctx) => {
|
|
732
|
+
return ctx.client.usage.history({ months: ctx.params.months });
|
|
733
|
+
});
|
|
734
|
+
var getBilling = safeFunc(async (ctx) => {
|
|
735
|
+
return ctx.client.billing.get();
|
|
736
|
+
});
|
|
737
|
+
var requestUpgrade = safeFunc(async (ctx) => {
|
|
738
|
+
return ctx.client.billing.upgradeRequests.create(ctx.params);
|
|
739
|
+
});
|
|
740
|
+
var getUpgradeRequest = safeFunc(async (ctx) => {
|
|
741
|
+
return ctx.client.billing.upgradeRequests.get(ctx.params.id);
|
|
742
|
+
});
|
|
743
|
+
var cancelUpgradeRequest = safeFunc(async (ctx) => {
|
|
744
|
+
return ctx.client.billing.upgradeRequests.cancel(ctx.params.id);
|
|
745
|
+
});
|
|
631
746
|
function createExecutor(fn) {
|
|
632
747
|
return (client, params) => fn({ client, params });
|
|
633
748
|
}
|
|
634
749
|
|
|
750
|
+
// src/untrusted.ts
|
|
751
|
+
var EVENT_UNTRUSTED_FIELDS = ["title", "description", "metadata"];
|
|
752
|
+
var WEBHOOK_DELIVERY_UNTRUSTED_FIELDS = ["payload", "response_body"];
|
|
753
|
+
function withUntrustedFields(result, fields) {
|
|
754
|
+
const body = result.result;
|
|
755
|
+
if (result.isError || typeof body !== "object" || body === null || Array.isArray(body)) return result;
|
|
756
|
+
return { ...result, result: { untrusted_fields: [...fields], ...body } };
|
|
757
|
+
}
|
|
758
|
+
function markUntrusted(def) {
|
|
759
|
+
const fields = def.untrustedFields;
|
|
760
|
+
if (!fields || fields.length === 0) return def;
|
|
761
|
+
const execute = def.execute;
|
|
762
|
+
return { ...def, execute: async (client, params) => withUntrustedFields(await execute(client, params), fields) };
|
|
763
|
+
}
|
|
764
|
+
|
|
635
765
|
// src/definitions.ts
|
|
636
766
|
var HOSTED_API_MCP_TOOL_NAMES = [
|
|
637
767
|
"create_agent",
|
|
@@ -639,6 +769,7 @@ var HOSTED_API_MCP_TOOL_NAMES = [
|
|
|
639
769
|
"create_calendar",
|
|
640
770
|
"create_event",
|
|
641
771
|
"list_events",
|
|
772
|
+
"list_org_events",
|
|
642
773
|
"get_event",
|
|
643
774
|
"update_event",
|
|
644
775
|
"get_availability",
|
|
@@ -655,6 +786,8 @@ var HOSTED_API_MCP_TOOL_NAMES = [
|
|
|
655
786
|
"update_ical_subscription",
|
|
656
787
|
"delete_ical_subscription",
|
|
657
788
|
"sync_ical_subscription",
|
|
789
|
+
"pause_ical_subscription",
|
|
790
|
+
"resume_ical_subscription",
|
|
658
791
|
"get_calendar_context",
|
|
659
792
|
"create_proposal",
|
|
660
793
|
"list_proposals",
|
|
@@ -674,6 +807,9 @@ var HOSTED_API_MCP_TOOL_NAMES = [
|
|
|
674
807
|
"update_webhook",
|
|
675
808
|
"delete_webhook",
|
|
676
809
|
"list_webhook_deliveries",
|
|
810
|
+
"get_webhook_delivery",
|
|
811
|
+
"send_test_webhook",
|
|
812
|
+
"replay_webhook_delivery",
|
|
677
813
|
"get_agent",
|
|
678
814
|
"update_agent",
|
|
679
815
|
"delete_agent",
|
|
@@ -686,21 +822,26 @@ var HOSTED_API_MCP_TOOL_NAMES = [
|
|
|
686
822
|
"get_booking_page",
|
|
687
823
|
"delete_booking_page",
|
|
688
824
|
"get_usage",
|
|
825
|
+
"get_usage_history",
|
|
689
826
|
"get_audit_log",
|
|
690
|
-
"accept_terms"
|
|
827
|
+
"accept_terms",
|
|
828
|
+
"get_billing",
|
|
829
|
+
"request_upgrade",
|
|
830
|
+
"get_upgrade_request",
|
|
831
|
+
"cancel_upgrade_request"
|
|
691
832
|
];
|
|
692
|
-
var
|
|
833
|
+
var RAW_TOOL_DEFINITIONS = [
|
|
693
834
|
// ── Calendars ──────────────────────────────────────────────────
|
|
694
835
|
{
|
|
695
836
|
name: "list_calendars",
|
|
696
|
-
description: "List calendars in the org.
|
|
837
|
+
description: "List calendars in the org. Organization keys see every calendar (agent-owned and shared); Agent keys see only their own agent's calendars. Use this to discover calendar IDs before creating or listing events.",
|
|
697
838
|
schema: ListCalendarsSchema,
|
|
698
839
|
annotations: { title: "List Calendars", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
699
840
|
execute: createExecutor(listCalendars)
|
|
700
841
|
},
|
|
701
842
|
{
|
|
702
843
|
name: "get_calendar",
|
|
703
|
-
description: "Fetch a single calendar by ID, including its name, timezone, agent status, and default reminders. Agent
|
|
844
|
+
description: "Fetch a single calendar by ID, including its name, timezone, agent status, and default reminders. Agent keys may only read calendars owned by their agent.",
|
|
704
845
|
schema: GetCalendarSchema,
|
|
705
846
|
annotations: { title: "Get Calendar", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
706
847
|
execute: createExecutor(getCalendar)
|
|
@@ -714,14 +855,14 @@ var TOOL_DEFINITIONS = [
|
|
|
714
855
|
},
|
|
715
856
|
{
|
|
716
857
|
name: "update_calendar",
|
|
717
|
-
description: "Update a calendar's name, timezone, agent status, default reminders, or metadata. Agent
|
|
858
|
+
description: "Update a calendar's name, timezone, agent status, default reminders, or metadata. Agent keys may only update calendars owned by their agent.",
|
|
718
859
|
schema: UpdateCalendarSchema,
|
|
719
860
|
annotations: { title: "Update Calendar", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
720
861
|
execute: createExecutor(updateCalendar)
|
|
721
862
|
},
|
|
722
863
|
{
|
|
723
864
|
name: "delete_calendar",
|
|
724
|
-
description: "Delete a calendar (soft delete). Its events are no longer returned and it stops contributing to availability. Agent
|
|
865
|
+
description: "Delete a calendar (soft delete). Its events are no longer returned and it stops contributing to availability. Agent keys may only delete calendars owned by their agent.",
|
|
725
866
|
schema: DeleteCalendarSchema,
|
|
726
867
|
annotations: { title: "Delete Calendar", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
727
868
|
execute: createExecutor(deleteCalendar)
|
|
@@ -736,7 +877,7 @@ var TOOL_DEFINITIONS = [
|
|
|
736
877
|
},
|
|
737
878
|
{
|
|
738
879
|
name: "list_booking_pages",
|
|
739
|
-
description: "List booking pages in the org. Agent
|
|
880
|
+
description: "List booking pages in the org. Agent keys see only pages on their own agent's calendars.",
|
|
740
881
|
schema: ListBookingPagesSchema,
|
|
741
882
|
annotations: { title: "List Booking Pages", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
742
883
|
execute: createExecutor(listBookingPages)
|
|
@@ -761,13 +902,23 @@ var TOOL_DEFINITIONS = [
|
|
|
761
902
|
description: "List events on a calendar or across an agent's calendars, including internally created events and externally synced events from iCal subscriptions (e.g. Google Calendar, Outlook). Provide `calendar_id` OR `agent_id`. Narrow with `start_after`/`start_before` (time window), `status`, and `source`.",
|
|
762
903
|
schema: ListEventsSchema,
|
|
763
904
|
annotations: { title: "List Events", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
905
|
+
untrustedFields: EVENT_UNTRUSTED_FIELDS,
|
|
764
906
|
execute: createExecutor(listEvents)
|
|
765
907
|
},
|
|
908
|
+
{
|
|
909
|
+
name: "list_org_events",
|
|
910
|
+
description: "List events across all of the organization's calendars in one call, ordered by start time (an Agent key sees only its agent's calendars). Narrow with `calendar_ids`, `agent_id`, a `start_after`/`start_before` window, `status` and `source`. `q` searches titles (case-insensitive) and needs both window bounds at most 31 days apart. Use list_events for one calendar.",
|
|
911
|
+
schema: ListOrgEventsSchema,
|
|
912
|
+
annotations: { title: "List Organization Events", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
913
|
+
untrustedFields: EVENT_UNTRUSTED_FIELDS,
|
|
914
|
+
execute: createExecutor(listOrgEvents)
|
|
915
|
+
},
|
|
766
916
|
{
|
|
767
917
|
name: "get_event",
|
|
768
918
|
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.",
|
|
769
919
|
schema: GetEventSchema,
|
|
770
920
|
annotations: { title: "Get Event", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
921
|
+
untrustedFields: EVENT_UNTRUSTED_FIELDS,
|
|
771
922
|
execute: createExecutor(getEvent)
|
|
772
923
|
},
|
|
773
924
|
{
|
|
@@ -782,6 +933,7 @@ var TOOL_DEFINITIONS = [
|
|
|
782
933
|
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.",
|
|
783
934
|
schema: UpdateEventSchema,
|
|
784
935
|
annotations: { title: "Update Event", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
936
|
+
untrustedFields: EVENT_UNTRUSTED_FIELDS,
|
|
785
937
|
execute: createExecutor(updateEvent)
|
|
786
938
|
},
|
|
787
939
|
{
|
|
@@ -789,6 +941,7 @@ var TOOL_DEFINITIONS = [
|
|
|
789
941
|
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. For a recurring series, pass `occurrence_start` to cancel just that one occurrence (the series continues); omit it to cancel the whole series. `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.",
|
|
790
942
|
schema: CancelEventSchema,
|
|
791
943
|
annotations: { title: "Cancel Event", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
944
|
+
untrustedFields: EVENT_UNTRUSTED_FIELDS,
|
|
792
945
|
execute: createExecutor(cancelEvent)
|
|
793
946
|
},
|
|
794
947
|
{
|
|
@@ -796,6 +949,7 @@ var TOOL_DEFINITIONS = [
|
|
|
796
949
|
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.',
|
|
797
950
|
schema: ConfirmEventSchema,
|
|
798
951
|
annotations: { title: "Confirm Event", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
952
|
+
untrustedFields: EVENT_UNTRUSTED_FIELDS,
|
|
799
953
|
execute: createExecutor(confirmEvent)
|
|
800
954
|
},
|
|
801
955
|
{
|
|
@@ -822,21 +976,21 @@ var TOOL_DEFINITIONS = [
|
|
|
822
976
|
},
|
|
823
977
|
{
|
|
824
978
|
name: "get_agent",
|
|
825
|
-
description: "Fetch a single agent by ID. An agent represents an AI assistant, human, or shared resource (e.g. a meeting room). Agent
|
|
979
|
+
description: "Fetch a single agent by ID. An agent represents an AI assistant, human, or shared resource (e.g. a meeting room). Agent keys may only read their own agent.",
|
|
826
980
|
schema: GetAgentSchema,
|
|
827
981
|
annotations: { title: "Get Agent", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
828
982
|
execute: createExecutor(getAgent)
|
|
829
983
|
},
|
|
830
984
|
{
|
|
831
985
|
name: "update_agent",
|
|
832
|
-
description: "Update an agent's name, description, metadata, or status (active/paused). Requires an
|
|
986
|
+
description: "Update an agent's name, description, metadata, or status (active/paused). Requires an Organization key \u2014 Agent keys cannot mutate agents.",
|
|
833
987
|
schema: UpdateAgentSchema,
|
|
834
988
|
annotations: { title: "Update Agent", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
835
989
|
execute: createExecutor(updateAgent)
|
|
836
990
|
},
|
|
837
991
|
{
|
|
838
992
|
name: "delete_agent",
|
|
839
|
-
description: "Decommission an agent. This marks the agent as decommissioned and revokes all of its
|
|
993
|
+
description: "Decommission an agent. This marks the agent as decommissioned and revokes all of its Agent keys. Requires an Organization key \u2014 Agent keys cannot delete agents.",
|
|
840
994
|
schema: DeleteAgentSchema,
|
|
841
995
|
annotations: { title: "Delete Agent", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
842
996
|
execute: createExecutor(deleteAgent)
|
|
@@ -858,21 +1012,21 @@ var TOOL_DEFINITIONS = [
|
|
|
858
1012
|
},
|
|
859
1013
|
{
|
|
860
1014
|
name: "create_connection_link",
|
|
861
|
-
description: "Request human setup of Google Calendar or Microsoft Outlook for a Chronary calendar. Give setup_url to a human; the agent never receives OAuth credentials, provider calendar names, or event data. The secret URL is returned only on first creation. If reused=true and setup_url is null, retain the original URL or cancel this link and create a replacement.",
|
|
1015
|
+
description: "Request human setup of Google Calendar or Microsoft Outlook for a Chronary calendar. Give setup_url to a human; the agent never receives OAuth credentials, provider calendar names, or event data. When the human finishes, the linked account becomes a Connection, listed under Human calendars in the Chronary console. The secret URL is returned only on first creation. If reused=true and setup_url is null, retain the original URL or cancel this link and create a replacement.",
|
|
862
1016
|
schema: CreateConnectionLinkSchema,
|
|
863
1017
|
annotations: { title: "Create Human Calendar Setup Link", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
864
1018
|
execute: createExecutor(createConnectionLink)
|
|
865
1019
|
},
|
|
866
1020
|
{
|
|
867
1021
|
name: "get_connection_link",
|
|
868
|
-
description: "Poll a human-calendar setup request. Returns provider-neutral status and
|
|
1022
|
+
description: "Poll a human-calendar setup request. Returns provider-neutral status and, when complete, the ID of the resulting Connection (the human sees it under Human calendars in the Chronary console), but never replays the bearer setup URL or exposes human calendar data.",
|
|
869
1023
|
schema: GetConnectionLinkSchema,
|
|
870
1024
|
annotations: { title: "Get Human Calendar Setup Status", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
871
1025
|
execute: createExecutor(getConnectionLink)
|
|
872
1026
|
},
|
|
873
1027
|
{
|
|
874
1028
|
name: "cancel_connection_link",
|
|
875
|
-
description: "Cancel a pending human-calendar setup request. This invalidates the setup URL and does not disconnect
|
|
1029
|
+
description: "Cancel a pending human-calendar setup request. This invalidates the setup URL and does not disconnect a Connection that was already completed; the human manages Connections under Human calendars in the Chronary console.",
|
|
876
1030
|
schema: CancelConnectionLinkSchema,
|
|
877
1031
|
annotations: { title: "Cancel Human Calendar Setup Link", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
878
1032
|
execute: createExecutor(cancelConnectionLink)
|
|
@@ -883,47 +1037,48 @@ var TOOL_DEFINITIONS = [
|
|
|
883
1037
|
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.`,
|
|
884
1038
|
schema: GetCalendarContextSchema,
|
|
885
1039
|
annotations: { title: "Get Calendar Context", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1040
|
+
untrustedFields: EVENT_UNTRUSTED_FIELDS,
|
|
886
1041
|
execute: createExecutor(getCalendarContext)
|
|
887
1042
|
},
|
|
888
1043
|
// ── Scheduling proposals ───────────────────────────────────────
|
|
889
1044
|
{
|
|
890
1045
|
name: "create_proposal",
|
|
891
|
-
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
|
|
1046
|
+
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 Organization key. Pro plan only.",
|
|
892
1047
|
schema: CreateProposalSchema,
|
|
893
1048
|
annotations: { title: "Create Proposal", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
894
1049
|
execute: createExecutor(createProposal)
|
|
895
1050
|
},
|
|
896
1051
|
{
|
|
897
1052
|
name: "list_proposals",
|
|
898
|
-
description: "List scheduling proposals for the org. Filter by status (pending|confirmed|expired|cancelled) or organizer_agent_id. Requires an
|
|
1053
|
+
description: "List scheduling proposals for the org. Filter by status (pending|confirmed|expired|cancelled) or organizer_agent_id. Requires an Organization key.",
|
|
899
1054
|
schema: ListProposalsSchema,
|
|
900
1055
|
annotations: { title: "List Proposals", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
901
1056
|
execute: createExecutor(listProposals)
|
|
902
1057
|
},
|
|
903
1058
|
{
|
|
904
1059
|
name: "get_proposal",
|
|
905
|
-
description: "Get a scheduling proposal by id, including its slots and per-participant responses. Requires an
|
|
1060
|
+
description: "Get a scheduling proposal by id, including its slots and per-participant responses. Requires an Organization key.",
|
|
906
1061
|
schema: GetProposalSchema,
|
|
907
1062
|
annotations: { title: "Get Proposal", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
908
1063
|
execute: createExecutor(getProposal)
|
|
909
1064
|
},
|
|
910
1065
|
{
|
|
911
1066
|
name: "respond_to_proposal",
|
|
912
|
-
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
|
|
1067
|
+
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 Organization key. Pro plan only.',
|
|
913
1068
|
schema: RespondToProposalSchema,
|
|
914
1069
|
annotations: { title: "Respond To Proposal", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
915
1070
|
execute: createExecutor(respondToProposal)
|
|
916
1071
|
},
|
|
917
1072
|
{
|
|
918
1073
|
name: "resolve_proposal",
|
|
919
|
-
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
|
|
1074
|
+
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 Organization key. Pro plan only.',
|
|
920
1075
|
schema: ResolveProposalSchema,
|
|
921
1076
|
annotations: { title: "Resolve Proposal", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
922
1077
|
execute: createExecutor(resolveProposal)
|
|
923
1078
|
},
|
|
924
1079
|
{
|
|
925
1080
|
name: "cancel_proposal",
|
|
926
|
-
description: 'Cancel an open proposal. Fires a proposal.cancelled webhook with reason="organizer_cancelled". Requires an
|
|
1081
|
+
description: 'Cancel an open proposal. Fires a proposal.cancelled webhook with reason="organizer_cancelled". Requires an Organization key. Pro plan only.',
|
|
927
1082
|
schema: CancelProposalSchema,
|
|
928
1083
|
annotations: { title: "Cancel Proposal", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
929
1084
|
execute: createExecutor(cancelProposal)
|
|
@@ -953,46 +1108,69 @@ var TOOL_DEFINITIONS = [
|
|
|
953
1108
|
// ── Webhooks ───────────────────────────────────────────────────
|
|
954
1109
|
{
|
|
955
1110
|
name: "list_webhooks",
|
|
956
|
-
description: "List the org's webhook subscriptions with their subscribed event types and active state. Signing secrets are never returned. Requires an
|
|
1111
|
+
description: "List the org's webhook subscriptions with their subscribed event types and active state. Signing secrets are never returned. Requires an Organization key.",
|
|
957
1112
|
schema: ListWebhooksSchema,
|
|
958
1113
|
annotations: { title: "List Webhooks", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
959
1114
|
execute: createExecutor(listWebhooks)
|
|
960
1115
|
},
|
|
961
1116
|
{
|
|
962
1117
|
name: "get_webhook",
|
|
963
|
-
description: "Get a single webhook subscription by id, including its subscribed event types and active state. The signing secret is never returned. Requires an
|
|
1118
|
+
description: "Get a single webhook subscription by id, including its subscribed event types and active state. The signing secret is never returned. Requires an Organization key.",
|
|
964
1119
|
schema: GetWebhookSchema,
|
|
965
1120
|
annotations: { title: "Get Webhook", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
966
1121
|
execute: createExecutor(getWebhook)
|
|
967
1122
|
},
|
|
968
1123
|
{
|
|
969
1124
|
name: "create_webhook",
|
|
970
|
-
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
|
|
1125
|
+
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 Organization key.",
|
|
971
1126
|
schema: CreateWebhookSchema,
|
|
972
|
-
annotations: { title: "Create Webhook", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint:
|
|
1127
|
+
annotations: { title: "Create Webhook", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
973
1128
|
execute: createExecutor(createWebhook)
|
|
974
1129
|
},
|
|
975
1130
|
{
|
|
976
1131
|
name: "update_webhook",
|
|
977
|
-
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
|
|
1132
|
+
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 Organization key.",
|
|
978
1133
|
schema: UpdateWebhookSchema,
|
|
979
|
-
annotations: { title: "Update Webhook", readOnlyHint: false, destructiveHint:
|
|
1134
|
+
annotations: { title: "Update Webhook", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: true },
|
|
980
1135
|
execute: createExecutor(updateWebhook)
|
|
981
1136
|
},
|
|
982
1137
|
{
|
|
983
1138
|
name: "delete_webhook",
|
|
984
|
-
description: "Permanently delete a webhook subscription. This frees its endpoint slot against the per-plan cap. Requires an
|
|
1139
|
+
description: "Permanently delete a webhook subscription. This frees its endpoint slot against the per-plan cap. Requires an Organization key.",
|
|
985
1140
|
schema: DeleteWebhookSchema,
|
|
986
1141
|
annotations: { title: "Delete Webhook", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
987
1142
|
execute: createExecutor(deleteWebhook)
|
|
988
1143
|
},
|
|
989
1144
|
{
|
|
990
1145
|
name: "list_webhook_deliveries",
|
|
991
|
-
description: "List delivery attempts for a webhook subscription, with per-status counts (pending/delivered/failed). Use this to debug failing deliveries. Requires an
|
|
1146
|
+
description: "List delivery attempts for a webhook subscription, newest first, with per-status counts (pending/delivered/failed/dropped). Filter by status, event type, creation time, delivery id or test flag, and page with next_cursor. `dropped` deliveries were stopped by the Free plan monthly limit. Use this to debug failing deliveries. Requires an Organization key.",
|
|
992
1147
|
schema: ListWebhookDeliveriesSchema,
|
|
993
1148
|
annotations: { title: "List Webhook Deliveries", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1149
|
+
untrustedFields: WEBHOOK_DELIVERY_UNTRUSTED_FIELDS,
|
|
994
1150
|
execute: createExecutor(listWebhookDeliveries)
|
|
995
1151
|
},
|
|
1152
|
+
{
|
|
1153
|
+
name: "get_webhook_delivery",
|
|
1154
|
+
description: "Get one webhook delivery with its payload and every attempt, oldest first: HTTP status, duration, the first 2 KB of the response body and an error code (timeout, connection_error, tls_error, redirect_not_followed, unsafe_destination_url, non_2xx). Use this to find out why a delivery failed. Requires an Organization key.",
|
|
1155
|
+
schema: GetWebhookDeliverySchema,
|
|
1156
|
+
annotations: { title: "Get Webhook Delivery", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1157
|
+
untrustedFields: WEBHOOK_DELIVERY_UNTRUSTED_FIELDS,
|
|
1158
|
+
execute: createExecutor(getWebhookDelivery)
|
|
1159
|
+
},
|
|
1160
|
+
{
|
|
1161
|
+
name: "send_test_webhook",
|
|
1162
|
+
description: "Send a signed sample payload of one event type to a webhook endpoint, to check that it receives and verifies deliveries. The delivery is marked is_test, carries the X-Chronary-Test: 1 header, makes one attempt, does not count toward the monthly delivery quota and is sent even when the endpoint is paused or disabled. The endpoint must subscribe to the event type. Poll get_webhook_delivery with the returned delivery_id for the result. Limited to 10 per minute. Requires an Organization key.",
|
|
1163
|
+
schema: SendTestWebhookSchema,
|
|
1164
|
+
annotations: { title: "Send Test Webhook", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
1165
|
+
execute: createExecutor(sendTestWebhook)
|
|
1166
|
+
},
|
|
1167
|
+
{
|
|
1168
|
+
name: "replay_webhook_delivery",
|
|
1169
|
+
description: "Send a failed or dropped webhook delivery again, as a new delivery with a new delivery_id. The stored payload goes out unchanged (same event id), signed with the endpoint's current secret, with an X-Chronary-Replay-Of header naming the original delivery. Only failed or dropped deliveries that are not test events can be replayed, the endpoint must be active, and the payload must still be stored (30 days). The replay follows the normal retry schedule and counts toward the monthly delivery quota. Poll get_webhook_delivery with the returned delivery_id for the result. Limited to 30 per minute. Requires a Developer or Pro plan and an Organization key.",
|
|
1170
|
+
schema: ReplayWebhookDeliverySchema,
|
|
1171
|
+
annotations: { title: "Replay Webhook Delivery", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
1172
|
+
execute: createExecutor(replayWebhookDelivery)
|
|
1173
|
+
},
|
|
996
1174
|
// ── iCal Subscriptions ─────────────────────────────────────────
|
|
997
1175
|
{
|
|
998
1176
|
name: "list_ical_subscriptions",
|
|
@@ -1019,7 +1197,7 @@ var TOOL_DEFINITIONS = [
|
|
|
1019
1197
|
name: "update_ical_subscription",
|
|
1020
1198
|
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.",
|
|
1021
1199
|
schema: UpdateICalSubscriptionSchema,
|
|
1022
|
-
annotations: { title: "Update iCal Subscription", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint:
|
|
1200
|
+
annotations: { title: "Update iCal Subscription", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
1023
1201
|
execute: createExecutor(updateICalSubscription)
|
|
1024
1202
|
},
|
|
1025
1203
|
{
|
|
@@ -1031,29 +1209,43 @@ var TOOL_DEFINITIONS = [
|
|
|
1031
1209
|
},
|
|
1032
1210
|
{
|
|
1033
1211
|
name: "sync_ical_subscription",
|
|
1034
|
-
description:
|
|
1212
|
+
description: 'Start an immediate fetch of an external iCal feed instead of waiting for the next scheduled poll. Returns {"status":"syncing"} as soon as the fetch has started; call get_ical_subscription a few seconds later to read last_synced_at and last_error. A paused feed must be resumed first; one manual sync per feed per minute.',
|
|
1035
1213
|
schema: SyncICalSubscriptionSchema,
|
|
1036
1214
|
annotations: { title: "Sync iCal Subscription", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
1037
1215
|
execute: createExecutor(syncICalSubscription)
|
|
1038
1216
|
},
|
|
1217
|
+
{
|
|
1218
|
+
name: "pause_ical_subscription",
|
|
1219
|
+
description: "Pause an external iCal feed subscription: scheduled polls skip it and manual syncs are refused until it is resumed. Busy blocks already imported stay. Pausing a paused feed changes nothing. Returns the subscription.",
|
|
1220
|
+
schema: PauseICalSubscriptionSchema,
|
|
1221
|
+
annotations: { title: "Pause iCal Subscription", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1222
|
+
execute: createExecutor(pauseICalSubscription)
|
|
1223
|
+
},
|
|
1224
|
+
{
|
|
1225
|
+
name: "resume_ical_subscription",
|
|
1226
|
+
description: "Resume a paused or failing external iCal feed subscription: it returns to scheduled polling and its last_error is cleared. Resuming an active feed changes nothing. Returns the subscription.",
|
|
1227
|
+
schema: ResumeICalSubscriptionSchema,
|
|
1228
|
+
annotations: { title: "Resume iCal Subscription", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1229
|
+
execute: createExecutor(resumeICalSubscription)
|
|
1230
|
+
},
|
|
1039
1231
|
// ── Scoped keys ────────────────────────────────────────────────
|
|
1040
1232
|
{
|
|
1041
1233
|
name: "create_scoped_key",
|
|
1042
|
-
description: "Create an
|
|
1234
|
+
description: "Create an Agent 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 Organization key.",
|
|
1043
1235
|
schema: CreateScopedKeySchema,
|
|
1044
1236
|
annotations: { title: "Create Scoped Key", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
1045
1237
|
execute: createExecutor(createScopedKey)
|
|
1046
1238
|
},
|
|
1047
1239
|
{
|
|
1048
1240
|
name: "list_scoped_keys",
|
|
1049
|
-
description: "List all live (non-revoked)
|
|
1241
|
+
description: "List all live (non-revoked) Agent keys for this org. Returns key metadata only (id, prefix, agent_id, label, created_at) \u2014 never the plaintext secret. Requires an Organization key.",
|
|
1050
1242
|
schema: ListScopedKeysSchema,
|
|
1051
1243
|
annotations: { title: "List Scoped Keys", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1052
1244
|
execute: createExecutor(listScopedKeys)
|
|
1053
1245
|
},
|
|
1054
1246
|
{
|
|
1055
1247
|
name: "revoke_scoped_key",
|
|
1056
|
-
description: "Revoke an
|
|
1248
|
+
description: "Revoke an Agent key by ID. Revocation is permanent (cannot be un-revoked); the key stops authenticating within about a minute. Requires an Organization key.",
|
|
1057
1249
|
schema: RevokeScopedKeySchema,
|
|
1058
1250
|
annotations: { title: "Revoke Scoped Key", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
1059
1251
|
execute: createExecutor(revokeScopedKey)
|
|
@@ -1061,7 +1253,7 @@ var TOOL_DEFINITIONS = [
|
|
|
1061
1253
|
// ── Audit log ──────────────────────────────────────────────────
|
|
1062
1254
|
{
|
|
1063
1255
|
name: "get_audit_log",
|
|
1064
|
-
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
|
|
1256
|
+
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 Organization key (chr_sk_*); Agent keys cannot read the org-wide audit log.",
|
|
1065
1257
|
schema: GetAuditLogSchema,
|
|
1066
1258
|
annotations: { title: "Get Audit Log", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1067
1259
|
execute: createExecutor(getAuditLog)
|
|
@@ -1069,7 +1261,7 @@ var TOOL_DEFINITIONS = [
|
|
|
1069
1261
|
// ── Terms ──────────────────────────────────────────────────────
|
|
1070
1262
|
{
|
|
1071
1263
|
name: "accept_terms",
|
|
1072
|
-
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
|
|
1264
|
+
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 Organization key (chr_sk_*); Agent keys cannot accept org-wide terms.",
|
|
1073
1265
|
schema: AcceptTermsSchema,
|
|
1074
1266
|
annotations: { title: "Accept Terms", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1075
1267
|
execute: createExecutor(acceptTerms)
|
|
@@ -1077,12 +1269,49 @@ var TOOL_DEFINITIONS = [
|
|
|
1077
1269
|
// ── Usage ──────────────────────────────────────────────────────
|
|
1078
1270
|
{
|
|
1079
1271
|
name: "get_usage",
|
|
1080
|
-
description: "Get the calling org's current-period usage and plan limits (agents, calendars, events, API calls,
|
|
1272
|
+
description: "Get the calling org's current-period usage and plan limits (agents, calendars, events, API calls, webhook deliveries, webhook endpoints, availability queries, iCal subscriptions, proposals, recurring events, booking pages, scoped keys, holds, cross-calendar queries) and when the monthly counters reset (resets_at, 00:00 UTC on the 1st). Requires an Organization key (chr_sk_*); Agent keys cannot read org-wide usage.",
|
|
1081
1273
|
schema: GetUsageSchema,
|
|
1082
1274
|
annotations: { title: "Get Usage", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1083
1275
|
execute: createExecutor(getUsage)
|
|
1276
|
+
},
|
|
1277
|
+
{
|
|
1278
|
+
name: "get_usage_history",
|
|
1279
|
+
description: "Get the calling org's monthly usage totals for the last 1-12 UTC calendar months (default 6), oldest first, ending with the current partial month. Each month lists every monthly counter (api_calls, events, webhook_deliveries, availability_queries, proposals, holds_created, holds_confirmed, holds_expired, cross_calendar_queries); limits are the current plan's (null = unlimited). Requires an Organization key (chr_sk_*); Agent keys cannot read org-wide usage.",
|
|
1280
|
+
schema: GetUsageHistorySchema,
|
|
1281
|
+
annotations: { title: "Get Usage History", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1282
|
+
execute: createExecutor(getUsageHistory)
|
|
1283
|
+
},
|
|
1284
|
+
// ── Billing ────────────────────────────────────────────────────
|
|
1285
|
+
{
|
|
1286
|
+
name: "get_billing",
|
|
1287
|
+
description: "Get the org's plan and billing status: plan, subscription status, renewal/cancellation dates, upgrade options, and any pending upgrade request. Read-only \u2014 agents cannot pay, cancel, or change payment methods. Requires an Organization key (chr_sk_*).",
|
|
1288
|
+
schema: GetBillingSchema,
|
|
1289
|
+
annotations: { title: "Get Billing", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1290
|
+
execute: createExecutor(getBilling)
|
|
1291
|
+
},
|
|
1292
|
+
{
|
|
1293
|
+
name: "request_upgrade",
|
|
1294
|
+
description: "Ask your human to upgrade this Chronary account to Pro. Returns approval_url \u2014 give it to your human; only a human can pay. If reused=true a request is already pending \u2014 do not call again; poll get_upgrade_request at most once a minute. The link opens the Billing page in the Chronary console.",
|
|
1295
|
+
schema: RequestUpgradeSchema,
|
|
1296
|
+
annotations: { title: "Request Upgrade", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1297
|
+
execute: createExecutor(requestUpgrade)
|
|
1298
|
+
},
|
|
1299
|
+
{
|
|
1300
|
+
name: "get_upgrade_request",
|
|
1301
|
+
description: "Poll an upgrade request by ID. status is pending, completed, declined, canceled, or expired. Poll at most once a minute; after completed, retry the blocked call about 15 seconds later. Requires an Organization key (chr_sk_*).",
|
|
1302
|
+
schema: GetUpgradeRequestSchema,
|
|
1303
|
+
annotations: { title: "Get Upgrade Request", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1304
|
+
execute: createExecutor(getUpgradeRequest)
|
|
1305
|
+
},
|
|
1306
|
+
{
|
|
1307
|
+
name: "cancel_upgrade_request",
|
|
1308
|
+
description: "Withdraw a pending upgrade request (for example, the blocker went away). The approval URL stops working. Fails with upgrade_request_not_pending if the request is already completed, declined, canceled, or expired.",
|
|
1309
|
+
schema: CancelUpgradeRequestSchema,
|
|
1310
|
+
annotations: { title: "Cancel Upgrade Request", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1311
|
+
execute: createExecutor(cancelUpgradeRequest)
|
|
1084
1312
|
}
|
|
1085
1313
|
];
|
|
1314
|
+
var TOOL_DEFINITIONS = RAW_TOOL_DEFINITIONS.map(markUntrusted);
|
|
1086
1315
|
var toolkitToolNames = new Set(TOOL_DEFINITIONS.map((tool) => tool.name));
|
|
1087
1316
|
var hostedToolNames = new Set(HOSTED_API_MCP_TOOL_NAMES);
|
|
1088
1317
|
var TOOLKIT_MCP_PARITY = {
|