@critical-path/mcp 0.1.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 +180 -0
- package/dist/bin/cli.d.ts +3 -0
- package/dist/bin/cli.d.ts.map +1 -0
- package/dist/bin/cli.js +75 -0
- package/dist/bin/cli.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/index.test.d.ts +2 -0
- package/dist/index.test.d.ts.map +1 -0
- package/dist/index.test.js +160 -0
- package/dist/index.test.js.map +1 -0
- package/dist/server/index.d.ts +13 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +212 -0
- package/dist/server/index.js.map +1 -0
- package/dist/tools/definitions.d.ts +86 -0
- package/dist/tools/definitions.d.ts.map +1 -0
- package/dist/tools/definitions.js +360 -0
- package/dist/tools/definitions.js.map +1 -0
- package/dist/web/index.d.ts +42 -0
- package/dist/web/index.d.ts.map +1 -0
- package/dist/web/index.js +117 -0
- package/dist/web/index.js.map +1 -0
- package/package.json +53 -0
- package/src/bin/cli.ts +78 -0
- package/src/index.test.ts +211 -0
- package/src/index.ts +3 -0
- package/src/server/index.ts +255 -0
- package/src/tools/definitions.ts +423 -0
- package/src/web/index.ts +162 -0
- package/tsconfig.json +8 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
3
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js';
|
|
4
|
+
import { ALL_TOOLS, TOOL_MAP } from '../tools/definitions.js';
|
|
5
|
+
export function createCriticalPathMcpServer(options) {
|
|
6
|
+
const target = options.engine || options.client;
|
|
7
|
+
if (!target) {
|
|
8
|
+
throw new Error('Either engine or client must be provided to createCriticalPathMcpServer.');
|
|
9
|
+
}
|
|
10
|
+
const serverName = options.name || 'critical-path-mcp';
|
|
11
|
+
const serverVersion = options.version || '0.1.0';
|
|
12
|
+
const activeTools = options.tools
|
|
13
|
+
? ALL_TOOLS.filter((t) => options.tools.includes(t.name))
|
|
14
|
+
: ALL_TOOLS;
|
|
15
|
+
const server = new Server({
|
|
16
|
+
name: serverName,
|
|
17
|
+
version: serverVersion
|
|
18
|
+
}, {
|
|
19
|
+
capabilities: {
|
|
20
|
+
tools: {},
|
|
21
|
+
resources: {},
|
|
22
|
+
prompts: {}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
// 1. Tool Listing
|
|
26
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
27
|
+
return {
|
|
28
|
+
tools: activeTools.map((tool) => ({
|
|
29
|
+
name: tool.name,
|
|
30
|
+
description: tool.description,
|
|
31
|
+
inputSchema: tool.inputSchema
|
|
32
|
+
}))
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
// 2. Tool Execution
|
|
36
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
37
|
+
const { name, arguments: args } = request.params;
|
|
38
|
+
const tool = TOOL_MAP.get(name);
|
|
39
|
+
if (!tool) {
|
|
40
|
+
throw new McpError(ErrorCode.MethodNotFound, `Tool "${name}" is not registered on this MCP server.`);
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
const result = await tool.execute(args || {}, target);
|
|
44
|
+
return {
|
|
45
|
+
content: [
|
|
46
|
+
{
|
|
47
|
+
type: 'text',
|
|
48
|
+
text: JSON.stringify(result, null, 2)
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
return {
|
|
55
|
+
content: [
|
|
56
|
+
{
|
|
57
|
+
type: 'text',
|
|
58
|
+
text: `Error executing tool "${name}": ${err?.message || String(err)}`
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
isError: true
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
// 3. Resources Listing
|
|
66
|
+
server.setRequestHandler(ListResourcesRequestSchema, async () => {
|
|
67
|
+
return {
|
|
68
|
+
resources: [
|
|
69
|
+
{
|
|
70
|
+
uri: 'criticalpath://projects',
|
|
71
|
+
name: 'Critical Path Projects',
|
|
72
|
+
mimeType: 'application/json',
|
|
73
|
+
description: 'Live list of all projects managed by Critical Path'
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
uri: 'criticalpath://tasks',
|
|
77
|
+
name: 'Critical Path Tasks',
|
|
78
|
+
mimeType: 'application/json',
|
|
79
|
+
description: 'Live list of all tasks across projects'
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
// 4. Resource Reading
|
|
85
|
+
server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
|
|
86
|
+
const uri = request.params.uri;
|
|
87
|
+
if (uri === 'criticalpath://projects') {
|
|
88
|
+
const projects = await target.getProjects();
|
|
89
|
+
return {
|
|
90
|
+
contents: [
|
|
91
|
+
{
|
|
92
|
+
uri,
|
|
93
|
+
mimeType: 'application/json',
|
|
94
|
+
text: JSON.stringify(projects, null, 2)
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
if (uri === 'criticalpath://tasks') {
|
|
100
|
+
const tasks = await target.getTasks();
|
|
101
|
+
return {
|
|
102
|
+
contents: [
|
|
103
|
+
{
|
|
104
|
+
uri,
|
|
105
|
+
mimeType: 'application/json',
|
|
106
|
+
text: JSON.stringify(tasks, null, 2)
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
const taskMatch = uri.match(/^criticalpath:\/\/tasks\/([^/]+)$/);
|
|
112
|
+
if (taskMatch) {
|
|
113
|
+
const taskId = taskMatch[1];
|
|
114
|
+
const task = await target.getTask(taskId);
|
|
115
|
+
if (!task) {
|
|
116
|
+
throw new McpError(ErrorCode.InvalidRequest, `Task with ID "${taskId}" not found.`);
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
contents: [
|
|
120
|
+
{
|
|
121
|
+
uri,
|
|
122
|
+
mimeType: 'application/json',
|
|
123
|
+
text: JSON.stringify(task, null, 2)
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
throw new McpError(ErrorCode.InvalidRequest, `Unknown resource URI: ${uri}`);
|
|
129
|
+
});
|
|
130
|
+
// 5. Prompts Listing
|
|
131
|
+
server.setRequestHandler(ListPromptsRequestSchema, async () => {
|
|
132
|
+
return {
|
|
133
|
+
prompts: [
|
|
134
|
+
{
|
|
135
|
+
name: 'summarize_project',
|
|
136
|
+
description: 'Analyze project health, open tasks, blockers, and recent deliverables.',
|
|
137
|
+
arguments: [
|
|
138
|
+
{
|
|
139
|
+
name: 'projectId',
|
|
140
|
+
description: 'The ID of the project to summarize',
|
|
141
|
+
required: true
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
name: 'triage_task',
|
|
147
|
+
description: 'Review a task description, suggest priority, labels, and workflow status.',
|
|
148
|
+
arguments: [
|
|
149
|
+
{
|
|
150
|
+
name: 'taskId',
|
|
151
|
+
description: 'The task ID to triage',
|
|
152
|
+
required: true
|
|
153
|
+
}
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
};
|
|
158
|
+
});
|
|
159
|
+
// 6. Prompts Retrieval
|
|
160
|
+
server.setRequestHandler(GetPromptRequestSchema, async (request) => {
|
|
161
|
+
const { name, arguments: args } = request.params;
|
|
162
|
+
if (name === 'summarize_project') {
|
|
163
|
+
const projectId = args?.projectId;
|
|
164
|
+
if (!projectId) {
|
|
165
|
+
throw new McpError(ErrorCode.InvalidParams, 'Argument "projectId" is required.');
|
|
166
|
+
}
|
|
167
|
+
const project = await target.getProject(projectId);
|
|
168
|
+
const tasks = await target.getTasks(projectId);
|
|
169
|
+
return {
|
|
170
|
+
description: `Project summary for ${project?.name || projectId}`,
|
|
171
|
+
messages: [
|
|
172
|
+
{
|
|
173
|
+
role: 'user',
|
|
174
|
+
content: {
|
|
175
|
+
type: 'text',
|
|
176
|
+
text: `Please analyze the current status of project "${project?.name || projectId}".\n\nProject Info:\n${JSON.stringify(project, null, 2)}\n\nTasks (${tasks.length} total):\n${JSON.stringify(tasks, null, 2)}\n\nProvide an executive summary highlighting:\n1. Overall progress and completion rate\n2. Any high/urgent priority tasks needing immediate attention\n3. Recommendations for unblocking or advancing the sprint.`
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
]
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
if (name === 'triage_task') {
|
|
183
|
+
const taskId = args?.taskId;
|
|
184
|
+
if (!taskId) {
|
|
185
|
+
throw new McpError(ErrorCode.InvalidParams, 'Argument "taskId" is required.');
|
|
186
|
+
}
|
|
187
|
+
const task = await target.getTask(taskId);
|
|
188
|
+
if (!task) {
|
|
189
|
+
throw new McpError(ErrorCode.InvalidRequest, `Task "${taskId}" not found.`);
|
|
190
|
+
}
|
|
191
|
+
return {
|
|
192
|
+
description: `Triage task "${task.title}"`,
|
|
193
|
+
messages: [
|
|
194
|
+
{
|
|
195
|
+
role: 'user',
|
|
196
|
+
content: {
|
|
197
|
+
type: 'text',
|
|
198
|
+
text: `Please review and triage the following task:\n\n${JSON.stringify(task, null, 2)}\n\nSuggest:\n1. Appropriate priority level\n2. Relevant tags\n3. Estimated completion hours\n4. Clear acceptance criteria or missing details.`
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
]
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
throw new McpError(ErrorCode.MethodNotFound, `Prompt "${name}" is not defined.`);
|
|
205
|
+
});
|
|
206
|
+
return server;
|
|
207
|
+
}
|
|
208
|
+
export async function startStdioServer(server) {
|
|
209
|
+
const transport = new StdioServerTransport();
|
|
210
|
+
await server.connect(transport);
|
|
211
|
+
}
|
|
212
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,0BAA0B,EAC1B,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,EACtB,SAAS,EACT,QAAQ,EACT,MAAM,oCAAoC,CAAC;AAG5C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAuB,MAAM,yBAAyB,CAAC;AAUnF,MAAM,UAAU,2BAA2B,CAAC,OAAqC;IAC/E,MAAM,MAAM,GAA+B,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;IAC5E,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAC;IAC9F,CAAC;IAED,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,IAAI,mBAAmB,CAAC;IACvD,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC;IAEjD,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK;QAC/B,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC1D,CAAC,CAAC,SAAS,CAAC;IAEd,MAAM,MAAM,GAAG,IAAI,MAAM,CACvB;QACE,IAAI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AAC,CAAC;YAChF,CAAC;YACD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAC1C,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC,cAAc,EAAE,SAAS,MAAM,cAAc,CAAC,CAAC;YAC9E,CAAC;YAED,OAAO;gBACL,WAAW,EAAE,gBAAgB,IAAI,CAAC,KAAK,GAAG;gBAC1C,QAAQ,EAAE;oBACR;wBACE,IAAI,EAAE,MAAM;wBACZ,OAAO,EAAE;4BACP,IAAI,EAAE,MAAM;4BACZ,IAAI,EAAE,mDAAmD,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,gJAAgJ;yBACvO;qBACF;iBACF;aACF,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC,cAAc,EAAE,WAAW,IAAI,mBAAmB,CAAC,CAAC;IACnF,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,MAAc;IACnD,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { CriticalPathEngine } from '@critical-path/core';
|
|
3
|
+
import type { CriticalPathClient } from '@critical-path/client';
|
|
4
|
+
export type BackendContext = CriticalPathEngine | CriticalPathClient;
|
|
5
|
+
export interface ToolDefinition<TParams = any, TResult = any> {
|
|
6
|
+
name: string;
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
zodSchema: z.ZodObject<any>;
|
|
10
|
+
inputSchema: Record<string, unknown>;
|
|
11
|
+
annotations?: {
|
|
12
|
+
readOnlyHint?: boolean;
|
|
13
|
+
requiresConfirmation?: boolean;
|
|
14
|
+
};
|
|
15
|
+
execute: (args: TParams, target: BackendContext, ambientContext?: {
|
|
16
|
+
projectId?: string;
|
|
17
|
+
}) => Promise<TResult>;
|
|
18
|
+
}
|
|
19
|
+
export declare function resolveBackend(target: BackendContext): Promise<{
|
|
20
|
+
isEngine: boolean;
|
|
21
|
+
}>;
|
|
22
|
+
export declare const listProjectsTool: ToolDefinition;
|
|
23
|
+
export declare const getProjectTool: ToolDefinition<{
|
|
24
|
+
id: string;
|
|
25
|
+
}>;
|
|
26
|
+
export declare const createProjectTool: ToolDefinition<{
|
|
27
|
+
name: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
key?: string;
|
|
30
|
+
}>;
|
|
31
|
+
export declare const listTasksTool: ToolDefinition<{
|
|
32
|
+
projectId?: string;
|
|
33
|
+
status?: string;
|
|
34
|
+
priority?: string;
|
|
35
|
+
assigneeId?: string;
|
|
36
|
+
}>;
|
|
37
|
+
export declare const getTaskTool: ToolDefinition<{
|
|
38
|
+
id: string;
|
|
39
|
+
}>;
|
|
40
|
+
export declare const createTaskTool: ToolDefinition<{
|
|
41
|
+
projectId?: string;
|
|
42
|
+
title: string;
|
|
43
|
+
description?: string;
|
|
44
|
+
status?: string;
|
|
45
|
+
priority?: 'urgent' | 'high' | 'medium' | 'low' | 'none';
|
|
46
|
+
assigneeId?: string;
|
|
47
|
+
dueDate?: string;
|
|
48
|
+
tags?: string[];
|
|
49
|
+
estimatedHours?: number;
|
|
50
|
+
}>;
|
|
51
|
+
export declare const updateTaskTool: ToolDefinition<{
|
|
52
|
+
id: string;
|
|
53
|
+
title?: string;
|
|
54
|
+
description?: string;
|
|
55
|
+
status?: string;
|
|
56
|
+
priority?: 'urgent' | 'high' | 'medium' | 'low' | 'none';
|
|
57
|
+
assigneeId?: string;
|
|
58
|
+
dueDate?: string;
|
|
59
|
+
tags?: string[];
|
|
60
|
+
estimatedHours?: number;
|
|
61
|
+
loggedHours?: number;
|
|
62
|
+
}>;
|
|
63
|
+
export declare const deleteTaskTool: ToolDefinition<{
|
|
64
|
+
id: string;
|
|
65
|
+
}>;
|
|
66
|
+
export declare const listDeliverablesTool: ToolDefinition<{
|
|
67
|
+
projectId?: string;
|
|
68
|
+
}>;
|
|
69
|
+
export declare const createDeliverableTool: ToolDefinition<{
|
|
70
|
+
projectId?: string;
|
|
71
|
+
title: string;
|
|
72
|
+
description?: string;
|
|
73
|
+
dueDate?: string;
|
|
74
|
+
taskIds?: string[];
|
|
75
|
+
}>;
|
|
76
|
+
export declare const listCommentsTool: ToolDefinition<{
|
|
77
|
+
taskId: string;
|
|
78
|
+
}>;
|
|
79
|
+
export declare const addCommentTool: ToolDefinition<{
|
|
80
|
+
taskId: string;
|
|
81
|
+
content: string;
|
|
82
|
+
authorId: string;
|
|
83
|
+
}>;
|
|
84
|
+
export declare const ALL_TOOLS: ToolDefinition[];
|
|
85
|
+
export declare const TOOL_MAP: Map<string, ToolDefinition<any, any>>;
|
|
86
|
+
//# sourceMappingURL=definitions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/tools/definitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAAG,kBAAkB,CAAC;AAErE,MAAM,WAAW,cAAc,CAAC,OAAO,GAAG,GAAG,EAAE,OAAO,GAAG,GAAG;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC5B,WAAW,EAAE,MAAM,CAA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,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CA0BhG,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,cAAc,EAarC,CAAC;AAEF,eAAO,MAAM,QAAQ,uCAEpB,CAAC"}
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// Helper to normalize calling engine vs client
|
|
3
|
+
export async function resolveBackend(target) {
|
|
4
|
+
const isEngine = 'store' in target && typeof target.store === 'object';
|
|
5
|
+
return { isEngine };
|
|
6
|
+
}
|
|
7
|
+
export const listProjectsTool = {
|
|
8
|
+
name: 'list_projects',
|
|
9
|
+
title: 'List Projects',
|
|
10
|
+
description: 'Retrieve all projects in the workspace.',
|
|
11
|
+
zodSchema: z.object({}),
|
|
12
|
+
inputSchema: {
|
|
13
|
+
type: 'object',
|
|
14
|
+
properties: {},
|
|
15
|
+
additionalProperties: false
|
|
16
|
+
},
|
|
17
|
+
annotations: { readOnlyHint: true },
|
|
18
|
+
execute: async (_args, target) => {
|
|
19
|
+
return target.getProjects();
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
export const getProjectTool = {
|
|
23
|
+
name: 'get_project',
|
|
24
|
+
title: 'Get Project',
|
|
25
|
+
description: 'Get details of a specific project by its ID.',
|
|
26
|
+
zodSchema: z.object({
|
|
27
|
+
id: z.string().describe('The project ID')
|
|
28
|
+
}),
|
|
29
|
+
inputSchema: {
|
|
30
|
+
type: 'object',
|
|
31
|
+
properties: {
|
|
32
|
+
id: { type: 'string', description: 'The project ID' }
|
|
33
|
+
},
|
|
34
|
+
required: ['id'],
|
|
35
|
+
additionalProperties: false
|
|
36
|
+
},
|
|
37
|
+
annotations: { readOnlyHint: true },
|
|
38
|
+
execute: async (args, target) => {
|
|
39
|
+
return target.getProject(args.id);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
export const createProjectTool = {
|
|
43
|
+
name: 'create_project',
|
|
44
|
+
title: 'Create Project',
|
|
45
|
+
description: 'Create a new project workspace.',
|
|
46
|
+
zodSchema: z.object({
|
|
47
|
+
name: z.string().describe('Name of the project'),
|
|
48
|
+
description: z.string().optional().describe('Description of the project'),
|
|
49
|
+
key: z.string().optional().describe('Short project key/prefix (e.g. "PROJ")')
|
|
50
|
+
}),
|
|
51
|
+
inputSchema: {
|
|
52
|
+
type: 'object',
|
|
53
|
+
properties: {
|
|
54
|
+
name: { type: 'string', description: 'Name of the project' },
|
|
55
|
+
description: { type: 'string', description: 'Description of the project' },
|
|
56
|
+
key: { type: 'string', description: 'Short project key/prefix (e.g. "PROJ")' }
|
|
57
|
+
},
|
|
58
|
+
required: ['name'],
|
|
59
|
+
additionalProperties: false
|
|
60
|
+
},
|
|
61
|
+
execute: async (args, target) => {
|
|
62
|
+
return target.createProject(args);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
export const listTasksTool = {
|
|
66
|
+
name: 'list_tasks',
|
|
67
|
+
title: 'List Tasks',
|
|
68
|
+
description: 'List tasks, optionally filtered by project, status, priority, or assignee.',
|
|
69
|
+
zodSchema: z.object({
|
|
70
|
+
projectId: z.string().optional().describe('Filter by project ID'),
|
|
71
|
+
status: z.string().optional().describe('Filter by task status key'),
|
|
72
|
+
priority: z.enum(['urgent', 'high', 'medium', 'low', 'none']).optional().describe('Filter by priority'),
|
|
73
|
+
assigneeId: z.string().optional().describe('Filter by assignee ID')
|
|
74
|
+
}),
|
|
75
|
+
inputSchema: {
|
|
76
|
+
type: 'object',
|
|
77
|
+
properties: {
|
|
78
|
+
projectId: { type: 'string', description: 'Filter by project ID' },
|
|
79
|
+
status: { type: 'string', description: 'Filter by task status key' },
|
|
80
|
+
priority: {
|
|
81
|
+
type: 'string',
|
|
82
|
+
enum: ['urgent', 'high', 'medium', 'low', 'none'],
|
|
83
|
+
description: 'Filter by priority'
|
|
84
|
+
},
|
|
85
|
+
assigneeId: { type: 'string', description: 'Filter by assignee ID' }
|
|
86
|
+
},
|
|
87
|
+
additionalProperties: false
|
|
88
|
+
},
|
|
89
|
+
annotations: { readOnlyHint: true },
|
|
90
|
+
execute: async (args, target, ambientContext) => {
|
|
91
|
+
const projectId = args.projectId || ambientContext?.projectId;
|
|
92
|
+
let tasks = await target.getTasks(projectId);
|
|
93
|
+
if (args.status) {
|
|
94
|
+
tasks = tasks.filter((t) => t.status === args.status);
|
|
95
|
+
}
|
|
96
|
+
if (args.priority) {
|
|
97
|
+
tasks = tasks.filter((t) => t.priority === args.priority);
|
|
98
|
+
}
|
|
99
|
+
if (args.assigneeId) {
|
|
100
|
+
tasks = tasks.filter((t) => t.assigneeId === args.assigneeId);
|
|
101
|
+
}
|
|
102
|
+
return tasks;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
export const getTaskTool = {
|
|
106
|
+
name: 'get_task',
|
|
107
|
+
title: 'Get Task',
|
|
108
|
+
description: 'Get task details by ID.',
|
|
109
|
+
zodSchema: z.object({
|
|
110
|
+
id: z.string().describe('The task ID')
|
|
111
|
+
}),
|
|
112
|
+
inputSchema: {
|
|
113
|
+
type: 'object',
|
|
114
|
+
properties: {
|
|
115
|
+
id: { type: 'string', description: 'The task ID' }
|
|
116
|
+
},
|
|
117
|
+
required: ['id'],
|
|
118
|
+
additionalProperties: false
|
|
119
|
+
},
|
|
120
|
+
annotations: { readOnlyHint: true },
|
|
121
|
+
execute: async (args, target) => {
|
|
122
|
+
return target.getTask(args.id);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
export const createTaskTool = {
|
|
126
|
+
name: 'create_task',
|
|
127
|
+
title: 'Create Task',
|
|
128
|
+
description: 'Create a new task within a project.',
|
|
129
|
+
zodSchema: z.object({
|
|
130
|
+
projectId: z.string().optional().describe('Project ID (inferred from active view in browser if omitted)'),
|
|
131
|
+
title: z.string().describe('Title of the task'),
|
|
132
|
+
description: z.string().optional().describe('Detailed description / markdown'),
|
|
133
|
+
status: z.string().optional().describe('Status (defaults to "todo" or first workflow status)'),
|
|
134
|
+
priority: z.enum(['urgent', 'high', 'medium', 'low', 'none']).optional().default('none').describe('Task priority'),
|
|
135
|
+
assigneeId: z.string().optional().describe('User ID to assign task to'),
|
|
136
|
+
dueDate: z.string().optional().describe('Due date (ISO string)'),
|
|
137
|
+
tags: z.array(z.string()).optional().describe('Tags for categorization'),
|
|
138
|
+
estimatedHours: z.number().optional().describe('Estimated hours to complete')
|
|
139
|
+
}),
|
|
140
|
+
inputSchema: {
|
|
141
|
+
type: 'object',
|
|
142
|
+
properties: {
|
|
143
|
+
projectId: { type: 'string', description: 'Project ID (inferred from active view if omitted)' },
|
|
144
|
+
title: { type: 'string', description: 'Title of the task' },
|
|
145
|
+
description: { type: 'string', description: 'Detailed description' },
|
|
146
|
+
status: { type: 'string', description: 'Status key' },
|
|
147
|
+
priority: { type: 'string', enum: ['urgent', 'high', 'medium', 'low', 'none'] },
|
|
148
|
+
assigneeId: { type: 'string', description: 'User ID of assignee' },
|
|
149
|
+
dueDate: { type: 'string', description: 'Due date in ISO 8601 format' },
|
|
150
|
+
tags: { type: 'array', items: { type: 'string' } },
|
|
151
|
+
estimatedHours: { type: 'number' }
|
|
152
|
+
},
|
|
153
|
+
required: ['title'],
|
|
154
|
+
additionalProperties: false
|
|
155
|
+
},
|
|
156
|
+
execute: async (args, target, ambientContext) => {
|
|
157
|
+
const projectId = args.projectId || ambientContext?.projectId;
|
|
158
|
+
if (!projectId) {
|
|
159
|
+
throw new Error('projectId is required to create a task, but none was provided or active in context.');
|
|
160
|
+
}
|
|
161
|
+
const input = {
|
|
162
|
+
projectId,
|
|
163
|
+
title: args.title,
|
|
164
|
+
description: args.description,
|
|
165
|
+
status: args.status || 'todo',
|
|
166
|
+
priority: args.priority || 'none',
|
|
167
|
+
assigneeId: args.assigneeId,
|
|
168
|
+
dueDate: args.dueDate,
|
|
169
|
+
tags: args.tags || [],
|
|
170
|
+
estimatedHours: args.estimatedHours
|
|
171
|
+
};
|
|
172
|
+
return target.createTask(input);
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
export const updateTaskTool = {
|
|
176
|
+
name: 'update_task',
|
|
177
|
+
title: 'Update Task',
|
|
178
|
+
description: 'Update fields of an existing task (e.g. title, status, priority, assignee).',
|
|
179
|
+
zodSchema: z.object({
|
|
180
|
+
id: z.string().describe('The task ID'),
|
|
181
|
+
title: z.string().optional(),
|
|
182
|
+
description: z.string().optional(),
|
|
183
|
+
status: z.string().optional(),
|
|
184
|
+
priority: z.enum(['urgent', 'high', 'medium', 'low', 'none']).optional(),
|
|
185
|
+
assigneeId: z.string().optional(),
|
|
186
|
+
dueDate: z.string().optional(),
|
|
187
|
+
tags: z.array(z.string()).optional(),
|
|
188
|
+
estimatedHours: z.number().optional(),
|
|
189
|
+
loggedHours: z.number().optional()
|
|
190
|
+
}),
|
|
191
|
+
inputSchema: {
|
|
192
|
+
type: 'object',
|
|
193
|
+
properties: {
|
|
194
|
+
id: { type: 'string', description: 'Task ID' },
|
|
195
|
+
title: { type: 'string' },
|
|
196
|
+
description: { type: 'string' },
|
|
197
|
+
status: { type: 'string' },
|
|
198
|
+
priority: { type: 'string', enum: ['urgent', 'high', 'medium', 'low', 'none'] },
|
|
199
|
+
assigneeId: { type: 'string' },
|
|
200
|
+
dueDate: { type: 'string' },
|
|
201
|
+
tags: { type: 'array', items: { type: 'string' } },
|
|
202
|
+
estimatedHours: { type: 'number' },
|
|
203
|
+
loggedHours: { type: 'number' }
|
|
204
|
+
},
|
|
205
|
+
required: ['id'],
|
|
206
|
+
additionalProperties: false
|
|
207
|
+
},
|
|
208
|
+
execute: async (args, target) => {
|
|
209
|
+
const { id, ...updates } = args;
|
|
210
|
+
return target.updateTask(id, updates);
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
export const deleteTaskTool = {
|
|
214
|
+
name: 'delete_task',
|
|
215
|
+
title: 'Delete Task',
|
|
216
|
+
description: 'Delete a task by ID.',
|
|
217
|
+
zodSchema: z.object({
|
|
218
|
+
id: z.string().describe('The task ID to delete')
|
|
219
|
+
}),
|
|
220
|
+
inputSchema: {
|
|
221
|
+
type: 'object',
|
|
222
|
+
properties: {
|
|
223
|
+
id: { type: 'string', description: 'The task ID' }
|
|
224
|
+
},
|
|
225
|
+
required: ['id'],
|
|
226
|
+
additionalProperties: false
|
|
227
|
+
},
|
|
228
|
+
annotations: { requiresConfirmation: true },
|
|
229
|
+
execute: async (args, target) => {
|
|
230
|
+
const success = await target.deleteTask(args.id);
|
|
231
|
+
return { success };
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
export const listDeliverablesTool = {
|
|
235
|
+
name: 'list_deliverables',
|
|
236
|
+
title: 'List Deliverables',
|
|
237
|
+
description: 'List deliverables/milestones for a project.',
|
|
238
|
+
zodSchema: z.object({
|
|
239
|
+
projectId: z.string().optional().describe('Project ID')
|
|
240
|
+
}),
|
|
241
|
+
inputSchema: {
|
|
242
|
+
type: 'object',
|
|
243
|
+
properties: {
|
|
244
|
+
projectId: { type: 'string', description: 'Project ID' }
|
|
245
|
+
},
|
|
246
|
+
additionalProperties: false
|
|
247
|
+
},
|
|
248
|
+
annotations: { readOnlyHint: true },
|
|
249
|
+
execute: async (args, target, ambientContext) => {
|
|
250
|
+
const projectId = args.projectId || ambientContext?.projectId;
|
|
251
|
+
if (!projectId)
|
|
252
|
+
throw new Error('projectId is required to list deliverables.');
|
|
253
|
+
if ('getDeliverables' in target && typeof target.getDeliverables === 'function') {
|
|
254
|
+
return target.getDeliverables(projectId);
|
|
255
|
+
}
|
|
256
|
+
return [];
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
export const createDeliverableTool = {
|
|
260
|
+
name: 'create_deliverable',
|
|
261
|
+
title: 'Create Deliverable',
|
|
262
|
+
description: 'Create a milestone deliverable within a project.',
|
|
263
|
+
zodSchema: z.object({
|
|
264
|
+
projectId: z.string().optional(),
|
|
265
|
+
title: z.string(),
|
|
266
|
+
description: z.string().optional(),
|
|
267
|
+
dueDate: z.string().optional(),
|
|
268
|
+
taskIds: z.array(z.string()).optional()
|
|
269
|
+
}),
|
|
270
|
+
inputSchema: {
|
|
271
|
+
type: 'object',
|
|
272
|
+
properties: {
|
|
273
|
+
projectId: { type: 'string' },
|
|
274
|
+
title: { type: 'string' },
|
|
275
|
+
description: { type: 'string' },
|
|
276
|
+
dueDate: { type: 'string' },
|
|
277
|
+
taskIds: { type: 'array', items: { type: 'string' } }
|
|
278
|
+
},
|
|
279
|
+
required: ['title'],
|
|
280
|
+
additionalProperties: false
|
|
281
|
+
},
|
|
282
|
+
execute: async (args, target, ambientContext) => {
|
|
283
|
+
const projectId = args.projectId || ambientContext?.projectId;
|
|
284
|
+
if (!projectId)
|
|
285
|
+
throw new Error('projectId is required to create a deliverable.');
|
|
286
|
+
if ('createDeliverable' in target && typeof target.createDeliverable === 'function') {
|
|
287
|
+
return target.createDeliverable({
|
|
288
|
+
...args,
|
|
289
|
+
projectId
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
throw new Error('createDeliverable is not supported by this backend target.');
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
export const listCommentsTool = {
|
|
296
|
+
name: 'list_comments',
|
|
297
|
+
title: 'List Comments',
|
|
298
|
+
description: 'List comments associated with a task.',
|
|
299
|
+
zodSchema: z.object({
|
|
300
|
+
taskId: z.string().describe('The task ID')
|
|
301
|
+
}),
|
|
302
|
+
inputSchema: {
|
|
303
|
+
type: 'object',
|
|
304
|
+
properties: {
|
|
305
|
+
taskId: { type: 'string', description: 'The task ID' }
|
|
306
|
+
},
|
|
307
|
+
required: ['taskId'],
|
|
308
|
+
additionalProperties: false
|
|
309
|
+
},
|
|
310
|
+
annotations: { readOnlyHint: true },
|
|
311
|
+
execute: async (args, target) => {
|
|
312
|
+
if ('getComments' in target && typeof target.getComments === 'function') {
|
|
313
|
+
return target.getComments(args.taskId);
|
|
314
|
+
}
|
|
315
|
+
return [];
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
export const addCommentTool = {
|
|
319
|
+
name: 'add_comment',
|
|
320
|
+
title: 'Add Comment',
|
|
321
|
+
description: 'Add a comment to a task.',
|
|
322
|
+
zodSchema: z.object({
|
|
323
|
+
taskId: z.string().describe('The task ID'),
|
|
324
|
+
content: z.string().describe('Comment body/markdown'),
|
|
325
|
+
authorId: z.string().describe('Author user ID')
|
|
326
|
+
}),
|
|
327
|
+
inputSchema: {
|
|
328
|
+
type: 'object',
|
|
329
|
+
properties: {
|
|
330
|
+
taskId: { type: 'string', description: 'The task ID' },
|
|
331
|
+
content: { type: 'string', description: 'Comment body/markdown' },
|
|
332
|
+
authorId: { type: 'string', description: 'Author user ID' }
|
|
333
|
+
},
|
|
334
|
+
required: ['taskId', 'content', 'authorId'],
|
|
335
|
+
additionalProperties: false
|
|
336
|
+
},
|
|
337
|
+
execute: async (args, target) => {
|
|
338
|
+
return target.addComment({
|
|
339
|
+
taskId: args.taskId,
|
|
340
|
+
content: args.content,
|
|
341
|
+
authorId: args.authorId
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
export const ALL_TOOLS = [
|
|
346
|
+
listProjectsTool,
|
|
347
|
+
getProjectTool,
|
|
348
|
+
createProjectTool,
|
|
349
|
+
listTasksTool,
|
|
350
|
+
getTaskTool,
|
|
351
|
+
createTaskTool,
|
|
352
|
+
updateTaskTool,
|
|
353
|
+
deleteTaskTool,
|
|
354
|
+
listDeliverablesTool,
|
|
355
|
+
createDeliverableTool,
|
|
356
|
+
listCommentsTool,
|
|
357
|
+
addCommentTool
|
|
358
|
+
];
|
|
359
|
+
export const TOOL_MAP = new Map(ALL_TOOLS.map((tool) => [tool.name, tool]));
|
|
360
|
+
//# sourceMappingURL=definitions.js.map
|