@orchestrator-claude/mcp-server 1.4.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/.mcp.json.example +11 -0
- package/README.md +180 -0
- package/dist/client/OrchestratorApiClient.d.ts +35 -0
- package/dist/client/OrchestratorApiClient.d.ts.map +1 -0
- package/dist/client/OrchestratorApiClient.js +121 -0
- package/dist/client/OrchestratorApiClient.js.map +1 -0
- package/dist/client/index.d.ts +8 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +7 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/types.d.ts +26 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +7 -0
- package/dist/client/types.js.map +1 -0
- package/dist/config.d.ts +12 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +17 -0
- package/dist/config.js.map +1 -0
- package/dist/errors/McpApiError.d.ts +23 -0
- package/dist/errors/McpApiError.d.ts.map +1 -0
- package/dist/errors/McpApiError.js +27 -0
- package/dist/errors/McpApiError.js.map +1 -0
- package/dist/handlers/context-handlers.d.ts +64 -0
- package/dist/handlers/context-handlers.d.ts.map +1 -0
- package/dist/handlers/context-handlers.js +67 -0
- package/dist/handlers/context-handlers.js.map +1 -0
- package/dist/handlers/gate-handlers.d.ts +63 -0
- package/dist/handlers/gate-handlers.d.ts.map +1 -0
- package/dist/handlers/gate-handlers.js +67 -0
- package/dist/handlers/gate-handlers.js.map +1 -0
- package/dist/handlers/index.d.ts +15 -0
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +241 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/handlers/metrics-handlers.d.ts +84 -0
- package/dist/handlers/metrics-handlers.d.ts.map +1 -0
- package/dist/handlers/metrics-handlers.js +87 -0
- package/dist/handlers/metrics-handlers.js.map +1 -0
- package/dist/handlers/pending-action-handlers.d.ts +81 -0
- package/dist/handlers/pending-action-handlers.d.ts.map +1 -0
- package/dist/handlers/pending-action-handlers.js +87 -0
- package/dist/handlers/pending-action-handlers.js.map +1 -0
- package/dist/handlers/workflow-handlers.d.ts +80 -0
- package/dist/handlers/workflow-handlers.d.ts.map +1 -0
- package/dist/handlers/workflow-handlers.js +87 -0
- package/dist/handlers/workflow-handlers.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +24 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +51 -0
- package/dist/server.js.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-handlers.js","sourceRoot":"","sources":["../../src/handlers/context-handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAA8B;IACpE,OAAO,KAAK,EAAE,MAA+B,EAAE,EAAE;QAC/C,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YAC5D,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;aACrE,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,WAAW,EAAE,CAAC;gBACjC,OAAO,KAAK,CAAC,UAAU,EAAE,CAAC;YAC5B,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,0BAA0B,CAAC,MAA8B;IACvE,OAAO,KAAK,EAAE,MAA+D,EAAE,EAAE;QAC/E,IAAI,CAAC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
+
* - createCheckpoint
|
|
7
|
+
* - validateArtifact
|
|
8
|
+
*/
|
|
9
|
+
import type { IOrchestratorApiClient } from '../client/types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Handler for evaluateGate tool
|
|
12
|
+
*/
|
|
13
|
+
export declare function createEvaluateGateHandler(client: IOrchestratorApiClient): (params: {
|
|
14
|
+
workflowId: string;
|
|
15
|
+
targetPhase: string;
|
|
16
|
+
}) => Promise<{
|
|
17
|
+
content: Array<{
|
|
18
|
+
type: string;
|
|
19
|
+
text: string;
|
|
20
|
+
}>;
|
|
21
|
+
isError: true;
|
|
22
|
+
} | {
|
|
23
|
+
content: {
|
|
24
|
+
type: string;
|
|
25
|
+
text: string;
|
|
26
|
+
}[];
|
|
27
|
+
}>;
|
|
28
|
+
/**
|
|
29
|
+
* Handler for createCheckpoint tool
|
|
30
|
+
*/
|
|
31
|
+
export declare function createCreateCheckpointHandler(client: IOrchestratorApiClient): (params: {
|
|
32
|
+
workflowId: string;
|
|
33
|
+
description: string;
|
|
34
|
+
}) => Promise<{
|
|
35
|
+
content: Array<{
|
|
36
|
+
type: string;
|
|
37
|
+
text: string;
|
|
38
|
+
}>;
|
|
39
|
+
isError: true;
|
|
40
|
+
} | {
|
|
41
|
+
content: {
|
|
42
|
+
type: string;
|
|
43
|
+
text: string;
|
|
44
|
+
}[];
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Handler for validateArtifact tool
|
|
48
|
+
*/
|
|
49
|
+
export declare function createValidateArtifactHandler(client: IOrchestratorApiClient): (params: {
|
|
50
|
+
artifactId: string;
|
|
51
|
+
}) => Promise<{
|
|
52
|
+
content: Array<{
|
|
53
|
+
type: string;
|
|
54
|
+
text: string;
|
|
55
|
+
}>;
|
|
56
|
+
isError: true;
|
|
57
|
+
} | {
|
|
58
|
+
content: {
|
|
59
|
+
type: string;
|
|
60
|
+
text: string;
|
|
61
|
+
}[];
|
|
62
|
+
}>;
|
|
63
|
+
//# sourceMappingURL=gate-handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gate-handlers.d.ts","sourceRoot":"","sources":["../../src/handlers/gate-handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAGjE;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,sBAAsB,IACxD,QAAQ;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;GAalE;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,sBAAsB,IAC5D,QAAQ;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;GAalE;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,sBAAsB,IAC5D,QAAQ;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;GAa7C"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gate Handlers
|
|
3
|
+
*
|
|
4
|
+
* MCP tool handlers for gate and checkpoint management:
|
|
5
|
+
* - evaluateGate
|
|
6
|
+
* - createCheckpoint
|
|
7
|
+
* - validateArtifact
|
|
8
|
+
*/
|
|
9
|
+
import { McpApiError } from '../errors/McpApiError.js';
|
|
10
|
+
/**
|
|
11
|
+
* Handler for evaluateGate tool
|
|
12
|
+
*/
|
|
13
|
+
export function createEvaluateGateHandler(client) {
|
|
14
|
+
return async (params) => {
|
|
15
|
+
try {
|
|
16
|
+
const response = await client.evaluateGate(params.workflowId, params.targetPhase);
|
|
17
|
+
return {
|
|
18
|
+
content: [{ type: 'text', text: JSON.stringify(response, null, 2) }],
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
if (error instanceof McpApiError) {
|
|
23
|
+
return error.toMcpError();
|
|
24
|
+
}
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Handler for createCheckpoint tool
|
|
31
|
+
*/
|
|
32
|
+
export function createCreateCheckpointHandler(client) {
|
|
33
|
+
return async (params) => {
|
|
34
|
+
try {
|
|
35
|
+
const response = await client.createCheckpoint(params.workflowId, params.description);
|
|
36
|
+
return {
|
|
37
|
+
content: [{ type: 'text', text: JSON.stringify(response, null, 2) }],
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
if (error instanceof McpApiError) {
|
|
42
|
+
return error.toMcpError();
|
|
43
|
+
}
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Handler for validateArtifact tool
|
|
50
|
+
*/
|
|
51
|
+
export function createValidateArtifactHandler(client) {
|
|
52
|
+
return async (params) => {
|
|
53
|
+
try {
|
|
54
|
+
const response = await client.validateArtifact(params.artifactId);
|
|
55
|
+
return {
|
|
56
|
+
content: [{ type: 'text', text: JSON.stringify(response, null, 2) }],
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
if (error instanceof McpApiError) {
|
|
61
|
+
return error.toMcpError();
|
|
62
|
+
}
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=gate-handlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gate-handlers.js","sourceRoot":"","sources":["../../src/handlers/gate-handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD;;GAEG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAA8B;IACtE,OAAO,KAAK,EAAE,MAAmD,EAAE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,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YAClE,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;aACrE,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,WAAW,EAAE,CAAC;gBACjC,OAAO,KAAK,CAAC,UAAU,EAAE,CAAC;YAC5B,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Handlers
|
|
3
|
+
*
|
|
4
|
+
* Registers all 18 MCP tools with the server.
|
|
5
|
+
*
|
|
6
|
+
* Note: Using type assertions for inputSchema because MCP SDK types expect Zod schemas
|
|
7
|
+
* but JSON Schema format is also supported at runtime.
|
|
8
|
+
*/
|
|
9
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
10
|
+
import type { IOrchestratorApiClient } from '../client/types.js';
|
|
11
|
+
/**
|
|
12
|
+
* Registers all 18 MCP tools with the server
|
|
13
|
+
*/
|
|
14
|
+
export declare function registerTools(server: McpServer, client: IOrchestratorApiClient): void;
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/handlers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAwCjE;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,sBAAsB,GAAG,IAAI,CAmTrF"}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Handlers
|
|
3
|
+
*
|
|
4
|
+
* Registers all 18 MCP tools with the server.
|
|
5
|
+
*
|
|
6
|
+
* Note: Using type assertions for inputSchema because MCP SDK types expect Zod schemas
|
|
7
|
+
* but JSON Schema format is also supported at runtime.
|
|
8
|
+
*/
|
|
9
|
+
// Workflow handlers
|
|
10
|
+
import { createDetectWorkflowHandler, createStartWorkflowHandler, createAdvancePhaseHandler, createGetStatusHandler, } from './workflow-handlers.js';
|
|
11
|
+
// Context handlers
|
|
12
|
+
import { createGetContextHandler, createExecuteActionHandler, createCanAdvanceHandler, } from './context-handlers.js';
|
|
13
|
+
// Gate handlers
|
|
14
|
+
import { createEvaluateGateHandler, createCreateCheckpointHandler, createValidateArtifactHandler, } from './gate-handlers.js';
|
|
15
|
+
// Pending action handlers
|
|
16
|
+
import { createGetNextActionHandler, createSetPendingActionHandler, createClearPendingActionHandler, createApproveActionHandler, } from './pending-action-handlers.js';
|
|
17
|
+
// Metrics handlers
|
|
18
|
+
import { createGetMetricsHandler, createGetInvocationsHandler, createStartAgentInvocationHandler, createCompleteAgentInvocationHandler, } from './metrics-handlers.js';
|
|
19
|
+
/**
|
|
20
|
+
* Registers all 18 MCP tools with the server
|
|
21
|
+
*/
|
|
22
|
+
export function registerTools(server, client) {
|
|
23
|
+
// Workflow Management Tools
|
|
24
|
+
// @ts-expect-error - JSON Schema format is supported
|
|
25
|
+
server.registerTool('detectWorkflow', {
|
|
26
|
+
description: 'Detect workflow type from user prompt',
|
|
27
|
+
inputSchema: {
|
|
28
|
+
type: 'object',
|
|
29
|
+
properties: {
|
|
30
|
+
prompt: { type: 'string', description: 'User prompt to analyze' },
|
|
31
|
+
},
|
|
32
|
+
required: ['prompt'],
|
|
33
|
+
},
|
|
34
|
+
}, createDetectWorkflowHandler(client));
|
|
35
|
+
// @ts-expect-error - JSON Schema format is supported
|
|
36
|
+
server.registerTool('startWorkflow', {
|
|
37
|
+
description: 'Start a new workflow',
|
|
38
|
+
inputSchema: {
|
|
39
|
+
type: 'object',
|
|
40
|
+
properties: {
|
|
41
|
+
type: { type: 'string', description: 'Workflow type (e.g., feature-development)' },
|
|
42
|
+
prompt: { type: 'string', description: 'User prompt or feature description' },
|
|
43
|
+
},
|
|
44
|
+
required: ['type', 'prompt'],
|
|
45
|
+
},
|
|
46
|
+
}, createStartWorkflowHandler(client));
|
|
47
|
+
// @ts-expect-error - JSON Schema format is supported
|
|
48
|
+
server.registerTool('advancePhase', {
|
|
49
|
+
description: 'Advance workflow to next phase',
|
|
50
|
+
inputSchema: {
|
|
51
|
+
type: 'object',
|
|
52
|
+
properties: {
|
|
53
|
+
workflowId: { type: 'string', description: 'Workflow ID' },
|
|
54
|
+
},
|
|
55
|
+
required: ['workflowId'],
|
|
56
|
+
},
|
|
57
|
+
}, createAdvancePhaseHandler(client));
|
|
58
|
+
// @ts-expect-error - JSON Schema format is supported
|
|
59
|
+
server.registerTool('getStatus', {
|
|
60
|
+
description: 'Get workflow status',
|
|
61
|
+
inputSchema: {
|
|
62
|
+
type: 'object',
|
|
63
|
+
properties: {
|
|
64
|
+
workflowId: { type: 'string', description: 'Workflow ID (optional, defaults to active)' },
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
}, createGetStatusHandler(client));
|
|
68
|
+
// V2 Context API Tools
|
|
69
|
+
// @ts-expect-error - JSON Schema format is supported
|
|
70
|
+
server.registerTool('getContext', {
|
|
71
|
+
description: 'Get workflow context with available actions (V2 deterministic API)',
|
|
72
|
+
inputSchema: {
|
|
73
|
+
type: 'object',
|
|
74
|
+
properties: {
|
|
75
|
+
workflowId: { type: 'string', description: 'Workflow ID (optional, defaults to active)' },
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
}, createGetContextHandler(client));
|
|
79
|
+
// @ts-expect-error - JSON Schema format is supported
|
|
80
|
+
server.registerTool('executeAction', {
|
|
81
|
+
description: 'Execute a workflow action (V2 deterministic API)',
|
|
82
|
+
inputSchema: {
|
|
83
|
+
type: 'object',
|
|
84
|
+
properties: {
|
|
85
|
+
workflowId: { type: 'string', description: 'Workflow ID' },
|
|
86
|
+
action: { type: 'string', description: 'Action name to execute' },
|
|
87
|
+
prompt: { type: 'string', description: 'Optional prompt for the action' },
|
|
88
|
+
},
|
|
89
|
+
required: ['workflowId', 'action'],
|
|
90
|
+
},
|
|
91
|
+
}, createExecuteActionHandler(client));
|
|
92
|
+
// @ts-expect-error - JSON Schema format is supported
|
|
93
|
+
server.registerTool('canAdvance', {
|
|
94
|
+
description: 'Check if workflow can advance to target phase (V2 API)',
|
|
95
|
+
inputSchema: {
|
|
96
|
+
type: 'object',
|
|
97
|
+
properties: {
|
|
98
|
+
workflowId: { type: 'string', description: 'Workflow ID' },
|
|
99
|
+
targetPhase: { type: 'string', description: 'Target phase name' },
|
|
100
|
+
},
|
|
101
|
+
required: ['workflowId', 'targetPhase'],
|
|
102
|
+
},
|
|
103
|
+
}, createCanAdvanceHandler(client));
|
|
104
|
+
// Gate & Checkpoint Tools
|
|
105
|
+
// @ts-expect-error - JSON Schema format is supported
|
|
106
|
+
server.registerTool('evaluateGate', {
|
|
107
|
+
description: 'Evaluate phase gate for workflow',
|
|
108
|
+
inputSchema: {
|
|
109
|
+
type: 'object',
|
|
110
|
+
properties: {
|
|
111
|
+
workflowId: { type: 'string', description: 'Workflow ID' },
|
|
112
|
+
targetPhase: { type: 'string', description: 'Target phase to evaluate' },
|
|
113
|
+
},
|
|
114
|
+
required: ['workflowId', 'targetPhase'],
|
|
115
|
+
},
|
|
116
|
+
}, createEvaluateGateHandler(client));
|
|
117
|
+
// @ts-expect-error - JSON Schema format is supported
|
|
118
|
+
server.registerTool('createCheckpoint', {
|
|
119
|
+
description: 'Create a git checkpoint for workflow',
|
|
120
|
+
inputSchema: {
|
|
121
|
+
type: 'object',
|
|
122
|
+
properties: {
|
|
123
|
+
workflowId: { type: 'string', description: 'Workflow ID' },
|
|
124
|
+
description: { type: 'string', description: 'Checkpoint description' },
|
|
125
|
+
},
|
|
126
|
+
required: ['workflowId', 'description'],
|
|
127
|
+
},
|
|
128
|
+
}, createCreateCheckpointHandler(client));
|
|
129
|
+
// @ts-expect-error - JSON Schema format is supported
|
|
130
|
+
server.registerTool('validateArtifact', {
|
|
131
|
+
description: 'Validate artifact against schema',
|
|
132
|
+
inputSchema: {
|
|
133
|
+
type: 'object',
|
|
134
|
+
properties: {
|
|
135
|
+
artifactId: { type: 'string', description: 'Artifact ID to validate' },
|
|
136
|
+
},
|
|
137
|
+
required: ['artifactId'],
|
|
138
|
+
},
|
|
139
|
+
}, createValidateArtifactHandler(client));
|
|
140
|
+
// Pending Action Tools
|
|
141
|
+
// @ts-expect-error - JSON Schema format is supported
|
|
142
|
+
server.registerTool('getNextAction', {
|
|
143
|
+
description: 'Get next pending action for workflow (Ping-Pong pattern)',
|
|
144
|
+
inputSchema: {
|
|
145
|
+
type: 'object',
|
|
146
|
+
properties: {
|
|
147
|
+
workflowId: { type: 'string', description: 'Workflow ID (optional, defaults to active)' },
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
}, createGetNextActionHandler(client));
|
|
151
|
+
// @ts-expect-error - JSON Schema format is supported
|
|
152
|
+
server.registerTool('setPendingAction', {
|
|
153
|
+
description: 'Set a pending action for workflow',
|
|
154
|
+
inputSchema: {
|
|
155
|
+
type: 'object',
|
|
156
|
+
properties: {
|
|
157
|
+
workflowId: { type: 'string', description: 'Workflow ID' },
|
|
158
|
+
action: {
|
|
159
|
+
type: 'object',
|
|
160
|
+
description: 'Action details (agent, status, prompt, etc.)',
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
required: ['workflowId', 'action'],
|
|
164
|
+
},
|
|
165
|
+
}, createSetPendingActionHandler(client));
|
|
166
|
+
// @ts-expect-error - JSON Schema format is supported
|
|
167
|
+
server.registerTool('clearPendingAction', {
|
|
168
|
+
description: 'Clear pending action for workflow',
|
|
169
|
+
inputSchema: {
|
|
170
|
+
type: 'object',
|
|
171
|
+
properties: {
|
|
172
|
+
workflowId: { type: 'string', description: 'Workflow ID' },
|
|
173
|
+
result: {
|
|
174
|
+
type: 'object',
|
|
175
|
+
description: 'Optional result data from action completion',
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
required: ['workflowId'],
|
|
179
|
+
},
|
|
180
|
+
}, createClearPendingActionHandler(client));
|
|
181
|
+
// @ts-expect-error - JSON Schema format is supported
|
|
182
|
+
server.registerTool('approveAction', {
|
|
183
|
+
description: 'Approve a pending action (e.g., before IMPLEMENT phase)',
|
|
184
|
+
inputSchema: {
|
|
185
|
+
type: 'object',
|
|
186
|
+
properties: {
|
|
187
|
+
workflowId: { type: 'string', description: 'Workflow ID' },
|
|
188
|
+
},
|
|
189
|
+
required: ['workflowId'],
|
|
190
|
+
},
|
|
191
|
+
}, createApproveActionHandler(client));
|
|
192
|
+
// Metrics & Invocation Tools
|
|
193
|
+
// @ts-expect-error - JSON Schema format is supported
|
|
194
|
+
server.registerTool('getMetrics', {
|
|
195
|
+
description: 'Get workflow metrics',
|
|
196
|
+
inputSchema: {
|
|
197
|
+
type: 'object',
|
|
198
|
+
properties: {
|
|
199
|
+
workflowId: { type: 'string', description: 'Workflow ID (optional, defaults to active)' },
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
}, createGetMetricsHandler(client));
|
|
203
|
+
// @ts-expect-error - JSON Schema format is supported
|
|
204
|
+
server.registerTool('getInvocations', {
|
|
205
|
+
description: 'Get agent invocation history',
|
|
206
|
+
inputSchema: {
|
|
207
|
+
type: 'object',
|
|
208
|
+
properties: {
|
|
209
|
+
workflowId: { type: 'string', description: 'Workflow ID (optional, defaults to active)' },
|
|
210
|
+
limit: { type: 'number', description: 'Maximum number of invocations to return' },
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
}, createGetInvocationsHandler(client));
|
|
214
|
+
// @ts-expect-error - JSON Schema format is supported
|
|
215
|
+
server.registerTool('startAgentInvocation', {
|
|
216
|
+
description: 'Start tracking an agent invocation',
|
|
217
|
+
inputSchema: {
|
|
218
|
+
type: 'object',
|
|
219
|
+
properties: {
|
|
220
|
+
agentName: { type: 'string', description: 'Name of the agent' },
|
|
221
|
+
phase: { type: 'string', description: 'Workflow phase' },
|
|
222
|
+
workflowId: { type: 'string', description: 'Workflow ID (optional)' },
|
|
223
|
+
},
|
|
224
|
+
required: ['agentName', 'phase'],
|
|
225
|
+
},
|
|
226
|
+
}, createStartAgentInvocationHandler(client));
|
|
227
|
+
// @ts-expect-error - JSON Schema format is supported
|
|
228
|
+
server.registerTool('completeAgentInvocation', {
|
|
229
|
+
description: 'Mark agent invocation as complete',
|
|
230
|
+
inputSchema: {
|
|
231
|
+
type: 'object',
|
|
232
|
+
properties: {
|
|
233
|
+
invocationId: { type: 'string', description: 'Invocation ID' },
|
|
234
|
+
status: { type: 'string', description: 'Completion status (completed, failed, etc.)' },
|
|
235
|
+
summary: { type: 'string', description: 'Optional summary of invocation result' },
|
|
236
|
+
},
|
|
237
|
+
required: ['invocationId', 'status'],
|
|
238
|
+
},
|
|
239
|
+
}, createCompleteAgentInvocationHandler(client));
|
|
240
|
+
}
|
|
241
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/handlers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,oBAAoB;AACpB,OAAO,EACL,2BAA2B,EAC3B,0BAA0B,EAC1B,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAEhC,mBAAmB;AACnB,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAE/B,gBAAgB;AAChB,OAAO,EACL,yBAAyB,EACzB,6BAA6B,EAC7B,6BAA6B,GAC9B,MAAM,oBAAoB,CAAC;AAE5B,0BAA0B;AAC1B,OAAO,EACL,0BA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D,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,gBAAgB,EAAE;gBACxD,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wBAAwB,EAAE;aACtE;YACD,QAAQ,EAAE,CAAC,WAAW,EAAE,OAAO,CAAC;SACjC;KACF,EACD,iCAAiC,CAAC,MAAM,CAAC,CAC1C,CAAC;IAEF,qDAAqD;IACrD,MAAM,CAAC,YAAY,CACjB,yBAAyB,EACzB;QACE,WAAW,EAAE,mCAAmC;QAChD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE;gBAC9D,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6CAA6C,EAAE;gBACtF,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,uCAAuC,EAAE;aAClF;YACD,QAAQ,EAAE,CAAC,cAAc,EAAE,QAAQ,CAAC;SACrC;KACF,EACD,oCAAoC,CAAC,MAAM,CAAC,CAC7C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Metrics Handlers
|
|
3
|
+
*
|
|
4
|
+
* MCP tool handlers for metrics and invocation tracking:
|
|
5
|
+
* - getMetrics
|
|
6
|
+
* - getInvocations
|
|
7
|
+
* - startAgentInvocation
|
|
8
|
+
* - completeAgentInvocation
|
|
9
|
+
*/
|
|
10
|
+
import type { IOrchestratorApiClient } from '../client/types.js';
|
|
11
|
+
/**
|
|
12
|
+
* Handler for getMetrics tool
|
|
13
|
+
*/
|
|
14
|
+
export declare function createGetMetricsHandler(client: IOrchestratorApiClient): (params: {
|
|
15
|
+
workflowId?: string;
|
|
16
|
+
}) => Promise<{
|
|
17
|
+
content: Array<{
|
|
18
|
+
type: string;
|
|
19
|
+
text: string;
|
|
20
|
+
}>;
|
|
21
|
+
isError: true;
|
|
22
|
+
} | {
|
|
23
|
+
content: {
|
|
24
|
+
type: string;
|
|
25
|
+
text: string;
|
|
26
|
+
}[];
|
|
27
|
+
}>;
|
|
28
|
+
/**
|
|
29
|
+
* Handler for getInvocations tool
|
|
30
|
+
*/
|
|
31
|
+
export declare function createGetInvocationsHandler(client: IOrchestratorApiClient): (params: {
|
|
32
|
+
workflowId?: string;
|
|
33
|
+
limit?: number;
|
|
34
|
+
}) => Promise<{
|
|
35
|
+
content: Array<{
|
|
36
|
+
type: string;
|
|
37
|
+
text: string;
|
|
38
|
+
}>;
|
|
39
|
+
isError: true;
|
|
40
|
+
} | {
|
|
41
|
+
content: {
|
|
42
|
+
type: string;
|
|
43
|
+
text: string;
|
|
44
|
+
}[];
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Handler for startAgentInvocation tool
|
|
48
|
+
*/
|
|
49
|
+
export declare function createStartAgentInvocationHandler(client: IOrchestratorApiClient): (params: {
|
|
50
|
+
agentName: string;
|
|
51
|
+
phase: string;
|
|
52
|
+
workflowId?: string;
|
|
53
|
+
}) => Promise<{
|
|
54
|
+
content: Array<{
|
|
55
|
+
type: string;
|
|
56
|
+
text: string;
|
|
57
|
+
}>;
|
|
58
|
+
isError: true;
|
|
59
|
+
} | {
|
|
60
|
+
content: {
|
|
61
|
+
type: string;
|
|
62
|
+
text: string;
|
|
63
|
+
}[];
|
|
64
|
+
}>;
|
|
65
|
+
/**
|
|
66
|
+
* Handler for completeAgentInvocation tool
|
|
67
|
+
*/
|
|
68
|
+
export declare function createCompleteAgentInvocationHandler(client: IOrchestratorApiClient): (params: {
|
|
69
|
+
invocationId: string;
|
|
70
|
+
status: string;
|
|
71
|
+
summary?: string;
|
|
72
|
+
}) => Promise<{
|
|
73
|
+
content: Array<{
|
|
74
|
+
type: string;
|
|
75
|
+
text: string;
|
|
76
|
+
}>;
|
|
77
|
+
isError: true;
|
|
78
|
+
} | {
|
|
79
|
+
content: {
|
|
80
|
+
type: string;
|
|
81
|
+
text: string;
|
|
82
|
+
}[];
|
|
83
|
+
}>;
|
|
84
|
+
//# sourceMappingURL=metrics-handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics-handlers.d.ts","sourceRoot":"","sources":["../../src/handlers/metrics-handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAGjE;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,sBAAsB,IACtD,QAAQ;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;GAa9C;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,sBAAsB,IAC1D,QAAQ;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;GAa9D;AAED;;GAEG;AACH,wBAAgB,iCAAiC,CAAC,MAAM,EAAE,sBAAsB,IAChE,QAAQ;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;GAiBhF;AAED;;GAEG;AACH,wBAAgB,oCAAoC,CAAC,MAAM,EAAE,sBAAsB,IACnE,QAAQ;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;GAiBjF"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Metrics Handlers
|
|
3
|
+
*
|
|
4
|
+
* MCP tool handlers for metrics and invocation tracking:
|
|
5
|
+
* - getMetrics
|
|
6
|
+
* - getInvocations
|
|
7
|
+
* - startAgentInvocation
|
|
8
|
+
* - completeAgentInvocation
|
|
9
|
+
*/
|
|
10
|
+
import { McpApiError } from '../errors/McpApiError.js';
|
|
11
|
+
/**
|
|
12
|
+
* Handler for getMetrics tool
|
|
13
|
+
*/
|
|
14
|
+
export function createGetMetricsHandler(client) {
|
|
15
|
+
return async (params) => {
|
|
16
|
+
try {
|
|
17
|
+
const response = await client.getMetrics(params.workflowId);
|
|
18
|
+
return {
|
|
19
|
+
content: [{ type: 'text', text: JSON.stringify(response, null, 2) }],
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
if (error instanceof McpApiError) {
|
|
24
|
+
return error.toMcpError();
|
|
25
|
+
}
|
|
26
|
+
throw error;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Handler for getInvocations tool
|
|
32
|
+
*/
|
|
33
|
+
export function createGetInvocationsHandler(client) {
|
|
34
|
+
return async (params) => {
|
|
35
|
+
try {
|
|
36
|
+
const response = await client.getInvocations(params.workflowId, params.limit);
|
|
37
|
+
return {
|
|
38
|
+
content: [{ type: 'text', text: JSON.stringify(response, null, 2) }],
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
if (error instanceof McpApiError) {
|
|
43
|
+
return error.toMcpError();
|
|
44
|
+
}
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Handler for startAgentInvocation tool
|
|
51
|
+
*/
|
|
52
|
+
export function createStartAgentInvocationHandler(client) {
|
|
53
|
+
return async (params) => {
|
|
54
|
+
try {
|
|
55
|
+
const response = await client.startAgentInvocation(params.agentName, params.phase, params.workflowId);
|
|
56
|
+
return {
|
|
57
|
+
content: [{ type: 'text', text: JSON.stringify(response, null, 2) }],
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
if (error instanceof McpApiError) {
|
|
62
|
+
return error.toMcpError();
|
|
63
|
+
}
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Handler for completeAgentInvocation tool
|
|
70
|
+
*/
|
|
71
|
+
export function createCompleteAgentInvocationHandler(client) {
|
|
72
|
+
return async (params) => {
|
|
73
|
+
try {
|
|
74
|
+
const response = await client.completeAgentInvocation(params.invocationId, params.status, params.summary);
|
|
75
|
+
return {
|
|
76
|
+
content: [{ type: 'text', text: JSON.stringify(response, null, 2) }],
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
if (error instanceof McpApiError) {
|
|
81
|
+
return error.toMcpError();
|
|
82
|
+
}
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=metrics-handlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics-handlers.js","sourceRoot":"","sources":["../../src/handlers/metrics-handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAA8B;IACpE,OAAO,KAAK,EAAE,MAA+B,EAAE,EAAE;QAC/C,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YAC5D,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;aACrE,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,WAAW,EAAE,CAAC;gBACjC,OAAO,KAAK,CAA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