@critical-path/mcp 0.8.0 → 0.9.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/CHANGELOG.md +27 -0
- package/README.md +1 -1
- package/dist/tools/definitions.d.ts +30 -24
- package/dist/tools/definitions.d.ts.map +1 -1
- package/dist/tools/definitions.js +47 -219
- package/dist/tools/definitions.js.map +1 -1
- package/dist/tools/definitions.test.js +10 -2
- package/dist/tools/definitions.test.js.map +1 -1
- package/package.json +4 -3
- package/src/tools/definitions.test.ts +12 -2
- package/src/tools/definitions.ts +57 -225
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @critical-path/mcp
|
|
2
2
|
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b54e22c: Validate request bodies with shared zod schemas and publish an OpenAPI document.
|
|
8
|
+
|
|
9
|
+
**@critical-path/core**
|
|
10
|
+
- New `@critical-path/core/schemas` subpath with create/update schemas for every resource and `parsePayload(schema, data)`. Kept off the package root so browser bundles do not include zod. `zod` is now a dependency of core.
|
|
11
|
+
- `ValidationError` carries an optional `issues: { path, message }[]`.
|
|
12
|
+
|
|
13
|
+
**@critical-path/server**
|
|
14
|
+
- All request bodies are validated. Invalid bodies return `400` with `issues`. Server-assigned fields (`id`, `createdAt`, `updatedAt`, task `key`, owning `projectId` on updates) and unknown keys are stripped, so a `PATCH` can no longer move a task to another project.
|
|
15
|
+
- Comments, reactions and attachments require an author unless `getContext` resolves the caller. Attachment `mimeType` and `sizeBytes` default to `application/octet-stream` and `0` for linked files.
|
|
16
|
+
- New `GET /openapi.json` and `buildOpenApiDocument()` (OpenAPI 3.1, request bodies generated from the validation schemas).
|
|
17
|
+
|
|
18
|
+
**@critical-path/mcp**
|
|
19
|
+
- Tool `inputSchema`s are generated from their zod schemas via the new `defineTool`, removing the hand-written JSON copies.
|
|
20
|
+
|
|
21
|
+
**@critical-path/svelte**
|
|
22
|
+
- Rebuilt with the bundled `@critical-path/mcp` changes.
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- Updated dependencies [b54e22c]
|
|
27
|
+
- @critical-path/core@0.24.0
|
|
28
|
+
- @critical-path/client@0.14.9
|
|
29
|
+
|
|
3
30
|
## 0.8.0
|
|
4
31
|
|
|
5
32
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -177,7 +177,7 @@ handle.unregister();
|
|
|
177
177
|
| `get_timeline_ladder` | Multi-scale Ladder of Abstraction (macro/standard/concrete) | `{ projectId?, level?, containerId?, iterationId? }` |
|
|
178
178
|
| `get_task_ladder` | Single-task ladder view connecting phase, CPM Gantt, and concrete evidence | `{ taskId }` |
|
|
179
179
|
|
|
180
|
-
Tool arguments are validated against each tool's zod schema before execution, on both the standard server and WebMCP. Invalid arguments return an `isError` result, and fields a tool does not declare are stripped (for example, `projectId` cannot be changed through `update_task`). When you pass `tools: [...]` to `createCriticalPathMcpServer`, tools outside that list are neither listed nor callable. `delete_task` is advertised with the MCP `destructiveHint` annotation.
|
|
180
|
+
Each tool's JSON `inputSchema` is generated from its zod schema with `defineTool`, so what the model sees always matches what is enforced. Tool arguments are validated against each tool's zod schema before execution, on both the standard server and WebMCP. Invalid arguments return an `isError` result, and fields a tool does not declare are stripped (for example, `projectId` cannot be changed through `update_task`). When you pass `tools: [...]` to `createCriticalPathMcpServer`, tools outside that list are neither listed nor callable. `delete_task` is advertised with the MCP `destructiveHint` annotation.
|
|
181
181
|
|
|
182
182
|
---
|
|
183
183
|
|
|
@@ -7,6 +7,7 @@ export interface ToolDefinition<TParams = any, TResult = any> {
|
|
|
7
7
|
title: string;
|
|
8
8
|
description: string;
|
|
9
9
|
zodSchema: z.ZodObject<any>;
|
|
10
|
+
/** JSON Schema shown to MCP clients. Generated from `zodSchema` by `defineTool`. */
|
|
10
11
|
inputSchema: Record<string, unknown>;
|
|
11
12
|
annotations?: {
|
|
12
13
|
readOnlyHint?: boolean;
|
|
@@ -16,6 +17,11 @@ export interface ToolDefinition<TParams = any, TResult = any> {
|
|
|
16
17
|
projectId?: string;
|
|
17
18
|
}) => Promise<TResult>;
|
|
18
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Declares a tool, generating its JSON Schema `inputSchema` from `zodSchema` so the schema the
|
|
22
|
+
* model sees and the one arguments are validated against cannot drift apart.
|
|
23
|
+
*/
|
|
24
|
+
export declare function defineTool<TParams = any, TResult = any>(spec: Omit<ToolDefinition<TParams, TResult>, 'inputSchema'>): ToolDefinition<TParams, TResult>;
|
|
19
25
|
export declare class ToolArgumentError extends Error {
|
|
20
26
|
constructor(toolName: string, details: string);
|
|
21
27
|
}
|
|
@@ -27,43 +33,43 @@ export declare function parseToolArgs<TParams>(tool: ToolDefinition<TParams>, ar
|
|
|
27
33
|
export declare function resolveBackend(target: BackendContext): Promise<{
|
|
28
34
|
isEngine: boolean;
|
|
29
35
|
}>;
|
|
30
|
-
export declare const listProjectsTool: ToolDefinition
|
|
36
|
+
export declare const listProjectsTool: ToolDefinition<any, import("@critical-path/core").Project[]>;
|
|
31
37
|
export declare const getProjectTool: ToolDefinition<{
|
|
32
38
|
id: string;
|
|
33
|
-
}>;
|
|
39
|
+
}, any>;
|
|
34
40
|
export declare const createProjectTool: ToolDefinition<{
|
|
35
41
|
name: string;
|
|
36
42
|
description?: string;
|
|
37
43
|
key?: string;
|
|
38
|
-
}>;
|
|
44
|
+
}, any>;
|
|
39
45
|
export declare const listTasksTool: ToolDefinition<{
|
|
40
46
|
projectId?: string;
|
|
41
47
|
status?: string;
|
|
42
48
|
priority?: string;
|
|
43
49
|
assigneeId?: string;
|
|
44
|
-
}>;
|
|
50
|
+
}, any>;
|
|
45
51
|
export declare const getTaskTool: ToolDefinition<{
|
|
46
52
|
id: string;
|
|
47
|
-
}>;
|
|
53
|
+
}, any>;
|
|
48
54
|
export declare const createTaskTool: ToolDefinition<{
|
|
49
55
|
projectId?: string;
|
|
50
56
|
title: string;
|
|
51
57
|
description?: string;
|
|
52
58
|
status?: string;
|
|
53
|
-
priority?:
|
|
59
|
+
priority?: "urgent" | "high" | "medium" | "low" | "none";
|
|
54
60
|
assigneeId?: string;
|
|
55
61
|
dueDate?: string;
|
|
56
62
|
tags?: string[];
|
|
57
63
|
estimatedHours?: number;
|
|
58
64
|
isBlocked?: boolean;
|
|
59
65
|
blockedReason?: string;
|
|
60
|
-
}>;
|
|
66
|
+
}, any>;
|
|
61
67
|
export declare const updateTaskTool: ToolDefinition<{
|
|
62
68
|
id: string;
|
|
63
69
|
title?: string;
|
|
64
70
|
description?: string;
|
|
65
71
|
status?: string;
|
|
66
|
-
priority?:
|
|
72
|
+
priority?: "urgent" | "high" | "medium" | "low" | "none";
|
|
67
73
|
assigneeId?: string;
|
|
68
74
|
dueDate?: string;
|
|
69
75
|
tags?: string[];
|
|
@@ -71,55 +77,55 @@ export declare const updateTaskTool: ToolDefinition<{
|
|
|
71
77
|
loggedHours?: number;
|
|
72
78
|
isBlocked?: boolean;
|
|
73
79
|
blockedReason?: string;
|
|
74
|
-
}>;
|
|
80
|
+
}, any>;
|
|
75
81
|
export declare const deleteTaskTool: ToolDefinition<{
|
|
76
82
|
id: string;
|
|
77
|
-
}>;
|
|
83
|
+
}, any>;
|
|
78
84
|
export declare const listDeliverablesTool: ToolDefinition<{
|
|
79
85
|
projectId?: string;
|
|
80
|
-
}>;
|
|
86
|
+
}, any>;
|
|
81
87
|
export declare const createDeliverableTool: ToolDefinition<{
|
|
82
88
|
projectId?: string;
|
|
83
89
|
title: string;
|
|
84
90
|
description?: string;
|
|
85
91
|
dueDate?: string;
|
|
86
92
|
taskIds?: string[];
|
|
87
|
-
}>;
|
|
93
|
+
}, any>;
|
|
88
94
|
export declare const listCommentsTool: ToolDefinition<{
|
|
89
95
|
taskId: string;
|
|
90
|
-
}>;
|
|
96
|
+
}, any>;
|
|
91
97
|
export declare const addCommentTool: ToolDefinition<{
|
|
92
98
|
taskId: string;
|
|
93
99
|
content: string;
|
|
94
100
|
authorId: string;
|
|
95
|
-
}>;
|
|
101
|
+
}, any>;
|
|
96
102
|
export declare const calculateCriticalPathTool: ToolDefinition<{
|
|
97
103
|
projectId?: string;
|
|
98
|
-
}>;
|
|
104
|
+
}, any>;
|
|
99
105
|
export declare const getTimelineLadderTool: ToolDefinition<{
|
|
100
106
|
projectId?: string;
|
|
101
|
-
level?:
|
|
107
|
+
level?: "macro" | "standard" | "concrete" | "all";
|
|
102
108
|
containerId?: string;
|
|
103
109
|
iterationId?: string;
|
|
104
|
-
}>;
|
|
110
|
+
}, any>;
|
|
105
111
|
export declare const getTaskLadderTool: ToolDefinition<{
|
|
106
112
|
taskId: string;
|
|
107
|
-
}>;
|
|
113
|
+
}, any>;
|
|
108
114
|
export declare const getTaskMetricsTool: ToolDefinition<{
|
|
109
115
|
taskId: string;
|
|
110
|
-
}>;
|
|
116
|
+
}, any>;
|
|
111
117
|
export declare const getTaskProgressHistoryTool: ToolDefinition<{
|
|
112
118
|
taskId: string;
|
|
113
|
-
}>;
|
|
119
|
+
}, any>;
|
|
114
120
|
export declare const getWorkloadDistributionTool: ToolDefinition<{
|
|
115
121
|
projectId?: string;
|
|
116
122
|
startDate?: string;
|
|
117
123
|
endDate?: string;
|
|
118
|
-
interval?:
|
|
119
|
-
groupBy?:
|
|
120
|
-
metric?:
|
|
124
|
+
interval?: "day" | "week" | "month";
|
|
125
|
+
groupBy?: "assignee" | "team" | "taskType" | "priority" | "status";
|
|
126
|
+
metric?: "scheduled" | "logged" | "remaining" | "blended";
|
|
121
127
|
defaultWeeklyCapacityHours?: number;
|
|
122
|
-
}>;
|
|
128
|
+
}, any>;
|
|
123
129
|
export declare const ALL_TOOLS: ToolDefinition[];
|
|
124
130
|
export declare const TOOL_MAP: Map<string, ToolDefinition<any, any>>;
|
|
125
131
|
//# sourceMappingURL=definitions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/tools/definitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/tools/definitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,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,oFAAoF;IACpF,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,WAAW,CAAC,EAAE;QACZ,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,oBAAoB,CAAC,EAAE,OAAO,CAAC;KAChC,CAAC;IACF,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC/G;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,OAAO,GAAG,GAAG,EAAE,OAAO,GAAG,GAAG,EACrD,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,aAAa,CAAC,GAC1D,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAGlC;AAED,qBAAa,iBAAkB,SAAQ,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