agent-orchestrator-mcp-server 0.2.4 → 0.3.0
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 +128 -3
- package/shared/orchestrator-client/orchestrator-client.integration-mock.js +313 -1
- package/shared/orchestrator-client/orchestrator-client.js +205 -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-sessions.d.ts +3 -10
- package/shared/tools/search-sessions.js +10 -15
- package/shared/tools/search-triggers.d.ts +78 -0
- package/shared/tools/search-triggers.js +145 -0
- package/shared/tools.d.ts +7 -9
- package/shared/tools.js +105 -32
- package/shared/types.d.ts +162 -1
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import type { IAgentOrchestratorClient } from '../orchestrator-client/orchestrator-client.js';
|
|
4
|
+
export declare const ActionTriggerSchema: z.ZodObject<{
|
|
5
|
+
action: z.ZodEnum<["create", "update", "delete", "toggle"]>;
|
|
6
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
name: z.ZodOptional<z.ZodString>;
|
|
8
|
+
trigger_type: z.ZodOptional<z.ZodEnum<["slack", "schedule"]>>;
|
|
9
|
+
agent_root_name: z.ZodOptional<z.ZodString>;
|
|
10
|
+
prompt_template: z.ZodOptional<z.ZodString>;
|
|
11
|
+
status: z.ZodOptional<z.ZodEnum<["enabled", "disabled"]>>;
|
|
12
|
+
stop_condition: z.ZodOptional<z.ZodString>;
|
|
13
|
+
reuse_session: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
mcp_servers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
15
|
+
configuration: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
action: "create" | "update" | "delete" | "toggle";
|
|
18
|
+
status?: "enabled" | "disabled" | undefined;
|
|
19
|
+
mcp_servers?: string[] | undefined;
|
|
20
|
+
trigger_type?: "slack" | "schedule" | undefined;
|
|
21
|
+
name?: string | undefined;
|
|
22
|
+
id?: number | undefined;
|
|
23
|
+
stop_condition?: string | undefined;
|
|
24
|
+
agent_root_name?: string | undefined;
|
|
25
|
+
prompt_template?: string | undefined;
|
|
26
|
+
reuse_session?: boolean | undefined;
|
|
27
|
+
configuration?: Record<string, unknown> | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
action: "create" | "update" | "delete" | "toggle";
|
|
30
|
+
status?: "enabled" | "disabled" | undefined;
|
|
31
|
+
mcp_servers?: string[] | undefined;
|
|
32
|
+
trigger_type?: "slack" | "schedule" | undefined;
|
|
33
|
+
name?: string | undefined;
|
|
34
|
+
id?: number | undefined;
|
|
35
|
+
stop_condition?: string | undefined;
|
|
36
|
+
agent_root_name?: string | undefined;
|
|
37
|
+
prompt_template?: string | undefined;
|
|
38
|
+
reuse_session?: boolean | undefined;
|
|
39
|
+
configuration?: Record<string, unknown> | undefined;
|
|
40
|
+
}>;
|
|
41
|
+
export declare function actionTriggerTool(_server: Server, clientFactory: () => IAgentOrchestratorClient): {
|
|
42
|
+
name: string;
|
|
43
|
+
description: string;
|
|
44
|
+
inputSchema: {
|
|
45
|
+
type: "object";
|
|
46
|
+
properties: {
|
|
47
|
+
action: {
|
|
48
|
+
type: string;
|
|
49
|
+
enum: readonly ["create", "update", "delete", "toggle"];
|
|
50
|
+
description: string;
|
|
51
|
+
};
|
|
52
|
+
id: {
|
|
53
|
+
type: string;
|
|
54
|
+
description: string;
|
|
55
|
+
};
|
|
56
|
+
name: {
|
|
57
|
+
type: string;
|
|
58
|
+
description: string;
|
|
59
|
+
};
|
|
60
|
+
trigger_type: {
|
|
61
|
+
type: string;
|
|
62
|
+
enum: string[];
|
|
63
|
+
description: string;
|
|
64
|
+
};
|
|
65
|
+
agent_root_name: {
|
|
66
|
+
type: string;
|
|
67
|
+
description: string;
|
|
68
|
+
};
|
|
69
|
+
prompt_template: {
|
|
70
|
+
type: string;
|
|
71
|
+
description: string;
|
|
72
|
+
};
|
|
73
|
+
status: {
|
|
74
|
+
type: string;
|
|
75
|
+
enum: string[];
|
|
76
|
+
description: string;
|
|
77
|
+
};
|
|
78
|
+
stop_condition: {
|
|
79
|
+
type: string;
|
|
80
|
+
description: string;
|
|
81
|
+
};
|
|
82
|
+
reuse_session: {
|
|
83
|
+
type: string;
|
|
84
|
+
description: string;
|
|
85
|
+
};
|
|
86
|
+
mcp_servers: {
|
|
87
|
+
type: string;
|
|
88
|
+
items: {
|
|
89
|
+
type: string;
|
|
90
|
+
};
|
|
91
|
+
description: string;
|
|
92
|
+
};
|
|
93
|
+
configuration: {
|
|
94
|
+
type: string;
|
|
95
|
+
description: string;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
required: string[];
|
|
99
|
+
};
|
|
100
|
+
handler: (args: unknown) => Promise<{
|
|
101
|
+
content: {
|
|
102
|
+
type: string;
|
|
103
|
+
text: string;
|
|
104
|
+
}[];
|
|
105
|
+
isError: boolean;
|
|
106
|
+
} | {
|
|
107
|
+
content: {
|
|
108
|
+
type: string;
|
|
109
|
+
text: string;
|
|
110
|
+
}[];
|
|
111
|
+
isError?: undefined;
|
|
112
|
+
}>;
|
|
113
|
+
};
|
|
114
|
+
//# sourceMappingURL=action-trigger.d.ts.map
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const ACTION_ENUM = ['create', 'update', 'delete', 'toggle'];
|
|
3
|
+
export const ActionTriggerSchema = z.object({
|
|
4
|
+
action: z.enum(ACTION_ENUM),
|
|
5
|
+
id: z.number().optional(),
|
|
6
|
+
name: z.string().optional(),
|
|
7
|
+
trigger_type: z.enum(['slack', 'schedule']).optional(),
|
|
8
|
+
agent_root_name: z.string().optional(),
|
|
9
|
+
prompt_template: z.string().optional(),
|
|
10
|
+
status: z.enum(['enabled', 'disabled']).optional(),
|
|
11
|
+
stop_condition: z.string().optional(),
|
|
12
|
+
reuse_session: z.boolean().optional(),
|
|
13
|
+
mcp_servers: z.array(z.string()).optional(),
|
|
14
|
+
configuration: z.record(z.unknown()).optional(),
|
|
15
|
+
});
|
|
16
|
+
const TOOL_DESCRIPTION = `Create, update, delete, or toggle automation triggers.
|
|
17
|
+
|
|
18
|
+
**Actions:**
|
|
19
|
+
- **create**: Create a new trigger (requires name, trigger_type, agent_root_name, prompt_template)
|
|
20
|
+
- **update**: Update an existing trigger (requires "id")
|
|
21
|
+
- **delete**: Delete a trigger (requires "id")
|
|
22
|
+
- **toggle**: Enable/disable a trigger (requires "id")
|
|
23
|
+
|
|
24
|
+
**Trigger types:**
|
|
25
|
+
- **slack**: Triggered by Slack events (requires configuration with channel_id)
|
|
26
|
+
- **schedule**: Triggered on a schedule (requires configuration with interval, unit, etc.)
|
|
27
|
+
|
|
28
|
+
Use search_triggers first to see available triggers and Slack channels.`;
|
|
29
|
+
export function actionTriggerTool(_server, clientFactory) {
|
|
30
|
+
return {
|
|
31
|
+
name: 'action_trigger',
|
|
32
|
+
description: TOOL_DESCRIPTION,
|
|
33
|
+
inputSchema: {
|
|
34
|
+
type: 'object',
|
|
35
|
+
properties: {
|
|
36
|
+
action: { type: 'string', enum: ACTION_ENUM, description: 'Action to perform.' },
|
|
37
|
+
id: { type: 'number', description: 'Trigger ID. Required for update, delete, toggle.' },
|
|
38
|
+
name: { type: 'string', description: 'Trigger name. Required for create.' },
|
|
39
|
+
trigger_type: {
|
|
40
|
+
type: 'string',
|
|
41
|
+
enum: ['slack', 'schedule'],
|
|
42
|
+
description: 'Trigger type. Required for create.',
|
|
43
|
+
},
|
|
44
|
+
agent_root_name: { type: 'string', description: 'Agent root name. Required for create.' },
|
|
45
|
+
prompt_template: { type: 'string', description: 'Prompt template. Required for create.' },
|
|
46
|
+
status: { type: 'string', enum: ['enabled', 'disabled'], description: 'Trigger status.' },
|
|
47
|
+
stop_condition: { type: 'string', description: 'Stop condition for triggered sessions.' },
|
|
48
|
+
reuse_session: { type: 'boolean', description: 'Whether to reuse existing sessions.' },
|
|
49
|
+
mcp_servers: {
|
|
50
|
+
type: 'array',
|
|
51
|
+
items: { type: 'string' },
|
|
52
|
+
description: 'MCP servers for triggered sessions.',
|
|
53
|
+
},
|
|
54
|
+
configuration: {
|
|
55
|
+
type: 'object',
|
|
56
|
+
description: 'Type-specific configuration (schedule, Slack channel, etc.).',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
required: ['action'],
|
|
60
|
+
},
|
|
61
|
+
handler: async (args) => {
|
|
62
|
+
try {
|
|
63
|
+
const validated = ActionTriggerSchema.parse(args);
|
|
64
|
+
const client = clientFactory();
|
|
65
|
+
const { action, id } = validated;
|
|
66
|
+
let result;
|
|
67
|
+
switch (action) {
|
|
68
|
+
case 'create': {
|
|
69
|
+
if (!validated.name ||
|
|
70
|
+
!validated.trigger_type ||
|
|
71
|
+
!validated.agent_root_name ||
|
|
72
|
+
!validated.prompt_template) {
|
|
73
|
+
return {
|
|
74
|
+
content: [
|
|
75
|
+
{
|
|
76
|
+
type: 'text',
|
|
77
|
+
text: 'Error: "name", "trigger_type", "agent_root_name", and "prompt_template" are required for the "create" action.',
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
isError: true,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
const trigger = await client.createTrigger({
|
|
84
|
+
name: validated.name,
|
|
85
|
+
trigger_type: validated.trigger_type,
|
|
86
|
+
agent_root_name: validated.agent_root_name,
|
|
87
|
+
prompt_template: validated.prompt_template,
|
|
88
|
+
status: validated.status,
|
|
89
|
+
stop_condition: validated.stop_condition,
|
|
90
|
+
reuse_session: validated.reuse_session,
|
|
91
|
+
mcp_servers: validated.mcp_servers,
|
|
92
|
+
configuration: validated.configuration,
|
|
93
|
+
});
|
|
94
|
+
result = [
|
|
95
|
+
'## Trigger Created',
|
|
96
|
+
'',
|
|
97
|
+
`- **ID:** ${trigger.id}`,
|
|
98
|
+
`- **Name:** ${trigger.name}`,
|
|
99
|
+
`- **Type:** ${trigger.trigger_type}`,
|
|
100
|
+
`- **Status:** ${trigger.status}`,
|
|
101
|
+
`- **Agent Root:** ${trigger.agent_root_name}`,
|
|
102
|
+
].join('\n');
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
case 'update': {
|
|
106
|
+
if (!id) {
|
|
107
|
+
return {
|
|
108
|
+
content: [
|
|
109
|
+
{ type: 'text', text: 'Error: "id" is required for the "update" action.' },
|
|
110
|
+
],
|
|
111
|
+
isError: true,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
const trigger = await client.updateTrigger(id, {
|
|
115
|
+
name: validated.name,
|
|
116
|
+
trigger_type: validated.trigger_type,
|
|
117
|
+
agent_root_name: validated.agent_root_name,
|
|
118
|
+
prompt_template: validated.prompt_template,
|
|
119
|
+
status: validated.status,
|
|
120
|
+
stop_condition: validated.stop_condition,
|
|
121
|
+
reuse_session: validated.reuse_session,
|
|
122
|
+
mcp_servers: validated.mcp_servers,
|
|
123
|
+
configuration: validated.configuration,
|
|
124
|
+
});
|
|
125
|
+
result = `## Trigger Updated\n\n- **ID:** ${trigger.id}\n- **Name:** ${trigger.name}\n- **Status:** ${trigger.status}`;
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
case 'delete': {
|
|
129
|
+
if (!id) {
|
|
130
|
+
return {
|
|
131
|
+
content: [
|
|
132
|
+
{ type: 'text', text: 'Error: "id" is required for the "delete" action.' },
|
|
133
|
+
],
|
|
134
|
+
isError: true,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
await client.deleteTrigger(id);
|
|
138
|
+
result = `## Trigger Deleted\n\nTrigger ${id} has been deleted.`;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
case 'toggle': {
|
|
142
|
+
if (!id) {
|
|
143
|
+
return {
|
|
144
|
+
content: [
|
|
145
|
+
{ type: 'text', text: 'Error: "id" is required for the "toggle" action.' },
|
|
146
|
+
],
|
|
147
|
+
isError: true,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
const trigger = await client.toggleTrigger(id);
|
|
151
|
+
result = `## Trigger Toggled\n\n- **ID:** ${trigger.id}\n- **Name:** ${trigger.name}\n- **New Status:** ${trigger.status}`;
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
default: {
|
|
155
|
+
const _exhaustiveCheck = action;
|
|
156
|
+
return {
|
|
157
|
+
content: [{ type: 'text', text: `Error: Unknown action "${_exhaustiveCheck}"` }],
|
|
158
|
+
isError: true,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return { content: [{ type: 'text', text: result }] };
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
return {
|
|
166
|
+
content: [
|
|
167
|
+
{
|
|
168
|
+
type: 'text',
|
|
169
|
+
text: `Error managing trigger: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
170
|
+
},
|
|
171
|
+
],
|
|
172
|
+
isError: true,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import type { IAgentOrchestratorClient } from '../orchestrator-client/orchestrator-client.js';
|
|
4
|
+
export declare const GetNotificationsSchema: z.ZodObject<{
|
|
5
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
badge_only: z.ZodOptional<z.ZodBoolean>;
|
|
7
|
+
status: z.ZodOptional<z.ZodEnum<["read", "unread"]>>;
|
|
8
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
per_page: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
per_page?: number | undefined;
|
|
12
|
+
status?: "read" | "unread" | undefined;
|
|
13
|
+
page?: number | undefined;
|
|
14
|
+
id?: number | undefined;
|
|
15
|
+
badge_only?: boolean | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
per_page?: number | undefined;
|
|
18
|
+
status?: "read" | "unread" | undefined;
|
|
19
|
+
page?: number | undefined;
|
|
20
|
+
id?: number | undefined;
|
|
21
|
+
badge_only?: boolean | undefined;
|
|
22
|
+
}>;
|
|
23
|
+
export declare function getNotificationsTool(_server: Server, clientFactory: () => IAgentOrchestratorClient): {
|
|
24
|
+
name: string;
|
|
25
|
+
description: string;
|
|
26
|
+
inputSchema: {
|
|
27
|
+
type: "object";
|
|
28
|
+
properties: {
|
|
29
|
+
id: {
|
|
30
|
+
type: string;
|
|
31
|
+
description: string;
|
|
32
|
+
};
|
|
33
|
+
badge_only: {
|
|
34
|
+
type: string;
|
|
35
|
+
description: string;
|
|
36
|
+
};
|
|
37
|
+
status: {
|
|
38
|
+
type: string;
|
|
39
|
+
enum: string[];
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
42
|
+
page: {
|
|
43
|
+
type: string;
|
|
44
|
+
minimum: number;
|
|
45
|
+
description: string;
|
|
46
|
+
};
|
|
47
|
+
per_page: {
|
|
48
|
+
type: string;
|
|
49
|
+
minimum: number;
|
|
50
|
+
maximum: number;
|
|
51
|
+
description: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
required: never[];
|
|
55
|
+
};
|
|
56
|
+
handler: (args: unknown) => Promise<{
|
|
57
|
+
content: {
|
|
58
|
+
type: string;
|
|
59
|
+
text: string;
|
|
60
|
+
}[];
|
|
61
|
+
isError?: undefined;
|
|
62
|
+
} | {
|
|
63
|
+
content: {
|
|
64
|
+
type: string;
|
|
65
|
+
text: string;
|
|
66
|
+
}[];
|
|
67
|
+
isError: boolean;
|
|
68
|
+
}>;
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=get-notifications.d.ts.map
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const GetNotificationsSchema = z.object({
|
|
3
|
+
id: z.number().optional(),
|
|
4
|
+
badge_only: z.boolean().optional(),
|
|
5
|
+
status: z.enum(['read', 'unread']).optional(),
|
|
6
|
+
page: z.number().min(1).optional(),
|
|
7
|
+
per_page: z.number().min(1).max(100).optional(),
|
|
8
|
+
});
|
|
9
|
+
const TOOL_DESCRIPTION = `Get notifications from the Agent Orchestrator.
|
|
10
|
+
|
|
11
|
+
**Modes:**
|
|
12
|
+
- **Badge only**: Set badge_only=true to get just the pending notification count
|
|
13
|
+
- **Get by ID**: Provide an id to get a specific notification
|
|
14
|
+
- **List**: List notifications with optional status filter and pagination
|
|
15
|
+
|
|
16
|
+
**Use cases:**
|
|
17
|
+
- Check how many unread notifications you have
|
|
18
|
+
- Review notification details
|
|
19
|
+
- Monitor session alerts`;
|
|
20
|
+
export function getNotificationsTool(_server, clientFactory) {
|
|
21
|
+
return {
|
|
22
|
+
name: 'get_notifications',
|
|
23
|
+
description: TOOL_DESCRIPTION,
|
|
24
|
+
inputSchema: {
|
|
25
|
+
type: 'object',
|
|
26
|
+
properties: {
|
|
27
|
+
id: { type: 'number', description: 'Get a specific notification by ID.' },
|
|
28
|
+
badge_only: {
|
|
29
|
+
type: 'boolean',
|
|
30
|
+
description: 'If true, returns only the pending notification count. Default: false',
|
|
31
|
+
},
|
|
32
|
+
status: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
enum: ['read', 'unread'],
|
|
35
|
+
description: 'Filter by status when listing.',
|
|
36
|
+
},
|
|
37
|
+
page: { type: 'number', minimum: 1, description: 'Page number. Default: 1' },
|
|
38
|
+
per_page: {
|
|
39
|
+
type: 'number',
|
|
40
|
+
minimum: 1,
|
|
41
|
+
maximum: 100,
|
|
42
|
+
description: 'Results per page. Default: 25',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
required: [],
|
|
46
|
+
},
|
|
47
|
+
handler: async (args) => {
|
|
48
|
+
try {
|
|
49
|
+
const validated = GetNotificationsSchema.parse(args);
|
|
50
|
+
const client = clientFactory();
|
|
51
|
+
if (validated.badge_only) {
|
|
52
|
+
const badge = await client.getNotificationBadge();
|
|
53
|
+
return {
|
|
54
|
+
content: [
|
|
55
|
+
{
|
|
56
|
+
type: 'text',
|
|
57
|
+
text: `## Notification Badge\n\n**Pending notifications:** ${badge.pending_count}`,
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
if (validated.id) {
|
|
63
|
+
const notification = await client.getNotification(validated.id);
|
|
64
|
+
const lines = [
|
|
65
|
+
`## Notification #${notification.id}`,
|
|
66
|
+
'',
|
|
67
|
+
`- **Type:** ${notification.notification_type}`,
|
|
68
|
+
`- **Read:** ${notification.read ? 'Yes' : 'No'}`,
|
|
69
|
+
`- **Session ID:** ${notification.session_id}`,
|
|
70
|
+
];
|
|
71
|
+
if (notification.session) {
|
|
72
|
+
lines.push(`- **Session Title:** ${notification.session.title}`);
|
|
73
|
+
lines.push(`- **Session Status:** ${notification.session.status}`);
|
|
74
|
+
}
|
|
75
|
+
lines.push(`- **Created:** ${notification.created_at}`);
|
|
76
|
+
return { content: [{ type: 'text', text: lines.join('\n') }] };
|
|
77
|
+
}
|
|
78
|
+
// List notifications
|
|
79
|
+
const response = await client.listNotifications({
|
|
80
|
+
status: validated.status,
|
|
81
|
+
page: validated.page,
|
|
82
|
+
per_page: validated.per_page,
|
|
83
|
+
});
|
|
84
|
+
if (response.notifications.length === 0) {
|
|
85
|
+
return {
|
|
86
|
+
content: [{ type: 'text', text: '## Notifications\n\nNo notifications found.' }],
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
const lines = [
|
|
90
|
+
`## Notifications (${response.pagination.total_count} total, page ${response.pagination.page} of ${response.pagination.total_pages})`,
|
|
91
|
+
'',
|
|
92
|
+
];
|
|
93
|
+
response.notifications.forEach((n) => {
|
|
94
|
+
const readStatus = n.read ? 'read' : 'unread';
|
|
95
|
+
const sessionInfo = n.session ? ` - ${n.session.title} (${n.session.status})` : '';
|
|
96
|
+
lines.push(`- **#${n.id}** [${readStatus}] ${n.notification_type}${sessionInfo} (${n.created_at})`);
|
|
97
|
+
});
|
|
98
|
+
return { content: [{ type: 'text', text: lines.join('\n') }] };
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
return {
|
|
102
|
+
content: [
|
|
103
|
+
{
|
|
104
|
+
type: 'text',
|
|
105
|
+
text: `Error getting notifications: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
isError: true,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
}
|
|
@@ -4,6 +4,7 @@ import type { IAgentOrchestratorClient } from '../orchestrator-client/orchestrat
|
|
|
4
4
|
export declare const GetSessionSchema: z.ZodObject<{
|
|
5
5
|
id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
6
6
|
include_transcript: z.ZodOptional<z.ZodBoolean>;
|
|
7
|
+
transcript_format: z.ZodOptional<z.ZodEnum<["text", "json"]>>;
|
|
7
8
|
include_logs: z.ZodOptional<z.ZodBoolean>;
|
|
8
9
|
logs_page: z.ZodOptional<z.ZodNumber>;
|
|
9
10
|
logs_per_page: z.ZodOptional<z.ZodNumber>;
|
|
@@ -13,6 +14,7 @@ export declare const GetSessionSchema: z.ZodObject<{
|
|
|
13
14
|
}, "strip", z.ZodTypeAny, {
|
|
14
15
|
id: string | number;
|
|
15
16
|
include_transcript?: boolean | undefined;
|
|
17
|
+
transcript_format?: "text" | "json" | undefined;
|
|
16
18
|
include_logs?: boolean | undefined;
|
|
17
19
|
logs_page?: number | undefined;
|
|
18
20
|
logs_per_page?: number | undefined;
|
|
@@ -22,6 +24,7 @@ export declare const GetSessionSchema: z.ZodObject<{
|
|
|
22
24
|
}, {
|
|
23
25
|
id: string | number;
|
|
24
26
|
include_transcript?: boolean | undefined;
|
|
27
|
+
transcript_format?: "text" | "json" | undefined;
|
|
25
28
|
include_logs?: boolean | undefined;
|
|
26
29
|
logs_page?: number | undefined;
|
|
27
30
|
logs_per_page?: number | undefined;
|
|
@@ -45,6 +48,11 @@ export declare function getSessionTool(_server: Server, clientFactory: () => IAg
|
|
|
45
48
|
type: string;
|
|
46
49
|
description: "Include the full transcript of the session. Default: false. Set to true for complete conversation history.";
|
|
47
50
|
};
|
|
51
|
+
transcript_format: {
|
|
52
|
+
type: string;
|
|
53
|
+
enum: string[];
|
|
54
|
+
description: "Format for transcript retrieval: \"text\" (human-readable) or \"json\" (structured). Only used when include_transcript is true. When specified, fetches transcript via dedicated endpoint instead of inline.";
|
|
55
|
+
};
|
|
48
56
|
include_logs: {
|
|
49
57
|
type: string;
|
|
50
58
|
description: "Include logs for the session. Default: false. Use logs_page and logs_per_page for pagination.";
|
|
@@ -2,6 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
const PARAM_DESCRIPTIONS = {
|
|
3
3
|
id: 'Session ID (numeric) or slug (string). Examples: "1", "fix-auth-bug-20250115"',
|
|
4
4
|
include_transcript: 'Include the full transcript of the session. Default: false. Set to true for complete conversation history.',
|
|
5
|
+
transcript_format: 'Format for transcript retrieval: "text" (human-readable) or "json" (structured). Only used when include_transcript is true. When specified, fetches transcript via dedicated endpoint instead of inline.',
|
|
5
6
|
include_logs: 'Include logs for the session. Default: false. Use logs_page and logs_per_page for pagination.',
|
|
6
7
|
logs_page: 'Page number for logs pagination. Default: 1',
|
|
7
8
|
logs_per_page: 'Number of logs per page (1-100). Default: 25',
|
|
@@ -12,6 +13,10 @@ const PARAM_DESCRIPTIONS = {
|
|
|
12
13
|
export const GetSessionSchema = z.object({
|
|
13
14
|
id: z.union([z.string(), z.number()]).describe(PARAM_DESCRIPTIONS.id),
|
|
14
15
|
include_transcript: z.boolean().optional().describe(PARAM_DESCRIPTIONS.include_transcript),
|
|
16
|
+
transcript_format: z
|
|
17
|
+
.enum(['text', 'json'])
|
|
18
|
+
.optional()
|
|
19
|
+
.describe(PARAM_DESCRIPTIONS.transcript_format),
|
|
15
20
|
include_logs: z.boolean().optional().describe(PARAM_DESCRIPTIONS.include_logs),
|
|
16
21
|
logs_page: z.number().min(1).optional().describe(PARAM_DESCRIPTIONS.logs_page),
|
|
17
22
|
logs_per_page: z.number().min(1).max(100).optional().describe(PARAM_DESCRIPTIONS.logs_per_page),
|
|
@@ -190,6 +195,11 @@ export function getSessionTool(_server, clientFactory) {
|
|
|
190
195
|
type: 'boolean',
|
|
191
196
|
description: PARAM_DESCRIPTIONS.include_transcript,
|
|
192
197
|
},
|
|
198
|
+
transcript_format: {
|
|
199
|
+
type: 'string',
|
|
200
|
+
enum: ['text', 'json'],
|
|
201
|
+
description: PARAM_DESCRIPTIONS.transcript_format,
|
|
202
|
+
},
|
|
193
203
|
include_logs: {
|
|
194
204
|
type: 'boolean',
|
|
195
205
|
description: PARAM_DESCRIPTIONS.include_logs,
|
|
@@ -227,9 +237,18 @@ export function getSessionTool(_server, clientFactory) {
|
|
|
227
237
|
try {
|
|
228
238
|
const validatedArgs = GetSessionSchema.parse(args);
|
|
229
239
|
const client = clientFactory();
|
|
230
|
-
// Get session details
|
|
231
|
-
const
|
|
240
|
+
// Get session details - if using transcript_format, fetch transcript separately
|
|
241
|
+
const useTranscriptEndpoint = validatedArgs.include_transcript && validatedArgs.transcript_format;
|
|
242
|
+
const session = await client.getSession(validatedArgs.id, validatedArgs.include_transcript && !useTranscriptEndpoint);
|
|
232
243
|
let output = formatSessionDetails(session, validatedArgs.include_transcript || false);
|
|
244
|
+
// If transcript_format specified, use dedicated transcript endpoint
|
|
245
|
+
if (useTranscriptEndpoint) {
|
|
246
|
+
const transcriptResponse = await client.getTranscript(session.id, validatedArgs.transcript_format);
|
|
247
|
+
output += '\n\n### Transcript';
|
|
248
|
+
output += '\n```';
|
|
249
|
+
output += `\n${transcriptResponse.transcript_text}`;
|
|
250
|
+
output += '\n```';
|
|
251
|
+
}
|
|
233
252
|
// Get logs if requested
|
|
234
253
|
if (validatedArgs.include_logs) {
|
|
235
254
|
const logsResponse = await client.listLogs(session.id, {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import type { IAgentOrchestratorClient } from '../orchestrator-client/orchestrator-client.js';
|
|
4
|
+
export declare const GetSystemHealthSchema: z.ZodObject<{
|
|
5
|
+
include_cli_status: z.ZodOptional<z.ZodBoolean>;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
include_cli_status?: boolean | undefined;
|
|
8
|
+
}, {
|
|
9
|
+
include_cli_status?: boolean | undefined;
|
|
10
|
+
}>;
|
|
11
|
+
export declare function getSystemHealthTool(_server: Server, clientFactory: () => IAgentOrchestratorClient): {
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
inputSchema: {
|
|
15
|
+
type: "object";
|
|
16
|
+
properties: {
|
|
17
|
+
include_cli_status: {
|
|
18
|
+
type: string;
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
required: never[];
|
|
23
|
+
};
|
|
24
|
+
handler: (args: unknown) => Promise<{
|
|
25
|
+
content: {
|
|
26
|
+
type: string;
|
|
27
|
+
text: string;
|
|
28
|
+
}[];
|
|
29
|
+
isError?: undefined;
|
|
30
|
+
} | {
|
|
31
|
+
content: {
|
|
32
|
+
type: string;
|
|
33
|
+
text: string;
|
|
34
|
+
}[];
|
|
35
|
+
isError: boolean;
|
|
36
|
+
}>;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=get-system-health.d.ts.map
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const GetSystemHealthSchema = z.object({
|
|
3
|
+
include_cli_status: z.boolean().optional(),
|
|
4
|
+
});
|
|
5
|
+
const TOOL_DESCRIPTION = `Get the system health report for the Agent Orchestrator.
|
|
6
|
+
|
|
7
|
+
Returns system health information including session counts, job queue status, and system metrics.
|
|
8
|
+
Optionally include CLI tool installation status.
|
|
9
|
+
|
|
10
|
+
**Use cases:**
|
|
11
|
+
- Monitor system health and performance
|
|
12
|
+
- Check for stuck sessions or failed jobs
|
|
13
|
+
- Verify CLI tools are properly installed`;
|
|
14
|
+
export function getSystemHealthTool(_server, clientFactory) {
|
|
15
|
+
return {
|
|
16
|
+
name: 'get_system_health',
|
|
17
|
+
description: TOOL_DESCRIPTION,
|
|
18
|
+
inputSchema: {
|
|
19
|
+
type: 'object',
|
|
20
|
+
properties: {
|
|
21
|
+
include_cli_status: {
|
|
22
|
+
type: 'boolean',
|
|
23
|
+
description: 'Include CLI tool installation status. Default: false',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
required: [],
|
|
27
|
+
},
|
|
28
|
+
handler: async (args) => {
|
|
29
|
+
try {
|
|
30
|
+
const validated = GetSystemHealthSchema.parse(args);
|
|
31
|
+
const client = clientFactory();
|
|
32
|
+
const health = await client.getHealth();
|
|
33
|
+
const lines = [
|
|
34
|
+
'## System Health Report',
|
|
35
|
+
'',
|
|
36
|
+
`- **Timestamp:** ${health.timestamp}`,
|
|
37
|
+
`- **Environment:** ${health.rails_env}`,
|
|
38
|
+
`- **Ruby Version:** ${health.ruby_version}`,
|
|
39
|
+
'',
|
|
40
|
+
'### Health Details',
|
|
41
|
+
'```json',
|
|
42
|
+
JSON.stringify(health.health_report, null, 2),
|
|
43
|
+
'```',
|
|
44
|
+
];
|
|
45
|
+
if (validated.include_cli_status) {
|
|
46
|
+
try {
|
|
47
|
+
const cliStatus = await client.getCliStatus();
|
|
48
|
+
lines.push('', '### CLI Status', `- **Unauthenticated CLIs:** ${cliStatus.unauthenticated_count}`, '', '```json', JSON.stringify(cliStatus.cli_status, null, 2), '```');
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
lines.push('', `*Could not fetch CLI status: ${error instanceof Error ? error.message : 'Unknown error'}*`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return { content: [{ type: 'text', text: lines.join('\n') }] };
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
return {
|
|
58
|
+
content: [
|
|
59
|
+
{
|
|
60
|
+
type: 'text',
|
|
61
|
+
text: `Error getting system health: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
isError: true,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|