@chronary/toolkit 1.5.0 → 1.5.2

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/base.ts","../src/schemas.ts","../src/safe.ts","../src/functions.ts","../src/definitions.ts","../src/adapters/ai-sdk.ts"],"sourcesContent":["import { Chronary } from '@chronary/sdk';\nimport type { ToolDefinition, ToolName, ChronaryToolkitConfig } from './types';\nimport { TOOL_DEFINITIONS } from './definitions';\n\nfunction resolveClient(config: ChronaryToolkitConfig): Chronary {\n if ('client' in config && config.client) return config.client;\n const { tools: _tools, ...sdkConfig } = config as {\n apiKey?: string;\n baseUrl?: string;\n tools?: ToolName[];\n extraHeaders?: Record<string, string>;\n };\n return new Chronary(sdkConfig);\n}\n\nexport abstract class BaseToolkit<T> {\n protected readonly client: Chronary;\n protected readonly definitions: ToolDefinition[];\n\n constructor(config: ChronaryToolkitConfig) {\n this.client = resolveClient(config);\n this.definitions = config.tools\n ? TOOL_DEFINITIONS.filter((d) => (config.tools as ToolName[]).includes(d.name))\n : [...TOOL_DEFINITIONS];\n }\n\n /** Convert a framework-agnostic ToolDefinition into the adapter's native format */\n protected abstract buildTool(def: ToolDefinition): T;\n\n abstract getTools(): T[] | Record<string, T>;\n}\n\nexport abstract class ListToolkit<T> extends BaseToolkit<T> {\n getTools(): T[] {\n return this.definitions.map((def) => this.buildTool(def));\n }\n}\n\nexport abstract class MapToolkit<T> extends BaseToolkit<T> {\n getTools(): Record<string, T> {\n const map: Record<string, T> = {};\n for (const def of this.definitions) {\n map[def.name] = this.buildTool(def);\n }\n return map;\n }\n}\n","import { z } from 'zod';\n\n// Webhook event types and delivery statuses — kept in lockstep with the hosted\n// MCP server's `@chronary/shared` WEBHOOK_EVENT_TYPES / WEBHOOK_DELIVERY_STATUSES.\n// Inlined here because the toolkit deliberately does not depend on @chronary/shared.\nconst WEBHOOK_EVENT_TYPES = [\n 'agent.created',\n 'agent.updated',\n 'event.created',\n 'event.updated',\n 'event.deleted',\n 'event.started',\n 'event.ended',\n 'event.reminder',\n 'event.hold_created',\n 'event.hold_expired',\n 'event.hold_released',\n 'event.hold_confirmed',\n 'proposal.created',\n 'proposal.responded',\n 'proposal.confirmed',\n 'proposal.expired',\n 'proposal.cancelled',\n 'webhook.deactivated',\n] as const;\n\nconst WEBHOOK_DELIVERY_STATUSES = ['pending', 'delivered', 'failed'] as const;\n\n// ── Calendars ──────────────────────────────────────────────────\n\nexport const ListCalendarsSchema = z.object({\n agent_id: z.string().optional().describe('Filter to calendars owned by this agent. Org keys only — agent-scoped keys are always limited to their own agent and ignore this.'),\n include: z.enum(['all']).optional().describe('Pass \"all\" to include calendars across all agents (org keys only)'),\n limit: z.number().int().min(1).max(200).default(50).describe('Max results to return'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset'),\n});\n\nexport const GetCalendarSchema = z.object({\n calendar_id: z.string().describe('Calendar ID to fetch'),\n});\n\nexport const CreateCalendarSchema = z.object({\n name: z.string().min(1).max(255).describe('Calendar name'),\n agent_id: z.string().optional().describe('Agent ID to own this calendar (omit for org-level)'),\n timezone: z.string().min(1).describe('IANA timezone (e.g. America/New_York)'),\n 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.'),\n});\n\nexport const UpdateCalendarSchema = z.object({\n calendar_id: z.string().describe('Calendar ID to update'),\n name: z.string().min(1).max(255).optional().describe('New calendar name'),\n timezone: z.string().min(1).optional().describe('New IANA timezone (e.g. America/New_York)'),\n agent_status: z.enum(['idle', 'working', 'waiting', 'error']).optional().describe('Owning agent\\'s status'),\n 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'),\n metadata: z.record(z.string(), z.unknown()).optional().describe('Arbitrary metadata (max 16KB)'),\n});\n\nexport const DeleteCalendarSchema = z.object({\n calendar_id: z.string().describe('Calendar ID to delete'),\n});\n\n// ── Booking pages ──────────────────────────────────────────────\n\nexport const ListBookingPagesSchema = z.object({\n limit: z.number().int().min(1).max(200).default(50).describe('Max results to return'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset'),\n});\n\nexport const GetBookingPageSchema = z.object({\n booking_page_id: z.string().describe('Booking page ID to fetch (bkp_...)'),\n});\n\nexport const CreateBookingPageSchema = z.object({\n calendar_id: z.string().describe('Calendar a booking resolves to (from create_calendar/list_calendars).'),\n title: z.string().min(1).max(200).describe('Meeting title shown on the page.'),\n description: z.string().max(2000).optional().describe('Optional description shown to the booker.'),\n duration_minutes: z.number().int().min(5).max(480).optional().describe('Slot length in minutes (default 30).'),\n buffer_minutes: z.number().int().min(0).max(120).optional().describe('Padding before/after existing events (default 0).'),\n window_days: z.number().int().min(1).max(365).optional().describe('How far ahead bookings are allowed (default 14).'),\n min_notice_minutes: z.number().int().min(0).max(40320).optional().describe('Minimum lead time before a bookable slot (default 0).'),\n timezone: z.string().min(1).max(64).optional().describe('IANA timezone for display + working hours (default UTC).'),\n availability_constraints: z\n .record(z.string(), z.object({ start: z.string(), end: z.string() }))\n .nullable()\n .optional()\n .describe('Weekly working hours, e.g. {\"mon\":{\"start\":\"09:00\",\"end\":\"17:00\"}}. Omit/null for any time in the window.'),\n active: z.boolean().optional().describe('Whether the page accepts bookings (default true).'),\n});\n\nexport const DeleteBookingPageSchema = z.object({\n booking_page_id: z.string().describe('Booking page ID to delete (bkp_...)'),\n});\n\n// ── Events ─────────────────────────────────────────────────────\n\nexport const ListEventsSchema = z.object({\n calendar_id: z.string().optional().describe('Calendar ID to list events from. Provide this or agent_id.'),\n agent_id: z.string().optional().describe('Agent ID to list events for across all of the agent\\'s calendars. Provide this or calendar_id.'),\n start_after: z.string().datetime().optional().describe('Only events starting after this ISO 8601 time'),\n start_before: z.string().datetime().optional().describe('Only events starting before this ISO 8601 time'),\n status: z.enum(['confirmed', 'tentative', 'cancelled', 'hold']).optional().describe('Filter by event status'),\n source: z.enum(['internal', 'external_ical']).optional().describe('Filter by source: \"internal\" (created via the API) or \"external_ical\" (synced from an iCal subscription)'),\n limit: z.number().int().min(1).max(200).default(50).describe('Max results to return'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset'),\n 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.'),\n});\n\nexport const GetEventSchema = z.object({\n event_id: z.string().describe('Event ID to retrieve'),\n calendar_id: z.string().optional().describe('Calendar ID that owns the event. Optional — if omitted the calendar is resolved from the event.'),\n});\n\nexport const CreateEventSchema = z.object({\n calendar_id: z.string().describe('Calendar ID to add the event to'),\n title: z.string().min(1).max(500).describe('Event title'),\n start_time: z.string().datetime().describe('Start time (ISO 8601)'),\n end_time: z.string().datetime().describe('End time (ISO 8601)'),\n description: z.string().optional().describe('Optional event description'),\n all_day: z.boolean().default(false).describe('Whether this is an all-day event'),\n 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\".'),\n 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.'),\n hold_expires_at: z.string().datetime().optional().describe('Required when status=\"hold\". ISO 8601 timestamp 30s-15min in the future. Auto-releases the hold when reached.'),\n hold_priority: z.number().int().min(0).max(100).optional().describe('Only valid with status=\"hold\". Higher-priority overlapping holds pre-empt lower-priority ones. Defaults to 0.'),\n recurrence_rule: z.string().max(256).optional().describe('Make this a recurring series (RFC 5545 RRULE subset, no \"RRULE:\" prefix), e.g. \"FREQ=WEEKLY;BYDAY=MO,WE;COUNT=12\". Supports FREQ=DAILY/WEEKLY/MONTHLY/YEARLY, INTERVAL, COUNT (max 730) or UNTIL, BYDAY (weekly list or monthly ordinal like 2TU/-1FR), BYMONTHDAY (1-28 or -1). start_time must match the rule pattern; expansion is UTC-only. Not allowed with status=\"hold\". Free plan: max 5 recurring events, series must end within 90 days.'),\n});\n\nexport const UpdateEventSchema = z.object({\n event_id: z.string().describe('Event ID to update'),\n calendar_id: z.string().optional().describe('Calendar ID that owns the event. Optional — if omitted the calendar is resolved from the event.'),\n title: z.string().min(1).max(500).optional().describe('New event title'),\n description: z.string().nullable().optional().describe('New description, or null to clear it'),\n start_time: z.string().datetime().optional().describe('New start time (ISO 8601)'),\n end_time: z.string().datetime().optional().describe('New end time (ISO 8601)'),\n all_day: z.boolean().optional().describe('Whether this is an all-day event'),\n status: z.enum(['confirmed', 'tentative', 'cancelled']).optional().describe('New event status'),\n metadata: z.record(z.string(), z.unknown()).optional().describe('Replacement metadata object'),\n reminders: z.array(z.number().int().min(1).max(40320)).max(5).nullable().optional().describe('Reminder offsets in minutes before start_time. Omit to leave unchanged, null to inherit the calendar default, [] for no reminders.'),\n recurrence_rule: z.string().max(256).nullable().optional().describe('Set/change the recurring series rule (RFC 5545 RRULE subset, full-series semantics), or null to make the event a one-off. Changing the rule or start_time resets cancelled occurrences.'),\n});\n\nexport const CancelEventSchema = z.object({\n event_id: z.string().describe('Event ID to cancel'),\n calendar_id: z.string().optional().describe('Calendar ID that owns the event. Optional — if omitted the calendar is resolved from the event. Matches the asymmetry with confirm_event / release_event which never required this arg.'),\n occurrence_start: z.string().datetime().optional().describe('For recurring events only: ISO 8601 start of the single occurrence to cancel. The rest of the series is unaffected.'),\n});\n\nexport const ConfirmEventSchema = z.object({\n event_id: z.string().describe('Event ID of the hold to confirm'),\n});\n\nexport const ReleaseEventSchema = z.object({\n event_id: z.string().describe('Event ID of the hold to release'),\n});\n\n// ── Agents ─────────────────────────────────────────────────────\n\nexport const CreateAgentSchema = z.object({\n name: z.string().min(1).max(255).describe('Display name for the agent'),\n type: z.enum(['ai', 'human', 'resource']).describe('Agent type'),\n description: z.string().optional().describe('Optional description'),\n});\n\nexport const ListAgentsSchema = z.object({\n type: z.enum(['ai', 'human', 'resource']).optional().describe('Filter by agent type'),\n status: z.enum(['active', 'paused', 'decommissioned']).optional().describe('Filter by status'),\n limit: z.number().int().min(1).max(200).default(50).describe('Max results to return'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset'),\n});\n\nexport const GetAgentSchema = z.object({\n agent_id: z.string().describe('Agent ID to fetch'),\n});\n\nexport const UpdateAgentSchema = z.object({\n agent_id: z.string().describe('Agent ID to update'),\n name: z.string().min(1).max(255).optional().describe('New display name'),\n description: z.string().nullable().optional().describe('New description (null to clear)'),\n metadata: z.record(z.string(), z.unknown()).optional().describe('Arbitrary metadata (max 16KB)'),\n status: z.enum(['active', 'paused']).optional().describe('Operational status'),\n});\n\nexport const DeleteAgentSchema = z.object({\n agent_id: z.string().describe('Agent ID to decommission'),\n});\n\n// ── Availability ───────────────────────────────────────────────\n\nexport const GetAvailabilitySchema = z.object({\n agent_id: z.string().describe('Agent ID to check availability for'),\n start: z.string().datetime().optional().describe('Range start (ISO 8601). Alias: start_time.'),\n end: z.string().datetime().optional().describe('Range end (ISO 8601). Alias: end_time.'),\n start_time: z.string().datetime().optional().describe('Alias for `start` (matches REST events naming).'),\n end_time: z.string().datetime().optional().describe('Alias for `end` (matches REST events naming).'),\n duration: z.enum(['15m', '30m', '45m', '1h', '2h']).optional().describe('Requested slot length (15m/30m/45m/1h/2h). Preferred over the deprecated slot_duration. Defaults to 30m.'),\n slot_duration: z.enum(['15m', '30m', '45m', '1h', '2h']).optional().describe('Deprecated alias for `duration` — minimum slot length. Prefer `duration`.'),\n include_busy: z.boolean().default(false).describe('Include busy blocks in response'),\n});\n\nexport const FindMeetingTimeSchema = z.object({\n agents: z.array(z.string()).min(1).optional().describe('Array of agent IDs to find common free time for. All agents must be free during the returned slots. Alias: agent_ids.'),\n agent_ids: z.array(z.string()).min(1).optional().describe('Alias for `agents` (matches REST/scheduling-proposal naming).'),\n start: z.string().datetime().optional().describe('Search range start (ISO 8601). Alias: start_time.'),\n end: z.string().datetime().optional().describe('Search range end (ISO 8601). Alias: end_time.'),\n start_time: z.string().datetime().optional().describe('Alias for `start` (matches REST events naming).'),\n end_time: z.string().datetime().optional().describe('Alias for `end` (matches REST events naming).'),\n duration: z.enum(['15m', '30m', '45m', '1h', '2h']).optional().describe('Requested slot length (15m/30m/45m/1h/2h). Preferred over the deprecated slot_duration. Defaults to 30m.'),\n slot_duration: z.enum(['15m', '30m', '45m', '1h', '2h']).optional().describe('Deprecated alias for `duration` — minimum slot length. Prefer `duration`.'),\n calendars: z.array(z.string()).optional().describe('Additional shared calendar IDs to treat as busy'),\n include_busy: z.boolean().default(false).describe('Include per-agent busy blocks in response'),\n});\n\nexport const CreateConnectionLinkSchema = z.object({\n calendar_id: z.string().startsWith('cal_').describe('Chronary calendar whose owning agent will receive authorized availability'),\n capabilities: z.array(z.enum(['availability', 'publishing'])).min(1).max(2).default(['availability']).describe('Request opaque availability and optional publishing permission'),\n publication_policy: z.enum(['none', 'confirmed', 'confirmed_tentative']).default('none').describe('Desired event publishing policy; a human still selects the destination'),\n});\n\nexport const GetConnectionLinkSchema = z.object({\n connection_link_id: z.string().startsWith('csl_').describe('Connection setup link ID'),\n});\n\nexport const CancelConnectionLinkSchema = GetConnectionLinkSchema;\n\n// ── Calendar context ───────────────────────────────────────────\n\nexport const GetCalendarContextSchema = z.object({\n calendar_id: z.string().describe('Calendar ID'),\n});\n\n// ── Scheduling proposals ───────────────────────────────────────\n\nconst proposalSlotSchema = z.object({\n start_time: z.string().datetime().describe('Slot start time (ISO 8601)'),\n end_time: z.string().datetime().describe('Slot end time (ISO 8601), after start_time'),\n weight: z.number().min(0).max(10).default(1.0).optional().describe('Preference for this slot, 0–10 (higher = more preferred). Used to rank candidate slots when the proposal is resolved. Defaults to 1.'),\n calendar_id: z.string().optional().describe('Calendar to create the event on if this slot is chosen. Defaults to the proposal\\'s top-level calendar_id.'),\n});\n\nexport const CreateProposalSchema = z.object({\n title: z.string().min(1).max(500).describe('Short description of what the meeting is about'),\n description: z.string().max(5000).optional().describe('Longer context/agenda'),\n organizer_agent_id: z.string().describe('Agent ID proposing the meeting'),\n participant_agent_ids: z.array(z.string()).min(1).max(50).describe('Agent IDs invited to respond'),\n calendar_id: z.string().describe('Calendar the resolved event will be created on'),\n slots: z.array(proposalSlotSchema).min(1).max(20).describe('Candidate time slots (up to 20)'),\n expires_at: z.string().datetime().optional().describe('Auto-cancel cutoff if unresolved'),\n});\n\nexport const ListProposalsSchema = z.object({\n status: z.enum(['pending', 'confirmed', 'expired', 'cancelled']).optional().describe('Filter by proposal status'),\n organizer_agent_id: z.string().optional().describe('Filter by organizer agent'),\n limit: z.number().int().min(1).max(200).optional().describe('Max results (default 50)'),\n offset: z.number().int().min(0).optional().describe('Pagination offset (default 0)'),\n});\n\nexport const GetProposalSchema = z.object({\n proposal_id: z.string().describe('Proposal to fetch'),\n});\n\nexport const RespondToProposalSchema = z.object({\n proposal_id: z.string().describe('Proposal to respond to'),\n agent_id: z.string().describe('Participant agent responding'),\n response: z.enum(['accept', 'decline', 'counter']).describe('Decision from this agent'),\n selected_slot_id: z.string().optional().describe('Required when response is \"accept\"'),\n counter_slots: z.array(proposalSlotSchema).max(20).optional().describe('Alternative slots when response is \"counter\"'),\n message: z.string().max(2000).optional().describe('Optional note for the organizer'),\n});\n\nexport const ResolveProposalSchema = z.object({\n proposal_id: z.string().describe('Proposal to resolve'),\n});\n\nexport const CancelProposalSchema = z.object({\n proposal_id: z.string().describe('Proposal to cancel'),\n});\n\n// ── Availability rules ─────────────────────────────────────────\n\nconst timeOfDay = z.string().regex(/^([01]\\d|2[0-3]):[0-5]\\d$/, 'must be HH:MM in 24-hour time');\n\nconst workingHoursDaySchema = z.object({\n start: timeOfDay.describe('Start of the working window, HH:MM 24-hour, in the rules timezone (e.g. \"09:00\")'),\n end: timeOfDay.describe('End of the working window, HH:MM 24-hour, after start (e.g. \"17:00\")'),\n})\n .refine((v) => v.end > v.start, 'end must be after start')\n .describe('A single day\\'s working hours window');\n\nconst workingHoursSchema = z.object({\n mon: workingHoursDaySchema.optional(),\n tue: workingHoursDaySchema.optional(),\n wed: workingHoursDaySchema.optional(),\n thu: workingHoursDaySchema.optional(),\n fri: workingHoursDaySchema.optional(),\n sat: workingHoursDaySchema.optional(),\n sun: workingHoursDaySchema.optional(),\n})\n .refine((v) => Object.keys(v).length > 0, 'at least one day must be specified')\n .nullable();\n\nexport const SetAvailabilityRulesSchema = z.object({\n calendar_id: z.string().describe('Calendar to configure'),\n buffer_before_minutes: z.number().int().min(0).max(120).default(0).describe('Minutes of buffer before each event (0–120)'),\n buffer_after_minutes: z.number().int().min(0).max(120).default(0).describe('Minutes of buffer after each event (0–120)'),\n working_hours: workingHoursSchema.default(null).describe('Per-day working hours map in the calendar\\'s timezone; omit keys for off-days. Pass null to remove any working-hours constraint.'),\n timezone: z.string().min(1).max(64).default('UTC').describe('IANA timezone used to interpret working_hours (e.g. America/New_York)'),\n});\n\nexport const GetAvailabilityRulesSchema = z.object({\n calendar_id: z.string().describe('Calendar to read'),\n});\n\nexport const ClearAvailabilityRulesSchema = z.object({\n calendar_id: z.string().describe('Calendar whose rules should be cleared'),\n});\n\n// ── Scoped keys ────────────────────────────────────────────────\n\nexport const CreateScopedKeySchema = z.object({\n agent_id: z.string().regex(/^agt_/).describe('Agent ID this key is scoped to'),\n label: z.string().min(1).max(100).optional().describe('Human-readable label for the key'),\n});\n\nexport const ListScopedKeysSchema = z.object({});\n\nexport const RevokeScopedKeySchema = z.object({\n key_id: z.string().describe('ID of the scoped key to revoke'),\n});\n\n// ── Audit log ──────────────────────────────────────────────────\n\nexport const GetAuditLogSchema = z.object({\n from: z.string().datetime({ offset: true }).optional().describe('Start of the window (ISO 8601). Silently clamped to the plan retention window if older.'),\n to: z.string().datetime({ offset: true }).optional().describe('End of the window (ISO 8601)'),\n action: z.string().min(1).max(64).optional().describe('Filter by action name (e.g. event.created)'),\n actor_key_prefix: z.string().min(1).max(32).optional().describe('Filter by the API key prefix that performed the action'),\n cursor: z.string().min(1).max(256).optional().describe('Opaque pagination cursor from a previous response'),\n limit: z.number().int().min(1).max(200).optional().describe('Max results to return (default 50)'),\n});\n\n// ── Terms ──────────────────────────────────────────────────────\n\nexport const AcceptTermsSchema = z.object({\n tos_version: z.string().min(1).describe('The terms-of-service version to accept; must match the current version'),\n});\n\n// ── Webhooks ───────────────────────────────────────────────────\n\nexport const ListWebhooksSchema = z.object({\n limit: z.number().int().min(1).max(100).default(20).describe('Max results to return'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset'),\n});\n\nexport const GetWebhookSchema = z.object({\n webhook_id: z.string().describe('Webhook subscription to fetch'),\n});\n\nexport const CreateWebhookSchema = z.object({\n url: z.string().url().describe('HTTPS endpoint that will receive event deliveries'),\n events: z.array(z.enum(WEBHOOK_EVENT_TYPES)).min(1).describe('Event types to subscribe to'),\n});\n\nexport const UpdateWebhookSchema = z.object({\n webhook_id: z.string().describe('Webhook subscription to update'),\n url: z.string().url().optional().describe('New HTTPS delivery endpoint'),\n events: z.array(z.enum(WEBHOOK_EVENT_TYPES)).min(1).optional().describe('Replacement set of event types to subscribe to'),\n active: z.boolean().optional().describe('Set false to pause deliveries, true to resume'),\n});\n\nexport const DeleteWebhookSchema = z.object({\n webhook_id: z.string().describe('Webhook subscription to delete'),\n});\n\nexport const ListWebhookDeliveriesSchema = z.object({\n webhook_id: z.string().describe('Webhook subscription whose deliveries to list'),\n limit: z.number().int().min(1).max(100).default(20).describe('Max results to return'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset'),\n status: z.enum(WEBHOOK_DELIVERY_STATUSES).optional().describe('Filter to a single delivery status'),\n include_payload: z.boolean().optional().describe('Include the full event payload sent on each delivery'),\n});\n\n// ── iCal Subscriptions ─────────────────────────────────────────\n\nexport const ListICalSubscriptionsSchema = z.object({\n agent_id: z.string().describe('Agent ID whose iCal subscriptions to list'),\n status: z.enum(['active', 'error', 'paused']).optional().describe('Filter by subscription status'),\n limit: z.number().int().min(1).max(200).default(50).describe('Max results to return'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset'),\n});\n\nexport const GetICalSubscriptionSchema = z.object({\n subscription_id: z.string().describe('iCal subscription ID to fetch'),\n});\n\nexport const SubscribeICalSchema = z.object({\n agent_id: z.string().describe('Agent ID that will own this subscription'),\n calendar_id: z.string().describe('Calendar ID to sync external events into'),\n url: z.string().url().describe('HTTPS URL of the iCal feed (.ics) to subscribe to'),\n label: z.string().optional().describe('Optional label for this subscription'),\n});\n\nexport const UpdateICalSubscriptionSchema = z.object({\n subscription_id: z.string().describe('iCal subscription ID to update'),\n label: z.string().min(1).max(255).optional().describe('New label for this subscription'),\n url: z.string().url().startsWith('https://', 'URL must use HTTPS').optional().describe('New HTTPS URL of the iCal feed (.ics)'),\n});\n\nexport const DeleteICalSubscriptionSchema = z.object({\n subscription_id: z.string().describe('iCal subscription ID to delete'),\n});\n\nexport const SyncICalSubscriptionSchema = z.object({\n subscription_id: z.string().describe('iCal subscription ID to sync'),\n});\n\n// ── Usage ──────────────────────────────────────────────────────\n\nexport const GetUsageSchema = z.object({});\n","import { ChronaryError } from '@chronary/sdk';\nimport type { ToolResult } from './types';\n\n/**\n * Wraps an async function so SDK errors become structured ToolResult objects\n * instead of thrown exceptions. LLMs see error messages, never stack traces.\n */\nexport function safeFunc<TParams>(\n fn: (params: TParams) => Promise<unknown>,\n): (params: TParams) => Promise<ToolResult> {\n return async (params: TParams): Promise<ToolResult> => {\n try {\n const result = await fn(params);\n return { result: result ?? { success: true }, isError: false };\n } catch (err) {\n if (err instanceof ChronaryError) {\n return { result: `${err.name}: ${err.message}`, isError: true };\n }\n return {\n result: `Error: ${err instanceof Error ? err.message : String(err)}`,\n isError: true,\n };\n }\n };\n}\n","import type { Chronary } from '@chronary/sdk';\nimport { safeFunc } from './safe';\nimport type { ToolResult } from './types';\n\ninterface Ctx<P = Record<string, unknown>> {\n client: Chronary;\n params: P;\n}\n\n// Helper to consume a PageIterator's first page\nasync function fetchPage(\n iterator: AsyncIterable<unknown> & { getPage(offset?: number, limit?: number): Promise<{ data: unknown[]; total: number; hasMore: boolean }> },\n offset?: number,\n limit?: number,\n) {\n const page = await iterator.getPage(offset ?? 0, limit);\n return { data: page.data, total: page.total, has_more: page.hasMore };\n}\n\n// ── Calendars ──────────────────────────────────────────────────\n\nexport const listCalendars = safeFunc(async (ctx: Ctx<{\n agent_id?: string; include?: 'all'; limit?: number; offset?: number;\n}>) => {\n const { client, params } = ctx;\n const iter = client.calendars.list({ agentId: params.agent_id, include: params.include, limit: params.limit });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const getCalendar = safeFunc(async (ctx: Ctx<{ calendar_id: string }>) => {\n return ctx.client.calendars.get(ctx.params.calendar_id);\n});\n\nexport const createCalendar = safeFunc(async (ctx: Ctx<{\n name: string; timezone: string; agent_id?: string; default_reminders?: number[] | null; metadata?: Record<string, unknown>;\n}>) => {\n const { client, params } = ctx;\n return client.calendars.create({\n name: params.name,\n timezone: params.timezone,\n agentId: params.agent_id,\n default_reminders: params.default_reminders,\n metadata: params.metadata,\n });\n});\n\nexport const updateCalendar = safeFunc(async (ctx: Ctx<{\n calendar_id: string; name?: string; timezone?: string;\n agent_status?: 'idle' | 'working' | 'waiting' | 'error';\n default_reminders?: number[] | null; metadata?: Record<string, unknown>;\n}>) => {\n const { client, params } = ctx;\n const { calendar_id, ...updates } = params;\n return client.calendars.update(calendar_id, updates);\n});\n\nexport const deleteCalendar = safeFunc(async (ctx: Ctx<{ calendar_id: string }>) => {\n await ctx.client.calendars.delete(ctx.params.calendar_id);\n return undefined; // safeFunc normalizes to { success: true }\n});\n\n// ── Booking pages ──────────────────────────────────────────────\n\nexport const listBookingPages = safeFunc(async (ctx: Ctx<{ limit?: number; offset?: number }>) => {\n const { client, params } = ctx;\n const iter = client.bookingPages.list({ limit: params.limit });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const getBookingPage = safeFunc(async (ctx: Ctx<{ booking_page_id: string }>) => {\n return ctx.client.bookingPages.get(ctx.params.booking_page_id);\n});\n\nexport const createBookingPage = safeFunc(async (ctx: Ctx<{\n calendar_id: string; title: string; description?: string; duration_minutes?: number;\n buffer_minutes?: number; window_days?: number; min_notice_minutes?: number; timezone?: string;\n availability_constraints?: Record<string, { start: string; end: string }> | null; active?: boolean;\n}>) => {\n const { client, params } = ctx;\n return client.bookingPages.create({\n calendar_id: params.calendar_id,\n title: params.title,\n description: params.description,\n duration_minutes: params.duration_minutes,\n buffer_minutes: params.buffer_minutes,\n window_days: params.window_days,\n min_notice_minutes: params.min_notice_minutes,\n timezone: params.timezone,\n availability_constraints: params.availability_constraints,\n active: params.active,\n });\n});\n\nexport const deleteBookingPage = safeFunc(async (ctx: Ctx<{ booking_page_id: string }>) => {\n await ctx.client.bookingPages.delete(ctx.params.booking_page_id);\n return undefined; // safeFunc normalizes to { success: true }\n});\n\n// ── Events ─────────────────────────────────────────────────────\n\nexport const listEvents = safeFunc(async (ctx: Ctx<{\n calendar_id?: string; agent_id?: string; start_after?: string; start_before?: string;\n status?: 'confirmed' | 'tentative' | 'cancelled' | 'hold'; source?: 'internal' | 'external_ical';\n limit?: number; offset?: number; expand?: boolean;\n}>) => {\n const { client, params } = ctx;\n if (!params.calendar_id && !params.agent_id) {\n throw new Error('Provide calendar_id or agent_id');\n }\n const iter = client.events.list({\n calendarId: params.calendar_id,\n agentId: params.agent_id,\n start_after: params.start_after,\n start_before: params.start_before,\n status: params.status,\n source: params.source,\n expand: params.expand,\n limit: params.limit,\n });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const getEvent = safeFunc(async (ctx: Ctx<{ calendar_id?: string; event_id: string }>) => {\n const { calendar_id, event_id } = ctx.params;\n return calendar_id\n ? ctx.client.events.get(calendar_id, event_id)\n : ctx.client.events.getById(event_id);\n});\n\nexport const createEvent = safeFunc(async (ctx: Ctx<{\n calendar_id: string; title: string; start_time: string; end_time: string;\n description?: string; all_day?: boolean;\n status?: 'confirmed' | 'tentative' | 'hold'; reminders?: number[] | null; metadata?: Record<string, unknown>;\n hold_expires_at?: string; hold_priority?: number; recurrence_rule?: string;\n}>) => {\n const { client, params } = ctx;\n const { calendar_id, ...eventParams } = params;\n return client.events.create(calendar_id, eventParams);\n});\n\nexport const updateEvent = safeFunc(async (ctx: Ctx<{\n calendar_id?: string; event_id: string; title?: string; description?: string | null;\n start_time?: string; end_time?: string; all_day?: boolean;\n status?: 'confirmed' | 'tentative' | 'cancelled'; reminders?: number[] | null; metadata?: Record<string, unknown>;\n recurrence_rule?: string | null;\n}>) => {\n const { client, params } = ctx;\n const { calendar_id, event_id, ...updates } = params;\n return calendar_id\n ? client.events.update(calendar_id, event_id, updates)\n : client.events.updateById(event_id, updates);\n});\n\nexport const cancelEvent = safeFunc(async (ctx: Ctx<{ calendar_id?: string; event_id: string; occurrence_start?: string }>) => {\n const { calendar_id, event_id, occurrence_start } = ctx.params;\n if (occurrence_start) {\n // Single-occurrence cancel on a recurring series (#996): the API EXDATEs\n // that occurrence and returns the updated series master (the rest of the\n // series is unaffected). Mirrors the hosted MCP tool's response shape.\n const event = calendar_id\n ? await ctx.client.events.delete(calendar_id, event_id, { occurrence_start })\n : await ctx.client.events.deleteById(event_id, { occurrence_start });\n return { occurrence_cancelled: true, id: event_id, occurrence_start, event };\n }\n if (calendar_id) {\n await ctx.client.events.delete(calendar_id, event_id);\n } else {\n await ctx.client.events.deleteById(event_id);\n }\n return undefined;\n});\n\nexport const confirmEvent = safeFunc(async (ctx: Ctx<{ event_id: string }>) => {\n return ctx.client.events.confirm(ctx.params.event_id);\n});\n\nexport const releaseEvent = safeFunc(async (ctx: Ctx<{ event_id: string }>) => {\n return ctx.client.events.release(ctx.params.event_id);\n});\n\n// ── Agents ─────────────────────────────────────────────────────\n\nexport const createAgent = safeFunc(async (ctx: Ctx<{\n name: string; type: 'ai' | 'human' | 'resource'; description?: string; metadata?: Record<string, unknown>;\n}>) => {\n return ctx.client.agents.create(ctx.params);\n});\n\nexport const listAgents = safeFunc(async (ctx: Ctx<{\n type?: 'ai' | 'human' | 'resource'; status?: 'active' | 'paused' | 'decommissioned'; limit?: number; offset?: number;\n}>) => {\n const { client, params } = ctx;\n const iter = client.agents.list({ type: params.type, status: params.status, limit: params.limit });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const getAgent = safeFunc(async (ctx: Ctx<{ agent_id: string }>) => {\n return ctx.client.agents.get(ctx.params.agent_id);\n});\n\nexport const updateAgent = safeFunc(async (ctx: Ctx<{\n agent_id: string; name?: string; description?: string | null; metadata?: Record<string, unknown>; status?: 'active' | 'paused';\n}>) => {\n const { client, params } = ctx;\n const { agent_id, ...updates } = params;\n return client.agents.update(agent_id, updates);\n});\n\nexport const deleteAgent = safeFunc(async (ctx: Ctx<{ agent_id: string }>) => {\n await ctx.client.agents.delete(ctx.params.agent_id);\n return undefined;\n});\n\n// ── Availability ───────────────────────────────────────────────\n\nexport const getAvailability = safeFunc(async (ctx: Ctx<{\n agent_id: string; start?: string; end?: string; start_time?: string; end_time?: string;\n duration?: '15m' | '30m' | '45m' | '1h' | '2h';\n slot_duration?: '15m' | '30m' | '45m' | '1h' | '2h'; include_busy?: boolean;\n}>) => {\n const { client, params } = ctx;\n // Resolve the `start`/`end` canonical names from their REST aliases, mirroring\n // the hosted MCP tool's validation. `duration`/`slot_duration` are forwarded\n // as-is; the API coalesces them (and rejects conflicting values with a 400).\n const start = params.start ?? params.start_time;\n const end = params.end ?? params.end_time;\n if (!start || !end) {\n throw new Error('start (or start_time) and end (or end_time) are required');\n }\n return client.availability.forAgent(params.agent_id, {\n start,\n end,\n duration: params.duration,\n slot_duration: params.slot_duration,\n include_busy: params.include_busy,\n });\n});\n\nexport const findMeetingTime = safeFunc(async (ctx: Ctx<{\n agents?: string[]; agent_ids?: string[];\n start?: string; end?: string; start_time?: string; end_time?: string;\n duration?: '15m' | '30m' | '45m' | '1h' | '2h';\n slot_duration?: '15m' | '30m' | '45m' | '1h' | '2h';\n calendars?: string[]; include_busy?: boolean;\n}>) => {\n const { client, params } = ctx;\n // Resolve the canonical `agents`/`start`/`end` from their REST/scheduling\n // aliases, mirroring the hosted MCP tool's validation. `duration`/`slot_duration`\n // are forwarded as-is; the API coalesces them (400 on conflicting values).\n const agents = params.agents ?? params.agent_ids;\n const start = params.start ?? params.start_time;\n const end = params.end ?? params.end_time;\n if (!agents || !start || !end) {\n throw new Error('agents (or agent_ids), start (or start_time), and end (or end_time) are required');\n }\n return client.availability.check({\n agents,\n start,\n end,\n duration: params.duration,\n slot_duration: params.slot_duration,\n calendars: params.calendars,\n include_busy: params.include_busy,\n });\n});\n\nexport const createConnectionLink = safeFunc(async (ctx: Ctx<{\n calendar_id: string;\n capabilities: Array<'availability' | 'publishing'>;\n publication_policy?: 'none' | 'confirmed' | 'confirmed_tentative';\n}>) => {\n const { calendar_id, ...params } = ctx.params;\n return ctx.client.connectionLinks.create(calendar_id, params);\n});\n\nexport const getConnectionLink = safeFunc(async (ctx: Ctx<{ connection_link_id: string }>) =>\n ctx.client.connectionLinks.get(ctx.params.connection_link_id));\n\nexport const cancelConnectionLink = safeFunc(async (ctx: Ctx<{ connection_link_id: string }>) => {\n await ctx.client.connectionLinks.cancel(ctx.params.connection_link_id);\n return { cancelled: true, id: ctx.params.connection_link_id };\n});\n\n// ── Calendar context ───────────────────────────────────────────\n\nexport const getCalendarContext = safeFunc(async (ctx: Ctx<{ calendar_id: string }>) => {\n return ctx.client.calendars.getContext(ctx.params.calendar_id);\n});\n\n// ── Scheduling proposals ───────────────────────────────────────\n\ninterface ProposalSlotInput {\n start_time: string;\n end_time: string;\n weight?: number;\n calendar_id?: string;\n}\n\nexport const createProposal = safeFunc(async (ctx: Ctx<{\n title: string; description?: string; organizer_agent_id: string;\n participant_agent_ids: string[]; calendar_id: string;\n slots: ProposalSlotInput[]; expires_at?: string;\n}>) => {\n return ctx.client.scheduling.create(ctx.params);\n});\n\nexport const listProposals = safeFunc(async (ctx: Ctx<{\n status?: 'pending' | 'confirmed' | 'expired' | 'cancelled'; organizer_agent_id?: string; limit?: number; offset?: number;\n}>) => {\n const { client, params } = ctx;\n const iter = client.scheduling.list({\n status: params.status,\n organizer_agent_id: params.organizer_agent_id,\n limit: params.limit,\n });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const getProposal = safeFunc(async (ctx: Ctx<{ proposal_id: string }>) => {\n return ctx.client.scheduling.get(ctx.params.proposal_id);\n});\n\nexport const respondToProposal = safeFunc(async (ctx: Ctx<{\n proposal_id: string; agent_id: string; response: 'accept' | 'decline' | 'counter';\n selected_slot_id?: string; counter_slots?: ProposalSlotInput[]; message?: string;\n}>) => {\n const { client, params } = ctx;\n const { proposal_id, ...body } = params;\n return client.scheduling.respond(proposal_id, body);\n});\n\nexport const resolveProposal = safeFunc(async (ctx: Ctx<{ proposal_id: string }>) => {\n return ctx.client.scheduling.resolve(ctx.params.proposal_id);\n});\n\nexport const cancelProposal = safeFunc(async (ctx: Ctx<{ proposal_id: string }>) => {\n return ctx.client.scheduling.cancel(ctx.params.proposal_id);\n});\n\n// ── Availability rules ─────────────────────────────────────────\n\ninterface WorkingHoursDayInput { start: string; end: string; }\ntype WorkingHoursInput = {\n mon?: WorkingHoursDayInput; tue?: WorkingHoursDayInput; wed?: WorkingHoursDayInput;\n thu?: WorkingHoursDayInput; fri?: WorkingHoursDayInput; sat?: WorkingHoursDayInput; sun?: WorkingHoursDayInput;\n} | null;\n\nexport const setAvailabilityRules = safeFunc(async (ctx: Ctx<{\n calendar_id: string; buffer_before_minutes?: number; buffer_after_minutes?: number;\n working_hours?: WorkingHoursInput; timezone?: string;\n}>) => {\n const { client, params } = ctx;\n const { calendar_id, ...rules } = params;\n return client.calendars.setAvailabilityRules(calendar_id, rules);\n});\n\nexport const getAvailabilityRules = safeFunc(async (ctx: Ctx<{ calendar_id: string }>) => {\n return ctx.client.calendars.getAvailabilityRules(ctx.params.calendar_id);\n});\n\nexport const clearAvailabilityRules = safeFunc(async (ctx: Ctx<{ calendar_id: string }>) => {\n await ctx.client.calendars.deleteAvailabilityRules(ctx.params.calendar_id);\n return undefined;\n});\n\n// ── Scoped keys ────────────────────────────────────────────────\n\nexport const createScopedKey = safeFunc(async (ctx: Ctx<{ agent_id: string; label?: string }>) => {\n return ctx.client.keys.create(ctx.params);\n});\n\nexport const listScopedKeys = safeFunc(async (ctx: Ctx) => {\n return ctx.client.keys.list();\n});\n\nexport const revokeScopedKey = safeFunc(async (ctx: Ctx<{ key_id: string }>) => {\n await ctx.client.keys.delete(ctx.params.key_id);\n return undefined;\n});\n\n// ── Webhooks ───────────────────────────────────────────────────\n\nexport const listWebhooks = safeFunc(async (ctx: Ctx<{ limit?: number; offset?: number }>) => {\n const { client, params } = ctx;\n const iter = client.webhooks.list({ limit: params.limit });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const getWebhook = safeFunc(async (ctx: Ctx<{ webhook_id: string }>) => {\n return ctx.client.webhooks.get(ctx.params.webhook_id);\n});\n\nexport const createWebhook = safeFunc(async (ctx: Ctx<{ url: string; events: string[] }>) => {\n return ctx.client.webhooks.create(ctx.params);\n});\n\nexport const updateWebhook = safeFunc(async (ctx: Ctx<{\n webhook_id: string; url?: string; events?: string[]; active?: boolean;\n}>) => {\n const { client, params } = ctx;\n const { webhook_id, ...updates } = params;\n return client.webhooks.update(webhook_id, updates);\n});\n\nexport const deleteWebhook = safeFunc(async (ctx: Ctx<{ webhook_id: string }>) => {\n await ctx.client.webhooks.delete(ctx.params.webhook_id);\n return undefined;\n});\n\nexport const listWebhookDeliveries = safeFunc(async (ctx: Ctx<{\n webhook_id: string; limit?: number; offset?: number;\n status?: 'pending' | 'delivered' | 'failed'; include_payload?: boolean;\n}>) => {\n const { client, params } = ctx;\n const { webhook_id, ...query } = params;\n return client.webhooks.listDeliveries(webhook_id, query);\n});\n\n// ── Audit log ──────────────────────────────────────────────────\n\nexport const getAuditLog = safeFunc(async (ctx: Ctx<{\n from?: string; to?: string; action?: string; actor_key_prefix?: string; cursor?: string; limit?: number;\n}>) => {\n return ctx.client.auditLog.list(ctx.params);\n});\n\n// ── Terms ──────────────────────────────────────────────────────\n\nexport const acceptTerms = safeFunc(async (ctx: Ctx<{ tos_version: string }>) => {\n return ctx.client.terms.accept(ctx.params);\n});\n\n// ── iCal Subscriptions ─────────────────────────────────────────\n\nexport const listICalSubscriptions = safeFunc(async (ctx: Ctx<{\n agent_id: string; status?: 'active' | 'error' | 'paused'; limit?: number; offset?: number;\n}>) => {\n const { client, params } = ctx;\n const iter = client.icalSubscriptions.list({\n agentId: params.agent_id,\n status: params.status,\n limit: params.limit,\n });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const getICalSubscription = safeFunc(async (ctx: Ctx<{ subscription_id: string }>) => {\n return ctx.client.icalSubscriptions.get(ctx.params.subscription_id);\n});\n\nexport const subscribeICal = safeFunc(async (ctx: Ctx<{\n agent_id: string; calendar_id: string; url: string; label?: string;\n}>) => {\n const { client, params } = ctx;\n const { agent_id, ...subParams } = params;\n return client.icalSubscriptions.create(agent_id, subParams);\n});\n\nexport const updateICalSubscription = safeFunc(async (ctx: Ctx<{\n subscription_id: string; label?: string; url?: string;\n}>) => {\n const { client, params } = ctx;\n const { subscription_id, ...updates } = params;\n return client.icalSubscriptions.update(subscription_id, updates);\n});\n\nexport const deleteICalSubscription = safeFunc(async (ctx: Ctx<{ subscription_id: string }>) => {\n await ctx.client.icalSubscriptions.delete(ctx.params.subscription_id);\n return undefined;\n});\n\nexport const syncICalSubscription = safeFunc(async (ctx: Ctx<{ subscription_id: string }>) => {\n return ctx.client.icalSubscriptions.sync(ctx.params.subscription_id);\n});\n\n// ── Usage ──────────────────────────────────────────────────────\n\nexport const getUsage = safeFunc(async (ctx: Ctx) => {\n return ctx.client.usage.get();\n});\n\n// ── Factory ────────────────────────────────────────────────────\n\n/** Map of tool name → executor function. Used by definitions.ts to wire up execute(). */\nexport function createExecutor(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n fn: (ctx: { client: Chronary; params: any }) => Promise<ToolResult>,\n): (client: Chronary, params: Record<string, unknown>) => Promise<ToolResult> {\n return (client, params) => fn({ client, params });\n}\n","import type { ToolDefinition } from './types';\nimport * as schemas from './schemas';\nimport * as fns from './functions';\nimport { createExecutor } from './functions';\n\nexport const HOSTED_API_MCP_TOOL_NAMES = [\n 'create_agent',\n 'list_agents',\n 'create_calendar',\n 'create_event',\n 'list_events',\n 'get_event',\n 'update_event',\n 'get_availability',\n 'find_meeting_time',\n 'create_connection_link',\n 'get_connection_link',\n 'cancel_connection_link',\n 'cancel_event',\n 'confirm_event',\n 'release_event',\n 'subscribe_ical',\n 'list_ical_subscriptions',\n 'get_ical_subscription',\n 'update_ical_subscription',\n 'delete_ical_subscription',\n 'sync_ical_subscription',\n 'get_calendar_context',\n 'create_proposal',\n 'list_proposals',\n 'get_proposal',\n 'respond_to_proposal',\n 'resolve_proposal',\n 'cancel_proposal',\n 'set_availability_rules',\n 'get_availability_rules',\n 'clear_availability_rules',\n 'create_scoped_key',\n 'list_scoped_keys',\n 'revoke_scoped_key',\n 'create_webhook',\n 'list_webhooks',\n 'get_webhook',\n 'update_webhook',\n 'delete_webhook',\n 'list_webhook_deliveries',\n 'get_agent',\n 'update_agent',\n 'delete_agent',\n 'list_calendars',\n 'get_calendar',\n 'update_calendar',\n 'delete_calendar',\n 'create_booking_page',\n 'list_booking_pages',\n 'get_booking_page',\n 'delete_booking_page',\n 'get_usage',\n 'get_audit_log',\n 'accept_terms',\n] as const;\n\nexport const TOOL_DEFINITIONS: ToolDefinition[] = [\n // ── Calendars ──────────────────────────────────────────────────\n {\n name: 'list_calendars',\n description: 'List calendars in the org. Org-level API keys see every calendar (agent-owned and shared); agent-scoped keys see only their own agent\\'s calendars. Use this to discover calendar IDs before creating or listing events.',\n schema: schemas.ListCalendarsSchema,\n annotations: { title: 'List Calendars', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listCalendars),\n },\n {\n name: 'get_calendar',\n description: 'Fetch a single calendar by ID, including its name, timezone, agent status, and default reminders. Agent-scoped keys may only read calendars owned by their agent.',\n schema: schemas.GetCalendarSchema,\n annotations: { title: 'Get Calendar', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getCalendar),\n },\n {\n name: 'create_calendar',\n description: 'Create a calendar to hold events and track availability. Calendars are required before creating events — call this first when setting up a new agent. An agent can have multiple calendars (e.g. \"Work\", \"Personal\"). Org-level calendars (no agent_id) can be used as shared resources like meeting rooms.',\n schema: schemas.CreateCalendarSchema,\n annotations: { title: 'Create Calendar', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.createCalendar),\n },\n {\n name: 'update_calendar',\n description: 'Update a calendar\\'s name, timezone, agent status, default reminders, or metadata. Agent-scoped keys may only update calendars owned by their agent.',\n schema: schemas.UpdateCalendarSchema,\n annotations: { title: 'Update Calendar', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.updateCalendar),\n },\n {\n name: 'delete_calendar',\n description: 'Delete a calendar (soft delete). Its events are no longer returned and it stops contributing to availability. Agent-scoped keys may only delete calendars owned by their agent.',\n schema: schemas.DeleteCalendarSchema,\n annotations: { title: 'Delete Calendar', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.deleteCalendar),\n },\n\n // ── Booking pages ──────────────────────────────────────────────\n {\n name: 'create_booking_page',\n description: 'Create a public booking page (Calendly-style scheduling link) for a calendar. Returns a booking_url to send to a human; when they pick a slot, a confirmed event is created on the calendar and an event.created webhook fires with a booking_page_id field. Set availability_constraints to restrict to weekly working hours; existing calendar events always block slots.',\n schema: schemas.CreateBookingPageSchema,\n annotations: { title: 'Create Booking Page', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.createBookingPage),\n },\n {\n name: 'list_booking_pages',\n description: 'List booking pages in the org. Agent-scoped keys see only pages on their own agent\\'s calendars.',\n schema: schemas.ListBookingPagesSchema,\n annotations: { title: 'List Booking Pages', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listBookingPages),\n },\n {\n name: 'get_booking_page',\n description: 'Fetch a single booking page by ID, including its public booking_url and settings.',\n schema: schemas.GetBookingPageSchema,\n annotations: { title: 'Get Booking Page', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getBookingPage),\n },\n {\n name: 'delete_booking_page',\n description: 'Delete (deactivate) a booking page. Its hosted URL stops resolving; already-booked events are unaffected.',\n schema: schemas.DeleteBookingPageSchema,\n annotations: { title: 'Delete Booking Page', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.deleteBookingPage),\n },\n\n // ── Events ─────────────────────────────────────────────────────\n {\n name: 'list_events',\n 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`.',\n schema: schemas.ListEventsSchema,\n annotations: { title: 'List Events', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listEvents),\n },\n {\n name: 'get_event',\n 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 — if omitted the calendar is resolved from the event. Provide `calendar_id` to fail fast on cross-calendar typos.',\n schema: schemas.GetEventSchema,\n annotations: { title: 'Get Event', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getEvent),\n },\n {\n name: 'create_event',\n description: 'Create a booking, appointment, meeting, hold, or any scheduled event on a calendar. The calendar_id comes from create_calendar or list_events. Once created, this event blocks the agent\\'s availability during that time and appears in availability queries. Use status=\"hold\" with hold_expires_at to tentatively reserve a slot that auto-releases on TTL.',\n schema: schemas.CreateEventSchema,\n annotations: { title: 'Create Event', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.createEvent),\n },\n {\n name: 'update_event',\n description: 'Reschedule or edit an event — 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 — if omitted it is resolved from the event.',\n schema: schemas.UpdateEventSchema,\n annotations: { title: 'Update Event', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.updateEvent),\n },\n {\n name: 'cancel_event',\n 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 — if omitted the calendar is looked up from the event. Provide `calendar_id` to fail fast on cross-calendar typos.',\n schema: schemas.CancelEventSchema,\n annotations: { title: 'Cancel Event', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.cancelEvent),\n },\n {\n name: 'confirm_event',\n 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.',\n schema: schemas.ConfirmEventSchema,\n annotations: { title: 'Confirm Event', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.confirmEvent),\n },\n {\n name: 'release_event',\n 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.',\n schema: schemas.ReleaseEventSchema,\n annotations: { title: 'Release Event', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.releaseEvent),\n },\n\n // ── Agents ─────────────────────────────────────────────────────\n {\n name: 'create_agent',\n description: 'Register your agent (AI assistant, human participant, or resource) with Chronary so it can own calendars, events, and webhooks.',\n schema: schemas.CreateAgentSchema,\n annotations: { title: 'Create Agent', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.createAgent),\n },\n {\n name: 'list_agents',\n description: 'List all agents in your organization',\n schema: schemas.ListAgentsSchema,\n annotations: { title: 'List Agents', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listAgents),\n },\n {\n name: 'get_agent',\n description: 'Fetch a single agent by ID. An agent represents an AI assistant, human, or shared resource (e.g. a meeting room). Agent-scoped API keys may only read their own agent.',\n schema: schemas.GetAgentSchema,\n annotations: { title: 'Get Agent', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getAgent),\n },\n {\n name: 'update_agent',\n description: 'Update an agent\\'s name, description, metadata, or status (active/paused). Requires an org-level API key — agent-scoped keys cannot mutate agents.',\n schema: schemas.UpdateAgentSchema,\n annotations: { title: 'Update Agent', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.updateAgent),\n },\n {\n name: 'delete_agent',\n description: 'Decommission an agent. This marks the agent as decommissioned and revokes all of its scoped API keys. Requires an org-level API key — agent-scoped keys cannot delete agents.',\n schema: schemas.DeleteAgentSchema,\n annotations: { title: 'Delete Agent', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.deleteAgent),\n },\n\n // ── Availability ───────────────────────────────────────────────\n {\n name: 'get_availability',\n description: 'Check when a single agent is free across Chronary and authorized human calendars. This tool is fail-closed: always inspect availability_state and warnings before using slots.',\n schema: schemas.GetAvailabilitySchema,\n annotations: { title: 'Get Availability', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getAvailability),\n },\n {\n name: 'find_meeting_time',\n description: 'Find time when multiple agents are free across Chronary and their authorized human calendars. This tool is fail-closed: always inspect availability_state and warnings before using slots.',\n schema: schemas.FindMeetingTimeSchema,\n annotations: { title: 'Find Meeting Time', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.findMeetingTime),\n },\n {\n name: 'create_connection_link',\n description: 'Request human setup of Google Calendar or Microsoft Outlook for a Chronary calendar. Give setup_url to a human; agents never receive provider credentials or event data. The secret URL is returned only once.',\n schema: schemas.CreateConnectionLinkSchema,\n annotations: { title: 'Create Human Calendar Setup Link', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },\n execute: createExecutor(fns.createConnectionLink),\n },\n {\n name: 'get_connection_link',\n description: 'Poll provider-neutral human-calendar setup status. The bearer setup URL and provider data are never returned by polling.',\n schema: schemas.GetConnectionLinkSchema,\n annotations: { title: 'Get Human Calendar Setup Status', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getConnectionLink),\n },\n {\n name: 'cancel_connection_link',\n description: 'Cancel a pending human-calendar setup request and invalidate its setup URL.',\n schema: schemas.CancelConnectionLinkSchema,\n annotations: { title: 'Cancel Human Calendar Setup Link', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.cancelConnectionLink),\n },\n\n // ── Calendar context ───────────────────────────────────────────\n {\n name: 'get_calendar_context',\n 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.',\n schema: schemas.GetCalendarContextSchema,\n annotations: { title: 'Get Calendar Context', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getCalendarContext),\n },\n\n // ── Scheduling proposals ───────────────────────────────────────\n {\n name: 'create_proposal',\n description: 'Create a scheduling proposal — send a set of candidate time slots to one or more participant agents so they can accept, decline, or counter-propose. The organizer agent owns the proposal; once every participant responds, the system auto-resolves to the highest-scoring slot (or cancels if all decline). Requires an org-level API key. Pro plan only.',\n schema: schemas.CreateProposalSchema,\n annotations: { title: 'Create Proposal', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.createProposal),\n },\n {\n name: 'list_proposals',\n description: 'List scheduling proposals for the org. Filter by status (pending|confirmed|expired|cancelled) or organizer_agent_id. Requires an org-level API key.',\n schema: schemas.ListProposalsSchema,\n annotations: { title: 'List Proposals', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listProposals),\n },\n {\n name: 'get_proposal',\n description: 'Get a scheduling proposal by id, including its slots and per-participant responses. Requires an org-level API key.',\n schema: schemas.GetProposalSchema,\n annotations: { title: 'Get Proposal', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getProposal),\n },\n {\n name: 'respond_to_proposal',\n 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 — no separate resolve call needed in the normal flow. Requires an org-level API key. Pro plan only.',\n schema: schemas.RespondToProposalSchema,\n annotations: { title: 'Respond To Proposal', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.respondToProposal),\n },\n {\n name: 'resolve_proposal',\n description: 'Force-resolve an open proposal using responses collected so far. Picks the highest-scoring slot among those accepted by the most participants and creates a confirmed calendar event. If every response was \"decline\", the proposal is cancelled instead. Use when you want to close out a proposal without waiting for every participant. Requires an org-level API key. Pro plan only.',\n schema: schemas.ResolveProposalSchema,\n annotations: { title: 'Resolve Proposal', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.resolveProposal),\n },\n {\n name: 'cancel_proposal',\n description: 'Cancel an open proposal. Fires a proposal.cancelled webhook with reason=\"organizer_cancelled\". Requires an org-level API key. Pro plan only.',\n schema: schemas.CancelProposalSchema,\n annotations: { title: 'Cancel Proposal', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.cancelProposal),\n },\n\n // ── Availability rules ─────────────────────────────────────────\n {\n name: 'set_availability_rules',\n description: 'Set or replace the availability rules on a calendar — buffer times before/after events and optional per-day working hours. When these rules are set, every availability query on this calendar automatically applies them (busy-block expansion for buffers, masking outside working hours). Upsert: overwrites any existing rules.',\n schema: schemas.SetAvailabilityRulesSchema,\n annotations: { title: 'Set Availability Rules', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.setAvailabilityRules),\n },\n {\n name: 'get_availability_rules',\n description: 'Read the buffer times and working-hours rules configured on a calendar. Returns the rules row, or an error if none are set.',\n schema: schemas.GetAvailabilityRulesSchema,\n annotations: { title: 'Get Availability Rules', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getAvailabilityRules),\n },\n {\n name: 'clear_availability_rules',\n description: 'Remove the availability rules from a calendar, reverting to the default (no buffers, no working-hours mask). Returns the deleted row, or an error if none were set.',\n schema: schemas.ClearAvailabilityRulesSchema,\n annotations: { title: 'Clear Availability Rules', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.clearAvailabilityRules),\n },\n\n // ── Webhooks ───────────────────────────────────────────────────\n {\n name: 'list_webhooks',\n description: 'List the org\\'s webhook subscriptions with their subscribed event types and active state. Signing secrets are never returned. Requires an org-level API key.',\n schema: schemas.ListWebhooksSchema,\n annotations: { title: 'List Webhooks', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listWebhooks),\n },\n {\n name: 'get_webhook',\n description: 'Get a single webhook subscription by id, including its subscribed event types and active state. The signing secret is never returned. Requires an org-level API key.',\n schema: schemas.GetWebhookSchema,\n annotations: { title: 'Get Webhook', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getWebhook),\n },\n {\n name: 'create_webhook',\n 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 — store it to verify the HMAC-SHA256 signature on delivered payloads. Requires an org-level API key.',\n schema: schemas.CreateWebhookSchema,\n annotations: { title: 'Create Webhook', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.createWebhook),\n },\n {\n name: 'update_webhook',\n description: 'Update a webhook subscription — change its delivery URL, the set of subscribed event types, or pause/resume it via active. At least one field must be supplied. Requires an org-level API key.',\n schema: schemas.UpdateWebhookSchema,\n annotations: { title: 'Update Webhook', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.updateWebhook),\n },\n {\n name: 'delete_webhook',\n description: 'Permanently delete a webhook subscription. This frees its endpoint slot against the per-plan cap. Requires an org-level API key.',\n schema: schemas.DeleteWebhookSchema,\n annotations: { title: 'Delete Webhook', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.deleteWebhook),\n },\n {\n name: 'list_webhook_deliveries',\n 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.',\n schema: schemas.ListWebhookDeliveriesSchema,\n annotations: { title: 'List Webhook Deliveries', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listWebhookDeliveries),\n },\n\n // ── iCal Subscriptions ─────────────────────────────────────────\n {\n name: 'list_ical_subscriptions',\n description: \"List an agent's external iCal feed subscriptions (e.g. linked Google Calendar / Outlook feeds), including their sync status and last sync time.\",\n schema: schemas.ListICalSubscriptionsSchema,\n annotations: { title: 'List iCal Subscriptions', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listICalSubscriptions),\n },\n {\n name: 'get_ical_subscription',\n description: 'Get a single external iCal feed subscription by id, including its sync status, last sync time, and last error.',\n schema: schemas.GetICalSubscriptionSchema,\n annotations: { title: 'Get iCal Subscription', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getICalSubscription),\n },\n {\n name: 'subscribe_ical',\n description: \"Link an external iCal feed (e.g. a human's Google Calendar) to an agent's calendar so external events appear in availability calculations. The target calendar must be owned by the specified agent — create the calendar with that agent_id first (org-level calendars without an agent_id cannot host external iCal subscriptions; create a dedicated per-agent calendar for sync targets).\",\n schema: schemas.SubscribeICalSchema,\n annotations: { title: 'Subscribe iCal', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },\n execute: createExecutor(fns.subscribeICal),\n },\n {\n name: 'update_ical_subscription',\n description: 'Update an external iCal feed subscription — change its label or its feed URL. Changing the URL forces a full re-sync on the next poll.',\n schema: schemas.UpdateICalSubscriptionSchema,\n annotations: { title: 'Update iCal Subscription', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.updateICalSubscription),\n },\n {\n name: 'delete_ical_subscription',\n description: 'Delete an external iCal feed subscription. Events previously synced from the feed are no longer refreshed.',\n schema: schemas.DeleteICalSubscriptionSchema,\n annotations: { title: 'Delete iCal Subscription', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.deleteICalSubscription),\n },\n {\n name: 'sync_ical_subscription',\n description: 'Trigger an immediate sync of an external iCal feed subscription instead of waiting for the next scheduled poll. Returns once the sync has been queued.',\n schema: schemas.SyncICalSubscriptionSchema,\n annotations: { title: 'Sync iCal Subscription', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },\n execute: createExecutor(fns.syncICalSubscription),\n },\n\n // ── Scoped keys ────────────────────────────────────────────────\n {\n name: 'create_scoped_key',\n description: 'Create an agent-scoped API key (chr_ak_*) that can only act on behalf of a single agent. Use this to self-provision or rotate per-agent credentials. The plaintext key is returned exactly once in the response — store it immediately, it cannot be retrieved later. Requires an org-level API key.',\n schema: schemas.CreateScopedKeySchema,\n annotations: { title: 'Create Scoped Key', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.createScopedKey),\n },\n {\n name: 'list_scoped_keys',\n description: 'List all live (non-revoked) agent-scoped API keys for this org. Returns key metadata only (id, prefix, agent_id, label, created_at) — never the plaintext secret. Requires an org-level API key.',\n schema: schemas.ListScopedKeysSchema,\n annotations: { title: 'List Scoped Keys', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listScopedKeys),\n },\n {\n name: 'revoke_scoped_key',\n description: 'Revoke an agent-scoped API key by ID. Revocation is permanent (cannot be un-revoked); the key stops authenticating within about a minute. Requires an org-level API key.',\n schema: schemas.RevokeScopedKeySchema,\n annotations: { title: 'Revoke Scoped Key', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.revokeScopedKey),\n },\n\n // ── Audit log ──────────────────────────────────────────────────\n {\n name: 'get_audit_log',\n description: 'List audit-log entries for the calling org — mutating operations and auth-lifecycle events, newest first. Results are clamped to the plan\\'s retention window. Requires an org-level API key (chr_sk_*); agent-scoped keys cannot read the org-wide audit log.',\n schema: schemas.GetAuditLogSchema,\n annotations: { title: 'Get Audit Log', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getAuditLog),\n },\n\n // ── Terms ──────────────────────────────────────────────────────\n {\n name: 'accept_terms',\n 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 — a material ToS bump otherwise leaves MCP-only agents stuck without a console session. Pass the current tos_version (read it from GET /v1/auth/terms/current). Requires an org-level API key (chr_sk_*); agent-scoped keys cannot accept org-wide terms.',\n schema: schemas.AcceptTermsSchema,\n annotations: { title: 'Accept Terms', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.acceptTerms),\n },\n\n // ── Usage ──────────────────────────────────────────────────────\n {\n name: 'get_usage',\n description: 'Get the calling org\\'s current-period usage and plan limits (agents, calendars, events, API calls, webhooks, availability queries, iCal subscriptions, proposals, scoped keys, holds, cross-calendar queries). Requires an org-level API key (chr_sk_*); agent-scoped keys cannot read org-wide usage.',\n schema: schemas.GetUsageSchema,\n annotations: { title: 'Get Usage', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getUsage),\n },\n];\n\nconst toolkitToolNames = new Set<string>(TOOL_DEFINITIONS.map((tool) => tool.name));\nconst hostedToolNames = new Set<string>(HOSTED_API_MCP_TOOL_NAMES);\n\nexport const TOOLKIT_MCP_PARITY = {\n hostedToolNames: HOSTED_API_MCP_TOOL_NAMES,\n missingHostedTools: HOSTED_API_MCP_TOOL_NAMES.filter((name) => !toolkitToolNames.has(name)),\n toolkitOnlyTools: TOOL_DEFINITIONS.map((tool) => tool.name).filter((name) => !hostedToolNames.has(name)),\n};\n","import { MapToolkit } from '../base';\nimport type { ToolDefinition, ChronaryToolkitConfig } from '../types';\n\n/**\n * Vercel AI SDK 6.x adapter.\n *\n * Returns tools as `Record<string, Tool>` compatible with `generateText({ tools })`.\n * Zod schemas are passed directly via `parameters` (AI SDK accepts Zod natively).\n *\n * @example\n * ```ts\n * import { ChronaryToolkit } from '@chronary/toolkit/ai-sdk';\n * import { generateText } from 'ai';\n *\n * const toolkit = new ChronaryToolkit({ apiKey: process.env.CHRONARY_API_KEY });\n * const result = await generateText({\n * model: openai('gpt-4o'),\n * tools: toolkit.getTools(),\n * prompt: 'Schedule a meeting tomorrow at 2pm',\n * });\n * ```\n */\nexport class ChronaryToolkit extends MapToolkit<{\n description: string;\n parameters: ToolDefinition['schema'];\n execute: (params: Record<string, unknown>) => Promise<unknown>;\n}> {\n constructor(config: ChronaryToolkitConfig) {\n super(config);\n }\n\n protected buildTool(def: ToolDefinition) {\n const client = this.client;\n return {\n description: def.description,\n parameters: def.schema,\n execute: async (params: Record<string, unknown>) => {\n const result = await def.execute(client, params);\n if (result.isError) throw new Error(result.result as string);\n return result.result;\n },\n };\n }\n}\n\n/** Convenience function that returns the tools map directly */\nexport function chronaryTools(config: ChronaryToolkitConfig) {\n return new ChronaryToolkit(config).getTools();\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;;;ACAzB,SAAS,SAAS;AAKlB,IAAM,sBAAsB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAM,4BAA4B,CAAC,WAAW,aAAa,QAAQ;AAI5D,IAAM,sBAAsB,EAAE,OAAO;AAAA,EAC1C,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,wIAAmI;AAAA,EAC5K,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,SAAS,mEAAmE;AAAA,EAChH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG,EAAE,QAAQ,EAAE,EAAE,SAAS,uBAAuB;AAAA,EACpF,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,EAAE,SAAS,mBAAmB;AACzE,CAAC;AAEM,IAAM,oBAAoB,EAAE,OAAO;AAAA,EACxC,aAAa,EAAE,OAAO,EAAE,SAAS,sBAAsB;AACzD,CAAC;AAEM,IAAM,uBAAuB,EAAE,OAAO;AAAA,EAC3C,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG,EAAE,SAAS,eAAe;AAAA,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;AACpB,WAAO;AAAA,MACL,aAAa,IAAI;AAAA,MACjB,YAAY,IAAI;AAAA,MAChB,SAAS,OAAO,WAAoC;AAClD,cAAM,SAAS,MAAM,IAAI,QAAQ,QAAQ,MAAM;AAC/C,YAAI,OAAO,QAAS,OAAM,IAAI,MAAM,OAAO,MAAgB;AAC3D,eAAO,OAAO;AAAA,MAChB;AAAA,IACF;AAAA,EACF;AACF;AAGO,SAAS,cAAc,QAA+B;AAC3D,SAAO,IAAI,gBAAgB,MAAM,EAAE,SAAS;AAC9C;","names":[]}
1
+ {"version":3,"sources":["../src/base.ts","../src/schemas.ts","../src/safe.ts","../src/functions.ts","../src/definitions.ts","../src/adapters/ai-sdk.ts"],"sourcesContent":["import { Chronary } from '@chronary/sdk';\nimport type { ToolDefinition, ToolName, ChronaryToolkitConfig } from './types';\nimport { TOOL_DEFINITIONS } from './definitions';\n\nfunction resolveClient(config: ChronaryToolkitConfig): Chronary {\n if ('client' in config && config.client) return config.client;\n const { tools: _tools, ...sdkConfig } = config as {\n apiKey?: string;\n baseUrl?: string;\n tools?: ToolName[];\n extraHeaders?: Record<string, string>;\n };\n return new Chronary(sdkConfig);\n}\n\nexport abstract class BaseToolkit<T> {\n protected readonly client: Chronary;\n protected readonly definitions: ToolDefinition[];\n\n constructor(config: ChronaryToolkitConfig) {\n this.client = resolveClient(config);\n this.definitions = config.tools\n ? TOOL_DEFINITIONS.filter((d) => (config.tools as ToolName[]).includes(d.name))\n : [...TOOL_DEFINITIONS];\n }\n\n /** Convert a framework-agnostic ToolDefinition into the adapter's native format */\n protected abstract buildTool(def: ToolDefinition): T;\n\n abstract getTools(): T[] | Record<string, T>;\n}\n\nexport abstract class ListToolkit<T> extends BaseToolkit<T> {\n getTools(): T[] {\n return this.definitions.map((def) => this.buildTool(def));\n }\n}\n\nexport abstract class MapToolkit<T> extends BaseToolkit<T> {\n getTools(): Record<string, T> {\n const map: Record<string, T> = {};\n for (const def of this.definitions) {\n map[def.name] = this.buildTool(def);\n }\n return map;\n }\n}\n","import { z } from 'zod';\n\n// Webhook event types and delivery statuses — kept in lockstep with the hosted\n// MCP server's `@chronary/shared` WEBHOOK_EVENT_TYPES / WEBHOOK_DELIVERY_STATUSES.\n// Inlined here because the toolkit deliberately does not depend on @chronary/shared.\nconst WEBHOOK_EVENT_TYPES = [\n 'agent.created',\n 'agent.updated',\n 'event.created',\n 'event.updated',\n 'event.deleted',\n 'event.started',\n 'event.ended',\n 'event.reminder',\n 'event.hold_created',\n 'event.hold_expired',\n 'event.hold_released',\n 'event.hold_confirmed',\n 'proposal.created',\n 'proposal.responded',\n 'proposal.confirmed',\n 'proposal.expired',\n 'proposal.cancelled',\n 'webhook.deactivated',\n] as const;\n\nconst WEBHOOK_DELIVERY_STATUSES = ['pending', 'delivered', 'failed'] as const;\n\n// ── Calendars ──────────────────────────────────────────────────\n\nexport const ListCalendarsSchema = z.object({\n agent_id: z.string().optional().describe('Filter to calendars owned by this agent. Org keys only — agent-scoped keys are always limited to their own agent and ignore this.'),\n include: z.enum(['all']).optional().describe('Pass \"all\" to include calendars across all agents (org keys only)'),\n limit: z.number().int().min(1).max(200).default(50).describe('Max results to return'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset'),\n});\n\nexport const GetCalendarSchema = z.object({\n calendar_id: z.string().describe('Calendar ID to fetch'),\n});\n\nexport const CreateCalendarSchema = z.object({\n name: z.string().min(1).max(255).describe('Calendar name'),\n agent_id: z.string().optional().describe('Agent ID to own this calendar (omit for org-level)'),\n timezone: z.string().min(1).describe('IANA timezone (e.g. America/New_York)'),\n 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.'),\n});\n\nexport const UpdateCalendarSchema = z.object({\n calendar_id: z.string().describe('Calendar ID to update'),\n name: z.string().min(1).max(255).optional().describe('New calendar name'),\n timezone: z.string().min(1).optional().describe('New IANA timezone (e.g. America/New_York)'),\n agent_status: z.enum(['idle', 'working', 'waiting', 'error']).optional().describe('Owning agent\\'s status'),\n 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'),\n metadata: z.record(z.string(), z.unknown()).optional().describe('Arbitrary metadata (max 16KB)'),\n});\n\nexport const DeleteCalendarSchema = z.object({\n calendar_id: z.string().describe('Calendar ID to delete'),\n});\n\n// ── Booking pages ──────────────────────────────────────────────\n\nexport const ListBookingPagesSchema = z.object({\n limit: z.number().int().min(1).max(200).default(50).describe('Max results to return'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset'),\n});\n\nexport const GetBookingPageSchema = z.object({\n booking_page_id: z.string().describe('Booking page ID to fetch (bkp_...)'),\n});\n\nexport const CreateBookingPageSchema = z.object({\n calendar_id: z.string().describe('Calendar a booking resolves to (from create_calendar/list_calendars).'),\n title: z.string().min(1).max(200).describe('Meeting title shown on the page.'),\n description: z.string().max(2000).optional().describe('Optional description shown to the booker.'),\n duration_minutes: z.number().int().min(5).max(480).optional().describe('Slot length in minutes (default 30).'),\n buffer_minutes: z.number().int().min(0).max(120).optional().describe('Padding before/after existing events (default 0).'),\n window_days: z.number().int().min(1).max(365).optional().describe('How far ahead bookings are allowed (default 14).'),\n min_notice_minutes: z.number().int().min(0).max(40320).optional().describe('Minimum lead time before a bookable slot (default 0).'),\n timezone: z.string().min(1).max(64).optional().describe('IANA timezone for display + working hours (default UTC).'),\n availability_constraints: z\n .record(z.string(), z.object({ start: z.string(), end: z.string() }))\n .nullable()\n .optional()\n .describe('Weekly working hours, e.g. {\"mon\":{\"start\":\"09:00\",\"end\":\"17:00\"}}. Omit/null for any time in the window.'),\n active: z.boolean().optional().describe('Whether the page accepts bookings (default true).'),\n});\n\nexport const DeleteBookingPageSchema = z.object({\n booking_page_id: z.string().describe('Booking page ID to delete (bkp_...)'),\n});\n\n// ── Events ─────────────────────────────────────────────────────\n\nexport const ListEventsSchema = z.object({\n calendar_id: z.string().optional().describe('Calendar ID to list events from. Provide this or agent_id.'),\n agent_id: z.string().optional().describe('Agent ID to list events for across all of the agent\\'s calendars. Provide this or calendar_id.'),\n start_after: z.string().datetime().optional().describe('Only events starting after this ISO 8601 time'),\n start_before: z.string().datetime().optional().describe('Only events starting before this ISO 8601 time'),\n status: z.enum(['confirmed', 'tentative', 'cancelled', 'hold']).optional().describe('Filter by event status'),\n source: z.enum(['internal', 'external_ical']).optional().describe('Filter by source: \"internal\" (created via the API) or \"external_ical\" (synced from an iCal subscription)'),\n limit: z.number().int().min(1).max(200).default(50).describe('Max results to return'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset'),\n 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.'),\n});\n\nexport const GetEventSchema = z.object({\n event_id: z.string().describe('Event ID to retrieve'),\n calendar_id: z.string().optional().describe('Calendar ID that owns the event. Optional — if omitted the calendar is resolved from the event.'),\n});\n\nexport const CreateEventSchema = z.object({\n calendar_id: z.string().describe('Calendar ID to add the event to'),\n title: z.string().min(1).max(500).describe('Event title'),\n start_time: z.string().datetime().describe('Start time (ISO 8601)'),\n end_time: z.string().datetime().describe('End time (ISO 8601)'),\n description: z.string().optional().describe('Optional event description'),\n all_day: z.boolean().default(false).describe('Whether this is an all-day event'),\n 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\".'),\n 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.'),\n hold_expires_at: z.string().datetime().optional().describe('Required when status=\"hold\". ISO 8601 timestamp 30s-15min in the future. Auto-releases the hold when reached.'),\n hold_priority: z.number().int().min(0).max(100).optional().describe('Only valid with status=\"hold\". Higher-priority overlapping holds pre-empt lower-priority ones. Defaults to 0.'),\n recurrence_rule: z.string().max(256).optional().describe('Make this a recurring series (RFC 5545 RRULE subset, no \"RRULE:\" prefix), e.g. \"FREQ=WEEKLY;BYDAY=MO,WE;COUNT=12\". Supports FREQ=DAILY/WEEKLY/MONTHLY/YEARLY, INTERVAL, COUNT (max 730) or UNTIL, BYDAY (weekly list or monthly ordinal like 2TU/-1FR), BYMONTHDAY (1-28 or -1). start_time must match the rule pattern; expansion is UTC-only. Not allowed with status=\"hold\". Free plan: max 5 recurring events, series must end within 90 days.'),\n});\n\nexport const UpdateEventSchema = z.object({\n event_id: z.string().describe('Event ID to update'),\n calendar_id: z.string().optional().describe('Calendar ID that owns the event. Optional — if omitted the calendar is resolved from the event.'),\n title: z.string().min(1).max(500).optional().describe('New event title'),\n description: z.string().nullable().optional().describe('New description, or null to clear it'),\n start_time: z.string().datetime().optional().describe('New start time (ISO 8601)'),\n end_time: z.string().datetime().optional().describe('New end time (ISO 8601)'),\n all_day: z.boolean().optional().describe('Whether this is an all-day event'),\n status: z.enum(['confirmed', 'tentative', 'cancelled']).optional().describe('New event status'),\n metadata: z.record(z.string(), z.unknown()).optional().describe('Replacement metadata object'),\n reminders: z.array(z.number().int().min(1).max(40320)).max(5).nullable().optional().describe('Reminder offsets in minutes before start_time. Omit to leave unchanged, null to inherit the calendar default, [] for no reminders.'),\n recurrence_rule: z.string().max(256).nullable().optional().describe('Set/change the recurring series rule (RFC 5545 RRULE subset, full-series semantics), or null to make the event a one-off. Changing the rule or start_time resets cancelled occurrences.'),\n});\n\nexport const CancelEventSchema = z.object({\n event_id: z.string().describe('Event ID to cancel'),\n calendar_id: z.string().optional().describe('Calendar ID that owns the event. Optional — if omitted the calendar is resolved from the event. Matches the asymmetry with confirm_event / release_event which never required this arg.'),\n occurrence_start: z.string().datetime().optional().describe('For recurring events only: ISO 8601 start of the single occurrence to cancel. The rest of the series is unaffected.'),\n});\n\nexport const ConfirmEventSchema = z.object({\n event_id: z.string().describe('Event ID of the hold to confirm'),\n});\n\nexport const ReleaseEventSchema = z.object({\n event_id: z.string().describe('Event ID of the hold to release'),\n});\n\n// ── Agents ─────────────────────────────────────────────────────\n\nexport const CreateAgentSchema = z.object({\n name: z.string().min(1).max(255).describe('Display name for the agent'),\n type: z.enum(['ai', 'human', 'resource']).describe('Agent type'),\n description: z.string().optional().describe('Optional description'),\n});\n\nexport const ListAgentsSchema = z.object({\n type: z.enum(['ai', 'human', 'resource']).optional().describe('Filter by agent type'),\n status: z.enum(['active', 'paused', 'decommissioned']).optional().describe('Filter by status'),\n limit: z.number().int().min(1).max(200).default(50).describe('Max results to return'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset'),\n});\n\nexport const GetAgentSchema = z.object({\n agent_id: z.string().describe('Agent ID to fetch'),\n});\n\nexport const UpdateAgentSchema = z.object({\n agent_id: z.string().describe('Agent ID to update'),\n name: z.string().min(1).max(255).optional().describe('New display name'),\n description: z.string().nullable().optional().describe('New description (null to clear)'),\n metadata: z.record(z.string(), z.unknown()).optional().describe('Arbitrary metadata (max 16KB)'),\n status: z.enum(['active', 'paused']).optional().describe('Operational status'),\n});\n\nexport const DeleteAgentSchema = z.object({\n agent_id: z.string().describe('Agent ID to decommission'),\n});\n\n// ── Availability ───────────────────────────────────────────────\n\nexport const GetAvailabilitySchema = z.object({\n agent_id: z.string().describe('Agent ID to check availability for'),\n start: z.string().datetime().optional().describe('Range start (ISO 8601). Alias: start_time.'),\n end: z.string().datetime().optional().describe('Range end (ISO 8601). Alias: end_time.'),\n start_time: z.string().datetime().optional().describe('Alias for `start` (matches REST events naming).'),\n end_time: z.string().datetime().optional().describe('Alias for `end` (matches REST events naming).'),\n duration: z.enum(['15m', '30m', '45m', '1h', '2h']).optional().describe('Requested slot length (15m/30m/45m/1h/2h). Preferred over the deprecated slot_duration. Defaults to 30m.'),\n slot_duration: z.enum(['15m', '30m', '45m', '1h', '2h']).optional().describe('Deprecated alias for `duration` — minimum slot length. Prefer `duration`.'),\n include_busy: z.boolean().default(false).describe('Include busy blocks in response'),\n});\n\nexport const FindMeetingTimeSchema = z.object({\n agents: z.array(z.string()).min(1).optional().describe('Array of agent IDs to find common free time for. All agents must be free during the returned slots. Alias: agent_ids.'),\n agent_ids: z.array(z.string()).min(1).optional().describe('Alias for `agents` (matches REST/scheduling-proposal naming).'),\n start: z.string().datetime().optional().describe('Search range start (ISO 8601). Alias: start_time.'),\n end: z.string().datetime().optional().describe('Search range end (ISO 8601). Alias: end_time.'),\n start_time: z.string().datetime().optional().describe('Alias for `start` (matches REST events naming).'),\n end_time: z.string().datetime().optional().describe('Alias for `end` (matches REST events naming).'),\n duration: z.enum(['15m', '30m', '45m', '1h', '2h']).optional().describe('Requested slot length (15m/30m/45m/1h/2h). Preferred over the deprecated slot_duration. Defaults to 30m.'),\n slot_duration: z.enum(['15m', '30m', '45m', '1h', '2h']).optional().describe('Deprecated alias for `duration` — minimum slot length. Prefer `duration`.'),\n calendars: z.array(z.string()).optional().describe('Additional shared calendar IDs to treat as busy'),\n include_busy: z.boolean().default(false).describe('Include per-agent busy blocks in response'),\n});\n\nexport const CreateConnectionLinkSchema = z.object({\n calendar_id: z.string().startsWith('cal_').describe('Chronary calendar whose owning agent will receive authorized availability'),\n capabilities: z.array(z.enum(['availability', 'publishing'])).min(1).max(2).default(['availability']).describe('Request opaque availability, plus optional opt-in event publishing permission'),\n publication_policy: z.enum(['none', 'confirmed', 'confirmed_tentative']).default('none').describe('Desired publishing policy; a human still chooses the destination'),\n});\n\nexport const GetConnectionLinkSchema = z.object({\n connection_link_id: z.string().startsWith('csl_').describe('Connection setup link ID'),\n});\n\nexport const CancelConnectionLinkSchema = GetConnectionLinkSchema;\n\n// ── Calendar context ───────────────────────────────────────────\n\nexport const GetCalendarContextSchema = z.object({\n calendar_id: z.string().describe('Calendar ID'),\n});\n\n// ── Scheduling proposals ───────────────────────────────────────\n\nconst proposalSlotSchema = z.object({\n start_time: z.string().datetime().describe('Slot start time (ISO 8601)'),\n end_time: z.string().datetime().describe('Slot end time (ISO 8601), after start_time'),\n weight: z.number().min(0).max(10).default(1.0).optional().describe('Preference for this slot, 0–10 (higher = more preferred). Used to rank candidate slots when the proposal is resolved. Defaults to 1.'),\n calendar_id: z.string().optional().describe('Calendar to create the event on if this slot is chosen. Defaults to the proposal\\'s top-level calendar_id.'),\n});\n\nexport const CreateProposalSchema = z.object({\n title: z.string().min(1).max(500).describe('Short description of what the meeting is about'),\n description: z.string().max(5000).optional().describe('Longer context/agenda'),\n organizer_agent_id: z.string().describe('Agent ID proposing the meeting'),\n participant_agent_ids: z.array(z.string()).min(1).max(50).describe('Agent IDs invited to respond'),\n calendar_id: z.string().describe('Calendar the resolved event will be created on'),\n slots: z.array(proposalSlotSchema).min(1).max(20).describe('Candidate time slots (up to 20)'),\n expires_at: z.string().datetime().optional().describe('Auto-cancel cutoff if unresolved'),\n});\n\nexport const ListProposalsSchema = z.object({\n status: z.enum(['pending', 'confirmed', 'expired', 'cancelled']).optional().describe('Filter by proposal status'),\n organizer_agent_id: z.string().optional().describe('Filter by organizer agent'),\n limit: z.number().int().min(1).max(200).optional().describe('Max results (default 50)'),\n offset: z.number().int().min(0).optional().describe('Pagination offset (default 0)'),\n});\n\nexport const GetProposalSchema = z.object({\n proposal_id: z.string().describe('Proposal to fetch'),\n});\n\nexport const RespondToProposalSchema = z.object({\n proposal_id: z.string().describe('Proposal to respond to'),\n agent_id: z.string().describe('Participant agent responding'),\n response: z.enum(['accept', 'decline', 'counter']).describe('Decision from this agent'),\n selected_slot_id: z.string().optional().describe('Required when response is \"accept\"'),\n counter_slots: z.array(proposalSlotSchema).max(20).optional().describe('Alternative slots when response is \"counter\"'),\n message: z.string().max(2000).optional().describe('Optional note for the organizer'),\n});\n\nexport const ResolveProposalSchema = z.object({\n proposal_id: z.string().describe('Proposal to resolve'),\n});\n\nexport const CancelProposalSchema = z.object({\n proposal_id: z.string().describe('Proposal to cancel'),\n});\n\n// ── Availability rules ─────────────────────────────────────────\n\nconst timeOfDay = z.string().regex(/^([01]\\d|2[0-3]):[0-5]\\d$/, 'must be HH:MM in 24-hour time');\n\nconst workingHoursDaySchema = z.object({\n start: timeOfDay.describe('Start of the working window, HH:MM 24-hour, in the rules timezone (e.g. \"09:00\")'),\n end: timeOfDay.describe('End of the working window, HH:MM 24-hour, after start (e.g. \"17:00\")'),\n})\n .refine((v) => v.end > v.start, 'end must be after start')\n .describe('A single day\\'s working hours window');\n\nconst workingHoursSchema = z.object({\n mon: workingHoursDaySchema.optional(),\n tue: workingHoursDaySchema.optional(),\n wed: workingHoursDaySchema.optional(),\n thu: workingHoursDaySchema.optional(),\n fri: workingHoursDaySchema.optional(),\n sat: workingHoursDaySchema.optional(),\n sun: workingHoursDaySchema.optional(),\n})\n .refine((v) => Object.keys(v).length > 0, 'at least one day must be specified')\n .nullable();\n\nexport const SetAvailabilityRulesSchema = z.object({\n calendar_id: z.string().describe('Calendar to configure'),\n buffer_before_minutes: z.number().int().min(0).max(120).default(0).describe('Minutes of buffer before each event (0–120)'),\n buffer_after_minutes: z.number().int().min(0).max(120).default(0).describe('Minutes of buffer after each event (0–120)'),\n working_hours: workingHoursSchema.default(null).describe('Per-day working hours map in the calendar\\'s timezone; omit keys for off-days. Pass null to remove any working-hours constraint.'),\n timezone: z.string().min(1).max(64).default('UTC').describe('IANA timezone used to interpret working_hours (e.g. America/New_York)'),\n});\n\nexport const GetAvailabilityRulesSchema = z.object({\n calendar_id: z.string().describe('Calendar to read'),\n});\n\nexport const ClearAvailabilityRulesSchema = z.object({\n calendar_id: z.string().describe('Calendar whose rules should be cleared'),\n});\n\n// ── Scoped keys ────────────────────────────────────────────────\n\nexport const CreateScopedKeySchema = z.object({\n agent_id: z.string().regex(/^agt_/).describe('Agent ID this key is scoped to'),\n label: z.string().min(1).max(100).optional().describe('Human-readable label for the key'),\n});\n\nexport const ListScopedKeysSchema = z.object({});\n\nexport const RevokeScopedKeySchema = z.object({\n key_id: z.string().describe('ID of the scoped key to revoke'),\n});\n\n// ── Audit log ──────────────────────────────────────────────────\n\nexport const GetAuditLogSchema = z.object({\n from: z.string().datetime({ offset: true }).optional().describe('Start of the window (ISO 8601). Silently clamped to the plan retention window if older.'),\n to: z.string().datetime({ offset: true }).optional().describe('End of the window (ISO 8601)'),\n action: z.string().min(1).max(64).optional().describe('Filter by action name (e.g. event.created)'),\n actor_key_prefix: z.string().min(1).max(32).optional().describe('Filter by the API key prefix that performed the action'),\n cursor: z.string().min(1).max(256).optional().describe('Opaque pagination cursor from a previous response'),\n limit: z.number().int().min(1).max(200).optional().describe('Max results to return (default 50)'),\n});\n\n// ── Terms ──────────────────────────────────────────────────────\n\nexport const AcceptTermsSchema = z.object({\n tos_version: z.string().min(1).describe('The terms-of-service version to accept; must match the current version'),\n});\n\n// ── Webhooks ───────────────────────────────────────────────────\n\nexport const ListWebhooksSchema = z.object({\n limit: z.number().int().min(1).max(100).default(20).describe('Max results to return'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset'),\n});\n\nexport const GetWebhookSchema = z.object({\n webhook_id: z.string().describe('Webhook subscription to fetch'),\n});\n\nexport const CreateWebhookSchema = z.object({\n url: z.string().url().describe('HTTPS endpoint that will receive event deliveries'),\n events: z.array(z.enum(WEBHOOK_EVENT_TYPES)).min(1).describe('Event types to subscribe to'),\n});\n\nexport const UpdateWebhookSchema = z.object({\n webhook_id: z.string().describe('Webhook subscription to update'),\n url: z.string().url().optional().describe('New HTTPS delivery endpoint'),\n events: z.array(z.enum(WEBHOOK_EVENT_TYPES)).min(1).optional().describe('Replacement set of event types to subscribe to'),\n active: z.boolean().optional().describe('Set false to pause deliveries, true to resume'),\n});\n\nexport const DeleteWebhookSchema = z.object({\n webhook_id: z.string().describe('Webhook subscription to delete'),\n});\n\nexport const ListWebhookDeliveriesSchema = z.object({\n webhook_id: z.string().describe('Webhook subscription whose deliveries to list'),\n limit: z.number().int().min(1).max(100).default(20).describe('Max results to return'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset'),\n status: z.enum(WEBHOOK_DELIVERY_STATUSES).optional().describe('Filter to a single delivery status'),\n include_payload: z.boolean().optional().describe('Include the full event payload sent on each delivery'),\n});\n\n// ── iCal Subscriptions ─────────────────────────────────────────\n\nexport const ListICalSubscriptionsSchema = z.object({\n agent_id: z.string().describe('Agent ID whose iCal subscriptions to list'),\n status: z.enum(['active', 'error', 'paused']).optional().describe('Filter by subscription status'),\n limit: z.number().int().min(1).max(200).default(50).describe('Max results to return'),\n offset: z.number().int().min(0).default(0).describe('Pagination offset'),\n});\n\nexport const GetICalSubscriptionSchema = z.object({\n subscription_id: z.string().describe('iCal subscription ID to fetch'),\n});\n\nexport const SubscribeICalSchema = z.object({\n agent_id: z.string().describe('Agent ID that will own this subscription'),\n calendar_id: z.string().describe('Calendar ID to sync external events into'),\n url: z.string().url().describe('HTTPS URL of the iCal feed (.ics) to subscribe to'),\n label: z.string().optional().describe('Optional label for this subscription'),\n});\n\nexport const UpdateICalSubscriptionSchema = z.object({\n subscription_id: z.string().describe('iCal subscription ID to update'),\n label: z.string().min(1).max(255).optional().describe('New label for this subscription'),\n url: z.string().url().startsWith('https://', 'URL must use HTTPS').optional().describe('New HTTPS URL of the iCal feed (.ics)'),\n});\n\nexport const DeleteICalSubscriptionSchema = z.object({\n subscription_id: z.string().describe('iCal subscription ID to delete'),\n});\n\nexport const SyncICalSubscriptionSchema = z.object({\n subscription_id: z.string().describe('iCal subscription ID to sync'),\n});\n\n// ── Usage ──────────────────────────────────────────────────────\n\nexport const GetUsageSchema = z.object({});\n","import { ChronaryError } from '@chronary/sdk';\nimport type { ToolResult } from './types';\n\n/**\n * Wraps an async function so SDK errors become structured ToolResult objects\n * instead of thrown exceptions. LLMs see error messages, never stack traces.\n */\nexport function safeFunc<TParams>(\n fn: (params: TParams) => Promise<unknown>,\n): (params: TParams) => Promise<ToolResult> {\n return async (params: TParams): Promise<ToolResult> => {\n try {\n const result = await fn(params);\n return { result: result ?? { success: true }, isError: false };\n } catch (err) {\n if (err instanceof ChronaryError) {\n return { result: `${err.name}: ${err.message}`, isError: true };\n }\n return {\n result: `Error: ${err instanceof Error ? err.message : String(err)}`,\n isError: true,\n };\n }\n };\n}\n","import type { Chronary } from '@chronary/sdk';\nimport { safeFunc } from './safe';\nimport type { ToolResult } from './types';\n\ninterface Ctx<P = Record<string, unknown>> {\n client: Chronary;\n params: P;\n}\n\n// Helper to consume a PageIterator's first page\nasync function fetchPage(\n iterator: AsyncIterable<unknown> & { getPage(offset?: number, limit?: number): Promise<{ data: unknown[]; total: number; hasMore: boolean }> },\n offset?: number,\n limit?: number,\n) {\n const page = await iterator.getPage(offset ?? 0, limit);\n return { data: page.data, total: page.total, has_more: page.hasMore };\n}\n\n// ── Calendars ──────────────────────────────────────────────────\n\nexport const listCalendars = safeFunc(async (ctx: Ctx<{\n agent_id?: string; include?: 'all'; limit?: number; offset?: number;\n}>) => {\n const { client, params } = ctx;\n const iter = client.calendars.list({ agentId: params.agent_id, include: params.include, limit: params.limit });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const getCalendar = safeFunc(async (ctx: Ctx<{ calendar_id: string }>) => {\n return ctx.client.calendars.get(ctx.params.calendar_id);\n});\n\nexport const createCalendar = safeFunc(async (ctx: Ctx<{\n name: string; timezone: string; agent_id?: string; default_reminders?: number[] | null; metadata?: Record<string, unknown>;\n}>) => {\n const { client, params } = ctx;\n return client.calendars.create({\n name: params.name,\n timezone: params.timezone,\n agentId: params.agent_id,\n default_reminders: params.default_reminders,\n metadata: params.metadata,\n });\n});\n\nexport const updateCalendar = safeFunc(async (ctx: Ctx<{\n calendar_id: string; name?: string; timezone?: string;\n agent_status?: 'idle' | 'working' | 'waiting' | 'error';\n default_reminders?: number[] | null; metadata?: Record<string, unknown>;\n}>) => {\n const { client, params } = ctx;\n const { calendar_id, ...updates } = params;\n return client.calendars.update(calendar_id, updates);\n});\n\nexport const deleteCalendar = safeFunc(async (ctx: Ctx<{ calendar_id: string }>) => {\n await ctx.client.calendars.delete(ctx.params.calendar_id);\n return undefined; // safeFunc normalizes to { success: true }\n});\n\n// ── Booking pages ──────────────────────────────────────────────\n\nexport const listBookingPages = safeFunc(async (ctx: Ctx<{ limit?: number; offset?: number }>) => {\n const { client, params } = ctx;\n const iter = client.bookingPages.list({ limit: params.limit });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const getBookingPage = safeFunc(async (ctx: Ctx<{ booking_page_id: string }>) => {\n return ctx.client.bookingPages.get(ctx.params.booking_page_id);\n});\n\nexport const createBookingPage = safeFunc(async (ctx: Ctx<{\n calendar_id: string; title: string; description?: string; duration_minutes?: number;\n buffer_minutes?: number; window_days?: number; min_notice_minutes?: number; timezone?: string;\n availability_constraints?: Record<string, { start: string; end: string }> | null; active?: boolean;\n}>) => {\n const { client, params } = ctx;\n return client.bookingPages.create({\n calendar_id: params.calendar_id,\n title: params.title,\n description: params.description,\n duration_minutes: params.duration_minutes,\n buffer_minutes: params.buffer_minutes,\n window_days: params.window_days,\n min_notice_minutes: params.min_notice_minutes,\n timezone: params.timezone,\n availability_constraints: params.availability_constraints,\n active: params.active,\n });\n});\n\nexport const deleteBookingPage = safeFunc(async (ctx: Ctx<{ booking_page_id: string }>) => {\n await ctx.client.bookingPages.delete(ctx.params.booking_page_id);\n return undefined; // safeFunc normalizes to { success: true }\n});\n\n// ── Events ─────────────────────────────────────────────────────\n\nexport const listEvents = safeFunc(async (ctx: Ctx<{\n calendar_id?: string; agent_id?: string; start_after?: string; start_before?: string;\n status?: 'confirmed' | 'tentative' | 'cancelled' | 'hold'; source?: 'internal' | 'external_ical';\n limit?: number; offset?: number; expand?: boolean;\n}>) => {\n const { client, params } = ctx;\n if (!params.calendar_id && !params.agent_id) {\n throw new Error('Provide calendar_id or agent_id');\n }\n const iter = client.events.list({\n calendarId: params.calendar_id,\n agentId: params.agent_id,\n start_after: params.start_after,\n start_before: params.start_before,\n status: params.status,\n source: params.source,\n expand: params.expand,\n limit: params.limit,\n });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const getEvent = safeFunc(async (ctx: Ctx<{ calendar_id?: string; event_id: string }>) => {\n const { calendar_id, event_id } = ctx.params;\n return calendar_id\n ? ctx.client.events.get(calendar_id, event_id)\n : ctx.client.events.getById(event_id);\n});\n\nexport const createEvent = safeFunc(async (ctx: Ctx<{\n calendar_id: string; title: string; start_time: string; end_time: string;\n description?: string; all_day?: boolean;\n status?: 'confirmed' | 'tentative' | 'hold'; reminders?: number[] | null; metadata?: Record<string, unknown>;\n hold_expires_at?: string; hold_priority?: number; recurrence_rule?: string;\n}>) => {\n const { client, params } = ctx;\n const { calendar_id, ...eventParams } = params;\n return client.events.create(calendar_id, eventParams);\n});\n\nexport const updateEvent = safeFunc(async (ctx: Ctx<{\n calendar_id?: string; event_id: string; title?: string; description?: string | null;\n start_time?: string; end_time?: string; all_day?: boolean;\n status?: 'confirmed' | 'tentative' | 'cancelled'; reminders?: number[] | null; metadata?: Record<string, unknown>;\n recurrence_rule?: string | null;\n}>) => {\n const { client, params } = ctx;\n const { calendar_id, event_id, ...updates } = params;\n return calendar_id\n ? client.events.update(calendar_id, event_id, updates)\n : client.events.updateById(event_id, updates);\n});\n\nexport const cancelEvent = safeFunc(async (ctx: Ctx<{ calendar_id?: string; event_id: string; occurrence_start?: string }>) => {\n const { calendar_id, event_id, occurrence_start } = ctx.params;\n if (occurrence_start) {\n // Single-occurrence cancel on a recurring series (#996): the API EXDATEs\n // that occurrence and returns the updated series master (the rest of the\n // series is unaffected). Mirrors the hosted MCP tool's response shape.\n const event = calendar_id\n ? await ctx.client.events.delete(calendar_id, event_id, { occurrence_start })\n : await ctx.client.events.deleteById(event_id, { occurrence_start });\n return { occurrence_cancelled: true, id: event_id, occurrence_start, event };\n }\n if (calendar_id) {\n await ctx.client.events.delete(calendar_id, event_id);\n } else {\n await ctx.client.events.deleteById(event_id);\n }\n return undefined;\n});\n\nexport const confirmEvent = safeFunc(async (ctx: Ctx<{ event_id: string }>) => {\n return ctx.client.events.confirm(ctx.params.event_id);\n});\n\nexport const releaseEvent = safeFunc(async (ctx: Ctx<{ event_id: string }>) => {\n return ctx.client.events.release(ctx.params.event_id);\n});\n\n// ── Agents ─────────────────────────────────────────────────────\n\nexport const createAgent = safeFunc(async (ctx: Ctx<{\n name: string; type: 'ai' | 'human' | 'resource'; description?: string; metadata?: Record<string, unknown>;\n}>) => {\n return ctx.client.agents.create(ctx.params);\n});\n\nexport const listAgents = safeFunc(async (ctx: Ctx<{\n type?: 'ai' | 'human' | 'resource'; status?: 'active' | 'paused' | 'decommissioned'; limit?: number; offset?: number;\n}>) => {\n const { client, params } = ctx;\n const iter = client.agents.list({ type: params.type, status: params.status, limit: params.limit });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const getAgent = safeFunc(async (ctx: Ctx<{ agent_id: string }>) => {\n return ctx.client.agents.get(ctx.params.agent_id);\n});\n\nexport const updateAgent = safeFunc(async (ctx: Ctx<{\n agent_id: string; name?: string; description?: string | null; metadata?: Record<string, unknown>; status?: 'active' | 'paused';\n}>) => {\n const { client, params } = ctx;\n const { agent_id, ...updates } = params;\n return client.agents.update(agent_id, updates);\n});\n\nexport const deleteAgent = safeFunc(async (ctx: Ctx<{ agent_id: string }>) => {\n await ctx.client.agents.delete(ctx.params.agent_id);\n return undefined;\n});\n\n// ── Availability ───────────────────────────────────────────────\n\nexport const getAvailability = safeFunc(async (ctx: Ctx<{\n agent_id: string; start?: string; end?: string; start_time?: string; end_time?: string;\n duration?: '15m' | '30m' | '45m' | '1h' | '2h';\n slot_duration?: '15m' | '30m' | '45m' | '1h' | '2h'; include_busy?: boolean;\n}>) => {\n const { client, params } = ctx;\n // Resolve the `start`/`end` canonical names from their REST aliases, mirroring\n // the hosted MCP tool's validation. `duration`/`slot_duration` are forwarded\n // as-is; the API coalesces them (and rejects conflicting values with a 400).\n const start = params.start ?? params.start_time;\n const end = params.end ?? params.end_time;\n if (!start || !end) {\n throw new Error('start (or start_time) and end (or end_time) are required');\n }\n return client.availability.forAgent(params.agent_id, {\n start,\n end,\n duration: params.duration,\n slot_duration: params.slot_duration,\n include_busy: params.include_busy,\n });\n});\n\nexport const findMeetingTime = safeFunc(async (ctx: Ctx<{\n agents?: string[]; agent_ids?: string[];\n start?: string; end?: string; start_time?: string; end_time?: string;\n duration?: '15m' | '30m' | '45m' | '1h' | '2h';\n slot_duration?: '15m' | '30m' | '45m' | '1h' | '2h';\n calendars?: string[]; include_busy?: boolean;\n}>) => {\n const { client, params } = ctx;\n // Resolve the canonical `agents`/`start`/`end` from their REST/scheduling\n // aliases, mirroring the hosted MCP tool's validation. `duration`/`slot_duration`\n // are forwarded as-is; the API coalesces them (400 on conflicting values).\n const agents = params.agents ?? params.agent_ids;\n const start = params.start ?? params.start_time;\n const end = params.end ?? params.end_time;\n if (!agents || !start || !end) {\n throw new Error('agents (or agent_ids), start (or start_time), and end (or end_time) are required');\n }\n return client.availability.check({\n agents,\n start,\n end,\n duration: params.duration,\n slot_duration: params.slot_duration,\n calendars: params.calendars,\n include_busy: params.include_busy,\n });\n});\n\nexport const createConnectionLink = safeFunc(async (ctx: Ctx<{\n calendar_id: string;\n capabilities: Array<'availability' | 'publishing'>;\n publication_policy?: 'none' | 'confirmed' | 'confirmed_tentative';\n}>) => {\n const { calendar_id, ...params } = ctx.params;\n return ctx.client.connectionLinks.create(calendar_id, params);\n});\n\nexport const getConnectionLink = safeFunc(async (ctx: Ctx<{ connection_link_id: string }>) =>\n ctx.client.connectionLinks.get(ctx.params.connection_link_id));\n\nexport const cancelConnectionLink = safeFunc(async (ctx: Ctx<{ connection_link_id: string }>) => {\n await ctx.client.connectionLinks.cancel(ctx.params.connection_link_id);\n return { cancelled: true, id: ctx.params.connection_link_id };\n});\n\n// ── Calendar context ───────────────────────────────────────────\n\nexport const getCalendarContext = safeFunc(async (ctx: Ctx<{ calendar_id: string }>) => {\n return ctx.client.calendars.getContext(ctx.params.calendar_id);\n});\n\n// ── Scheduling proposals ───────────────────────────────────────\n\ninterface ProposalSlotInput {\n start_time: string;\n end_time: string;\n weight?: number;\n calendar_id?: string;\n}\n\nexport const createProposal = safeFunc(async (ctx: Ctx<{\n title: string; description?: string; organizer_agent_id: string;\n participant_agent_ids: string[]; calendar_id: string;\n slots: ProposalSlotInput[]; expires_at?: string;\n}>) => {\n return ctx.client.scheduling.create(ctx.params);\n});\n\nexport const listProposals = safeFunc(async (ctx: Ctx<{\n status?: 'pending' | 'confirmed' | 'expired' | 'cancelled'; organizer_agent_id?: string; limit?: number; offset?: number;\n}>) => {\n const { client, params } = ctx;\n const iter = client.scheduling.list({\n status: params.status,\n organizer_agent_id: params.organizer_agent_id,\n limit: params.limit,\n });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const getProposal = safeFunc(async (ctx: Ctx<{ proposal_id: string }>) => {\n return ctx.client.scheduling.get(ctx.params.proposal_id);\n});\n\nexport const respondToProposal = safeFunc(async (ctx: Ctx<{\n proposal_id: string; agent_id: string; response: 'accept' | 'decline' | 'counter';\n selected_slot_id?: string; counter_slots?: ProposalSlotInput[]; message?: string;\n}>) => {\n const { client, params } = ctx;\n const { proposal_id, ...body } = params;\n return client.scheduling.respond(proposal_id, body);\n});\n\nexport const resolveProposal = safeFunc(async (ctx: Ctx<{ proposal_id: string }>) => {\n return ctx.client.scheduling.resolve(ctx.params.proposal_id);\n});\n\nexport const cancelProposal = safeFunc(async (ctx: Ctx<{ proposal_id: string }>) => {\n return ctx.client.scheduling.cancel(ctx.params.proposal_id);\n});\n\n// ── Availability rules ─────────────────────────────────────────\n\ninterface WorkingHoursDayInput { start: string; end: string; }\ntype WorkingHoursInput = {\n mon?: WorkingHoursDayInput; tue?: WorkingHoursDayInput; wed?: WorkingHoursDayInput;\n thu?: WorkingHoursDayInput; fri?: WorkingHoursDayInput; sat?: WorkingHoursDayInput; sun?: WorkingHoursDayInput;\n} | null;\n\nexport const setAvailabilityRules = safeFunc(async (ctx: Ctx<{\n calendar_id: string; buffer_before_minutes?: number; buffer_after_minutes?: number;\n working_hours?: WorkingHoursInput; timezone?: string;\n}>) => {\n const { client, params } = ctx;\n const { calendar_id, ...rules } = params;\n return client.calendars.setAvailabilityRules(calendar_id, rules);\n});\n\nexport const getAvailabilityRules = safeFunc(async (ctx: Ctx<{ calendar_id: string }>) => {\n return ctx.client.calendars.getAvailabilityRules(ctx.params.calendar_id);\n});\n\nexport const clearAvailabilityRules = safeFunc(async (ctx: Ctx<{ calendar_id: string }>) => {\n await ctx.client.calendars.deleteAvailabilityRules(ctx.params.calendar_id);\n return undefined;\n});\n\n// ── Scoped keys ────────────────────────────────────────────────\n\nexport const createScopedKey = safeFunc(async (ctx: Ctx<{ agent_id: string; label?: string }>) => {\n return ctx.client.keys.create(ctx.params);\n});\n\nexport const listScopedKeys = safeFunc(async (ctx: Ctx) => {\n return ctx.client.keys.list();\n});\n\nexport const revokeScopedKey = safeFunc(async (ctx: Ctx<{ key_id: string }>) => {\n await ctx.client.keys.delete(ctx.params.key_id);\n return undefined;\n});\n\n// ── Webhooks ───────────────────────────────────────────────────\n\nexport const listWebhooks = safeFunc(async (ctx: Ctx<{ limit?: number; offset?: number }>) => {\n const { client, params } = ctx;\n const iter = client.webhooks.list({ limit: params.limit });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const getWebhook = safeFunc(async (ctx: Ctx<{ webhook_id: string }>) => {\n return ctx.client.webhooks.get(ctx.params.webhook_id);\n});\n\nexport const createWebhook = safeFunc(async (ctx: Ctx<{ url: string; events: string[] }>) => {\n return ctx.client.webhooks.create(ctx.params);\n});\n\nexport const updateWebhook = safeFunc(async (ctx: Ctx<{\n webhook_id: string; url?: string; events?: string[]; active?: boolean;\n}>) => {\n const { client, params } = ctx;\n const { webhook_id, ...updates } = params;\n return client.webhooks.update(webhook_id, updates);\n});\n\nexport const deleteWebhook = safeFunc(async (ctx: Ctx<{ webhook_id: string }>) => {\n await ctx.client.webhooks.delete(ctx.params.webhook_id);\n return undefined;\n});\n\nexport const listWebhookDeliveries = safeFunc(async (ctx: Ctx<{\n webhook_id: string; limit?: number; offset?: number;\n status?: 'pending' | 'delivered' | 'failed'; include_payload?: boolean;\n}>) => {\n const { client, params } = ctx;\n const { webhook_id, ...query } = params;\n return client.webhooks.listDeliveries(webhook_id, query);\n});\n\n// ── Audit log ──────────────────────────────────────────────────\n\nexport const getAuditLog = safeFunc(async (ctx: Ctx<{\n from?: string; to?: string; action?: string; actor_key_prefix?: string; cursor?: string; limit?: number;\n}>) => {\n return ctx.client.auditLog.list(ctx.params);\n});\n\n// ── Terms ──────────────────────────────────────────────────────\n\nexport const acceptTerms = safeFunc(async (ctx: Ctx<{ tos_version: string }>) => {\n return ctx.client.terms.accept(ctx.params);\n});\n\n// ── iCal Subscriptions ─────────────────────────────────────────\n\nexport const listICalSubscriptions = safeFunc(async (ctx: Ctx<{\n agent_id: string; status?: 'active' | 'error' | 'paused'; limit?: number; offset?: number;\n}>) => {\n const { client, params } = ctx;\n const iter = client.icalSubscriptions.list({\n agentId: params.agent_id,\n status: params.status,\n limit: params.limit,\n });\n return fetchPage(iter, params.offset, params.limit);\n});\n\nexport const getICalSubscription = safeFunc(async (ctx: Ctx<{ subscription_id: string }>) => {\n return ctx.client.icalSubscriptions.get(ctx.params.subscription_id);\n});\n\nexport const subscribeICal = safeFunc(async (ctx: Ctx<{\n agent_id: string; calendar_id: string; url: string; label?: string;\n}>) => {\n const { client, params } = ctx;\n const { agent_id, ...subParams } = params;\n return client.icalSubscriptions.create(agent_id, subParams);\n});\n\nexport const updateICalSubscription = safeFunc(async (ctx: Ctx<{\n subscription_id: string; label?: string; url?: string;\n}>) => {\n const { client, params } = ctx;\n const { subscription_id, ...updates } = params;\n return client.icalSubscriptions.update(subscription_id, updates);\n});\n\nexport const deleteICalSubscription = safeFunc(async (ctx: Ctx<{ subscription_id: string }>) => {\n await ctx.client.icalSubscriptions.delete(ctx.params.subscription_id);\n return undefined;\n});\n\nexport const syncICalSubscription = safeFunc(async (ctx: Ctx<{ subscription_id: string }>) => {\n return ctx.client.icalSubscriptions.sync(ctx.params.subscription_id);\n});\n\n// ── Usage ──────────────────────────────────────────────────────\n\nexport const getUsage = safeFunc(async (ctx: Ctx) => {\n return ctx.client.usage.get();\n});\n\n// ── Factory ────────────────────────────────────────────────────\n\n/** Map of tool name → executor function. Used by definitions.ts to wire up execute(). */\nexport function createExecutor(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n fn: (ctx: { client: Chronary; params: any }) => Promise<ToolResult>,\n): (client: Chronary, params: Record<string, unknown>) => Promise<ToolResult> {\n return (client, params) => fn({ client, params });\n}\n","import type { ToolDefinition } from './types';\nimport * as schemas from './schemas';\nimport * as fns from './functions';\nimport { createExecutor } from './functions';\n\nexport const HOSTED_API_MCP_TOOL_NAMES = [\n 'create_agent',\n 'list_agents',\n 'create_calendar',\n 'create_event',\n 'list_events',\n 'get_event',\n 'update_event',\n 'get_availability',\n 'find_meeting_time',\n 'create_connection_link',\n 'get_connection_link',\n 'cancel_connection_link',\n 'cancel_event',\n 'confirm_event',\n 'release_event',\n 'subscribe_ical',\n 'list_ical_subscriptions',\n 'get_ical_subscription',\n 'update_ical_subscription',\n 'delete_ical_subscription',\n 'sync_ical_subscription',\n 'get_calendar_context',\n 'create_proposal',\n 'list_proposals',\n 'get_proposal',\n 'respond_to_proposal',\n 'resolve_proposal',\n 'cancel_proposal',\n 'set_availability_rules',\n 'get_availability_rules',\n 'clear_availability_rules',\n 'create_scoped_key',\n 'list_scoped_keys',\n 'revoke_scoped_key',\n 'create_webhook',\n 'list_webhooks',\n 'get_webhook',\n 'update_webhook',\n 'delete_webhook',\n 'list_webhook_deliveries',\n 'get_agent',\n 'update_agent',\n 'delete_agent',\n 'list_calendars',\n 'get_calendar',\n 'update_calendar',\n 'delete_calendar',\n 'create_booking_page',\n 'list_booking_pages',\n 'get_booking_page',\n 'delete_booking_page',\n 'get_usage',\n 'get_audit_log',\n 'accept_terms',\n] as const;\n\nexport const TOOL_DEFINITIONS: ToolDefinition[] = [\n // ── Calendars ──────────────────────────────────────────────────\n {\n name: 'list_calendars',\n description: 'List calendars in the org. Org-level API keys see every calendar (agent-owned and shared); agent-scoped keys see only their own agent\\'s calendars. Use this to discover calendar IDs before creating or listing events.',\n schema: schemas.ListCalendarsSchema,\n annotations: { title: 'List Calendars', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listCalendars),\n },\n {\n name: 'get_calendar',\n description: 'Fetch a single calendar by ID, including its name, timezone, agent status, and default reminders. Agent-scoped keys may only read calendars owned by their agent.',\n schema: schemas.GetCalendarSchema,\n annotations: { title: 'Get Calendar', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getCalendar),\n },\n {\n name: 'create_calendar',\n description: 'Create a calendar to hold events and track availability. Calendars are required before creating events — call this first when setting up a new agent. An agent can have multiple calendars (e.g. \"Work\", \"Personal\"). Org-level calendars (no agent_id) can be used as shared resources like meeting rooms.',\n schema: schemas.CreateCalendarSchema,\n annotations: { title: 'Create Calendar', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.createCalendar),\n },\n {\n name: 'update_calendar',\n description: 'Update a calendar\\'s name, timezone, agent status, default reminders, or metadata. Agent-scoped keys may only update calendars owned by their agent.',\n schema: schemas.UpdateCalendarSchema,\n annotations: { title: 'Update Calendar', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.updateCalendar),\n },\n {\n name: 'delete_calendar',\n description: 'Delete a calendar (soft delete). Its events are no longer returned and it stops contributing to availability. Agent-scoped keys may only delete calendars owned by their agent.',\n schema: schemas.DeleteCalendarSchema,\n annotations: { title: 'Delete Calendar', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.deleteCalendar),\n },\n\n // ── Booking pages ──────────────────────────────────────────────\n {\n name: 'create_booking_page',\n description: 'Create a public booking page (a hosted scheduling link) for a calendar. Returns a booking_url to send to a human; when they pick a slot, a confirmed event is created on the calendar and an event.created webhook fires with a booking_page_id field. Set availability_constraints to restrict to weekly working hours; existing calendar events always block slots.',\n schema: schemas.CreateBookingPageSchema,\n annotations: { title: 'Create Booking Page', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.createBookingPage),\n },\n {\n name: 'list_booking_pages',\n description: 'List booking pages in the org. Agent-scoped keys see only pages on their own agent\\'s calendars.',\n schema: schemas.ListBookingPagesSchema,\n annotations: { title: 'List Booking Pages', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listBookingPages),\n },\n {\n name: 'get_booking_page',\n description: 'Fetch a single booking page by ID, including its public booking_url and settings.',\n schema: schemas.GetBookingPageSchema,\n annotations: { title: 'Get Booking Page', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getBookingPage),\n },\n {\n name: 'delete_booking_page',\n description: 'Delete (deactivate) a booking page. Its hosted URL stops resolving; already-booked events are unaffected.',\n schema: schemas.DeleteBookingPageSchema,\n annotations: { title: 'Delete Booking Page', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.deleteBookingPage),\n },\n\n // ── Events ─────────────────────────────────────────────────────\n {\n name: 'list_events',\n 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`.',\n schema: schemas.ListEventsSchema,\n annotations: { title: 'List Events', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listEvents),\n },\n {\n name: 'get_event',\n 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 — if omitted the calendar is resolved from the event. Provide `calendar_id` to fail fast on cross-calendar typos.',\n schema: schemas.GetEventSchema,\n annotations: { title: 'Get Event', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getEvent),\n },\n {\n name: 'create_event',\n description: 'Create a booking, appointment, meeting, hold, or any scheduled event on a calendar. The calendar_id comes from create_calendar or list_events. Once created, this event blocks the agent\\'s availability during that time and appears in availability queries. Use status=\"hold\" with hold_expires_at to tentatively reserve a slot that auto-releases on TTL.',\n schema: schemas.CreateEventSchema,\n annotations: { title: 'Create Event', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.createEvent),\n },\n {\n name: 'update_event',\n description: 'Reschedule or edit an event — 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 — if omitted it is resolved from the event.',\n schema: schemas.UpdateEventSchema,\n annotations: { title: 'Update Event', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.updateEvent),\n },\n {\n name: 'cancel_event',\n 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 — if omitted the calendar is looked up from the event. Provide `calendar_id` to fail fast on cross-calendar typos.',\n schema: schemas.CancelEventSchema,\n annotations: { title: 'Cancel Event', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.cancelEvent),\n },\n {\n name: 'confirm_event',\n 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.',\n schema: schemas.ConfirmEventSchema,\n annotations: { title: 'Confirm Event', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.confirmEvent),\n },\n {\n name: 'release_event',\n 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.',\n schema: schemas.ReleaseEventSchema,\n annotations: { title: 'Release Event', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.releaseEvent),\n },\n\n // ── Agents ─────────────────────────────────────────────────────\n {\n name: 'create_agent',\n description: 'Register your agent (AI assistant, human participant, or resource) with Chronary so it can own calendars, events, and webhooks.',\n schema: schemas.CreateAgentSchema,\n annotations: { title: 'Create Agent', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.createAgent),\n },\n {\n name: 'list_agents',\n description: 'List all agents in your organization',\n schema: schemas.ListAgentsSchema,\n annotations: { title: 'List Agents', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listAgents),\n },\n {\n name: 'get_agent',\n description: 'Fetch a single agent by ID. An agent represents an AI assistant, human, or shared resource (e.g. a meeting room). Agent-scoped API keys may only read their own agent.',\n schema: schemas.GetAgentSchema,\n annotations: { title: 'Get Agent', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getAgent),\n },\n {\n name: 'update_agent',\n description: 'Update an agent\\'s name, description, metadata, or status (active/paused). Requires an org-level API key — agent-scoped keys cannot mutate agents.',\n schema: schemas.UpdateAgentSchema,\n annotations: { title: 'Update Agent', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.updateAgent),\n },\n {\n name: 'delete_agent',\n description: 'Decommission an agent. This marks the agent as decommissioned and revokes all of its scoped API keys. Requires an org-level API key — agent-scoped keys cannot delete agents.',\n schema: schemas.DeleteAgentSchema,\n annotations: { title: 'Delete Agent', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.deleteAgent),\n },\n\n // ── Availability ───────────────────────────────────────────────\n {\n name: 'get_availability',\n description: 'Check when a single agent is free across its Chronary calendars and any human calendars authorized for that agent. This tool is fail-closed: always inspect `availability_state` and `warnings` before using slots. Accepts `start`/`end` or the `start_time`/`end_time` aliases.',\n schema: schemas.GetAvailabilitySchema,\n annotations: { title: 'Get Availability', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getAvailability),\n },\n {\n name: 'find_meeting_time',\n description: 'Find slots when multiple agents are free across Chronary calendars and any human calendars authorized for each agent. This tool is fail-closed: always inspect `availability_state` and `warnings` before using slots. Accepts `agents`/`start`/`end` or their aliases.',\n schema: schemas.FindMeetingTimeSchema,\n annotations: { title: 'Find Meeting Time', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.findMeetingTime),\n },\n {\n name: 'create_connection_link',\n 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.',\n schema: schemas.CreateConnectionLinkSchema,\n annotations: { title: 'Create Human Calendar Setup Link', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },\n execute: createExecutor(fns.createConnectionLink),\n },\n {\n name: 'get_connection_link',\n description: 'Poll a human-calendar setup request. Returns provider-neutral status and resulting connection ID when complete, but never replays the bearer setup URL or exposes human calendar data.',\n schema: schemas.GetConnectionLinkSchema,\n annotations: { title: 'Get Human Calendar Setup Status', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getConnectionLink),\n },\n {\n name: 'cancel_connection_link',\n description: 'Cancel a pending human-calendar setup request. This invalidates the setup URL and does not disconnect an already completed Google or Microsoft connection.',\n schema: schemas.CancelConnectionLinkSchema,\n annotations: { title: 'Cancel Human Calendar Setup Link', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.cancelConnectionLink),\n },\n\n // ── Calendar context ───────────────────────────────────────────\n {\n name: 'get_calendar_context',\n 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.',\n schema: schemas.GetCalendarContextSchema,\n annotations: { title: 'Get Calendar Context', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getCalendarContext),\n },\n\n // ── Scheduling proposals ───────────────────────────────────────\n {\n name: 'create_proposal',\n description: 'Create a scheduling proposal — send a set of candidate time slots to one or more participant agents so they can accept, decline, or counter-propose. The organizer agent owns the proposal; once every participant responds, the system auto-resolves to the highest-scoring slot (or cancels if all decline). Requires an org-level API key. Pro plan only.',\n schema: schemas.CreateProposalSchema,\n annotations: { title: 'Create Proposal', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.createProposal),\n },\n {\n name: 'list_proposals',\n description: 'List scheduling proposals for the org. Filter by status (pending|confirmed|expired|cancelled) or organizer_agent_id. Requires an org-level API key.',\n schema: schemas.ListProposalsSchema,\n annotations: { title: 'List Proposals', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listProposals),\n },\n {\n name: 'get_proposal',\n description: 'Get a scheduling proposal by id, including its slots and per-participant responses. Requires an org-level API key.',\n schema: schemas.GetProposalSchema,\n annotations: { title: 'Get Proposal', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getProposal),\n },\n {\n name: 'respond_to_proposal',\n 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 — no separate resolve call needed in the normal flow. Requires an org-level API key. Pro plan only.',\n schema: schemas.RespondToProposalSchema,\n annotations: { title: 'Respond To Proposal', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.respondToProposal),\n },\n {\n name: 'resolve_proposal',\n description: 'Force-resolve an open proposal using responses collected so far. Picks the highest-scoring slot among those accepted by the most participants and creates a confirmed calendar event. If every response was \"decline\", the proposal is cancelled instead. Use when you want to close out a proposal without waiting for every participant. Requires an org-level API key. Pro plan only.',\n schema: schemas.ResolveProposalSchema,\n annotations: { title: 'Resolve Proposal', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.resolveProposal),\n },\n {\n name: 'cancel_proposal',\n description: 'Cancel an open proposal. Fires a proposal.cancelled webhook with reason=\"organizer_cancelled\". Requires an org-level API key. Pro plan only.',\n schema: schemas.CancelProposalSchema,\n annotations: { title: 'Cancel Proposal', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.cancelProposal),\n },\n\n // ── Availability rules ─────────────────────────────────────────\n {\n name: 'set_availability_rules',\n description: 'Set or replace the availability rules on a calendar — buffer times before/after events and optional per-day working hours. When these rules are set, every availability query on this calendar automatically applies them (busy-block expansion for buffers, masking outside working hours). Upsert: overwrites any existing rules.',\n schema: schemas.SetAvailabilityRulesSchema,\n annotations: { title: 'Set Availability Rules', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.setAvailabilityRules),\n },\n {\n name: 'get_availability_rules',\n description: 'Read the buffer times and working-hours rules configured on a calendar. Returns the rules row, or an error if none are set.',\n schema: schemas.GetAvailabilityRulesSchema,\n annotations: { title: 'Get Availability Rules', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getAvailabilityRules),\n },\n {\n name: 'clear_availability_rules',\n description: 'Remove the availability rules from a calendar, reverting to the default (no buffers, no working-hours mask). Returns the deleted row, or an error if none were set.',\n schema: schemas.ClearAvailabilityRulesSchema,\n annotations: { title: 'Clear Availability Rules', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.clearAvailabilityRules),\n },\n\n // ── Webhooks ───────────────────────────────────────────────────\n {\n name: 'list_webhooks',\n description: 'List the org\\'s webhook subscriptions with their subscribed event types and active state. Signing secrets are never returned. Requires an org-level API key.',\n schema: schemas.ListWebhooksSchema,\n annotations: { title: 'List Webhooks', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listWebhooks),\n },\n {\n name: 'get_webhook',\n description: 'Get a single webhook subscription by id, including its subscribed event types and active state. The signing secret is never returned. Requires an org-level API key.',\n schema: schemas.GetWebhookSchema,\n annotations: { title: 'Get Webhook', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getWebhook),\n },\n {\n name: 'create_webhook',\n 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 — store it to verify the HMAC-SHA256 signature on delivered payloads. Requires an org-level API key.',\n schema: schemas.CreateWebhookSchema,\n annotations: { title: 'Create Webhook', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.createWebhook),\n },\n {\n name: 'update_webhook',\n description: 'Update a webhook subscription — change its delivery URL, the set of subscribed event types, or pause/resume it via active. At least one field must be supplied. Requires an org-level API key.',\n schema: schemas.UpdateWebhookSchema,\n annotations: { title: 'Update Webhook', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.updateWebhook),\n },\n {\n name: 'delete_webhook',\n description: 'Permanently delete a webhook subscription. This frees its endpoint slot against the per-plan cap. Requires an org-level API key.',\n schema: schemas.DeleteWebhookSchema,\n annotations: { title: 'Delete Webhook', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.deleteWebhook),\n },\n {\n name: 'list_webhook_deliveries',\n 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.',\n schema: schemas.ListWebhookDeliveriesSchema,\n annotations: { title: 'List Webhook Deliveries', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listWebhookDeliveries),\n },\n\n // ── iCal Subscriptions ─────────────────────────────────────────\n {\n name: 'list_ical_subscriptions',\n description: \"List an agent's external iCal feed subscriptions (e.g. linked Google Calendar / Outlook feeds), including their sync status and last sync time.\",\n schema: schemas.ListICalSubscriptionsSchema,\n annotations: { title: 'List iCal Subscriptions', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listICalSubscriptions),\n },\n {\n name: 'get_ical_subscription',\n description: 'Get a single external iCal feed subscription by id, including its sync status, last sync time, and last error.',\n schema: schemas.GetICalSubscriptionSchema,\n annotations: { title: 'Get iCal Subscription', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getICalSubscription),\n },\n {\n name: 'subscribe_ical',\n description: \"Link an external iCal feed (e.g. a human's Google Calendar) to an agent's calendar so external events appear in availability calculations. The target calendar must be owned by the specified agent — create the calendar with that agent_id first (org-level calendars without an agent_id cannot host external iCal subscriptions; create a dedicated per-agent calendar for sync targets).\",\n schema: schemas.SubscribeICalSchema,\n annotations: { title: 'Subscribe iCal', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },\n execute: createExecutor(fns.subscribeICal),\n },\n {\n name: 'update_ical_subscription',\n description: 'Update an external iCal feed subscription — change its label or its feed URL. Changing the URL forces a full re-sync on the next poll.',\n schema: schemas.UpdateICalSubscriptionSchema,\n annotations: { title: 'Update iCal Subscription', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.updateICalSubscription),\n },\n {\n name: 'delete_ical_subscription',\n description: 'Delete an external iCal feed subscription. Events previously synced from the feed are no longer refreshed.',\n schema: schemas.DeleteICalSubscriptionSchema,\n annotations: { title: 'Delete iCal Subscription', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.deleteICalSubscription),\n },\n {\n name: 'sync_ical_subscription',\n description: 'Trigger an immediate sync of an external iCal feed subscription instead of waiting for the next scheduled poll. Returns once the sync has been queued.',\n schema: schemas.SyncICalSubscriptionSchema,\n annotations: { title: 'Sync iCal Subscription', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },\n execute: createExecutor(fns.syncICalSubscription),\n },\n\n // ── Scoped keys ────────────────────────────────────────────────\n {\n name: 'create_scoped_key',\n description: 'Create an agent-scoped API key (chr_ak_*) that can only act on behalf of a single agent. Use this to self-provision or rotate per-agent credentials. The plaintext key is returned exactly once in the response — store it immediately, it cannot be retrieved later. Requires an org-level API key.',\n schema: schemas.CreateScopedKeySchema,\n annotations: { title: 'Create Scoped Key', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n execute: createExecutor(fns.createScopedKey),\n },\n {\n name: 'list_scoped_keys',\n description: 'List all live (non-revoked) agent-scoped API keys for this org. Returns key metadata only (id, prefix, agent_id, label, created_at) — never the plaintext secret. Requires an org-level API key.',\n schema: schemas.ListScopedKeysSchema,\n annotations: { title: 'List Scoped Keys', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.listScopedKeys),\n },\n {\n name: 'revoke_scoped_key',\n description: 'Revoke an agent-scoped API key by ID. Revocation is permanent (cannot be un-revoked); the key stops authenticating within about a minute. Requires an org-level API key.',\n schema: schemas.RevokeScopedKeySchema,\n annotations: { title: 'Revoke Scoped Key', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.revokeScopedKey),\n },\n\n // ── Audit log ──────────────────────────────────────────────────\n {\n name: 'get_audit_log',\n description: 'List audit-log entries for the calling org — mutating operations and auth-lifecycle events, newest first. Results are clamped to the plan\\'s retention window. Requires an org-level API key (chr_sk_*); agent-scoped keys cannot read the org-wide audit log.',\n schema: schemas.GetAuditLogSchema,\n annotations: { title: 'Get Audit Log', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getAuditLog),\n },\n\n // ── Terms ──────────────────────────────────────────────────────\n {\n name: 'accept_terms',\n 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 — a material ToS bump otherwise leaves MCP-only agents stuck without a console session. Pass the current tos_version (read it from GET /v1/auth/terms/current). Requires an org-level API key (chr_sk_*); agent-scoped keys cannot accept org-wide terms.',\n schema: schemas.AcceptTermsSchema,\n annotations: { title: 'Accept Terms', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.acceptTerms),\n },\n\n // ── Usage ──────────────────────────────────────────────────────\n {\n name: 'get_usage',\n description: 'Get the calling org\\'s current-period usage and plan limits (agents, calendars, events, API calls, webhooks, availability queries, iCal subscriptions, proposals, scoped keys, holds, cross-calendar queries). Requires an org-level API key (chr_sk_*); agent-scoped keys cannot read org-wide usage.',\n schema: schemas.GetUsageSchema,\n annotations: { title: 'Get Usage', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n execute: createExecutor(fns.getUsage),\n },\n];\n\nconst toolkitToolNames = new Set<string>(TOOL_DEFINITIONS.map((tool) => tool.name));\nconst hostedToolNames = new Set<string>(HOSTED_API_MCP_TOOL_NAMES);\n\nexport const TOOLKIT_MCP_PARITY = {\n hostedToolNames: HOSTED_API_MCP_TOOL_NAMES,\n missingHostedTools: HOSTED_API_MCP_TOOL_NAMES.filter((name) => !toolkitToolNames.has(name)),\n toolkitOnlyTools: TOOL_DEFINITIONS.map((tool) => tool.name).filter((name) => !hostedToolNames.has(name)),\n};\n","import { MapToolkit } from '../base';\nimport type { ToolDefinition, ChronaryToolkitConfig } from '../types';\n\n/**\n * Vercel AI SDK 6.x adapter.\n *\n * Returns tools as `Record<string, Tool>` compatible with `generateText({ tools })`.\n * Zod schemas are passed directly via `parameters` (AI SDK accepts Zod natively).\n *\n * @example\n * ```ts\n * import { ChronaryToolkit } from '@chronary/toolkit/ai-sdk';\n * import { generateText } from 'ai';\n *\n * const toolkit = new ChronaryToolkit({ apiKey: process.env.CHRONARY_API_KEY });\n * const result = await generateText({\n * model: openai('gpt-4o'),\n * tools: toolkit.getTools(),\n * prompt: 'Schedule a meeting tomorrow at 2pm',\n * });\n * ```\n */\nexport class ChronaryToolkit extends MapToolkit<{\n description: string;\n parameters: ToolDefinition['schema'];\n execute: (params: Record<string, unknown>) => Promise<unknown>;\n}> {\n constructor(config: ChronaryToolkitConfig) {\n super(config);\n }\n\n protected buildTool(def: ToolDefinition) {\n const client = this.client;\n return {\n description: def.description,\n parameters: def.schema,\n execute: async (params: Record<string, unknown>) => {\n const result = await def.execute(client, params);\n if (result.isError) throw new Error(result.result as string);\n return result.result;\n },\n };\n }\n}\n\n/** Convenience function that returns the tools map directly */\nexport function chronaryTools(config: ChronaryToolkitConfig) {\n return new ChronaryToolkit(config).getTools();\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;;;ACAzB,SAAS,SAAS;AAKlB,IAAM,sBAAsB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAM,4BAA4B,CAAC,WAAW,aAAa,QAAQ;AAI5D,IAAM,sBAAsB,EAAE,OAAO;AAAA,EAC1C,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,wIAAmI;AAAA,EAC5K,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,SAAS,mEAAmE;AAAA,EAChH,OAAO,EAAE,OAAO,E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