agent-orchestrator-mcp-server 0.2.3 → 0.2.5
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/README.md +125 -30
- package/build/index.js +4 -4
- package/package.json +1 -1
- package/shared/orchestrator-client/orchestrator-client.d.ts +123 -1
- package/shared/orchestrator-client/orchestrator-client.integration-mock.js +313 -0
- package/shared/orchestrator-client/orchestrator-client.js +139 -0
- package/shared/resources.js +9 -4
- package/shared/tools/action-health.d.ts +58 -0
- package/shared/tools/action-health.js +101 -0
- package/shared/tools/action-notification.d.ts +46 -0
- package/shared/tools/action-notification.js +99 -0
- package/shared/tools/action-session.d.ts +33 -9
- package/shared/tools/action-session.js +177 -15
- package/shared/tools/action-trigger.d.ts +114 -0
- package/shared/tools/action-trigger.js +177 -0
- package/shared/tools/get-notifications.d.ts +70 -0
- package/shared/tools/get-notifications.js +113 -0
- package/shared/tools/get-session.d.ts +8 -0
- package/shared/tools/get-session.js +21 -2
- package/shared/tools/get-system-health.d.ts +38 -0
- package/shared/tools/get-system-health.js +69 -0
- package/shared/tools/get-transcript-archive.d.ts +27 -0
- package/shared/tools/get-transcript-archive.js +64 -0
- package/shared/tools/manage-enqueued-messages.d.ts +94 -0
- package/shared/tools/manage-enqueued-messages.js +259 -0
- package/shared/tools/search-triggers.d.ts +78 -0
- package/shared/tools/search-triggers.js +145 -0
- package/shared/tools/start-session.d.ts +1 -1
- package/shared/tools/start-session.js +5 -1
- package/shared/tools.d.ts +7 -9
- package/shared/tools.js +104 -31
- package/shared/types.d.ts +162 -0
package/shared/tools.js
CHANGED
|
@@ -1,51 +1,122 @@
|
|
|
1
1
|
import { ListToolsRequestSchema, CallToolRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
-
//
|
|
2
|
+
// 13 tools across 4 domains
|
|
3
3
|
import { searchSessionsTool } from './tools/search-sessions.js';
|
|
4
4
|
import { startSessionTool } from './tools/start-session.js';
|
|
5
5
|
import { getSessionTool } from './tools/get-session.js';
|
|
6
6
|
import { actionSessionTool } from './tools/action-session.js';
|
|
7
7
|
import { getConfigsTool } from './tools/get-configs.js';
|
|
8
|
+
import { manageEnqueuedMessagesTool } from './tools/manage-enqueued-messages.js';
|
|
8
9
|
import { sendPushNotificationTool } from './tools/send-push-notification.js';
|
|
9
|
-
|
|
10
|
+
import { getNotificationsTool } from './tools/get-notifications.js';
|
|
11
|
+
import { actionNotificationTool } from './tools/action-notification.js';
|
|
12
|
+
import { searchTriggersTool } from './tools/search-triggers.js';
|
|
13
|
+
import { actionTriggerTool } from './tools/action-trigger.js';
|
|
14
|
+
import { getSystemHealthTool } from './tools/get-system-health.js';
|
|
15
|
+
import { actionHealthTool } from './tools/action-health.js';
|
|
16
|
+
import { getTranscriptArchiveTool } from './tools/get-transcript-archive.js';
|
|
10
17
|
/**
|
|
11
|
-
*
|
|
12
|
-
|
|
18
|
+
* All valid tool groups (base groups and their _readonly variants)
|
|
19
|
+
*/
|
|
20
|
+
const VALID_TOOL_GROUPS = [
|
|
21
|
+
'sessions',
|
|
22
|
+
'sessions_readonly',
|
|
23
|
+
'notifications',
|
|
24
|
+
'notifications_readonly',
|
|
25
|
+
'triggers',
|
|
26
|
+
'triggers_readonly',
|
|
27
|
+
'health',
|
|
28
|
+
'health_readonly',
|
|
29
|
+
];
|
|
30
|
+
/**
|
|
31
|
+
* Base groups (without _readonly suffix) - used for default "all groups" behavior
|
|
32
|
+
*/
|
|
33
|
+
const BASE_TOOL_GROUPS = ['sessions', 'notifications', 'triggers', 'health'];
|
|
34
|
+
/**
|
|
35
|
+
* Parse enabled tool groups from environment variable or parameter.
|
|
36
|
+
* @param enabledGroupsParam - Comma-separated list of groups (e.g., "sessions,notifications")
|
|
13
37
|
* @returns Array of enabled tool groups
|
|
14
38
|
*/
|
|
15
39
|
export function parseEnabledToolGroups(enabledGroupsParam) {
|
|
16
|
-
|
|
17
|
-
|
|
40
|
+
const groupsStr = enabledGroupsParam || process.env.TOOL_GROUPS || '';
|
|
41
|
+
if (!groupsStr) {
|
|
42
|
+
// Default: all base groups enabled (full read+write access)
|
|
43
|
+
return [...BASE_TOOL_GROUPS];
|
|
18
44
|
}
|
|
19
|
-
const
|
|
20
|
-
const validGroups =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
45
|
+
const groups = groupsStr.split(',').map((g) => g.trim());
|
|
46
|
+
const validGroups = [];
|
|
47
|
+
for (const group of groups) {
|
|
48
|
+
if (VALID_TOOL_GROUPS.includes(group) &&
|
|
49
|
+
!validGroups.includes(group)) {
|
|
50
|
+
validGroups.push(group);
|
|
51
|
+
}
|
|
52
|
+
else if (!VALID_TOOL_GROUPS.includes(group)) {
|
|
53
|
+
console.warn(`Unknown tool group: ${group}`);
|
|
54
|
+
}
|
|
24
55
|
}
|
|
25
56
|
return validGroups;
|
|
26
57
|
}
|
|
27
58
|
/**
|
|
28
59
|
* All available tools with their group assignments.
|
|
29
|
-
* Tools can belong to multiple groups.
|
|
30
60
|
*
|
|
31
|
-
*
|
|
32
|
-
* - search_sessions: Search/list/get sessions by ID
|
|
33
|
-
* -
|
|
34
|
-
* -
|
|
35
|
-
* -
|
|
36
|
-
* -
|
|
37
|
-
* -
|
|
61
|
+
* 14 tools across 4 domains:
|
|
62
|
+
* - search_sessions: Search/list/get sessions by ID (sessions, read)
|
|
63
|
+
* - get_session: Get detailed session info with optional logs/transcripts (sessions, read)
|
|
64
|
+
* - get_configs: Fetch all static configuration (sessions, read)
|
|
65
|
+
* - get_transcript_archive: Get transcript archive download URL and metadata (sessions, read)
|
|
66
|
+
* - start_session: Create a new session (sessions, write)
|
|
67
|
+
* - action_session: Perform session actions (sessions, write)
|
|
68
|
+
* - manage_enqueued_messages: Manage session message queue (sessions, write)
|
|
69
|
+
* - get_notifications: Get/list notifications and badge count (notifications, read)
|
|
70
|
+
* - send_push_notification: Send a push notification (notifications, write)
|
|
71
|
+
* - action_notification: Mark read, dismiss notifications (notifications, write)
|
|
72
|
+
* - search_triggers: Search/list automation triggers (triggers, read)
|
|
73
|
+
* - action_trigger: Create, update, delete, toggle triggers (triggers, write)
|
|
74
|
+
* - get_system_health: Get system health report and CLI status (health, read)
|
|
75
|
+
* - action_health: System maintenance actions (health, write)
|
|
38
76
|
*/
|
|
39
77
|
const ALL_TOOLS = [
|
|
40
|
-
//
|
|
41
|
-
{ factory: searchSessionsTool,
|
|
42
|
-
{ factory: getSessionTool,
|
|
43
|
-
{ factory: getConfigsTool,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
{ factory:
|
|
47
|
-
{ factory:
|
|
78
|
+
// Session tools - read operations
|
|
79
|
+
{ factory: searchSessionsTool, group: 'sessions', isWriteOperation: false },
|
|
80
|
+
{ factory: getSessionTool, group: 'sessions', isWriteOperation: false },
|
|
81
|
+
{ factory: getConfigsTool, group: 'sessions', isWriteOperation: false },
|
|
82
|
+
{ factory: getTranscriptArchiveTool, group: 'sessions', isWriteOperation: false },
|
|
83
|
+
// Session tools - write operations
|
|
84
|
+
{ factory: startSessionTool, group: 'sessions', isWriteOperation: true },
|
|
85
|
+
{ factory: actionSessionTool, group: 'sessions', isWriteOperation: true },
|
|
86
|
+
{ factory: manageEnqueuedMessagesTool, group: 'sessions', isWriteOperation: true },
|
|
87
|
+
// Notification tools - read operations
|
|
88
|
+
{ factory: getNotificationsTool, group: 'notifications', isWriteOperation: false },
|
|
89
|
+
// Notification tools - write operations
|
|
90
|
+
{ factory: sendPushNotificationTool, group: 'notifications', isWriteOperation: true },
|
|
91
|
+
{ factory: actionNotificationTool, group: 'notifications', isWriteOperation: true },
|
|
92
|
+
// Trigger tools - read operations
|
|
93
|
+
{ factory: searchTriggersTool, group: 'triggers', isWriteOperation: false },
|
|
94
|
+
// Trigger tools - write operations
|
|
95
|
+
{ factory: actionTriggerTool, group: 'triggers', isWriteOperation: true },
|
|
96
|
+
// Health tools - read operations
|
|
97
|
+
{ factory: getSystemHealthTool, group: 'health', isWriteOperation: false },
|
|
98
|
+
// Health tools - write operations
|
|
99
|
+
{ factory: actionHealthTool, group: 'health', isWriteOperation: true },
|
|
48
100
|
];
|
|
101
|
+
/**
|
|
102
|
+
* Check if a tool should be included based on enabled groups.
|
|
103
|
+
* @param toolDef - The tool definition to check
|
|
104
|
+
* @param enabledGroups - Array of enabled tool groups
|
|
105
|
+
* @returns true if the tool should be included
|
|
106
|
+
*/
|
|
107
|
+
function shouldIncludeTool(toolDef, enabledGroups) {
|
|
108
|
+
const baseGroup = toolDef.group;
|
|
109
|
+
const readonlyGroup = `${baseGroup}_readonly`;
|
|
110
|
+
// Check if the base group (full access) is enabled
|
|
111
|
+
if (enabledGroups.includes(baseGroup)) {
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
// Check if the readonly group is enabled (only include read operations)
|
|
115
|
+
if (enabledGroups.includes(readonlyGroup) && !toolDef.isWriteOperation) {
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
49
120
|
/**
|
|
50
121
|
* Creates a function to register all tools with the server.
|
|
51
122
|
* This pattern uses individual tool files for better modularity and testability.
|
|
@@ -54,14 +125,16 @@ const ALL_TOOLS = [
|
|
|
54
125
|
* a factory pattern that accepts the server and clientFactory as parameters.
|
|
55
126
|
*
|
|
56
127
|
* @param clientFactory - Factory function that creates client instances
|
|
57
|
-
* @param enabledGroups - Optional
|
|
128
|
+
* @param enabledGroups - Optional string of enabled tool groups (defaults to all)
|
|
58
129
|
* @returns Function that registers all tools with a server
|
|
59
130
|
*/
|
|
60
131
|
export function createRegisterTools(clientFactory, enabledGroups) {
|
|
61
|
-
const groups = enabledGroups || parseEnabledToolGroups(process.env.ENABLED_TOOLGROUPS);
|
|
62
132
|
return (server) => {
|
|
63
|
-
|
|
64
|
-
|
|
133
|
+
const enabledToolGroups = parseEnabledToolGroups(enabledGroups);
|
|
134
|
+
// Filter tools based on enabled groups
|
|
135
|
+
const enabledTools = ALL_TOOLS.filter((toolDef) => shouldIncludeTool(toolDef, enabledToolGroups));
|
|
136
|
+
// Create tool instances
|
|
137
|
+
const tools = enabledTools.map((toolDef) => toolDef.factory(server, clientFactory));
|
|
65
138
|
// List available tools
|
|
66
139
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
67
140
|
return {
|
package/shared/types.d.ts
CHANGED
|
@@ -186,4 +186,166 @@ export interface UpdateSubagentTranscriptRequest {
|
|
|
186
186
|
total_tokens?: number;
|
|
187
187
|
tool_use_count?: number;
|
|
188
188
|
}
|
|
189
|
+
export type EnqueuedMessageStatus = 'pending' | 'processing' | 'sent';
|
|
190
|
+
export interface EnqueuedMessage {
|
|
191
|
+
id: number;
|
|
192
|
+
session_id: number;
|
|
193
|
+
content: string;
|
|
194
|
+
stop_condition: string | null;
|
|
195
|
+
position: number;
|
|
196
|
+
status: EnqueuedMessageStatus;
|
|
197
|
+
created_at: string;
|
|
198
|
+
updated_at: string;
|
|
199
|
+
}
|
|
200
|
+
export interface EnqueuedMessagesResponse {
|
|
201
|
+
enqueued_messages: EnqueuedMessage[];
|
|
202
|
+
pagination: Pagination;
|
|
203
|
+
}
|
|
204
|
+
export interface EnqueuedMessageResponse {
|
|
205
|
+
enqueued_message: EnqueuedMessage;
|
|
206
|
+
}
|
|
207
|
+
export interface EnqueuedMessageInterruptResponse {
|
|
208
|
+
session: Session;
|
|
209
|
+
message: string;
|
|
210
|
+
}
|
|
211
|
+
export type TriggerType = 'slack' | 'schedule';
|
|
212
|
+
export type TriggerStatus = 'enabled' | 'disabled';
|
|
213
|
+
export interface Trigger {
|
|
214
|
+
id: number;
|
|
215
|
+
name: string;
|
|
216
|
+
trigger_type: TriggerType;
|
|
217
|
+
status: TriggerStatus;
|
|
218
|
+
agent_root_name: string;
|
|
219
|
+
prompt_template: string;
|
|
220
|
+
stop_condition: string | null;
|
|
221
|
+
reuse_session: boolean;
|
|
222
|
+
mcp_servers: string[];
|
|
223
|
+
configuration: Record<string, unknown>;
|
|
224
|
+
schedule_description: string | null;
|
|
225
|
+
last_session_id: number | null;
|
|
226
|
+
last_triggered_at: string | null;
|
|
227
|
+
last_polled_at: string | null;
|
|
228
|
+
sessions_created_count: number;
|
|
229
|
+
created_at: string;
|
|
230
|
+
updated_at: string;
|
|
231
|
+
}
|
|
232
|
+
export interface TriggersResponse {
|
|
233
|
+
triggers: Trigger[];
|
|
234
|
+
pagination: Pagination;
|
|
235
|
+
}
|
|
236
|
+
export interface TriggerResponse {
|
|
237
|
+
trigger: Trigger;
|
|
238
|
+
recent_sessions?: Session[];
|
|
239
|
+
}
|
|
240
|
+
export interface TriggerChannelsResponse {
|
|
241
|
+
channels: Array<{
|
|
242
|
+
id: string;
|
|
243
|
+
name: string;
|
|
244
|
+
is_private: boolean;
|
|
245
|
+
num_members: number;
|
|
246
|
+
}>;
|
|
247
|
+
}
|
|
248
|
+
export interface CreateTriggerRequest {
|
|
249
|
+
name: string;
|
|
250
|
+
trigger_type: TriggerType;
|
|
251
|
+
agent_root_name: string;
|
|
252
|
+
prompt_template: string;
|
|
253
|
+
status?: TriggerStatus;
|
|
254
|
+
stop_condition?: string;
|
|
255
|
+
reuse_session?: boolean;
|
|
256
|
+
mcp_servers?: string[];
|
|
257
|
+
configuration?: Record<string, unknown>;
|
|
258
|
+
}
|
|
259
|
+
export interface UpdateTriggerRequest {
|
|
260
|
+
name?: string;
|
|
261
|
+
trigger_type?: TriggerType;
|
|
262
|
+
agent_root_name?: string;
|
|
263
|
+
prompt_template?: string;
|
|
264
|
+
status?: TriggerStatus;
|
|
265
|
+
stop_condition?: string;
|
|
266
|
+
reuse_session?: boolean;
|
|
267
|
+
mcp_servers?: string[];
|
|
268
|
+
configuration?: Record<string, unknown>;
|
|
269
|
+
}
|
|
270
|
+
export interface Notification {
|
|
271
|
+
id: number;
|
|
272
|
+
session_id: number;
|
|
273
|
+
notification_type: string;
|
|
274
|
+
read: boolean;
|
|
275
|
+
stale: boolean;
|
|
276
|
+
created_at: string;
|
|
277
|
+
updated_at: string;
|
|
278
|
+
session?: {
|
|
279
|
+
id: number;
|
|
280
|
+
slug: string | null;
|
|
281
|
+
title: string;
|
|
282
|
+
status: string;
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
export interface NotificationsResponse {
|
|
286
|
+
notifications: Notification[];
|
|
287
|
+
pagination: Pagination;
|
|
288
|
+
}
|
|
289
|
+
export interface NotificationResponse {
|
|
290
|
+
notification: Notification;
|
|
291
|
+
}
|
|
292
|
+
export interface NotificationBadgeResponse {
|
|
293
|
+
pending_count: number;
|
|
294
|
+
}
|
|
295
|
+
export interface NotificationMarkAllReadResponse {
|
|
296
|
+
marked_count: number;
|
|
297
|
+
pending_count: number;
|
|
298
|
+
}
|
|
299
|
+
export interface NotificationDismissAllReadResponse {
|
|
300
|
+
dismissed_count: number;
|
|
301
|
+
pending_count: number;
|
|
302
|
+
}
|
|
303
|
+
export interface HealthReport {
|
|
304
|
+
health_report: Record<string, unknown>;
|
|
305
|
+
timestamp: string;
|
|
306
|
+
rails_env: string;
|
|
307
|
+
ruby_version: string;
|
|
308
|
+
}
|
|
309
|
+
export interface HealthActionResponse {
|
|
310
|
+
[key: string]: unknown;
|
|
311
|
+
}
|
|
312
|
+
export interface CliStatusResponse {
|
|
313
|
+
cli_status: Record<string, unknown>;
|
|
314
|
+
unauthenticated_count: number;
|
|
315
|
+
}
|
|
316
|
+
export interface CliActionResponse {
|
|
317
|
+
queued: boolean;
|
|
318
|
+
message: string;
|
|
319
|
+
[key: string]: unknown;
|
|
320
|
+
}
|
|
321
|
+
export interface ForkSessionResponse {
|
|
322
|
+
session: Session;
|
|
323
|
+
message: string;
|
|
324
|
+
}
|
|
325
|
+
export interface RefreshSessionResponse {
|
|
326
|
+
session: Session;
|
|
327
|
+
message: string;
|
|
328
|
+
}
|
|
329
|
+
export interface RefreshAllSessionsResponse {
|
|
330
|
+
message: string;
|
|
331
|
+
refreshed: number;
|
|
332
|
+
restarted: number;
|
|
333
|
+
continued: number;
|
|
334
|
+
errors: number;
|
|
335
|
+
}
|
|
336
|
+
export interface BulkArchiveResponse {
|
|
337
|
+
archived_count: number;
|
|
338
|
+
errors: Array<{
|
|
339
|
+
id: number;
|
|
340
|
+
error: string;
|
|
341
|
+
}>;
|
|
342
|
+
}
|
|
343
|
+
export interface TranscriptResponse {
|
|
344
|
+
transcript_text: string;
|
|
345
|
+
}
|
|
346
|
+
export interface TranscriptArchiveStatusResponse {
|
|
347
|
+
generated_at: string;
|
|
348
|
+
session_count: number;
|
|
349
|
+
file_size_bytes: number;
|
|
350
|
+
}
|
|
189
351
|
//# sourceMappingURL=types.d.ts.map
|