@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/mastra.js
CHANGED
|
@@ -21,12 +21,15 @@ var WEBHOOK_EVENT_TYPES = [
|
|
|
21
21
|
"proposal.confirmed",
|
|
22
22
|
"proposal.expired",
|
|
23
23
|
"proposal.cancelled",
|
|
24
|
-
"webhook.deactivated"
|
|
24
|
+
"webhook.deactivated",
|
|
25
|
+
"org.plan_changed",
|
|
26
|
+
"calendar_connection.reauthorization_required",
|
|
27
|
+
"usage.threshold_crossed"
|
|
25
28
|
];
|
|
26
|
-
var WEBHOOK_DELIVERY_STATUSES = ["pending", "delivered", "failed"];
|
|
29
|
+
var WEBHOOK_DELIVERY_STATUSES = ["pending", "delivered", "failed", "dropped"];
|
|
27
30
|
var ListCalendarsSchema = z.object({
|
|
28
|
-
agent_id: z.string().optional().describe("Filter to calendars owned by this agent.
|
|
29
|
-
include: z.enum(["all"]).optional().describe('Pass "all" to include calendars across all agents (
|
|
31
|
+
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."),
|
|
32
|
+
include: z.enum(["all"]).optional().describe('Pass "all" to include calendars across all agents (Organization keys only)'),
|
|
30
33
|
limit: z.number().int().min(1).max(200).default(50).describe("Max results to return"),
|
|
31
34
|
offset: z.number().int().min(0).default(0).describe("Pagination offset")
|
|
32
35
|
});
|
|
@@ -36,13 +39,13 @@ var GetCalendarSchema = z.object({
|
|
|
36
39
|
var CreateCalendarSchema = z.object({
|
|
37
40
|
name: z.string().min(1).max(255).describe("Calendar name"),
|
|
38
41
|
agent_id: z.string().optional().describe("Agent ID to own this calendar (omit for org-level)"),
|
|
39
|
-
timezone: z.string().min(1).describe("IANA timezone (e.g. America/New_York)"),
|
|
42
|
+
timezone: z.string().min(1).max(64).describe("IANA timezone (e.g. America/New_York)"),
|
|
40
43
|
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.")
|
|
41
44
|
});
|
|
42
45
|
var UpdateCalendarSchema = z.object({
|
|
43
46
|
calendar_id: z.string().describe("Calendar ID to update"),
|
|
44
47
|
name: z.string().min(1).max(255).optional().describe("New calendar name"),
|
|
45
|
-
timezone: z.string().min(1).optional().describe("New IANA timezone (e.g. America/New_York)"),
|
|
48
|
+
timezone: z.string().min(1).max(64).optional().describe("New IANA timezone (e.g. America/New_York)"),
|
|
46
49
|
agent_status: z.enum(["idle", "working", "waiting", "error"]).optional().describe("Owning agent's status"),
|
|
47
50
|
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"),
|
|
48
51
|
metadata: z.record(z.string(), z.unknown()).optional().describe("Arbitrary metadata (max 16KB)")
|
|
@@ -83,6 +86,18 @@ var ListEventsSchema = z.object({
|
|
|
83
86
|
offset: z.number().int().min(0).default(0).describe("Pagination offset"),
|
|
84
87
|
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.")
|
|
85
88
|
});
|
|
89
|
+
var ListOrgEventsSchema = z.object({
|
|
90
|
+
calendar_ids: z.array(z.string()).max(50).optional().describe("Only these calendar IDs (at most 50)"),
|
|
91
|
+
agent_id: z.string().optional().describe("Only this agent's calendars"),
|
|
92
|
+
start_after: z.string().datetime().optional().describe("Only events starting at or after this ISO 8601 time"),
|
|
93
|
+
start_before: z.string().datetime().optional().describe("Only events starting at or before this ISO 8601 time"),
|
|
94
|
+
status: z.enum(["confirmed", "tentative", "cancelled", "hold"]).optional().describe("Filter by event status"),
|
|
95
|
+
source: z.enum(["internal", "external_ical"]).optional().describe('Filter by source: "internal" (created via the API) or "external_ical" (synced from an iCal subscription)'),
|
|
96
|
+
q: z.string().optional().describe("Case-insensitive title search. Requires start_after and start_before at most 31 days apart"),
|
|
97
|
+
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)."),
|
|
98
|
+
limit: z.number().int().min(1).max(100).default(50).describe("Max results to return (1-100)"),
|
|
99
|
+
offset: z.number().int().min(0).default(0).describe("Pagination offset")
|
|
100
|
+
});
|
|
86
101
|
var GetEventSchema = z.object({
|
|
87
102
|
event_id: z.string().describe("Event ID to retrieve"),
|
|
88
103
|
calendar_id: z.string().optional().describe("Calendar ID that owns the event. Optional \u2014 if omitted the calendar is resolved from the event.")
|
|
@@ -92,7 +107,7 @@ var CreateEventSchema = z.object({
|
|
|
92
107
|
title: z.string().min(1).max(500).describe("Event title"),
|
|
93
108
|
start_time: z.string().datetime().describe("Start time (ISO 8601)"),
|
|
94
109
|
end_time: z.string().datetime().describe("End time (ISO 8601)"),
|
|
95
|
-
description: z.string().optional().describe("Optional event description"),
|
|
110
|
+
description: z.string().max(1e4).optional().describe("Optional event description"),
|
|
96
111
|
all_day: z.boolean().default(false).describe("Whether this is an all-day event"),
|
|
97
112
|
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".'),
|
|
98
113
|
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."),
|
|
@@ -104,7 +119,7 @@ var UpdateEventSchema = z.object({
|
|
|
104
119
|
event_id: z.string().describe("Event ID to update"),
|
|
105
120
|
calendar_id: z.string().optional().describe("Calendar ID that owns the event. Optional \u2014 if omitted the calendar is resolved from the event."),
|
|
106
121
|
title: z.string().min(1).max(500).optional().describe("New event title"),
|
|
107
|
-
description: z.string().nullable().optional().describe("New description, or null to clear it"),
|
|
122
|
+
description: z.string().max(1e4).nullable().optional().describe("New description, or null to clear it"),
|
|
108
123
|
start_time: z.string().datetime().optional().describe("New start time (ISO 8601)"),
|
|
109
124
|
end_time: z.string().datetime().optional().describe("New end time (ISO 8601)"),
|
|
110
125
|
all_day: z.boolean().optional().describe("Whether this is an all-day event"),
|
|
@@ -127,7 +142,7 @@ var ReleaseEventSchema = z.object({
|
|
|
127
142
|
var CreateAgentSchema = z.object({
|
|
128
143
|
name: z.string().min(1).max(255).describe("Display name for the agent"),
|
|
129
144
|
type: z.enum(["ai", "human", "resource"]).describe("Agent type"),
|
|
130
|
-
description: z.string().optional().describe("Optional description")
|
|
145
|
+
description: z.string().max(5e3).optional().describe("Optional description")
|
|
131
146
|
});
|
|
132
147
|
var ListAgentsSchema = z.object({
|
|
133
148
|
type: z.enum(["ai", "human", "resource"]).optional().describe("Filter by agent type"),
|
|
@@ -141,7 +156,7 @@ var GetAgentSchema = z.object({
|
|
|
141
156
|
var UpdateAgentSchema = z.object({
|
|
142
157
|
agent_id: z.string().describe("Agent ID to update"),
|
|
143
158
|
name: z.string().min(1).max(255).optional().describe("New display name"),
|
|
144
|
-
description: z.string().nullable().optional().describe("New description (null to clear)"),
|
|
159
|
+
description: z.string().max(5e3).nullable().optional().describe("New description (null to clear)"),
|
|
145
160
|
metadata: z.record(z.string(), z.unknown()).optional().describe("Arbitrary metadata (max 16KB)"),
|
|
146
161
|
status: z.enum(["active", "paused"]).optional().describe("Operational status")
|
|
147
162
|
});
|
|
@@ -198,7 +213,7 @@ var CreateProposalSchema = z.object({
|
|
|
198
213
|
expires_at: z.string().datetime().optional().describe("Auto-cancel cutoff if unresolved")
|
|
199
214
|
});
|
|
200
215
|
var ListProposalsSchema = z.object({
|
|
201
|
-
status: z.enum(["pending", "confirmed", "expired", "cancelled"]).optional().describe("Filter by proposal status"),
|
|
216
|
+
status: z.enum(["pending", "resolving", "confirmed", "expired", "cancelled"]).optional().describe("Filter by proposal status"),
|
|
202
217
|
organizer_agent_id: z.string().optional().describe("Filter by organizer agent"),
|
|
203
218
|
limit: z.number().int().min(1).max(200).optional().describe("Max results (default 50)"),
|
|
204
219
|
offset: z.number().int().min(0).optional().describe("Pagination offset (default 0)")
|
|
@@ -249,7 +264,8 @@ var ClearAvailabilityRulesSchema = z.object({
|
|
|
249
264
|
});
|
|
250
265
|
var CreateScopedKeySchema = z.object({
|
|
251
266
|
agent_id: z.string().regex(/^agt_/).describe("Agent ID this key is scoped to"),
|
|
252
|
-
label: z.string().min(1).max(100).optional().describe("Human-readable label for the key")
|
|
267
|
+
label: z.string().min(1).max(100).optional().describe("Human-readable label for the key"),
|
|
268
|
+
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.")
|
|
253
269
|
});
|
|
254
270
|
var ListScopedKeysSchema = z.object({});
|
|
255
271
|
var RevokeScopedKeySchema = z.object({
|
|
@@ -258,8 +274,14 @@ var RevokeScopedKeySchema = z.object({
|
|
|
258
274
|
var GetAuditLogSchema = z.object({
|
|
259
275
|
from: z.string().datetime({ offset: true }).optional().describe("Start of the window (ISO 8601). Silently clamped to the plan retention window if older."),
|
|
260
276
|
to: z.string().datetime({ offset: true }).optional().describe("End of the window (ISO 8601)"),
|
|
261
|
-
action: z.string().min(1).max(64).optional().describe("Filter by action name (e.g. event.
|
|
277
|
+
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."),
|
|
262
278
|
actor_key_prefix: z.string().min(1).max(32).optional().describe("Filter by the API key prefix that performed the action"),
|
|
279
|
+
actor_type: z.enum(["session", "org_key", "agent_key", "system"]).optional().describe("Filter by who acted: session (console), org_key, agent_key or system"),
|
|
280
|
+
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)"),
|
|
281
|
+
request_id: z.string().min(1).max(64).optional().describe("Filter by request id (the X-Request-Id of the original call)"),
|
|
282
|
+
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_)"),
|
|
283
|
+
status_class: z.enum(["2xx", "3xx", "4xx", "5xx"]).optional().describe("Filter by response status class: 2xx, 3xx, 4xx or 5xx"),
|
|
284
|
+
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)"),
|
|
263
285
|
cursor: z.string().min(1).max(256).optional().describe("Opaque pagination cursor from a previous response"),
|
|
264
286
|
limit: z.number().int().min(1).max(200).optional().describe("Max results to return (default 50)")
|
|
265
287
|
});
|
|
@@ -274,12 +296,12 @@ var GetWebhookSchema = z.object({
|
|
|
274
296
|
webhook_id: z.string().describe("Webhook subscription to fetch")
|
|
275
297
|
});
|
|
276
298
|
var CreateWebhookSchema = z.object({
|
|
277
|
-
url: z.string().url().describe("HTTPS endpoint that will receive event deliveries"),
|
|
299
|
+
url: z.string().url().max(2048).describe("HTTPS endpoint that will receive event deliveries"),
|
|
278
300
|
events: z.array(z.enum(WEBHOOK_EVENT_TYPES)).min(1).describe("Event types to subscribe to")
|
|
279
301
|
});
|
|
280
302
|
var UpdateWebhookSchema = z.object({
|
|
281
303
|
webhook_id: z.string().describe("Webhook subscription to update"),
|
|
282
|
-
url: z.string().url().optional().describe("New HTTPS delivery endpoint"),
|
|
304
|
+
url: z.string().url().max(2048).optional().describe("New HTTPS delivery endpoint"),
|
|
283
305
|
events: z.array(z.enum(WEBHOOK_EVENT_TYPES)).min(1).optional().describe("Replacement set of event types to subscribe to"),
|
|
284
306
|
active: z.boolean().optional().describe("Set false to pause deliveries, true to resume")
|
|
285
307
|
});
|
|
@@ -289,9 +311,27 @@ var DeleteWebhookSchema = z.object({
|
|
|
289
311
|
var ListWebhookDeliveriesSchema = z.object({
|
|
290
312
|
webhook_id: z.string().describe("Webhook subscription whose deliveries to list"),
|
|
291
313
|
limit: z.number().int().min(1).max(100).default(20).describe("Max results to return"),
|
|
292
|
-
offset: z.number().int().min(0).default(0).describe("Pagination offset"),
|
|
314
|
+
offset: z.number().int().min(0).default(0).describe("Pagination offset. Cannot be combined with cursor"),
|
|
293
315
|
status: z.enum(WEBHOOK_DELIVERY_STATUSES).optional().describe("Filter to a single delivery status"),
|
|
294
|
-
include_payload: z.boolean().optional().describe("Include the full event payload sent on each delivery")
|
|
316
|
+
include_payload: z.boolean().optional().describe("Include the full event payload sent on each delivery"),
|
|
317
|
+
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"),
|
|
318
|
+
created_after: z.string().datetime().optional().describe("Only deliveries created at or after this time (ISO 8601, UTC)"),
|
|
319
|
+
created_before: z.string().datetime().optional().describe("Only deliveries created before this time (ISO 8601, UTC)"),
|
|
320
|
+
delivery_id: z.string().max(100).regex(/^whd_[A-Za-z0-9_-]+$/).optional().describe("Only the delivery with this id"),
|
|
321
|
+
is_test: z.boolean().optional().describe("true for test events only, false to leave them out"),
|
|
322
|
+
cursor: z.string().min(1).max(1024).optional().describe("The next_cursor from the previous page")
|
|
323
|
+
});
|
|
324
|
+
var GetWebhookDeliverySchema = z.object({
|
|
325
|
+
webhook_id: z.string().describe("Webhook subscription the delivery belongs to"),
|
|
326
|
+
delivery_id: z.string().describe("Delivery ID (whd_...) from list_webhook_deliveries")
|
|
327
|
+
});
|
|
328
|
+
var SendTestWebhookSchema = z.object({
|
|
329
|
+
webhook_id: z.string().describe("Webhook subscription to send the test event to"),
|
|
330
|
+
event_type: z.enum(WEBHOOK_EVENT_TYPES).describe("Event type whose sample payload to send")
|
|
331
|
+
});
|
|
332
|
+
var ReplayWebhookDeliverySchema = z.object({
|
|
333
|
+
webhook_id: z.string().describe("Webhook subscription the delivery belongs to"),
|
|
334
|
+
delivery_id: z.string().describe("Delivery to replay (whd_...)")
|
|
295
335
|
});
|
|
296
336
|
var ListICalSubscriptionsSchema = z.object({
|
|
297
337
|
agent_id: z.string().describe("Agent ID whose iCal subscriptions to list"),
|
|
@@ -305,13 +345,13 @@ var GetICalSubscriptionSchema = z.object({
|
|
|
305
345
|
var SubscribeICalSchema = z.object({
|
|
306
346
|
agent_id: z.string().describe("Agent ID that will own this subscription"),
|
|
307
347
|
calendar_id: z.string().describe("Calendar ID to sync external events into"),
|
|
308
|
-
url: z.string().url().describe("HTTPS URL of the iCal feed (.ics) to subscribe to"),
|
|
348
|
+
url: z.string().url().max(2048).describe("HTTPS URL of the iCal feed (.ics) to subscribe to"),
|
|
309
349
|
label: z.string().optional().describe("Optional label for this subscription")
|
|
310
350
|
});
|
|
311
351
|
var UpdateICalSubscriptionSchema = z.object({
|
|
312
352
|
subscription_id: z.string().describe("iCal subscription ID to update"),
|
|
313
353
|
label: z.string().min(1).max(255).optional().describe("New label for this subscription"),
|
|
314
|
-
url: z.string().url().refine((u) => u.startsWith("https://"), "URL must use HTTPS").optional().describe("New HTTPS URL of the iCal feed (.ics)")
|
|
354
|
+
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)")
|
|
315
355
|
});
|
|
316
356
|
var DeleteICalSubscriptionSchema = z.object({
|
|
317
357
|
subscription_id: z.string().describe("iCal subscription ID to delete")
|
|
@@ -319,23 +359,53 @@ var DeleteICalSubscriptionSchema = z.object({
|
|
|
319
359
|
var SyncICalSubscriptionSchema = z.object({
|
|
320
360
|
subscription_id: z.string().describe("iCal subscription ID to sync")
|
|
321
361
|
});
|
|
362
|
+
var PauseICalSubscriptionSchema = z.object({
|
|
363
|
+
subscription_id: z.string().describe("iCal subscription ID to pause")
|
|
364
|
+
});
|
|
365
|
+
var ResumeICalSubscriptionSchema = z.object({
|
|
366
|
+
subscription_id: z.string().describe("iCal subscription ID to resume")
|
|
367
|
+
});
|
|
322
368
|
var GetUsageSchema = z.object({});
|
|
369
|
+
var GetUsageHistorySchema = z.object({
|
|
370
|
+
months: z.number().int().min(1).max(12).optional().describe("Number of UTC calendar months to return, 1-12 (default 6)")
|
|
371
|
+
});
|
|
372
|
+
var GetBillingSchema = z.object({});
|
|
373
|
+
var RequestUpgradeSchema = z.object({
|
|
374
|
+
interval: z.enum(["month", "year"]).optional().describe("Billing interval to request. Defaults to month."),
|
|
375
|
+
reason: z.string().max(500).optional().describe("Why the upgrade is needed (max 500 chars). Shown to your human as plain text."),
|
|
376
|
+
feature: z.string().optional().describe("Plan-gated feature that was blocked, e.g. scoped_keys (from a plan_required error)."),
|
|
377
|
+
metric: z.string().optional().describe("Quota metric that was exhausted, e.g. api_calls (from a quota_exceeded error).")
|
|
378
|
+
});
|
|
379
|
+
var GetUpgradeRequestSchema = z.object({
|
|
380
|
+
id: z.string().describe("Upgrade request ID (upr_...)")
|
|
381
|
+
});
|
|
382
|
+
var CancelUpgradeRequestSchema = GetUpgradeRequestSchema;
|
|
323
383
|
|
|
324
384
|
// src/safe.ts
|
|
325
385
|
import { ChronaryError } from "@chronary/sdk";
|
|
386
|
+
function toErrorPayload(err) {
|
|
387
|
+
if (err instanceof ChronaryError) {
|
|
388
|
+
const payload = {
|
|
389
|
+
error: err.errorType ?? err.name,
|
|
390
|
+
message: err.message
|
|
391
|
+
};
|
|
392
|
+
if (err.upgradeUrl !== void 0) payload.upgrade_url = err.upgradeUrl;
|
|
393
|
+
if (err.docsUrl !== void 0) payload.docs_url = err.docsUrl;
|
|
394
|
+
if (err.requiredPlan !== void 0) payload.required_plan = err.requiredPlan;
|
|
395
|
+
if (err.feature !== void 0) payload.feature = err.feature;
|
|
396
|
+
if (err.metric !== void 0) payload.metric = err.metric;
|
|
397
|
+
if (err.limit !== void 0) payload.limit = err.limit;
|
|
398
|
+
return payload;
|
|
399
|
+
}
|
|
400
|
+
return { error: "error", message: err instanceof Error ? err.message : String(err) };
|
|
401
|
+
}
|
|
326
402
|
function safeFunc(fn) {
|
|
327
403
|
return async (params) => {
|
|
328
404
|
try {
|
|
329
405
|
const result = await fn(params);
|
|
330
406
|
return { result: result ?? { success: true }, isError: false };
|
|
331
407
|
} catch (err) {
|
|
332
|
-
|
|
333
|
-
return { result: `${err.name}: ${err.message}`, isError: true };
|
|
334
|
-
}
|
|
335
|
-
return {
|
|
336
|
-
result: `Error: ${err instanceof Error ? err.message : String(err)}`,
|
|
337
|
-
isError: true
|
|
338
|
-
};
|
|
408
|
+
return { result: toErrorPayload(err), isError: true };
|
|
339
409
|
}
|
|
340
410
|
};
|
|
341
411
|
}
|
|
@@ -416,6 +486,21 @@ var listEvents = safeFunc(async (ctx) => {
|
|
|
416
486
|
});
|
|
417
487
|
return fetchPage(iter, params.offset, params.limit);
|
|
418
488
|
});
|
|
489
|
+
var listOrgEvents = safeFunc(async (ctx) => {
|
|
490
|
+
const { client, params } = ctx;
|
|
491
|
+
const iter = client.events.listAll({
|
|
492
|
+
calendar_id: params.calendar_ids,
|
|
493
|
+
agent_id: params.agent_id,
|
|
494
|
+
start_after: params.start_after,
|
|
495
|
+
start_before: params.start_before,
|
|
496
|
+
status: params.status,
|
|
497
|
+
source: params.source,
|
|
498
|
+
q: params.q,
|
|
499
|
+
expand: params.expand,
|
|
500
|
+
limit: params.limit
|
|
501
|
+
});
|
|
502
|
+
return fetchPage(iter, params.offset, params.limit);
|
|
503
|
+
});
|
|
419
504
|
var getEvent = safeFunc(async (ctx) => {
|
|
420
505
|
const { calendar_id, event_id } = ctx.params;
|
|
421
506
|
return calendar_id ? ctx.client.events.get(calendar_id, event_id) : ctx.client.events.getById(event_id);
|
|
@@ -587,6 +672,15 @@ var listWebhookDeliveries = safeFunc(async (ctx) => {
|
|
|
587
672
|
const { webhook_id, ...query } = params;
|
|
588
673
|
return client.webhooks.listDeliveries(webhook_id, query);
|
|
589
674
|
});
|
|
675
|
+
var getWebhookDelivery = safeFunc(async (ctx) => {
|
|
676
|
+
return ctx.client.webhooks.getDelivery(ctx.params.webhook_id, ctx.params.delivery_id);
|
|
677
|
+
});
|
|
678
|
+
var sendTestWebhook = safeFunc(async (ctx) => {
|
|
679
|
+
return ctx.client.webhooks.sendTest(ctx.params.webhook_id, { event_type: ctx.params.event_type });
|
|
680
|
+
});
|
|
681
|
+
var replayWebhookDelivery = safeFunc(async (ctx) => {
|
|
682
|
+
return ctx.client.webhooks.replayDelivery(ctx.params.webhook_id, ctx.params.delivery_id);
|
|
683
|
+
});
|
|
590
684
|
var getAuditLog = safeFunc(async (ctx) => {
|
|
591
685
|
return ctx.client.auditLog.list(ctx.params);
|
|
592
686
|
});
|
|
@@ -622,13 +716,49 @@ var deleteICalSubscription = safeFunc(async (ctx) => {
|
|
|
622
716
|
var syncICalSubscription = safeFunc(async (ctx) => {
|
|
623
717
|
return ctx.client.icalSubscriptions.sync(ctx.params.subscription_id);
|
|
624
718
|
});
|
|
719
|
+
var pauseICalSubscription = safeFunc(async (ctx) => {
|
|
720
|
+
return ctx.client.icalSubscriptions.pause(ctx.params.subscription_id);
|
|
721
|
+
});
|
|
722
|
+
var resumeICalSubscription = safeFunc(async (ctx) => {
|
|
723
|
+
return ctx.client.icalSubscriptions.resume(ctx.params.subscription_id);
|
|
724
|
+
});
|
|
625
725
|
var getUsage = safeFunc(async (ctx) => {
|
|
626
726
|
return ctx.client.usage.get();
|
|
627
727
|
});
|
|
728
|
+
var getUsageHistory = safeFunc(async (ctx) => {
|
|
729
|
+
return ctx.client.usage.history({ months: ctx.params.months });
|
|
730
|
+
});
|
|
731
|
+
var getBilling = safeFunc(async (ctx) => {
|
|
732
|
+
return ctx.client.billing.get();
|
|
733
|
+
});
|
|
734
|
+
var requestUpgrade = safeFunc(async (ctx) => {
|
|
735
|
+
return ctx.client.billing.upgradeRequests.create(ctx.params);
|
|
736
|
+
});
|
|
737
|
+
var getUpgradeRequest = safeFunc(async (ctx) => {
|
|
738
|
+
return ctx.client.billing.upgradeRequests.get(ctx.params.id);
|
|
739
|
+
});
|
|
740
|
+
var cancelUpgradeRequest = safeFunc(async (ctx) => {
|
|
741
|
+
return ctx.client.billing.upgradeRequests.cancel(ctx.params.id);
|
|
742
|
+
});
|
|
628
743
|
function createExecutor(fn) {
|
|
629
744
|
return (client, params) => fn({ client, params });
|
|
630
745
|
}
|
|
631
746
|
|
|
747
|
+
// src/untrusted.ts
|
|
748
|
+
var EVENT_UNTRUSTED_FIELDS = ["title", "description", "metadata"];
|
|
749
|
+
var WEBHOOK_DELIVERY_UNTRUSTED_FIELDS = ["payload", "response_body"];
|
|
750
|
+
function withUntrustedFields(result, fields) {
|
|
751
|
+
const body = result.result;
|
|
752
|
+
if (result.isError || typeof body !== "object" || body === null || Array.isArray(body)) return result;
|
|
753
|
+
return { ...result, result: { untrusted_fields: [...fields], ...body } };
|
|
754
|
+
}
|
|
755
|
+
function markUntrusted(def) {
|
|
756
|
+
const fields = def.untrustedFields;
|
|
757
|
+
if (!fields || fields.length === 0) return def;
|
|
758
|
+
const execute = def.execute;
|
|
759
|
+
return { ...def, execute: async (client, params) => withUntrustedFields(await execute(client, params), fields) };
|
|
760
|
+
}
|
|
761
|
+
|
|
632
762
|
// src/definitions.ts
|
|
633
763
|
var HOSTED_API_MCP_TOOL_NAMES = [
|
|
634
764
|
"create_agent",
|
|
@@ -636,6 +766,7 @@ var HOSTED_API_MCP_TOOL_NAMES = [
|
|
|
636
766
|
"create_calendar",
|
|
637
767
|
"create_event",
|
|
638
768
|
"list_events",
|
|
769
|
+
"list_org_events",
|
|
639
770
|
"get_event",
|
|
640
771
|
"update_event",
|
|
641
772
|
"get_availability",
|
|
@@ -652,6 +783,8 @@ var HOSTED_API_MCP_TOOL_NAMES = [
|
|
|
652
783
|
"update_ical_subscription",
|
|
653
784
|
"delete_ical_subscription",
|
|
654
785
|
"sync_ical_subscription",
|
|
786
|
+
"pause_ical_subscription",
|
|
787
|
+
"resume_ical_subscription",
|
|
655
788
|
"get_calendar_context",
|
|
656
789
|
"create_proposal",
|
|
657
790
|
"list_proposals",
|
|
@@ -671,6 +804,9 @@ var HOSTED_API_MCP_TOOL_NAMES = [
|
|
|
671
804
|
"update_webhook",
|
|
672
805
|
"delete_webhook",
|
|
673
806
|
"list_webhook_deliveries",
|
|
807
|
+
"get_webhook_delivery",
|
|
808
|
+
"send_test_webhook",
|
|
809
|
+
"replay_webhook_delivery",
|
|
674
810
|
"get_agent",
|
|
675
811
|
"update_agent",
|
|
676
812
|
"delete_agent",
|
|
@@ -683,21 +819,26 @@ var HOSTED_API_MCP_TOOL_NAMES = [
|
|
|
683
819
|
"get_booking_page",
|
|
684
820
|
"delete_booking_page",
|
|
685
821
|
"get_usage",
|
|
822
|
+
"get_usage_history",
|
|
686
823
|
"get_audit_log",
|
|
687
|
-
"accept_terms"
|
|
824
|
+
"accept_terms",
|
|
825
|
+
"get_billing",
|
|
826
|
+
"request_upgrade",
|
|
827
|
+
"get_upgrade_request",
|
|
828
|
+
"cancel_upgrade_request"
|
|
688
829
|
];
|
|
689
|
-
var
|
|
830
|
+
var RAW_TOOL_DEFINITIONS = [
|
|
690
831
|
// ── Calendars ──────────────────────────────────────────────────
|
|
691
832
|
{
|
|
692
833
|
name: "list_calendars",
|
|
693
|
-
description: "List calendars in the org.
|
|
834
|
+
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.",
|
|
694
835
|
schema: ListCalendarsSchema,
|
|
695
836
|
annotations: { title: "List Calendars", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
696
837
|
execute: createExecutor(listCalendars)
|
|
697
838
|
},
|
|
698
839
|
{
|
|
699
840
|
name: "get_calendar",
|
|
700
|
-
description: "Fetch a single calendar by ID, including its name, timezone, agent status, and default reminders. Agent
|
|
841
|
+
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.",
|
|
701
842
|
schema: GetCalendarSchema,
|
|
702
843
|
annotations: { title: "Get Calendar", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
703
844
|
execute: createExecutor(getCalendar)
|
|
@@ -711,14 +852,14 @@ var TOOL_DEFINITIONS = [
|
|
|
711
852
|
},
|
|
712
853
|
{
|
|
713
854
|
name: "update_calendar",
|
|
714
|
-
description: "Update a calendar's name, timezone, agent status, default reminders, or metadata. Agent
|
|
855
|
+
description: "Update a calendar's name, timezone, agent status, default reminders, or metadata. Agent keys may only update calendars owned by their agent.",
|
|
715
856
|
schema: UpdateCalendarSchema,
|
|
716
857
|
annotations: { title: "Update Calendar", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
717
858
|
execute: createExecutor(updateCalendar)
|
|
718
859
|
},
|
|
719
860
|
{
|
|
720
861
|
name: "delete_calendar",
|
|
721
|
-
description: "Delete a calendar (soft delete). Its events are no longer returned and it stops contributing to availability. Agent
|
|
862
|
+
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.",
|
|
722
863
|
schema: DeleteCalendarSchema,
|
|
723
864
|
annotations: { title: "Delete Calendar", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
724
865
|
execute: createExecutor(deleteCalendar)
|
|
@@ -733,7 +874,7 @@ var TOOL_DEFINITIONS = [
|
|
|
733
874
|
},
|
|
734
875
|
{
|
|
735
876
|
name: "list_booking_pages",
|
|
736
|
-
description: "List booking pages in the org. Agent
|
|
877
|
+
description: "List booking pages in the org. Agent keys see only pages on their own agent's calendars.",
|
|
737
878
|
schema: ListBookingPagesSchema,
|
|
738
879
|
annotations: { title: "List Booking Pages", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
739
880
|
execute: createExecutor(listBookingPages)
|
|
@@ -758,13 +899,23 @@ var TOOL_DEFINITIONS = [
|
|
|
758
899
|
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`.",
|
|
759
900
|
schema: ListEventsSchema,
|
|
760
901
|
annotations: { title: "List Events", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
902
|
+
untrustedFields: EVENT_UNTRUSTED_FIELDS,
|
|
761
903
|
execute: createExecutor(listEvents)
|
|
762
904
|
},
|
|
905
|
+
{
|
|
906
|
+
name: "list_org_events",
|
|
907
|
+
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.",
|
|
908
|
+
schema: ListOrgEventsSchema,
|
|
909
|
+
annotations: { title: "List Organization Events", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
910
|
+
untrustedFields: EVENT_UNTRUSTED_FIELDS,
|
|
911
|
+
execute: createExecutor(listOrgEvents)
|
|
912
|
+
},
|
|
763
913
|
{
|
|
764
914
|
name: "get_event",
|
|
765
915
|
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.",
|
|
766
916
|
schema: GetEventSchema,
|
|
767
917
|
annotations: { title: "Get Event", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
918
|
+
untrustedFields: EVENT_UNTRUSTED_FIELDS,
|
|
768
919
|
execute: createExecutor(getEvent)
|
|
769
920
|
},
|
|
770
921
|
{
|
|
@@ -779,6 +930,7 @@ var TOOL_DEFINITIONS = [
|
|
|
779
930
|
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.",
|
|
780
931
|
schema: UpdateEventSchema,
|
|
781
932
|
annotations: { title: "Update Event", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
933
|
+
untrustedFields: EVENT_UNTRUSTED_FIELDS,
|
|
782
934
|
execute: createExecutor(updateEvent)
|
|
783
935
|
},
|
|
784
936
|
{
|
|
@@ -786,6 +938,7 @@ var TOOL_DEFINITIONS = [
|
|
|
786
938
|
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.",
|
|
787
939
|
schema: CancelEventSchema,
|
|
788
940
|
annotations: { title: "Cancel Event", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
941
|
+
untrustedFields: EVENT_UNTRUSTED_FIELDS,
|
|
789
942
|
execute: createExecutor(cancelEvent)
|
|
790
943
|
},
|
|
791
944
|
{
|
|
@@ -793,6 +946,7 @@ var TOOL_DEFINITIONS = [
|
|
|
793
946
|
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.',
|
|
794
947
|
schema: ConfirmEventSchema,
|
|
795
948
|
annotations: { title: "Confirm Event", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
949
|
+
untrustedFields: EVENT_UNTRUSTED_FIELDS,
|
|
796
950
|
execute: createExecutor(confirmEvent)
|
|
797
951
|
},
|
|
798
952
|
{
|
|
@@ -819,21 +973,21 @@ var TOOL_DEFINITIONS = [
|
|
|
819
973
|
},
|
|
820
974
|
{
|
|
821
975
|
name: "get_agent",
|
|
822
|
-
description: "Fetch a single agent by ID. An agent represents an AI assistant, human, or shared resource (e.g. a meeting room). Agent
|
|
976
|
+
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.",
|
|
823
977
|
schema: GetAgentSchema,
|
|
824
978
|
annotations: { title: "Get Agent", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
825
979
|
execute: createExecutor(getAgent)
|
|
826
980
|
},
|
|
827
981
|
{
|
|
828
982
|
name: "update_agent",
|
|
829
|
-
description: "Update an agent's name, description, metadata, or status (active/paused). Requires an
|
|
983
|
+
description: "Update an agent's name, description, metadata, or status (active/paused). Requires an Organization key \u2014 Agent keys cannot mutate agents.",
|
|
830
984
|
schema: UpdateAgentSchema,
|
|
831
985
|
annotations: { title: "Update Agent", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
832
986
|
execute: createExecutor(updateAgent)
|
|
833
987
|
},
|
|
834
988
|
{
|
|
835
989
|
name: "delete_agent",
|
|
836
|
-
description: "Decommission an agent. This marks the agent as decommissioned and revokes all of its
|
|
990
|
+
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.",
|
|
837
991
|
schema: DeleteAgentSchema,
|
|
838
992
|
annotations: { title: "Delete Agent", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
839
993
|
execute: createExecutor(deleteAgent)
|
|
@@ -855,21 +1009,21 @@ var TOOL_DEFINITIONS = [
|
|
|
855
1009
|
},
|
|
856
1010
|
{
|
|
857
1011
|
name: "create_connection_link",
|
|
858
|
-
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.",
|
|
1012
|
+
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.",
|
|
859
1013
|
schema: CreateConnectionLinkSchema,
|
|
860
1014
|
annotations: { title: "Create Human Calendar Setup Link", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
861
1015
|
execute: createExecutor(createConnectionLink)
|
|
862
1016
|
},
|
|
863
1017
|
{
|
|
864
1018
|
name: "get_connection_link",
|
|
865
|
-
description: "Poll a human-calendar setup request. Returns provider-neutral status and
|
|
1019
|
+
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.",
|
|
866
1020
|
schema: GetConnectionLinkSchema,
|
|
867
1021
|
annotations: { title: "Get Human Calendar Setup Status", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
868
1022
|
execute: createExecutor(getConnectionLink)
|
|
869
1023
|
},
|
|
870
1024
|
{
|
|
871
1025
|
name: "cancel_connection_link",
|
|
872
|
-
description: "Cancel a pending human-calendar setup request. This invalidates the setup URL and does not disconnect
|
|
1026
|
+
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.",
|
|
873
1027
|
schema: CancelConnectionLinkSchema,
|
|
874
1028
|
annotations: { title: "Cancel Human Calendar Setup Link", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
875
1029
|
execute: createExecutor(cancelConnectionLink)
|
|
@@ -880,47 +1034,48 @@ var TOOL_DEFINITIONS = [
|
|
|
880
1034
|
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.`,
|
|
881
1035
|
schema: GetCalendarContextSchema,
|
|
882
1036
|
annotations: { title: "Get Calendar Context", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1037
|
+
untrustedFields: EVENT_UNTRUSTED_FIELDS,
|
|
883
1038
|
execute: createExecutor(getCalendarContext)
|
|
884
1039
|
},
|
|
885
1040
|
// ── Scheduling proposals ───────────────────────────────────────
|
|
886
1041
|
{
|
|
887
1042
|
name: "create_proposal",
|
|
888
|
-
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
|
|
1043
|
+
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.",
|
|
889
1044
|
schema: CreateProposalSchema,
|
|
890
1045
|
annotations: { title: "Create Proposal", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
891
1046
|
execute: createExecutor(createProposal)
|
|
892
1047
|
},
|
|
893
1048
|
{
|
|
894
1049
|
name: "list_proposals",
|
|
895
|
-
description: "List scheduling proposals for the org. Filter by status (pending|confirmed|expired|cancelled) or organizer_agent_id. Requires an
|
|
1050
|
+
description: "List scheduling proposals for the org. Filter by status (pending|confirmed|expired|cancelled) or organizer_agent_id. Requires an Organization key.",
|
|
896
1051
|
schema: ListProposalsSchema,
|
|
897
1052
|
annotations: { title: "List Proposals", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
898
1053
|
execute: createExecutor(listProposals)
|
|
899
1054
|
},
|
|
900
1055
|
{
|
|
901
1056
|
name: "get_proposal",
|
|
902
|
-
description: "Get a scheduling proposal by id, including its slots and per-participant responses. Requires an
|
|
1057
|
+
description: "Get a scheduling proposal by id, including its slots and per-participant responses. Requires an Organization key.",
|
|
903
1058
|
schema: GetProposalSchema,
|
|
904
1059
|
annotations: { title: "Get Proposal", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
905
1060
|
execute: createExecutor(getProposal)
|
|
906
1061
|
},
|
|
907
1062
|
{
|
|
908
1063
|
name: "respond_to_proposal",
|
|
909
|
-
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
|
|
1064
|
+
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.',
|
|
910
1065
|
schema: RespondToProposalSchema,
|
|
911
1066
|
annotations: { title: "Respond To Proposal", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
912
1067
|
execute: createExecutor(respondToProposal)
|
|
913
1068
|
},
|
|
914
1069
|
{
|
|
915
1070
|
name: "resolve_proposal",
|
|
916
|
-
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
|
|
1071
|
+
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.',
|
|
917
1072
|
schema: ResolveProposalSchema,
|
|
918
1073
|
annotations: { title: "Resolve Proposal", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
919
1074
|
execute: createExecutor(resolveProposal)
|
|
920
1075
|
},
|
|
921
1076
|
{
|
|
922
1077
|
name: "cancel_proposal",
|
|
923
|
-
description: 'Cancel an open proposal. Fires a proposal.cancelled webhook with reason="organizer_cancelled". Requires an
|
|
1078
|
+
description: 'Cancel an open proposal. Fires a proposal.cancelled webhook with reason="organizer_cancelled". Requires an Organization key. Pro plan only.',
|
|
924
1079
|
schema: CancelProposalSchema,
|
|
925
1080
|
annotations: { title: "Cancel Proposal", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
926
1081
|
execute: createExecutor(cancelProposal)
|
|
@@ -950,46 +1105,69 @@ var TOOL_DEFINITIONS = [
|
|
|
950
1105
|
// ── Webhooks ───────────────────────────────────────────────────
|
|
951
1106
|
{
|
|
952
1107
|
name: "list_webhooks",
|
|
953
|
-
description: "List the org's webhook subscriptions with their subscribed event types and active state. Signing secrets are never returned. Requires an
|
|
1108
|
+
description: "List the org's webhook subscriptions with their subscribed event types and active state. Signing secrets are never returned. Requires an Organization key.",
|
|
954
1109
|
schema: ListWebhooksSchema,
|
|
955
1110
|
annotations: { title: "List Webhooks", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
956
1111
|
execute: createExecutor(listWebhooks)
|
|
957
1112
|
},
|
|
958
1113
|
{
|
|
959
1114
|
name: "get_webhook",
|
|
960
|
-
description: "Get a single webhook subscription by id, including its subscribed event types and active state. The signing secret is never returned. Requires an
|
|
1115
|
+
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.",
|
|
961
1116
|
schema: GetWebhookSchema,
|
|
962
1117
|
annotations: { title: "Get Webhook", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
963
1118
|
execute: createExecutor(getWebhook)
|
|
964
1119
|
},
|
|
965
1120
|
{
|
|
966
1121
|
name: "create_webhook",
|
|
967
|
-
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
|
|
1122
|
+
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.",
|
|
968
1123
|
schema: CreateWebhookSchema,
|
|
969
|
-
annotations: { title: "Create Webhook", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint:
|
|
1124
|
+
annotations: { title: "Create Webhook", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
970
1125
|
execute: createExecutor(createWebhook)
|
|
971
1126
|
},
|
|
972
1127
|
{
|
|
973
1128
|
name: "update_webhook",
|
|
974
|
-
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
|
|
1129
|
+
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.",
|
|
975
1130
|
schema: UpdateWebhookSchema,
|
|
976
|
-
annotations: { title: "Update Webhook", readOnlyHint: false, destructiveHint:
|
|
1131
|
+
annotations: { title: "Update Webhook", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: true },
|
|
977
1132
|
execute: createExecutor(updateWebhook)
|
|
978
1133
|
},
|
|
979
1134
|
{
|
|
980
1135
|
name: "delete_webhook",
|
|
981
|
-
description: "Permanently delete a webhook subscription. This frees its endpoint slot against the per-plan cap. Requires an
|
|
1136
|
+
description: "Permanently delete a webhook subscription. This frees its endpoint slot against the per-plan cap. Requires an Organization key.",
|
|
982
1137
|
schema: DeleteWebhookSchema,
|
|
983
1138
|
annotations: { title: "Delete Webhook", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
984
1139
|
execute: createExecutor(deleteWebhook)
|
|
985
1140
|
},
|
|
986
1141
|
{
|
|
987
1142
|
name: "list_webhook_deliveries",
|
|
988
|
-
description: "List delivery attempts for a webhook subscription, with per-status counts (pending/delivered/failed). Use this to debug failing deliveries. Requires an
|
|
1143
|
+
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.",
|
|
989
1144
|
schema: ListWebhookDeliveriesSchema,
|
|
990
1145
|
annotations: { title: "List Webhook Deliveries", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1146
|
+
untrustedFields: WEBHOOK_DELIVERY_UNTRUSTED_FIELDS,
|
|
991
1147
|
execute: createExecutor(listWebhookDeliveries)
|
|
992
1148
|
},
|
|
1149
|
+
{
|
|
1150
|
+
name: "get_webhook_delivery",
|
|
1151
|
+
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.",
|
|
1152
|
+
schema: GetWebhookDeliverySchema,
|
|
1153
|
+
annotations: { title: "Get Webhook Delivery", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1154
|
+
untrustedFields: WEBHOOK_DELIVERY_UNTRUSTED_FIELDS,
|
|
1155
|
+
execute: createExecutor(getWebhookDelivery)
|
|
1156
|
+
},
|
|
1157
|
+
{
|
|
1158
|
+
name: "send_test_webhook",
|
|
1159
|
+
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.",
|
|
1160
|
+
schema: SendTestWebhookSchema,
|
|
1161
|
+
annotations: { title: "Send Test Webhook", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
1162
|
+
execute: createExecutor(sendTestWebhook)
|
|
1163
|
+
},
|
|
1164
|
+
{
|
|
1165
|
+
name: "replay_webhook_delivery",
|
|
1166
|
+
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.",
|
|
1167
|
+
schema: ReplayWebhookDeliverySchema,
|
|
1168
|
+
annotations: { title: "Replay Webhook Delivery", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
1169
|
+
execute: createExecutor(replayWebhookDelivery)
|
|
1170
|
+
},
|
|
993
1171
|
// ── iCal Subscriptions ─────────────────────────────────────────
|
|
994
1172
|
{
|
|
995
1173
|
name: "list_ical_subscriptions",
|
|
@@ -1016,7 +1194,7 @@ var TOOL_DEFINITIONS = [
|
|
|
1016
1194
|
name: "update_ical_subscription",
|
|
1017
1195
|
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.",
|
|
1018
1196
|
schema: UpdateICalSubscriptionSchema,
|
|
1019
|
-
annotations: { title: "Update iCal Subscription", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint:
|
|
1197
|
+
annotations: { title: "Update iCal Subscription", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
1020
1198
|
execute: createExecutor(updateICalSubscription)
|
|
1021
1199
|
},
|
|
1022
1200
|
{
|
|
@@ -1028,29 +1206,43 @@ var TOOL_DEFINITIONS = [
|
|
|
1028
1206
|
},
|
|
1029
1207
|
{
|
|
1030
1208
|
name: "sync_ical_subscription",
|
|
1031
|
-
description:
|
|
1209
|
+
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.',
|
|
1032
1210
|
schema: SyncICalSubscriptionSchema,
|
|
1033
1211
|
annotations: { title: "Sync iCal Subscription", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
1034
1212
|
execute: createExecutor(syncICalSubscription)
|
|
1035
1213
|
},
|
|
1214
|
+
{
|
|
1215
|
+
name: "pause_ical_subscription",
|
|
1216
|
+
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.",
|
|
1217
|
+
schema: PauseICalSubscriptionSchema,
|
|
1218
|
+
annotations: { title: "Pause iCal Subscription", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1219
|
+
execute: createExecutor(pauseICalSubscription)
|
|
1220
|
+
},
|
|
1221
|
+
{
|
|
1222
|
+
name: "resume_ical_subscription",
|
|
1223
|
+
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.",
|
|
1224
|
+
schema: ResumeICalSubscriptionSchema,
|
|
1225
|
+
annotations: { title: "Resume iCal Subscription", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1226
|
+
execute: createExecutor(resumeICalSubscription)
|
|
1227
|
+
},
|
|
1036
1228
|
// ── Scoped keys ────────────────────────────────────────────────
|
|
1037
1229
|
{
|
|
1038
1230
|
name: "create_scoped_key",
|
|
1039
|
-
description: "Create an
|
|
1231
|
+
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.",
|
|
1040
1232
|
schema: CreateScopedKeySchema,
|
|
1041
1233
|
annotations: { title: "Create Scoped Key", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
1042
1234
|
execute: createExecutor(createScopedKey)
|
|
1043
1235
|
},
|
|
1044
1236
|
{
|
|
1045
1237
|
name: "list_scoped_keys",
|
|
1046
|
-
description: "List all live (non-revoked)
|
|
1238
|
+
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.",
|
|
1047
1239
|
schema: ListScopedKeysSchema,
|
|
1048
1240
|
annotations: { title: "List Scoped Keys", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1049
1241
|
execute: createExecutor(listScopedKeys)
|
|
1050
1242
|
},
|
|
1051
1243
|
{
|
|
1052
1244
|
name: "revoke_scoped_key",
|
|
1053
|
-
description: "Revoke an
|
|
1245
|
+
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.",
|
|
1054
1246
|
schema: RevokeScopedKeySchema,
|
|
1055
1247
|
annotations: { title: "Revoke Scoped Key", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
1056
1248
|
execute: createExecutor(revokeScopedKey)
|
|
@@ -1058,7 +1250,7 @@ var TOOL_DEFINITIONS = [
|
|
|
1058
1250
|
// ── Audit log ──────────────────────────────────────────────────
|
|
1059
1251
|
{
|
|
1060
1252
|
name: "get_audit_log",
|
|
1061
|
-
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
|
|
1253
|
+
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.",
|
|
1062
1254
|
schema: GetAuditLogSchema,
|
|
1063
1255
|
annotations: { title: "Get Audit Log", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1064
1256
|
execute: createExecutor(getAuditLog)
|
|
@@ -1066,7 +1258,7 @@ var TOOL_DEFINITIONS = [
|
|
|
1066
1258
|
// ── Terms ──────────────────────────────────────────────────────
|
|
1067
1259
|
{
|
|
1068
1260
|
name: "accept_terms",
|
|
1069
|
-
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
|
|
1261
|
+
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.",
|
|
1070
1262
|
schema: AcceptTermsSchema,
|
|
1071
1263
|
annotations: { title: "Accept Terms", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1072
1264
|
execute: createExecutor(acceptTerms)
|
|
@@ -1074,12 +1266,49 @@ var TOOL_DEFINITIONS = [
|
|
|
1074
1266
|
// ── Usage ──────────────────────────────────────────────────────
|
|
1075
1267
|
{
|
|
1076
1268
|
name: "get_usage",
|
|
1077
|
-
description: "Get the calling org's current-period usage and plan limits (agents, calendars, events, API calls,
|
|
1269
|
+
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.",
|
|
1078
1270
|
schema: GetUsageSchema,
|
|
1079
1271
|
annotations: { title: "Get Usage", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1080
1272
|
execute: createExecutor(getUsage)
|
|
1273
|
+
},
|
|
1274
|
+
{
|
|
1275
|
+
name: "get_usage_history",
|
|
1276
|
+
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.",
|
|
1277
|
+
schema: GetUsageHistorySchema,
|
|
1278
|
+
annotations: { title: "Get Usage History", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1279
|
+
execute: createExecutor(getUsageHistory)
|
|
1280
|
+
},
|
|
1281
|
+
// ── Billing ────────────────────────────────────────────────────
|
|
1282
|
+
{
|
|
1283
|
+
name: "get_billing",
|
|
1284
|
+
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_*).",
|
|
1285
|
+
schema: GetBillingSchema,
|
|
1286
|
+
annotations: { title: "Get Billing", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1287
|
+
execute: createExecutor(getBilling)
|
|
1288
|
+
},
|
|
1289
|
+
{
|
|
1290
|
+
name: "request_upgrade",
|
|
1291
|
+
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.",
|
|
1292
|
+
schema: RequestUpgradeSchema,
|
|
1293
|
+
annotations: { title: "Request Upgrade", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1294
|
+
execute: createExecutor(requestUpgrade)
|
|
1295
|
+
},
|
|
1296
|
+
{
|
|
1297
|
+
name: "get_upgrade_request",
|
|
1298
|
+
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_*).",
|
|
1299
|
+
schema: GetUpgradeRequestSchema,
|
|
1300
|
+
annotations: { title: "Get Upgrade Request", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1301
|
+
execute: createExecutor(getUpgradeRequest)
|
|
1302
|
+
},
|
|
1303
|
+
{
|
|
1304
|
+
name: "cancel_upgrade_request",
|
|
1305
|
+
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.",
|
|
1306
|
+
schema: CancelUpgradeRequestSchema,
|
|
1307
|
+
annotations: { title: "Cancel Upgrade Request", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1308
|
+
execute: createExecutor(cancelUpgradeRequest)
|
|
1081
1309
|
}
|
|
1082
1310
|
];
|
|
1311
|
+
var TOOL_DEFINITIONS = RAW_TOOL_DEFINITIONS.map(markUntrusted);
|
|
1083
1312
|
var toolkitToolNames = new Set(TOOL_DEFINITIONS.map((tool) => tool.name));
|
|
1084
1313
|
var hostedToolNames = new Set(HOSTED_API_MCP_TOOL_NAMES);
|
|
1085
1314
|
var TOOLKIT_MCP_PARITY = {
|
|
@@ -1125,7 +1354,7 @@ var ChronaryToolkit = class extends MapToolkit {
|
|
|
1125
1354
|
inputSchema: def.schema,
|
|
1126
1355
|
execute: async ({ context }) => {
|
|
1127
1356
|
const result = await def.execute(client, context);
|
|
1128
|
-
if (result.isError) throw new Error(result.result);
|
|
1357
|
+
if (result.isError) throw new Error(typeof result.result === "string" ? result.result : JSON.stringify(result.result));
|
|
1129
1358
|
return result.result;
|
|
1130
1359
|
}
|
|
1131
1360
|
};
|