@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 +137 -0
- package/dist/mcp.cjs.map +1 -1
- package/dist/mcp.d.cts +43 -1
- package/dist/mcp.d.ts +43 -1
- package/dist/mcp.js +137 -0
- package/dist/mcp.js.map +1 -1
- package/package.json +1 -1
package/dist/mcp.d.cts
CHANGED
|
@@ -21,12 +21,42 @@ type McpToolHandlerResult = {
|
|
|
21
21
|
}>;
|
|
22
22
|
isError?: boolean;
|
|
23
23
|
};
|
|
24
|
+
interface McpPromptRegistrationConfig {
|
|
25
|
+
title?: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
argsSchema?: ZodRawShape;
|
|
28
|
+
}
|
|
29
|
+
type McpPromptHandlerResult = {
|
|
30
|
+
messages: Array<{
|
|
31
|
+
role: 'user';
|
|
32
|
+
content: {
|
|
33
|
+
type: 'text';
|
|
34
|
+
text: string;
|
|
35
|
+
};
|
|
36
|
+
}>;
|
|
37
|
+
};
|
|
38
|
+
interface McpResourceRegistrationConfig {
|
|
39
|
+
title?: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
mimeType?: string;
|
|
42
|
+
}
|
|
43
|
+
type McpResourceHandlerResult = {
|
|
44
|
+
contents: Array<{
|
|
45
|
+
uri: string;
|
|
46
|
+
mimeType: string;
|
|
47
|
+
text: string;
|
|
48
|
+
}>;
|
|
49
|
+
};
|
|
24
50
|
/**
|
|
25
51
|
* Minimal shape of the MCP SDK's `McpServer` that the toolkit depends on.
|
|
26
52
|
* Matches `registerTool(name, config, handler)` from `@modelcontextprotocol/sdk` >= 1.10.
|
|
53
|
+
* `registerPrompt` / `registerResource` are optional so tool-only callers (and
|
|
54
|
+
* the test mocks) don't have to implement them.
|
|
27
55
|
*/
|
|
28
56
|
interface McpServerLike {
|
|
29
57
|
registerTool(name: string, config: McpToolRegistrationConfig, handler: (params: Record<string, unknown>) => Promise<McpToolHandlerResult>): unknown;
|
|
58
|
+
registerPrompt?(name: string, config: McpPromptRegistrationConfig, handler: (...args: any[]) => McpPromptHandlerResult | Promise<McpPromptHandlerResult>): unknown;
|
|
59
|
+
registerResource?(name: string, uri: string, config: McpResourceRegistrationConfig, handler: (...args: any[]) => McpResourceHandlerResult | Promise<McpResourceHandlerResult>): unknown;
|
|
30
60
|
}
|
|
31
61
|
/**
|
|
32
62
|
* MCP v1.x adapter.
|
|
@@ -52,6 +82,18 @@ declare class ChronaryToolkit extends ListToolkit<McpToolDefinition> {
|
|
|
52
82
|
* Uses `server.registerTool()` (MCP SDK v1.10+) so annotations reach the client.
|
|
53
83
|
*/
|
|
54
84
|
registerAll(server: McpServerLike): void;
|
|
85
|
+
/**
|
|
86
|
+
* Register the reusable prompt templates (MCP `prompts` capability) on an
|
|
87
|
+
* McpServer. Mirrors the hosted server's four prompts so stdio and hosted
|
|
88
|
+
* expose the same `prompts/list`. No-op if the server can't register prompts.
|
|
89
|
+
*/
|
|
90
|
+
registerPrompts(server: McpServerLike): void;
|
|
91
|
+
/**
|
|
92
|
+
* Register the static `chronary://about` resource (MCP `resources` capability)
|
|
93
|
+
* so stdio and hosted expose the same `resources/list`. No-op if the server
|
|
94
|
+
* can't register resources.
|
|
95
|
+
*/
|
|
96
|
+
registerResources(server: McpServerLike): void;
|
|
55
97
|
}
|
|
56
98
|
|
|
57
|
-
export { ChronaryToolkit, type McpServerLike, type McpToolDefinition, type McpToolHandlerResult, type McpToolRegistrationConfig };
|
|
99
|
+
export { ChronaryToolkit, type McpPromptHandlerResult, type McpPromptRegistrationConfig, type McpResourceHandlerResult, type McpResourceRegistrationConfig, type McpServerLike, type McpToolDefinition, type McpToolHandlerResult, type McpToolRegistrationConfig };
|
package/dist/mcp.d.ts
CHANGED
|
@@ -21,12 +21,42 @@ type McpToolHandlerResult = {
|
|
|
21
21
|
}>;
|
|
22
22
|
isError?: boolean;
|
|
23
23
|
};
|
|
24
|
+
interface McpPromptRegistrationConfig {
|
|
25
|
+
title?: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
argsSchema?: ZodRawShape;
|
|
28
|
+
}
|
|
29
|
+
type McpPromptHandlerResult = {
|
|
30
|
+
messages: Array<{
|
|
31
|
+
role: 'user';
|
|
32
|
+
content: {
|
|
33
|
+
type: 'text';
|
|
34
|
+
text: string;
|
|
35
|
+
};
|
|
36
|
+
}>;
|
|
37
|
+
};
|
|
38
|
+
interface McpResourceRegistrationConfig {
|
|
39
|
+
title?: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
mimeType?: string;
|
|
42
|
+
}
|
|
43
|
+
type McpResourceHandlerResult = {
|
|
44
|
+
contents: Array<{
|
|
45
|
+
uri: string;
|
|
46
|
+
mimeType: string;
|
|
47
|
+
text: string;
|
|
48
|
+
}>;
|
|
49
|
+
};
|
|
24
50
|
/**
|
|
25
51
|
* Minimal shape of the MCP SDK's `McpServer` that the toolkit depends on.
|
|
26
52
|
* Matches `registerTool(name, config, handler)` from `@modelcontextprotocol/sdk` >= 1.10.
|
|
53
|
+
* `registerPrompt` / `registerResource` are optional so tool-only callers (and
|
|
54
|
+
* the test mocks) don't have to implement them.
|
|
27
55
|
*/
|
|
28
56
|
interface McpServerLike {
|
|
29
57
|
registerTool(name: string, config: McpToolRegistrationConfig, handler: (params: Record<string, unknown>) => Promise<McpToolHandlerResult>): unknown;
|
|
58
|
+
registerPrompt?(name: string, config: McpPromptRegistrationConfig, handler: (...args: any[]) => McpPromptHandlerResult | Promise<McpPromptHandlerResult>): unknown;
|
|
59
|
+
registerResource?(name: string, uri: string, config: McpResourceRegistrationConfig, handler: (...args: any[]) => McpResourceHandlerResult | Promise<McpResourceHandlerResult>): unknown;
|
|
30
60
|
}
|
|
31
61
|
/**
|
|
32
62
|
* MCP v1.x adapter.
|
|
@@ -52,6 +82,18 @@ declare class ChronaryToolkit extends ListToolkit<McpToolDefinition> {
|
|
|
52
82
|
* Uses `server.registerTool()` (MCP SDK v1.10+) so annotations reach the client.
|
|
53
83
|
*/
|
|
54
84
|
registerAll(server: McpServerLike): void;
|
|
85
|
+
/**
|
|
86
|
+
* Register the reusable prompt templates (MCP `prompts` capability) on an
|
|
87
|
+
* McpServer. Mirrors the hosted server's four prompts so stdio and hosted
|
|
88
|
+
* expose the same `prompts/list`. No-op if the server can't register prompts.
|
|
89
|
+
*/
|
|
90
|
+
registerPrompts(server: McpServerLike): void;
|
|
91
|
+
/**
|
|
92
|
+
* Register the static `chronary://about` resource (MCP `resources` capability)
|
|
93
|
+
* so stdio and hosted expose the same `resources/list`. No-op if the server
|
|
94
|
+
* can't register resources.
|
|
95
|
+
*/
|
|
96
|
+
registerResources(server: McpServerLike): void;
|
|
55
97
|
}
|
|
56
98
|
|
|
57
|
-
export { ChronaryToolkit, type McpServerLike, type McpToolDefinition, type McpToolHandlerResult, type McpToolRegistrationConfig };
|
|
99
|
+
export { ChronaryToolkit, type McpPromptHandlerResult, type McpPromptRegistrationConfig, type McpResourceHandlerResult, type McpResourceRegistrationConfig, type McpServerLike, type McpToolDefinition, type McpToolHandlerResult, type McpToolRegistrationConfig };
|
package/dist/mcp.js
CHANGED
|
@@ -988,6 +988,23 @@ var ListToolkit = class extends BaseToolkit {
|
|
|
988
988
|
};
|
|
989
989
|
|
|
990
990
|
// src/adapters/mcp.ts
|
|
991
|
+
var ABOUT_MARKDOWN = `# Chronary
|
|
992
|
+
|
|
993
|
+
Calendar-as-a-service for AI agents. Give an agent its own calendars and
|
|
994
|
+
events, coordinate availability across agents, run multi-party scheduling
|
|
995
|
+
proposals, place auto-expiring holds, manage availability rules, sync external
|
|
996
|
+
iCal feeds, and receive webhooks.
|
|
997
|
+
|
|
998
|
+
## Getting started
|
|
999
|
+
1. \`create_agent\` \u2014 register an agent (skip if you already have one).
|
|
1000
|
+
2. \`create_calendar\` \u2014 give the agent a calendar.
|
|
1001
|
+
3. \`create_event\` / \`get_availability\` / \`find_meeting_time\` \u2014 schedule and coordinate.
|
|
1002
|
+
|
|
1003
|
+
## Keys & plans
|
|
1004
|
+
Org keys (\`chr_sk_\`) can use every tool; agent-scoped keys (\`chr_ak_\`) are
|
|
1005
|
+
limited to their own agent and cannot use org-only tools such as
|
|
1006
|
+
\`create_agent\` or \`find_meeting_time\`. Temporal holds, cross-agent
|
|
1007
|
+
availability, and scheduling proposals require a Pro plan.`;
|
|
991
1008
|
var ChronaryToolkit = class extends ListToolkit {
|
|
992
1009
|
constructor(config) {
|
|
993
1010
|
super(config);
|
|
@@ -1024,6 +1041,126 @@ var ChronaryToolkit = class extends ListToolkit {
|
|
|
1024
1041
|
);
|
|
1025
1042
|
}
|
|
1026
1043
|
}
|
|
1044
|
+
/**
|
|
1045
|
+
* Register the reusable prompt templates (MCP `prompts` capability) on an
|
|
1046
|
+
* McpServer. Mirrors the hosted server's four prompts so stdio and hosted
|
|
1047
|
+
* expose the same `prompts/list`. No-op if the server can't register prompts.
|
|
1048
|
+
*/
|
|
1049
|
+
registerPrompts(server) {
|
|
1050
|
+
if (!server.registerPrompt) return;
|
|
1051
|
+
server.registerPrompt(
|
|
1052
|
+
"schedule_event",
|
|
1053
|
+
{
|
|
1054
|
+
title: "Schedule an event",
|
|
1055
|
+
description: "Create a calendar event on an agent's calendar at a specific time.",
|
|
1056
|
+
argsSchema: {
|
|
1057
|
+
calendar_id: z2.string().describe("Target calendar ID (cal_...). Run list_calendars first if unknown."),
|
|
1058
|
+
title: z2.string().describe("Event title"),
|
|
1059
|
+
start_time: z2.string().describe("Start time, ISO 8601 (e.g. 2026-07-10T15:00:00Z)"),
|
|
1060
|
+
end_time: z2.string().describe("End time, ISO 8601")
|
|
1061
|
+
}
|
|
1062
|
+
},
|
|
1063
|
+
({ calendar_id, title, start_time, end_time }) => ({
|
|
1064
|
+
messages: [
|
|
1065
|
+
{
|
|
1066
|
+
role: "user",
|
|
1067
|
+
content: {
|
|
1068
|
+
type: "text",
|
|
1069
|
+
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.`
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
]
|
|
1073
|
+
})
|
|
1074
|
+
);
|
|
1075
|
+
server.registerPrompt(
|
|
1076
|
+
"find_meeting_time",
|
|
1077
|
+
{
|
|
1078
|
+
title: "Find a meeting time",
|
|
1079
|
+
description: "Find a slot that works across several agents, then optionally book it.",
|
|
1080
|
+
argsSchema: {
|
|
1081
|
+
agent_ids: z2.string().describe("Comma-separated agent IDs to coordinate (agt_...)."),
|
|
1082
|
+
duration: z2.string().describe('Meeting length, e.g. "30m" or "1h".'),
|
|
1083
|
+
window: z2.string().optional().describe('Optional ISO 8601 range to search, e.g. "2026-07-10T09:00:00Z/2026-07-10T18:00:00Z".')
|
|
1084
|
+
}
|
|
1085
|
+
},
|
|
1086
|
+
({ agent_ids, duration, window }) => ({
|
|
1087
|
+
messages: [
|
|
1088
|
+
{
|
|
1089
|
+
role: "user",
|
|
1090
|
+
content: {
|
|
1091
|
+
type: "text",
|
|
1092
|
+
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.)`
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
]
|
|
1096
|
+
})
|
|
1097
|
+
);
|
|
1098
|
+
server.registerPrompt(
|
|
1099
|
+
"daily_agenda",
|
|
1100
|
+
{
|
|
1101
|
+
title: "Summarize an agent's day",
|
|
1102
|
+
description: "Get an agent's current status and upcoming schedule at a glance.",
|
|
1103
|
+
argsSchema: {
|
|
1104
|
+
agent_id: z2.string().describe("Agent whose day to summarize (agt_...)."),
|
|
1105
|
+
date: z2.string().optional().describe("Optional ISO 8601 date to focus on (defaults to today).")
|
|
1106
|
+
}
|
|
1107
|
+
},
|
|
1108
|
+
({ agent_id, date }) => ({
|
|
1109
|
+
messages: [
|
|
1110
|
+
{
|
|
1111
|
+
role: "user",
|
|
1112
|
+
content: {
|
|
1113
|
+
type: "text",
|
|
1114
|
+
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.`
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
]
|
|
1118
|
+
})
|
|
1119
|
+
);
|
|
1120
|
+
server.registerPrompt(
|
|
1121
|
+
"new_scheduling_proposal",
|
|
1122
|
+
{
|
|
1123
|
+
title: "Propose a multi-party meeting",
|
|
1124
|
+
description: "Create a scheduling proposal offering several time slots to participants.",
|
|
1125
|
+
argsSchema: {
|
|
1126
|
+
title: z2.string().describe("Proposal / meeting title"),
|
|
1127
|
+
organizer_agent_id: z2.string().describe("Organizer agent ID (agt_...)."),
|
|
1128
|
+
participant_agent_ids: z2.string().describe("Comma-separated participant agent IDs (agt_...).")
|
|
1129
|
+
}
|
|
1130
|
+
},
|
|
1131
|
+
({ title, organizer_agent_id, participant_agent_ids }) => ({
|
|
1132
|
+
messages: [
|
|
1133
|
+
{
|
|
1134
|
+
role: "user",
|
|
1135
|
+
content: {
|
|
1136
|
+
type: "text",
|
|
1137
|
+
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.)`
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
]
|
|
1141
|
+
})
|
|
1142
|
+
);
|
|
1143
|
+
}
|
|
1144
|
+
/**
|
|
1145
|
+
* Register the static `chronary://about` resource (MCP `resources` capability)
|
|
1146
|
+
* so stdio and hosted expose the same `resources/list`. No-op if the server
|
|
1147
|
+
* can't register resources.
|
|
1148
|
+
*/
|
|
1149
|
+
registerResources(server) {
|
|
1150
|
+
if (!server.registerResource) return;
|
|
1151
|
+
server.registerResource(
|
|
1152
|
+
"about",
|
|
1153
|
+
"chronary://about",
|
|
1154
|
+
{
|
|
1155
|
+
title: "About Chronary",
|
|
1156
|
+
description: "What Chronary is and how to use its MCP tools.",
|
|
1157
|
+
mimeType: "text/markdown"
|
|
1158
|
+
},
|
|
1159
|
+
() => ({
|
|
1160
|
+
contents: [{ uri: "chronary://about", mimeType: "text/markdown", text: ABOUT_MARKDOWN }]
|
|
1161
|
+
})
|
|
1162
|
+
);
|
|
1163
|
+
}
|
|
1027
1164
|
};
|
|
1028
1165
|
export {
|
|
1029
1166
|
ChronaryToolkit
|