@chronary/toolkit 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mcp.cjs CHANGED
@@ -1012,6 +1012,23 @@ var ListToolkit = class extends BaseToolkit {
1012
1012
  };
1013
1013
 
1014
1014
  // src/adapters/mcp.ts
1015
+ var ABOUT_MARKDOWN = `# Chronary
1016
+
1017
+ Calendar-as-a-service for AI agents. Give an agent its own calendars and
1018
+ events, coordinate availability across agents, run multi-party scheduling
1019
+ proposals, place auto-expiring holds, manage availability rules, sync external
1020
+ iCal feeds, and receive webhooks.
1021
+
1022
+ ## Getting started
1023
+ 1. \`create_agent\` \u2014 register an agent (skip if you already have one).
1024
+ 2. \`create_calendar\` \u2014 give the agent a calendar.
1025
+ 3. \`create_event\` / \`get_availability\` / \`find_meeting_time\` \u2014 schedule and coordinate.
1026
+
1027
+ ## Keys & plans
1028
+ Org keys (\`chr_sk_\`) can use every tool; agent-scoped keys (\`chr_ak_\`) are
1029
+ limited to their own agent and cannot use org-only tools such as
1030
+ \`create_agent\` or \`find_meeting_time\`. Temporal holds, cross-agent
1031
+ availability, and scheduling proposals require a Pro plan.`;
1015
1032
  var ChronaryToolkit = class extends ListToolkit {
1016
1033
  constructor(config) {
1017
1034
  super(config);
@@ -1048,6 +1065,126 @@ var ChronaryToolkit = class extends ListToolkit {
1048
1065
  );
1049
1066
  }
1050
1067
  }
