@chronary/toolkit 0.1.2 → 1.0.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 +11 -7
- package/LICENSE +189 -189
- package/README.md +113 -113
- package/dist/ai-sdk.cjs +472 -38
- package/dist/ai-sdk.cjs.map +1 -1
- package/dist/ai-sdk.d.cts +5 -6
- package/dist/ai-sdk.d.ts +5 -6
- package/dist/ai-sdk.js +472 -38
- package/dist/ai-sdk.js.map +1 -1
- package/dist/{base-BZ_wFEVc.d.cts → base-C6QWbxc1.d.cts} +3 -3
- package/dist/{base-BZ_wFEVc.d.ts → base-C6QWbxc1.d.ts} +3 -3
- package/dist/index.cjs +526 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +283 -233
- package/dist/index.d.ts +283 -233
- package/dist/index.js +526 -44
- package/dist/index.js.map +1 -1
- package/dist/langchain.cjs +472 -38
- package/dist/langchain.cjs.map +1 -1
- package/dist/langchain.d.cts +1 -1
- package/dist/langchain.d.ts +1 -1
- package/dist/langchain.js +472 -38
- package/dist/langchain.js.map +1 -1
- package/dist/mastra.cjs +472 -38
- package/dist/mastra.cjs.map +1 -1
- package/dist/mastra.d.cts +1 -1
- package/dist/mastra.d.ts +1 -1
- package/dist/mastra.js +472 -38
- package/dist/mastra.js.map +1 -1
- package/dist/mcp.cjs +474 -40
- package/dist/mcp.cjs.map +1 -1
- package/dist/mcp.d.cts +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.js +474 -40
- package/dist/mcp.js.map +1 -1
- package/dist/openai.cjs +475 -41
- package/dist/openai.cjs.map +1 -1
- package/dist/openai.d.cts +1 -1
- package/dist/openai.d.ts +1 -1
- package/dist/openai.js +475 -41
- package/dist/openai.js.map +1 -1
- package/package.json +11 -11
package/dist/mcp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/adapters/mcp.ts
|
|
2
|
-
import {
|
|
2
|
+
import { z as z2 } from "zod";
|
|
3
3
|
|
|
4
4
|
// src/base.ts
|
|
5
5
|
import { Chronary } from "@chronary/sdk";
|
|
@@ -19,13 +19,15 @@ var CreateCalendarSchema = z.object({
|
|
|
19
19
|
name: z.string().describe("Calendar name"),
|
|
20
20
|
timezone: z.string().describe('IANA timezone (e.g., "America/New_York")'),
|
|
21
21
|
agent_id: z.string().optional().describe("Agent ID to associate the calendar with"),
|
|
22
|
-
|
|
22
|
+
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 that don't set their own (e.g. [10, 1440]). null/omit = system default (10 min); [] = no reminders. Max 5, each 1\u201340320."),
|
|
23
|
+
metadata: z.record(z.string(), z.unknown()).optional().describe("Arbitrary key-value metadata")
|
|
23
24
|
});
|
|
24
25
|
var UpdateCalendarSchema = z.object({
|
|
25
26
|
calendar_id: z.string().describe("The calendar ID to update"),
|
|
26
27
|
name: z.string().optional().describe("New calendar name"),
|
|
27
28
|
timezone: z.string().optional().describe("New IANA timezone"),
|
|
28
|
-
|
|
29
|
+
default_reminders: z.array(z.number().int().min(1).max(40320)).max(5).nullable().optional().describe("New default reminder offsets in minutes before start. null = system default (10 min); [] = no reminders. Max 5, each 1\u201340320."),
|
|
30
|
+
metadata: z.record(z.string(), z.unknown()).optional().describe("Updated metadata")
|
|
29
31
|
});
|
|
30
32
|
var DeleteCalendarSchema = z.object({
|
|
31
33
|
calendar_id: z.string().describe("The calendar ID to delete")
|
|
@@ -52,7 +54,8 @@ var CreateEventSchema = z.object({
|
|
|
52
54
|
description: z.string().optional().describe("Event description"),
|
|
53
55
|
all_day: z.boolean().optional().describe("Whether this is an all-day event"),
|
|
54
56
|
status: z.enum(["confirmed", "tentative", "cancelled"]).optional().describe('Event status (default "confirmed")'),
|
|
55
|
-
|
|
57
|
+
reminders: z.array(z.number().int().min(1).max(40320)).max(5).nullable().optional().describe("Reminder offsets in minutes before start (e.g. [10, 1440]). Each fires an event.reminder webhook. null/omit = inherit calendar default (then 10 min); [] = no reminders. Max 5, each 1\u201340320."),
|
|
58
|
+
metadata: z.record(z.string(), z.unknown()).optional().describe("Arbitrary key-value metadata")
|
|
56
59
|
});
|
|
57
60
|
var UpdateEventSchema = z.object({
|
|
58
61
|
calendar_id: z.string().describe("Calendar ID the event belongs to"),
|
|
@@ -63,20 +66,145 @@ var UpdateEventSchema = z.object({
|
|
|
63
66
|
end_time: z.string().optional().describe("New end time in ISO 8601 format"),
|
|
64
67
|
all_day: z.boolean().optional().describe("Whether this is an all-day event"),
|
|
65
68
|
status: z.enum(["confirmed", "tentative", "cancelled"]).optional().describe("New event status"),
|
|
66
|
-
|
|
69
|
+
reminders: z.array(z.number().int().min(1).max(40320)).max(5).nullable().optional().describe("New reminder offsets in minutes before start. null = inherit calendar default; [] = no reminders. Max 5, each 1\u201340320."),
|
|
70
|
+
metadata: z.record(z.string(), z.unknown()).optional().describe("Updated metadata")
|
|
67
71
|
});
|
|
68
|
-
var
|
|
69
|
-
calendar_id: z.string().describe("Calendar ID the event
|
|
70
|
-
event_id: z.string().describe("
|
|
71
|
-
});
|
|
72
|
-
var
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
var CancelEventSchema = z.object({
|
|
73
|
+
calendar_id: z.string().describe("Calendar ID that owns the event"),
|
|
74
|
+
event_id: z.string().describe("Event ID to cancel")
|
|
75
|
+
});
|
|
76
|
+
var ConfirmEventSchema = z.object({
|
|
77
|
+
event_id: z.string().describe("Event ID of the hold to confirm")
|
|
78
|
+
});
|
|
79
|
+
var ReleaseEventSchema = z.object({
|
|
80
|
+
event_id: z.string().describe("Event ID of the hold to release")
|
|
81
|
+
});
|
|
82
|
+
var CreateAgentSchema = z.object({
|
|
83
|
+
name: z.string().min(1).max(255).describe("Display name for the agent"),
|
|
84
|
+
type: z.enum(["ai", "human", "resource"]).describe("Agent type"),
|
|
85
|
+
description: z.string().optional().describe("Optional description"),
|
|
86
|
+
metadata: z.record(z.string(), z.unknown()).optional().describe("Arbitrary key-value metadata")
|
|
87
|
+
});
|
|
88
|
+
var ListAgentsSchema = z.object({
|
|
89
|
+
type: z.enum(["ai", "human", "resource"]).optional().describe("Filter by agent type"),
|
|
90
|
+
status: z.enum(["active", "paused", "decommissioned"]).optional().describe("Filter by status"),
|
|
91
|
+
limit: z.number().int().min(1).max(200).optional().describe("Max results per page (default 50)"),
|
|
92
|
+
offset: z.number().int().min(0).optional().describe("Pagination offset (default 0)")
|
|
93
|
+
});
|
|
94
|
+
var GetAgentSchema = z.object({
|
|
95
|
+
agent_id: z.string().describe("Agent ID to fetch")
|
|
96
|
+
});
|
|
97
|
+
var UpdateAgentSchema = z.object({
|
|
98
|
+
agent_id: z.string().describe("Agent ID to update"),
|
|
99
|
+
name: z.string().min(1).max(255).optional().describe("New display name"),
|
|
100
|
+
description: z.string().nullable().optional().describe("New description (null to clear)"),
|
|
101
|
+
metadata: z.record(z.string(), z.unknown()).optional().describe("Arbitrary metadata (max 16KB)"),
|
|
102
|
+
status: z.enum(["active", "paused"]).optional().describe("Operational status")
|
|
103
|
+
});
|
|
104
|
+
var DeleteAgentSchema = z.object({
|
|
105
|
+
agent_id: z.string().describe("Agent ID to decommission")
|
|
106
|
+
});
|
|
107
|
+
var GetAvailabilitySchema = z.object({
|
|
108
|
+
agent_id: z.string().describe("Agent ID to check availability for"),
|
|
109
|
+
start: z.string().describe("Range start (ISO 8601)"),
|
|
110
|
+
end: z.string().describe("Range end (ISO 8601)"),
|
|
111
|
+
slot_duration: z.enum(["15m", "30m", "45m", "1h", "2h"]).optional().describe('Minimum slot duration required (default "30m")'),
|
|
78
112
|
include_busy: z.boolean().optional().describe("Include busy blocks in response")
|
|
79
113
|
});
|
|
114
|
+
var FindMeetingTimeSchema = z.object({
|
|
115
|
+
agents: z.array(z.string()).min(1).describe("Array of agent IDs to find common free time for. All agents must be free during the returned slots."),
|
|
116
|
+
start: z.string().describe("Search range start (ISO 8601)"),
|
|
117
|
+
end: z.string().describe("Search range end (ISO 8601)"),
|
|
118
|
+
slot_duration: z.enum(["15m", "30m", "45m", "1h", "2h"]).optional().describe('Minimum slot duration required (default "30m")'),
|
|
119
|
+
calendars: z.array(z.string()).optional().describe("Additional shared calendar IDs to treat as busy"),
|
|
120
|
+
include_busy: z.boolean().optional().describe("Include per-agent busy blocks in response")
|
|
121
|
+
});
|
|
122
|
+
var GetCalendarContextSchema = z.object({
|
|
123
|
+
calendar_id: z.string().describe("Calendar ID")
|
|
124
|
+
});
|
|
125
|
+
var proposalSlotSchema = z.object({
|
|
126
|
+
start_time: z.string().describe("Slot start (ISO 8601)"),
|
|
127
|
+
end_time: z.string().describe("Slot end (ISO 8601)"),
|
|
128
|
+
weight: z.number().min(0).max(10).optional().describe("Preference weight (default 1.0)"),
|
|
129
|
+
calendar_id: z.string().optional().describe("Override calendar for this slot")
|
|
130
|
+
});
|
|
131
|
+
var CreateProposalSchema = z.object({
|
|
132
|
+
title: z.string().min(1).max(500).describe("Short description of what the meeting is about"),
|
|
133
|
+
description: z.string().max(5e3).optional().describe("Longer context/agenda"),
|
|
134
|
+
organizer_agent_id: z.string().describe("Agent ID proposing the meeting"),
|
|
135
|
+
participant_agent_ids: z.array(z.string()).min(1).max(50).describe("Agent IDs invited to respond"),
|
|
136
|
+
calendar_id: z.string().describe("Calendar the resolved event will be created on"),
|
|
137
|
+
slots: z.array(proposalSlotSchema).min(1).max(20).describe("Candidate time slots (up to 20)"),
|
|
138
|
+
expires_at: z.string().optional().describe("Auto-cancel cutoff if unresolved (ISO 8601)")
|
|
139
|
+
});
|
|
140
|
+
var ListProposalsSchema = z.object({
|
|
141
|
+
status: z.enum(["pending", "confirmed", "expired", "cancelled"]).optional().describe("Filter by proposal status"),
|
|
142
|
+
organizer_agent_id: z.string().optional().describe("Filter by organizer agent"),
|
|
143
|
+
limit: z.number().int().min(1).max(200).optional().describe("Max results (default 50)"),
|
|
144
|
+
offset: z.number().int().min(0).optional().describe("Pagination offset (default 0)")
|
|
145
|
+
});
|
|
146
|
+
var GetProposalSchema = z.object({
|
|
147
|
+
proposal_id: z.string().describe("Proposal to fetch")
|
|
148
|
+
});
|
|
149
|
+
var RespondToProposalSchema = z.object({
|
|
150
|
+
proposal_id: z.string().describe("Proposal to respond to"),
|
|
151
|
+
agent_id: z.string().describe("Participant agent responding"),
|
|
152
|
+
response: z.enum(["accept", "decline", "counter"]).describe("Decision from this agent"),
|
|
153
|
+
selected_slot_id: z.string().optional().describe('Required when response is "accept"'),
|
|
154
|
+
counter_slots: z.array(proposalSlotSchema).max(20).optional().describe('Alternative slots when response is "counter"'),
|
|
155
|
+
message: z.string().max(2e3).optional().describe("Optional note for the organizer")
|
|
156
|
+
});
|
|
157
|
+
var ResolveProposalSchema = z.object({
|
|
158
|
+
proposal_id: z.string().describe("Proposal to resolve")
|
|
159
|
+
});
|
|
160
|
+
var CancelProposalSchema = z.object({
|
|
161
|
+
proposal_id: z.string().describe("Proposal to cancel")
|
|
162
|
+
});
|
|
163
|
+
var workingHoursDaySchema = z.object({
|
|
164
|
+
start: z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, "must be HH:MM in 24-hour time"),
|
|
165
|
+
end: z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, "must be HH:MM in 24-hour time")
|
|
166
|
+
});
|
|
167
|
+
var workingHoursSchema = z.object({
|
|
168
|
+
mon: workingHoursDaySchema.optional(),
|
|
169
|
+
tue: workingHoursDaySchema.optional(),
|
|
170
|
+
wed: workingHoursDaySchema.optional(),
|
|
171
|
+
thu: workingHoursDaySchema.optional(),
|
|
172
|
+
fri: workingHoursDaySchema.optional(),
|
|
173
|
+
sat: workingHoursDaySchema.optional(),
|
|
174
|
+
sun: workingHoursDaySchema.optional()
|
|
175
|
+
}).nullable();
|
|
176
|
+
var SetAvailabilityRulesSchema = z.object({
|
|
177
|
+
calendar_id: z.string().describe("Calendar to configure"),
|
|
178
|
+
buffer_before_minutes: z.number().int().min(0).max(120).optional().describe("Minutes of buffer before each event (0\u2013120)"),
|
|
179
|
+
buffer_after_minutes: z.number().int().min(0).max(120).optional().describe("Minutes of buffer after each event (0\u2013120)"),
|
|
180
|
+
working_hours: workingHoursSchema.optional().describe("Per-day working hours map in the calendar's timezone; omit keys for off-days. Pass null to remove any working-hours constraint."),
|
|
181
|
+
timezone: z.string().min(1).max(64).optional().describe("IANA timezone used to interpret working_hours (e.g. America/New_York)")
|
|
182
|
+
});
|
|
183
|
+
var GetAvailabilityRulesSchema = z.object({
|
|
184
|
+
calendar_id: z.string().describe("Calendar to read")
|
|
185
|
+
});
|
|
186
|
+
var ClearAvailabilityRulesSchema = z.object({
|
|
187
|
+
calendar_id: z.string().describe("Calendar whose rules should be cleared")
|
|
188
|
+
});
|
|
189
|
+
var CreateScopedKeySchema = z.object({
|
|
190
|
+
agent_id: z.string().regex(/^agt_/).describe("Agent ID this key is scoped to"),
|
|
191
|
+
label: z.string().min(1).max(100).optional().describe("Human-readable label for the key")
|
|
192
|
+
});
|
|
193
|
+
var ListScopedKeysSchema = z.object({});
|
|
194
|
+
var RevokeScopedKeySchema = z.object({
|
|
195
|
+
key_id: z.string().describe("ID of the scoped key to revoke")
|
|
196
|
+
});
|
|
197
|
+
var GetAuditLogSchema = z.object({
|
|
198
|
+
from: z.string().optional().describe("Start of the window (ISO 8601). Silently clamped to the plan retention window if older."),
|
|
199
|
+
to: z.string().optional().describe("End of the window (ISO 8601)"),
|
|
200
|
+
action: z.string().min(1).max(64).optional().describe("Filter by action name (e.g. event.created)"),
|
|
201
|
+
actor_key_prefix: z.string().min(1).max(32).optional().describe("Filter by the API key prefix that performed the action"),
|
|
202
|
+
cursor: z.string().min(1).max(256).optional().describe("Opaque pagination cursor from a previous response"),
|
|
203
|
+
limit: z.number().int().min(1).max(200).optional().describe("Max results to return (default 50)")
|
|
204
|
+
});
|
|
205
|
+
var AcceptTermsSchema = z.object({
|
|
206
|
+
tos_version: z.string().min(1).describe("The terms-of-service version to accept; must match the current version")
|
|
207
|
+
});
|
|
80
208
|
var ListWebhooksSchema = z.object({
|
|
81
209
|
limit: z.number().int().min(1).max(100).optional().describe("Max results per page (default 20)"),
|
|
82
210
|
offset: z.number().int().min(0).optional().describe("Pagination offset (default 0)")
|
|
@@ -106,11 +234,18 @@ var ListICalSubscriptionsSchema = z.object({
|
|
|
106
234
|
var GetICalSubscriptionSchema = z.object({
|
|
107
235
|
subscription_id: z.string().describe("The iCal subscription ID to retrieve")
|
|
108
236
|
});
|
|
109
|
-
var
|
|
110
|
-
agent_id: z.string().describe("Agent ID
|
|
111
|
-
calendar_id: z.string().describe("Calendar ID to
|
|
112
|
-
url: z.string().describe("HTTPS URL of the iCal feed to subscribe to"),
|
|
113
|
-
label: z.string().optional().describe("
|
|
237
|
+
var SubscribeICalSchema = z.object({
|
|
238
|
+
agent_id: z.string().describe("Agent ID that will own this subscription"),
|
|
239
|
+
calendar_id: z.string().describe("Calendar ID to sync external events into"),
|
|
240
|
+
url: z.string().url().describe("HTTPS URL of the iCal feed (.ics) to subscribe to"),
|
|
241
|
+
label: z.string().optional().describe("Optional label for this subscription")
|
|
242
|
+
});
|
|
243
|
+
var ListWebhookDeliveriesSchema = z.object({
|
|
244
|
+
webhook_id: z.string().describe("Webhook subscription whose deliveries to list"),
|
|
245
|
+
limit: z.number().int().min(1).max(100).optional().describe("Max results to return (default 20)"),
|
|
246
|
+
offset: z.number().int().min(0).optional().describe("Pagination offset (default 0)"),
|
|
247
|
+
status: z.enum(["pending", "delivered", "failed"]).optional().describe("Filter to a single delivery status"),
|
|
248
|
+
include_payload: z.boolean().optional().describe("Include the full event payload sent on each delivery")
|
|
114
249
|
});
|
|
115
250
|
var UpdateICalSubscriptionSchema = z.object({
|
|
116
251
|
subscription_id: z.string().describe("The iCal subscription ID to update"),
|
|
@@ -163,6 +298,7 @@ var createCalendar = safeFunc(async (ctx) => {
|
|
|
163
298
|
name: params.name,
|
|
164
299
|
timezone: params.timezone,
|
|
165
300
|
agentId: params.agent_id,
|
|
301
|
+
default_reminders: params.default_reminders,
|
|
166
302
|
metadata: params.metadata
|
|
167
303
|
});
|
|
168
304
|
});
|
|
@@ -201,13 +337,99 @@ var updateEvent = safeFunc(async (ctx) => {
|
|
|
201
337
|
const { calendar_id, event_id, ...updates } = params;
|
|
202
338
|
return client.events.update(calendar_id, event_id, updates);
|
|
203
339
|
});
|
|
204
|
-
var
|
|
340
|
+
var cancelEvent = safeFunc(async (ctx) => {
|
|
205
341
|
await ctx.client.events.delete(ctx.params.calendar_id, ctx.params.event_id);
|
|
206
342
|
return void 0;
|
|
207
343
|
});
|
|
208
|
-
var
|
|
344
|
+
var confirmEvent = safeFunc(async (ctx) => {
|
|
345
|
+
return ctx.client.events.confirm(ctx.params.event_id);
|
|
346
|
+
});
|
|
347
|
+
var releaseEvent = safeFunc(async (ctx) => {
|
|
348
|
+
return ctx.client.events.release(ctx.params.event_id);
|
|
349
|
+
});
|
|
350
|
+
var createAgent = safeFunc(async (ctx) => {
|
|
351
|
+
return ctx.client.agents.create(ctx.params);
|
|
352
|
+
});
|
|
353
|
+
var listAgents = safeFunc(async (ctx) => {
|
|
354
|
+
const { client, params } = ctx;
|
|
355
|
+
const iter = client.agents.list({ type: params.type, status: params.status, limit: params.limit });
|
|
356
|
+
return fetchPage(iter, params.offset, params.limit);
|
|
357
|
+
});
|
|
358
|
+
var getAgent = safeFunc(async (ctx) => {
|
|
359
|
+
return ctx.client.agents.get(ctx.params.agent_id);
|
|
360
|
+
});
|
|
361
|
+
var updateAgent = safeFunc(async (ctx) => {
|
|
362
|
+
const { client, params } = ctx;
|
|
363
|
+
const { agent_id, ...updates } = params;
|
|
364
|
+
return client.agents.update(agent_id, updates);
|
|
365
|
+
});
|
|
366
|
+
var deleteAgent = safeFunc(async (ctx) => {
|
|
367
|
+
await ctx.client.agents.delete(ctx.params.agent_id);
|
|
368
|
+
return void 0;
|
|
369
|
+
});
|
|
370
|
+
var getAvailability = safeFunc(async (ctx) => {
|
|
371
|
+
const { client, params } = ctx;
|
|
372
|
+
return client.availability.forAgent(params.agent_id, {
|
|
373
|
+
start: params.start,
|
|
374
|
+
end: params.end,
|
|
375
|
+
slot_duration: params.slot_duration,
|
|
376
|
+
include_busy: params.include_busy
|
|
377
|
+
});
|
|
378
|
+
});
|
|
379
|
+
var findMeetingTime = safeFunc(async (ctx) => {
|
|
209
380
|
return ctx.client.availability.check(ctx.params);
|
|
210
381
|
});
|
|
382
|
+
var getCalendarContext = safeFunc(async (ctx) => {
|
|
383
|
+
return ctx.client.calendars.getContext(ctx.params.calendar_id);
|
|
384
|
+
});
|
|
385
|
+
var createProposal = safeFunc(async (ctx) => {
|
|
386
|
+
return ctx.client.scheduling.create(ctx.params);
|
|
387
|
+
});
|
|
388
|
+
var listProposals = safeFunc(async (ctx) => {
|
|
389
|
+
const { client, params } = ctx;
|
|
390
|
+
const iter = client.scheduling.list({
|
|
391
|
+
status: params.status,
|
|
392
|
+
organizer_agent_id: params.organizer_agent_id,
|
|
393
|
+
limit: params.limit
|
|
394
|
+
});
|
|
395
|
+
return fetchPage(iter, params.offset, params.limit);
|
|
396
|
+
});
|
|
397
|
+
var getProposal = safeFunc(async (ctx) => {
|
|
398
|
+
return ctx.client.scheduling.get(ctx.params.proposal_id);
|
|
399
|
+
});
|
|
400
|
+
var respondToProposal = safeFunc(async (ctx) => {
|
|
401
|
+
const { client, params } = ctx;
|
|
402
|
+
const { proposal_id, ...body } = params;
|
|
403
|
+
return client.scheduling.respond(proposal_id, body);
|
|
404
|
+
});
|
|
405
|
+
var resolveProposal = safeFunc(async (ctx) => {
|
|
406
|
+
return ctx.client.scheduling.resolve(ctx.params.proposal_id);
|
|
407
|
+
});
|
|
408
|
+
var cancelProposal = safeFunc(async (ctx) => {
|
|
409
|
+
return ctx.client.scheduling.cancel(ctx.params.proposal_id);
|
|
410
|
+
});
|
|
411
|
+
var setAvailabilityRules = safeFunc(async (ctx) => {
|
|
412
|
+
const { client, params } = ctx;
|
|
413
|
+
const { calendar_id, ...rules } = params;
|
|
414
|
+
return client.calendars.setAvailabilityRules(calendar_id, rules);
|
|
415
|
+
});
|
|
416
|
+
var getAvailabilityRules = safeFunc(async (ctx) => {
|
|
417
|
+
return ctx.client.calendars.getAvailabilityRules(ctx.params.calendar_id);
|
|
418
|
+
});
|
|
419
|
+
var clearAvailabilityRules = safeFunc(async (ctx) => {
|
|
420
|
+
await ctx.client.calendars.deleteAvailabilityRules(ctx.params.calendar_id);
|
|
421
|
+
return void 0;
|
|
422
|
+
});
|
|
423
|
+
var createScopedKey = safeFunc(async (ctx) => {
|
|
424
|
+
return ctx.client.keys.create(ctx.params);
|
|
425
|
+
});
|
|
426
|
+
var listScopedKeys = safeFunc(async (ctx) => {
|
|
427
|
+
return ctx.client.keys.list();
|
|
428
|
+
});
|
|
429
|
+
var revokeScopedKey = safeFunc(async (ctx) => {
|
|
430
|
+
await ctx.client.keys.delete(ctx.params.key_id);
|
|
431
|
+
return void 0;
|
|
432
|
+
});
|
|
211
433
|
var listWebhooks = safeFunc(async (ctx) => {
|
|
212
434
|
const { client, params } = ctx;
|
|
213
435
|
const iter = client.webhooks.list({ limit: params.limit });
|
|
@@ -228,6 +450,17 @@ var deleteWebhook = safeFunc(async (ctx) => {
|
|
|
228
450
|
await ctx.client.webhooks.delete(ctx.params.webhook_id);
|
|
229
451
|
return void 0;
|
|
230
452
|
});
|
|
453
|
+
var listWebhookDeliveries = safeFunc(async (ctx) => {
|
|
454
|
+
const { client, params } = ctx;
|
|
455
|
+
const { webhook_id, ...query } = params;
|
|
456
|
+
return client.webhooks.listDeliveries(webhook_id, query);
|
|
457
|
+
});
|
|
458
|
+
var getAuditLog = safeFunc(async (ctx) => {
|
|
459
|
+
return ctx.client.auditLog.list(ctx.params);
|
|
460
|
+
});
|
|
461
|
+
var acceptTerms = safeFunc(async (ctx) => {
|
|
462
|
+
return ctx.client.terms.accept(ctx.params);
|
|
463
|
+
});
|
|
231
464
|
var listICalSubscriptions = safeFunc(async (ctx) => {
|
|
232
465
|
const { client, params } = ctx;
|
|
233
466
|
const iter = client.icalSubscriptions.list({
|
|
@@ -240,7 +473,7 @@ var listICalSubscriptions = safeFunc(async (ctx) => {
|
|
|
240
473
|
var getICalSubscription = safeFunc(async (ctx) => {
|
|
241
474
|
return ctx.client.icalSubscriptions.get(ctx.params.subscription_id);
|
|
242
475
|
});
|
|
243
|
-
var
|
|
476
|
+
var subscribeICal = safeFunc(async (ctx) => {
|
|
244
477
|
const { client, params } = ctx;
|
|
245
478
|
const { agent_id, ...subParams } = params;
|
|
246
479
|
return client.icalSubscriptions.create(agent_id, subParams);
|
|
@@ -271,12 +504,19 @@ var HOSTED_API_MCP_TOOL_NAMES = [
|
|
|
271
504
|
"create_calendar",
|
|
272
505
|
"create_event",
|
|
273
506
|
"list_events",
|
|
507
|
+
"get_event",
|
|
508
|
+
"update_event",
|
|
274
509
|
"get_availability",
|
|
275
510
|
"find_meeting_time",
|
|
276
511
|
"cancel_event",
|
|
277
512
|
"confirm_event",
|
|
278
513
|
"release_event",
|
|
279
514
|
"subscribe_ical",
|
|
515
|
+
"list_ical_subscriptions",
|
|
516
|
+
"get_ical_subscription",
|
|
517
|
+
"update_ical_subscription",
|
|
518
|
+
"delete_ical_subscription",
|
|
519
|
+
"sync_ical_subscription",
|
|
280
520
|
"get_calendar_context",
|
|
281
521
|
"create_proposal",
|
|
282
522
|
"list_proposals",
|
|
@@ -286,7 +526,26 @@ var HOSTED_API_MCP_TOOL_NAMES = [
|
|
|
286
526
|
"cancel_proposal",
|
|
287
527
|
"set_availability_rules",
|
|
288
528
|
"get_availability_rules",
|
|
289
|
-
"clear_availability_rules"
|
|
529
|
+
"clear_availability_rules",
|
|
530
|
+
"create_scoped_key",
|
|
531
|
+
"list_scoped_keys",
|
|
532
|
+
"revoke_scoped_key",
|
|
533
|
+
"create_webhook",
|
|
534
|
+
"list_webhooks",
|
|
535
|
+
"get_webhook",
|
|
536
|
+
"update_webhook",
|
|
537
|
+
"delete_webhook",
|
|
538
|
+
"list_webhook_deliveries",
|
|
539
|
+
"get_agent",
|
|
540
|
+
"update_agent",
|
|
541
|
+
"delete_agent",
|
|
542
|
+
"list_calendars",
|
|
543
|
+
"get_calendar",
|
|
544
|
+
"update_calendar",
|
|
545
|
+
"delete_calendar",
|
|
546
|
+
"get_usage",
|
|
547
|
+
"get_audit_log",
|
|
548
|
+
"accept_terms"
|
|
290
549
|
];
|
|
291
550
|
var TOOL_DEFINITIONS = [
|
|
292
551
|
// ── Calendars ──────────────────────────────────────────────────
|
|
@@ -355,19 +614,149 @@ var TOOL_DEFINITIONS = [
|
|
|
355
614
|
execute: createExecutor(updateEvent)
|
|
356
615
|
},
|
|
357
616
|
{
|
|
358
|
-
name: "
|
|
359
|
-
description: "Delete an event from a calendar.
|
|
360
|
-
schema:
|
|
361
|
-
annotations: { title: "
|
|
362
|
-
execute: createExecutor(
|
|
617
|
+
name: "cancel_event",
|
|
618
|
+
description: "Delete or cancel an event from a calendar. The event is marked cancelled and excluded from future availability calculations.",
|
|
619
|
+
schema: CancelEventSchema,
|
|
620
|
+
annotations: { title: "Cancel Event", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
621
|
+
execute: createExecutor(cancelEvent)
|
|
622
|
+
},
|
|
623
|
+
{
|
|
624
|
+
name: "confirm_event",
|
|
625
|
+
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.',
|
|
626
|
+
schema: ConfirmEventSchema,
|
|
627
|
+
annotations: { title: "Confirm Event", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
628
|
+
execute: createExecutor(confirmEvent)
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
name: "release_event",
|
|
632
|
+
description: 'Manually release a held event before its hold_expires_at. The event must currently have status="hold". Frees the slot for other agents to book.',
|
|
633
|
+
schema: ReleaseEventSchema,
|
|
634
|
+
annotations: { title: "Release Event", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
635
|
+
execute: createExecutor(releaseEvent)
|
|
636
|
+
},
|
|
637
|
+
// ── Agents ─────────────────────────────────────────────────────
|
|
638
|
+
{
|
|
639
|
+
name: "create_agent",
|
|
640
|
+
description: "Register your agent (AI assistant, human participant, or resource) with Chronary so it can own calendars, events, and webhooks.",
|
|
641
|
+
schema: CreateAgentSchema,
|
|
642
|
+
annotations: { title: "Create Agent", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
643
|
+
execute: createExecutor(createAgent)
|
|
644
|
+
},
|
|
645
|
+
{
|
|
646
|
+
name: "list_agents",
|
|
647
|
+
description: "List all agents in your organization. Returns paginated results.",
|
|
648
|
+
schema: ListAgentsSchema,
|
|
649
|
+
annotations: { title: "List Agents", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
650
|
+
execute: createExecutor(listAgents)
|
|
651
|
+
},
|
|
652
|
+
{
|
|
653
|
+
name: "get_agent",
|
|
654
|
+
description: "Fetch a single agent by ID. An agent represents an AI assistant, human, or shared resource (e.g. a meeting room).",
|
|
655
|
+
schema: GetAgentSchema,
|
|
656
|
+
annotations: { title: "Get Agent", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
657
|
+
execute: createExecutor(getAgent)
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
name: "update_agent",
|
|
661
|
+
description: "Update an agent's name, description, metadata, or status (active/paused). Requires an org-level API key.",
|
|
662
|
+
schema: UpdateAgentSchema,
|
|
663
|
+
annotations: { title: "Update Agent", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
664
|
+
execute: createExecutor(updateAgent)
|
|
665
|
+
},
|
|
666
|
+
{
|
|
667
|
+
name: "delete_agent",
|
|
668
|
+
description: "Decommission an agent. This marks the agent as decommissioned and revokes all of its scoped API keys. Requires an org-level API key.",
|
|
669
|
+
schema: DeleteAgentSchema,
|
|
670
|
+
annotations: { title: "Delete Agent", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
671
|
+
execute: createExecutor(deleteAgent)
|
|
363
672
|
},
|
|
364
673
|
// ── Availability ───────────────────────────────────────────────
|
|
365
674
|
{
|
|
366
|
-
name: "
|
|
367
|
-
description: "Check
|
|
368
|
-
schema:
|
|
369
|
-
annotations: { title: "
|
|
370
|
-
execute: createExecutor(
|
|
675
|
+
name: "get_availability",
|
|
676
|
+
description: "Check when a single agent is free within a time range. Returns available time slots and optionally busy blocks.",
|
|
677
|
+
schema: GetAvailabilitySchema,
|
|
678
|
+
annotations: { title: "Get Availability", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
679
|
+
execute: createExecutor(getAvailability)
|
|
680
|
+
},
|
|
681
|
+
{
|
|
682
|
+
name: "find_meeting_time",
|
|
683
|
+
description: "Find time slots when multiple agents are all free simultaneously. All agents must be free during the returned slots.",
|
|
684
|
+
schema: FindMeetingTimeSchema,
|
|
685
|
+
annotations: { title: "Find Meeting Time", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
686
|
+
execute: createExecutor(findMeetingTime)
|
|
687
|
+
},
|
|
688
|
+
// ── Calendar context ───────────────────────────────────────────
|
|
689
|
+
{
|
|
690
|
+
name: "get_calendar_context",
|
|
691
|
+
description: "Get a calendar's temporal context in a single call: the current event, the next upcoming event, recent past events, a short upcoming window, and the owning agent's status.",
|
|
692
|
+
schema: GetCalendarContextSchema,
|
|
693
|
+
annotations: { title: "Get Calendar Context", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
694
|
+
execute: createExecutor(getCalendarContext)
|
|
695
|
+
},
|
|
696
|
+
// ── Scheduling proposals ───────────────────────────────────────
|
|
697
|
+
{
|
|
698
|
+
name: "create_proposal",
|
|
699
|
+
description: "Create a scheduling proposal \u2014 send candidate time slots to one or more participant agents so they can accept, decline, or counter-propose. Requires an org-level API key. Pro plan only.",
|
|
700
|
+
schema: CreateProposalSchema,
|
|
701
|
+
annotations: { title: "Create Proposal", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
702
|
+
execute: createExecutor(createProposal)
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
name: "list_proposals",
|
|
706
|
+
description: "List scheduling proposals for the org. Filter by status or organizer_agent_id. Requires an org-level API key.",
|
|
707
|
+
schema: ListProposalsSchema,
|
|
708
|
+
annotations: { title: "List Proposals", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
709
|
+
execute: createExecutor(listProposals)
|
|
710
|
+
},
|
|
711
|
+
{
|
|
712
|
+
name: "get_proposal",
|
|
713
|
+
description: "Get a scheduling proposal by id, including its slots and per-participant responses. Requires an org-level API key.",
|
|
714
|
+
schema: GetProposalSchema,
|
|
715
|
+
annotations: { title: "Get Proposal", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
716
|
+
execute: createExecutor(getProposal)
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
name: "respond_to_proposal",
|
|
720
|
+
description: "Submit a response (accept / decline / counter) on behalf of one participant agent to an open proposal. Requires an org-level API key. Pro plan only.",
|
|
721
|
+
schema: RespondToProposalSchema,
|
|
722
|
+
annotations: { title: "Respond To Proposal", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
723
|
+
execute: createExecutor(respondToProposal)
|
|
724
|
+
},
|
|
725
|
+
{
|
|
726
|
+
name: "resolve_proposal",
|
|
727
|
+
description: "Force-resolve an open proposal using responses collected so far. Picks the highest-scoring slot and creates a confirmed calendar event. Requires an org-level API key. Pro plan only.",
|
|
728
|
+
schema: ResolveProposalSchema,
|
|
729
|
+
annotations: { title: "Resolve Proposal", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
730
|
+
execute: createExecutor(resolveProposal)
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
name: "cancel_proposal",
|
|
734
|
+
description: 'Cancel an open proposal. Fires a proposal.cancelled webhook with reason="organizer_cancelled". Requires an org-level API key. Pro plan only.',
|
|
735
|
+
schema: CancelProposalSchema,
|
|
736
|
+
annotations: { title: "Cancel Proposal", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
737
|
+
execute: createExecutor(cancelProposal)
|
|
738
|
+
},
|
|
739
|
+
// ── Availability rules ─────────────────────────────────────────
|
|
740
|
+
{
|
|
741
|
+
name: "set_availability_rules",
|
|
742
|
+
description: "Set or replace the availability rules on a calendar \u2014 buffer times before/after events and optional per-day working hours. Upsert: overwrites any existing rules.",
|
|
743
|
+
schema: SetAvailabilityRulesSchema,
|
|
744
|
+
annotations: { title: "Set Availability Rules", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
745
|
+
execute: createExecutor(setAvailabilityRules)
|
|
746
|
+
},
|
|
747
|
+
{
|
|
748
|
+
name: "get_availability_rules",
|
|
749
|
+
description: "Read the buffer times and working-hours rules configured on a calendar. Returns the rules row, or an error if none are set.",
|
|
750
|
+
schema: GetAvailabilityRulesSchema,
|
|
751
|
+
annotations: { title: "Get Availability Rules", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
752
|
+
execute: createExecutor(getAvailabilityRules)
|
|
753
|
+
},
|
|
754
|
+
{
|
|
755
|
+
name: "clear_availability_rules",
|
|
756
|
+
description: "Remove the availability rules from a calendar, reverting to the default (no buffers, no working-hours mask).",
|
|
757
|
+
schema: ClearAvailabilityRulesSchema,
|
|
758
|
+
annotations: { title: "Clear Availability Rules", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
759
|
+
execute: createExecutor(clearAvailabilityRules)
|
|
371
760
|
},
|
|
372
761
|
// ── Webhooks ───────────────────────────────────────────────────
|
|
373
762
|
{
|
|
@@ -405,6 +794,13 @@ var TOOL_DEFINITIONS = [
|
|
|
405
794
|
annotations: { title: "Delete Webhook", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
406
795
|
execute: createExecutor(deleteWebhook)
|
|
407
796
|
},
|
|
797
|
+
{
|
|
798
|
+
name: "list_webhook_deliveries",
|
|
799
|
+
description: "List delivery attempts for a webhook subscription, with per-status counts (pending/delivered/failed). Use this to debug failing deliveries. Requires an org-level API key.",
|
|
800
|
+
schema: ListWebhookDeliveriesSchema,
|
|
801
|
+
annotations: { title: "List Webhook Deliveries", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
802
|
+
execute: createExecutor(listWebhookDeliveries)
|
|
803
|
+
},
|
|
408
804
|
// ── iCal Subscriptions ─────────────────────────────────────────
|
|
409
805
|
{
|
|
410
806
|
name: "list_ical_subscriptions",
|
|
@@ -421,11 +817,11 @@ var TOOL_DEFINITIONS = [
|
|
|
421
817
|
execute: createExecutor(getICalSubscription)
|
|
422
818
|
},
|
|
423
819
|
{
|
|
424
|
-
name: "
|
|
425
|
-
description: "
|
|
426
|
-
schema:
|
|
427
|
-
annotations: { title: "
|
|
428
|
-
execute: createExecutor(
|
|
820
|
+
name: "subscribe_ical",
|
|
821
|
+
description: "Link an external iCal feed (e.g. a human's Google Calendar) to an agent's calendar so external events appear in availability calculations. Events are synced every 30 minutes.",
|
|
822
|
+
schema: SubscribeICalSchema,
|
|
823
|
+
annotations: { title: "Subscribe iCal", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
824
|
+
execute: createExecutor(subscribeICal)
|
|
429
825
|
},
|
|
430
826
|
{
|
|
431
827
|
name: "update_ical_subscription",
|
|
@@ -448,6 +844,44 @@ var TOOL_DEFINITIONS = [
|
|
|
448
844
|
annotations: { title: "Sync iCal Subscription", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
449
845
|
execute: createExecutor(syncICalSubscription)
|
|
450
846
|
},
|
|
847
|
+
// ── Scoped keys ────────────────────────────────────────────────
|
|
848
|
+
{
|
|
849
|
+
name: "create_scoped_key",
|
|
850
|
+
description: "Create an agent-scoped API key (chr_ak_*) that can only act on behalf of a single agent. The plaintext key is returned exactly once. Requires an org-level API key.",
|
|
851
|
+
schema: CreateScopedKeySchema,
|
|
852
|
+
annotations: { title: "Create Scoped Key", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
853
|
+
execute: createExecutor(createScopedKey)
|
|
854
|
+
},
|
|
855
|
+
{
|
|
856
|
+
name: "list_scoped_keys",
|
|
857
|
+
description: "List all live (non-revoked) agent-scoped API keys for this org. Returns key metadata only \u2014 never the plaintext secret. Requires an org-level API key.",
|
|
858
|
+
schema: ListScopedKeysSchema,
|
|
859
|
+
annotations: { title: "List Scoped Keys", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
860
|
+
execute: createExecutor(listScopedKeys)
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
name: "revoke_scoped_key",
|
|
864
|
+
description: "Revoke an agent-scoped API key by ID. The key stops authenticating immediately and cannot be un-revoked. Requires an org-level API key.",
|
|
865
|
+
schema: RevokeScopedKeySchema,
|
|
866
|
+
annotations: { title: "Revoke Scoped Key", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
867
|
+
execute: createExecutor(revokeScopedKey)
|
|
868
|
+
},
|
|
869
|
+
// ── Audit log ──────────────────────────────────────────────────
|
|
870
|
+
{
|
|
871
|
+
name: "get_audit_log",
|
|
872
|
+
description: "List audit-log entries for the calling org \u2014 mutating operations and auth-lifecycle events, newest first. Results are clamped to the plan's retention window. Requires an org-level API key.",
|
|
873
|
+
schema: GetAuditLogSchema,
|
|
874
|
+
annotations: { title: "Get Audit Log", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
875
|
+
execute: createExecutor(getAuditLog)
|
|
876
|
+
},
|
|
877
|
+
// ── Terms ──────────────────────────────────────────────────────
|
|
878
|
+
{
|
|
879
|
+
name: "accept_terms",
|
|
880
|
+
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. Requires an org-level API key.",
|
|
881
|
+
schema: AcceptTermsSchema,
|
|
882
|
+
annotations: { title: "Accept Terms", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
883
|
+
execute: createExecutor(acceptTerms)
|
|
884
|
+
},
|
|
451
885
|
// ── Usage ──────────────────────────────────────────────────────
|
|
452
886
|
{
|
|
453
887
|
name: "get_usage",
|
|
@@ -494,7 +928,7 @@ var ChronaryToolkit = class extends ListToolkit {
|
|
|
494
928
|
return {
|
|
495
929
|
name: def.name,
|
|
496
930
|
description: def.description,
|
|
497
|
-
inputSchema:
|
|
931
|
+
inputSchema: z2.toJSONSchema(def.schema),
|
|
498
932
|
annotations: { ...def.annotations }
|
|
499
933
|
};
|
|
500
934
|
}
|