1068
+ /**
1069
+ * Register the reusable prompt templates (MCP `prompts` capability) on an
1070
+ * McpServer. Mirrors the hosted server's four prompts so stdio and hosted
1071
+ * expose the same `prompts/list`. No-op if the server can't register prompts.
1072
+ */
1073
+ registerPrompts(server) {
1074
+ if (!server.registerPrompt) return;
1075
+ server.registerPrompt(
1076
+ "schedule_event",
1077
+ {
1078
+ title: "Schedule an event",
1079
+ description: "Create a calendar event on an agent's calendar at a specific time.",
1080
+ argsSchema: {
1081
+ calendar_id: import_zod2.z.string().describe("Target calendar ID (cal_...). Run list_calendars first if unknown."),
1082
+ title: import_zod2.z.string().describe("Event title"),
1083
+ start_time: import_zod2.z.string().describe("Start time, ISO 8601 (e.g. 2026-07-10T15:00:00Z)"),
1084
+ end_time: import_zod2.z.string().describe("End time, ISO 8601")
1085
+ }
1086
+ },
1087
+ ({ calendar_id, title, start_time, end_time }) => ({
1088
+ messages: [
1089
+ {
1090
+ role: "user",
1091
+ content: {
1092
+ type: "text",
1093
+ text: `Create an event on calendar ${calendar_id} titled "${title}" from ${start_time} to ${end_time}. Call the create_event tool with those arguments (calendar_id, title, start_time, end_time). If the calendar ID is unknown, call list_calendars first. Report the created event ID when done.`
1094
+ }
1095
+ }
1096
+ ]
1097
+ })
1098
+ );
1099
+ server.registerPrompt(
1100
+ "find_meeting_time",
1101
+ {
1102
+ title: "Find a meeting time",
1103
+ description: "Find a slot that works across several agents, then optionally book it.",
1104
+ argsSchema: {
1105
+ agent_ids: import_zod2.z.string().describe("Comma-separated agent IDs to coordinate (agt_...)."),
1106
+ duration: import_zod2.z.string().describe('Meeting length, e.g. "30m" or "1h".'),
1107
+ window: import_zod2.z.string().optional().describe('Optional ISO 8601 range to search, e.g. "2026-07-10T09:00:00Z/2026-07-10T18:00:00Z".')
1108
+ }
1109
+ },
1110
+ ({ agent_ids, duration, window }) => ({
1111
+ messages: [
1112
+ {
1113
+ role: "user",
1114
+ content: {
1115
+ type: "text",
1116
+ text: `Find a ${duration} slot that works for all of these agents: ${agent_ids}${window ? ` within ${window}` : ""}. Call the find_meeting_time tool (agents, duration, and start/end if a window is given). Present the top few candidate slots and ask which to book before calling create_event. (find_meeting_time requires a Pro plan.)`
1117
+ }
1118
+ }
1119
+ ]
1120
+ })
1121
+ );
1122
+ server.registerPrompt(
1123
+ "daily_agenda",
1124
+ {
1125
+ title: "Summarize an agent's day",
1126
+ description: "Get an agent's current status and upcoming schedule at a glance.",
1127
+ argsSchema: {
1128
+ agent_id: import_zod2.z.string().describe("Agent whose day to summarize (agt_...)."),
1129
+ date: import_zod2.z.string().optional().describe("Optional ISO 8601 date to focus on (defaults to today).")
1130
+ }
1131
+ },
1132
+ ({ agent_id, date }) => ({
1133
+ messages: [
1134
+ {
1135
+ role: "user",
1136
+ content: {
1137
+ type: "text",
1138
+ text: `Summarize agent ${agent_id}'s schedule${date ? ` for ${date}` : " for today"}. Use list_calendars to find the agent's calendar(s), then get_calendar_context for the current/next/upcoming events and status. Present a concise agenda.`
1139
+ }
1140
+ }
1141
+ ]
1142
+ })
1143
+ );
1144
+ server.registerPrompt(
1145
+ "new_scheduling_proposal",
1146
+ {
1147
+ title: "Propose a multi-party meeting",
1148
+ description: "Create a scheduling proposal offering several time slots to participants.",
1149
+ argsSchema: {
1150
+ title: import_zod2.z.string().describe("Proposal / meeting title"),
1151
+ organizer_agent_id: import_zod2.z.string().describe("Organizer agent ID (agt_...)."),
1152
+ participant_agent_ids: import_zod2.z.string().describe("Comma-separated participant agent IDs (agt_...).")
1153
+ }
1154
+ },
1155
+ ({ title, organizer_agent_id, participant_agent_ids }) => ({
1156
+ messages: [
1157
+ {
1158
+ role: "user",
1159
+ content: {
1160
+ type: "text",
1161
+ text: `Create a scheduling proposal "${title}" organized by ${organizer_agent_id} for participants ${participant_agent_ids}. First use get_availability / find_meeting_time to pick 2-3 candidate slots, then call create_proposal with those slots. Report the proposal ID. (Scheduling proposals require a Pro plan and an org-level key.)`
1162
+ }
1163
+ }
1164
+ ]
1165
+ })
1166
+ );
1167
+ }
1168
+ /**
1169
+ * Register the static `chronary://about` resource (MCP `resources` capability)
1170
+ * so stdio and hosted expose the same `resources/list`. No-op if the server
1171
+ * can't register resources.
1172
+ */
1173
+ registerResources(server) {
1174
+ if (!server.registerResource) return;
1175
+ server.registerResource(
1176
+ "about",
1177
+ "chronary://about",
1178
+ {
1179
+ title: "About Chronary",
1180
+ description: "What Chronary is and how to use its MCP tools.",
1181
+ mimeType: "text/markdown"
1182
+ },
1183
+ () => ({
1184
+ contents: [{ uri: "chronary://about", mimeType: "text/markdown", text: ABOUT_MARKDOWN }]
1185
+ })
1186
+ );
1187
+ }
1051
1188
  };
1052
1189
  // Annotate the CommonJS export names for ESM import in node:
1053
1190
  0 && (module.exports = {