coalesce-transform-mcp 0.3.0 → 0.4.2
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 +74 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +6 -2
- package/dist/client.js.map +1 -1
- package/dist/coalesce/api/environments.d.ts +0 -12
- package/dist/coalesce/api/environments.d.ts.map +1 -1
- package/dist/coalesce/api/environments.js +0 -4
- package/dist/coalesce/api/environments.js.map +1 -1
- package/dist/coalesce/api/jobs.d.ts +3 -5
- package/dist/coalesce/api/jobs.d.ts.map +1 -1
- package/dist/coalesce/api/jobs.js +3 -6
- package/dist/coalesce/api/jobs.js.map +1 -1
- package/dist/coalesce/api/nodes.d.ts +3 -3
- package/dist/coalesce/api/nodes.d.ts.map +1 -1
- package/dist/coalesce/api/nodes.js +6 -4
- package/dist/coalesce/api/nodes.js.map +1 -1
- package/dist/coalesce/api/runs.d.ts.map +1 -1
- package/dist/coalesce/api/runs.js +11 -1
- package/dist/coalesce/api/runs.js.map +1 -1
- package/dist/coalesce/api/scan.d.ts +14 -0
- package/dist/coalesce/api/scan.d.ts.map +1 -0
- package/dist/coalesce/api/scan.js +64 -0
- package/dist/coalesce/api/scan.js.map +1 -0
- package/dist/coalesce/api/subgraphs.d.ts +3 -2
- package/dist/coalesce/api/subgraphs.d.ts.map +1 -1
- package/dist/coalesce/api/subgraphs.js +3 -2
- package/dist/coalesce/api/subgraphs.js.map +1 -1
- package/dist/coalesce/run-schemas.d.ts.map +1 -1
- package/dist/coalesce/run-schemas.js +26 -16
- package/dist/coalesce/run-schemas.js.map +1 -1
- package/dist/coalesce/tool-response.d.ts +1 -13
- package/dist/coalesce/tool-response.d.ts.map +1 -1
- package/dist/coalesce/tool-response.js +20 -6
- package/dist/coalesce/tool-response.js.map +1 -1
- package/dist/coalesce/tool-schemas.d.ts +1 -2
- package/dist/coalesce/tool-schemas.d.ts.map +1 -1
- package/dist/coalesce/tool-schemas.js +368 -5
- package/dist/coalesce/tool-schemas.js.map +1 -1
- package/dist/coalesce/types.d.ts +8 -0
- package/dist/coalesce/types.d.ts.map +1 -1
- package/dist/coalesce/types.js +3 -1
- package/dist/coalesce/types.js.map +1 -1
- package/dist/constants.d.ts +18 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +21 -0
- package/dist/constants.js.map +1 -0
- package/dist/mcp/cache.d.ts +2 -1
- package/dist/mcp/cache.d.ts.map +1 -1
- package/dist/mcp/cache.js +122 -138
- package/dist/mcp/cache.js.map +1 -1
- package/dist/mcp/environments.d.ts +2 -1
- package/dist/mcp/environments.d.ts.map +1 -1
- package/dist/mcp/environments.js +56 -112
- package/dist/mcp/environments.js.map +1 -1
- package/dist/mcp/git-accounts.d.ts +2 -1
- package/dist/mcp/git-accounts.d.ts.map +1 -1
- package/dist/mcp/git-accounts.js +74 -96
- package/dist/mcp/git-accounts.js.map +1 -1
- package/dist/mcp/jobs.d.ts +2 -1
- package/dist/mcp/jobs.d.ts.map +1 -1
- package/dist/mcp/jobs.js +68 -122
- package/dist/mcp/jobs.js.map +1 -1
- package/dist/mcp/lineage.d.ts +5 -0
- package/dist/mcp/lineage.d.ts.map +1 -0
- package/dist/mcp/lineage.js +410 -0
- package/dist/mcp/lineage.js.map +1 -0
- package/dist/mcp/node-type-corpus.d.ts +2 -1
- package/dist/mcp/node-type-corpus.d.ts.map +1 -1
- package/dist/mcp/node-type-corpus.js +148 -151
- package/dist/mcp/node-type-corpus.js.map +1 -1
- package/dist/mcp/nodes.d.ts +2 -1
- package/dist/mcp/nodes.d.ts.map +1 -1
- package/dist/mcp/nodes.js +358 -464
- package/dist/mcp/nodes.js.map +1 -1
- package/dist/mcp/pipelines.d.ts +2 -1
- package/dist/mcp/pipelines.d.ts.map +1 -1
- package/dist/mcp/pipelines.js +514 -314
- package/dist/mcp/pipelines.js.map +1 -1
- package/dist/mcp/projects.d.ts +2 -1
- package/dist/mcp/projects.d.ts.map +1 -1
- package/dist/mcp/projects.js +66 -100
- package/dist/mcp/projects.js.map +1 -1
- package/dist/mcp/repo-node-types.d.ts +2 -1
- package/dist/mcp/repo-node-types.d.ts.map +1 -1
- package/dist/mcp/repo-node-types.js +92 -121
- package/dist/mcp/repo-node-types.js.map +1 -1
- package/dist/mcp/runs.d.ts +3 -2
- package/dist/mcp/runs.d.ts.map +1 -1
- package/dist/mcp/runs.js +93 -148
- package/dist/mcp/runs.js.map +1 -1
- package/dist/mcp/skills.d.ts +13 -0
- package/dist/mcp/skills.d.ts.map +1 -0
- package/dist/mcp/skills.js +85 -0
- package/dist/mcp/skills.js.map +1 -0
- package/dist/mcp/subgraphs.d.ts +2 -1
- package/dist/mcp/subgraphs.d.ts.map +1 -1
- package/dist/mcp/subgraphs.js +61 -98
- package/dist/mcp/subgraphs.js.map +1 -1
- package/dist/mcp/tool-helpers.d.ts +37 -0
- package/dist/mcp/tool-helpers.d.ts.map +1 -0
- package/dist/mcp/tool-helpers.js +82 -0
- package/dist/mcp/tool-helpers.js.map +1 -0
- package/dist/mcp/users.d.ts +2 -1
- package/dist/mcp/users.d.ts.map +1 -1
- package/dist/mcp/users.js +92 -145
- package/dist/mcp/users.js.map +1 -1
- package/dist/mcp/workshop.d.ts +2 -1
- package/dist/mcp/workshop.d.ts.map +1 -1
- package/dist/mcp/workshop.js +66 -101
- package/dist/mcp/workshop.js.map +1 -1
- package/dist/mcp/workspaces.d.ts +2 -1
- package/dist/mcp/workspaces.d.ts.map +1 -1
- package/dist/mcp/workspaces.js +19 -34
- package/dist/mcp/workspaces.js.map +1 -1
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +85 -0
- package/dist/prompts/index.js.map +1 -1
- package/dist/resources/context/pipeline-workshop-guide.md +1 -1
- package/dist/resources/context/tool-usage.md +7 -0
- package/dist/resources/index.d.ts +13 -0
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/index.js +105 -5
- package/dist/resources/index.js.map +1 -1
- package/dist/schemas/node-payloads.d.ts +2 -2
- package/dist/server.d.ts +2 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +158 -41
- package/dist/server.js.map +1 -1
- package/dist/services/cache/snapshots.d.ts.map +1 -1
- package/dist/services/cache/snapshots.js +9 -5
- package/dist/services/cache/snapshots.js.map +1 -1
- package/dist/services/config/schema-resolver.d.ts.map +1 -1
- package/dist/services/config/schema-resolver.js +3 -6
- package/dist/services/config/schema-resolver.js.map +1 -1
- package/dist/services/lineage/lineage-cache.d.ts +53 -0
- package/dist/services/lineage/lineage-cache.d.ts.map +1 -0
- package/dist/services/lineage/lineage-cache.js +335 -0
- package/dist/services/lineage/lineage-cache.js.map +1 -0
- package/dist/services/lineage/lineage-documentation.d.ts +29 -0
- package/dist/services/lineage/lineage-documentation.d.ts.map +1 -0
- package/dist/services/lineage/lineage-documentation.js +80 -0
- package/dist/services/lineage/lineage-documentation.js.map +1 -0
- package/dist/services/lineage/lineage-propagation.d.ts +47 -0
- package/dist/services/lineage/lineage-propagation.d.ts.map +1 -0
- package/dist/services/lineage/lineage-propagation.js +176 -0
- package/dist/services/lineage/lineage-propagation.js.map +1 -0
- package/dist/services/lineage/lineage-search.d.ts +33 -0
- package/dist/services/lineage/lineage-search.d.ts.map +1 -0
- package/dist/services/lineage/lineage-search.js +133 -0
- package/dist/services/lineage/lineage-search.js.map +1 -0
- package/dist/services/lineage/lineage-traversal.d.ts +34 -0
- package/dist/services/lineage/lineage-traversal.d.ts.map +1 -0
- package/dist/services/lineage/lineage-traversal.js +283 -0
- package/dist/services/lineage/lineage-traversal.js.map +1 -0
- package/dist/services/pipelines/clause-extraction.d.ts +3 -0
- package/dist/services/pipelines/clause-extraction.d.ts.map +1 -0
- package/dist/services/pipelines/clause-extraction.js +27 -0
- package/dist/services/pipelines/clause-extraction.js.map +1 -0
- package/dist/services/pipelines/column-helpers.d.ts +8 -0
- package/dist/services/pipelines/column-helpers.d.ts.map +1 -0
- package/dist/services/pipelines/column-helpers.js +125 -0
- package/dist/services/pipelines/column-helpers.js.map +1 -0
- package/dist/services/pipelines/cte-parsing.d.ts +29 -0
- package/dist/services/pipelines/cte-parsing.d.ts.map +1 -0
- package/dist/services/pipelines/cte-parsing.js +160 -0
- package/dist/services/pipelines/cte-parsing.js.map +1 -0
- package/dist/services/pipelines/cte-planning.d.ts +22 -0
- package/dist/services/pipelines/cte-planning.d.ts.map +1 -0
- package/dist/services/pipelines/cte-planning.js +206 -0
- package/dist/services/pipelines/cte-planning.js.map +1 -0
- package/dist/services/pipelines/execution.d.ts.map +1 -1
- package/dist/services/pipelines/execution.js +0 -1
- package/dist/services/pipelines/execution.js.map +1 -1
- package/dist/services/pipelines/intent-parsing.d.ts +24 -0
- package/dist/services/pipelines/intent-parsing.d.ts.map +1 -0
- package/dist/services/pipelines/intent-parsing.js +245 -0
- package/dist/services/pipelines/intent-parsing.js.map +1 -0
- package/dist/services/pipelines/intent-resolution.d.ts +24 -0
- package/dist/services/pipelines/intent-resolution.d.ts.map +1 -0
- package/dist/services/pipelines/intent-resolution.js +141 -0
- package/dist/services/pipelines/intent-resolution.js.map +1 -0
- package/dist/services/pipelines/intent.d.ts +4 -45
- package/dist/services/pipelines/intent.d.ts.map +1 -1
- package/dist/services/pipelines/intent.js +14 -408
- package/dist/services/pipelines/intent.js.map +1 -1
- package/dist/services/pipelines/node-type-candidates.d.ts +6 -0
- package/dist/services/pipelines/node-type-candidates.d.ts.map +1 -0
- package/dist/services/pipelines/node-type-candidates.js +165 -0
- package/dist/services/pipelines/node-type-candidates.js.map +1 -0
- package/dist/services/pipelines/node-type-intent.d.ts +1 -5
- package/dist/services/pipelines/node-type-intent.d.ts.map +1 -1
- package/dist/services/pipelines/node-type-intent.js +1 -5
- package/dist/services/pipelines/node-type-intent.js.map +1 -1
- package/dist/services/pipelines/node-type-scoring.d.ts +13 -0
- package/dist/services/pipelines/node-type-scoring.d.ts.map +1 -0
- package/dist/services/pipelines/node-type-scoring.js +322 -0
- package/dist/services/pipelines/node-type-scoring.js.map +1 -0
- package/dist/services/pipelines/node-type-selection.d.ts +22 -2
- package/dist/services/pipelines/node-type-selection.d.ts.map +1 -1
- package/dist/services/pipelines/node-type-selection.js +16 -538
- package/dist/services/pipelines/node-type-selection.js.map +1 -1
- package/dist/services/pipelines/plan-builder.d.ts +33 -0
- package/dist/services/pipelines/plan-builder.d.ts.map +1 -0
- package/dist/services/pipelines/plan-builder.js +224 -0
- package/dist/services/pipelines/plan-builder.js.map +1 -0
- package/dist/services/pipelines/planning-types.d.ts +543 -0
- package/dist/services/pipelines/planning-types.d.ts.map +1 -0
- package/dist/services/pipelines/planning-types.js +85 -0
- package/dist/services/pipelines/planning-types.js.map +1 -0
- package/dist/services/pipelines/planning.d.ts +8 -537
- package/dist/services/pipelines/planning.d.ts.map +1 -1
- package/dist/services/pipelines/planning.js +10 -1956
- package/dist/services/pipelines/planning.js.map +1 -1
- package/dist/services/pipelines/review.d.ts.map +1 -1
- package/dist/services/pipelines/review.js +3 -8
- package/dist/services/pipelines/review.js.map +1 -1
- package/dist/services/pipelines/select-parsing.d.ts +7 -0
- package/dist/services/pipelines/select-parsing.d.ts.map +1 -0
- package/dist/services/pipelines/select-parsing.js +185 -0
- package/dist/services/pipelines/select-parsing.js.map +1 -0
- package/dist/services/pipelines/source-parsing.d.ts +8 -0
- package/dist/services/pipelines/source-parsing.d.ts.map +1 -0
- package/dist/services/pipelines/source-parsing.js +151 -0
- package/dist/services/pipelines/source-parsing.js.map +1 -0
- package/dist/services/pipelines/sql-parsing.d.ts +8 -0
- package/dist/services/pipelines/sql-parsing.d.ts.map +1 -0
- package/dist/services/pipelines/sql-parsing.js +9 -0
- package/dist/services/pipelines/sql-parsing.js.map +1 -0
- package/dist/services/pipelines/sql-tokenizer.d.ts +42 -0
- package/dist/services/pipelines/sql-tokenizer.d.ts.map +1 -0
- package/dist/services/pipelines/sql-tokenizer.js +493 -0
- package/dist/services/pipelines/sql-tokenizer.js.map +1 -0
- package/dist/services/pipelines/sql-utils.d.ts +30 -0
- package/dist/services/pipelines/sql-utils.d.ts.map +1 -0
- package/dist/services/pipelines/sql-utils.js +62 -0
- package/dist/services/pipelines/sql-utils.js.map +1 -0
- package/dist/services/pipelines/workshop.d.ts.map +1 -1
- package/dist/services/pipelines/workshop.js +53 -25
- package/dist/services/pipelines/workshop.js.map +1 -1
- package/dist/services/pipelines/workspace-resolution.d.ts +18 -0
- package/dist/services/pipelines/workspace-resolution.d.ts.map +1 -0
- package/dist/services/pipelines/workspace-resolution.js +279 -0
- package/dist/services/pipelines/workspace-resolution.js.map +1 -0
- package/dist/services/runs/diagnostics.d.ts.map +1 -1
- package/dist/services/runs/diagnostics.js +3 -8
- package/dist/services/runs/diagnostics.js.map +1 -1
- package/dist/services/shared/elicitation.d.ts +14 -0
- package/dist/services/shared/elicitation.d.ts.map +1 -0
- package/dist/services/shared/elicitation.js +56 -0
- package/dist/services/shared/elicitation.js.map +1 -0
- package/dist/services/workspace/node-creation.d.ts.map +1 -1
- package/dist/services/workspace/node-creation.js +5 -1
- package/dist/services/workspace/node-creation.js.map +1 -1
- package/dist/services/workspace/node-update-helpers.d.ts.map +1 -1
- package/dist/services/workspace/node-update-helpers.js +3 -8
- package/dist/services/workspace/node-update-helpers.js.map +1 -1
- package/dist/utils.d.ts +11 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +20 -1
- package/dist/utils.js.map +1 -1
- package/dist/workflows/get-environment-health.d.ts +49 -0
- package/dist/workflows/get-environment-health.d.ts.map +1 -0
- package/dist/workflows/get-environment-health.js +310 -0
- package/dist/workflows/get-environment-health.js.map +1 -0
- package/dist/workflows/get-environment-overview.d.ts +2 -1
- package/dist/workflows/get-environment-overview.d.ts.map +1 -1
- package/dist/workflows/get-environment-overview.js +13 -19
- package/dist/workflows/get-environment-overview.js.map +1 -1
- package/dist/workflows/get-run-details.d.ts +2 -2
- package/dist/workflows/get-run-details.d.ts.map +1 -1
- package/dist/workflows/get-run-details.js +14 -19
- package/dist/workflows/get-run-details.js.map +1 -1
- package/dist/workflows/retry-and-wait.d.ts.map +1 -1
- package/dist/workflows/retry-and-wait.js +3 -2
- package/dist/workflows/retry-and-wait.js.map +1 -1
- package/dist/workflows/run-and-wait.d.ts.map +1 -1
- package/dist/workflows/run-and-wait.js +3 -2
- package/dist/workflows/run-and-wait.js.map +1 -1
- package/package.json +2 -2
package/dist/mcp/subgraphs.js
CHANGED
|
@@ -1,102 +1,65 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { listWorkspaceSubgraphs, getWorkspaceSubgraph, createWorkspaceSubgraph, updateWorkspaceSubgraph, deleteWorkspaceSubgraph, } from "../coalesce/api/subgraphs.js";
|
|
3
|
-
import { PaginationParams,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
inputSchema: z.object({
|
|
65
|
-
workspaceID: z.string().describe("The workspace ID"),
|
|
66
|
-
subgraphID: z.string().describe("The subgraph ID to update"),
|
|
67
|
-
name: z.string().describe("Updated name for the subgraph"),
|
|
68
|
-
steps: z
|
|
69
|
-
.array(z.string())
|
|
70
|
-
.describe("Updated array of node IDs to include in the subgraph"),
|
|
71
|
-
}),
|
|
72
|
-
outputSchema: getToolOutputSchema("update_workspace_subgraph"),
|
|
73
|
-
annotations: WRITE_ANNOTATIONS,
|
|
74
|
-
}, async (params) => {
|
|
75
|
-
try {
|
|
76
|
-
const result = await updateWorkspaceSubgraph(client, params);
|
|
77
|
-
return buildJsonToolResponse("update_workspace_subgraph", result);
|
|
78
|
-
}
|
|
79
|
-
catch (error) {
|
|
80
|
-
return handleToolError(error);
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
server.registerTool("delete_workspace_subgraph", {
|
|
84
|
-
title: "Delete Workspace Subgraph",
|
|
85
|
-
description: "Delete a subgraph from a workspace. Destructive — the subgraph is removed but its member nodes are NOT deleted.\n\nArgs:\n - workspaceID (string, required): The workspace ID\n - subgraphID (string, required): The subgraph ID\n\nReturns:\n Confirmation message.",
|
|
86
|
-
inputSchema: z.object({
|
|
87
|
-
workspaceID: z.string().describe("The workspace ID"),
|
|
88
|
-
subgraphID: z.string().describe("The subgraph ID to delete"),
|
|
89
|
-
}),
|
|
90
|
-
outputSchema: getToolOutputSchema("delete_workspace_subgraph"),
|
|
91
|
-
annotations: DESTRUCTIVE_ANNOTATIONS,
|
|
92
|
-
}, async (params) => {
|
|
93
|
-
try {
|
|
94
|
-
const result = await deleteWorkspaceSubgraph(client, params);
|
|
95
|
-
return buildJsonToolResponse("delete_workspace_subgraph", result);
|
|
96
|
-
}
|
|
97
|
-
catch (error) {
|
|
98
|
-
return handleToolError(error);
|
|
99
|
-
}
|
|
100
|
-
});
|
|
3
|
+
import { PaginationParams, READ_ONLY_ANNOTATIONS, WRITE_ANNOTATIONS, DESTRUCTIVE_ANNOTATIONS, } from "../coalesce/types.js";
|
|
4
|
+
import { defineSimpleTool, defineDestructiveTool } from "./tool-helpers.js";
|
|
5
|
+
export function defineSubgraphTools(server, client) {
|
|
6
|
+
return [
|
|
7
|
+
defineSimpleTool(client, "list_workspace_subgraphs", {
|
|
8
|
+
title: "List Workspace Subgraphs",
|
|
9
|
+
description: "List all subgraphs in a Coalesce workspace. Use this to discover subgraph IDs.\n\nArgs:\n - workspaceID (string, required): The workspace ID\n - limit, startingFrom, orderBy, orderByDirection: Pagination\n\nReturns:\n { data: Subgraph[], next?: string, total?: number }",
|
|
10
|
+
inputSchema: PaginationParams.extend({
|
|
11
|
+
workspaceID: z.string().describe("The workspace ID"),
|
|
12
|
+
}),
|
|
13
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
14
|
+
}, listWorkspaceSubgraphs),
|
|
15
|
+
defineSimpleTool(client, "get_workspace_subgraph", {
|
|
16
|
+
title: "Get Workspace Subgraph",
|
|
17
|
+
description: "Get details of a specific subgraph.\n\nArgs:\n - workspaceID (string, required): The workspace ID\n - subgraphID (string, required): The subgraph ID\n\nReturns:\n Subgraph object with name and node steps.",
|
|
18
|
+
inputSchema: z.object({
|
|
19
|
+
workspaceID: z.string().describe("The workspace ID"),
|
|
20
|
+
subgraphID: z.string().describe("The subgraph ID"),
|
|
21
|
+
}),
|
|
22
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
23
|
+
}, getWorkspaceSubgraph),
|
|
24
|
+
defineSimpleTool(client, "create_workspace_subgraph", {
|
|
25
|
+
title: "Create Workspace Subgraph",
|
|
26
|
+
description: "Create a subgraph in a Coalesce workspace. Subgraphs group nodes visually.\n\nArgs:\n - workspaceID (string, required): The workspace ID\n - name (string, required): Subgraph name\n - steps (string[], required): Array of node IDs to include\n\nReturns:\n Created subgraph with assigned ID.",
|
|
27
|
+
inputSchema: z.object({
|
|
28
|
+
workspaceID: z.string().describe("The workspace ID"),
|
|
29
|
+
name: z.string().describe("Name for the subgraph"),
|
|
30
|
+
steps: z
|
|
31
|
+
.array(z.string())
|
|
32
|
+
.describe("Array of node IDs to include in the subgraph"),
|
|
33
|
+
}),
|
|
34
|
+
annotations: WRITE_ANNOTATIONS,
|
|
35
|
+
}, createWorkspaceSubgraph),
|
|
36
|
+
defineSimpleTool(client, "update_workspace_subgraph", {
|
|
37
|
+
title: "Update Workspace Subgraph",
|
|
38
|
+
description: "Update a subgraph's name and member nodes. Replaces the entire steps array.\n\nArgs:\n - workspaceID (string, required): The workspace ID\n - subgraphID (string, required): The subgraph ID\n - name (string, required): Updated name\n - steps (string[], required): Updated node IDs\n\nReturns:\n Updated subgraph object.",
|
|
39
|
+
inputSchema: z.object({
|
|
40
|
+
workspaceID: z.string().describe("The workspace ID"),
|
|
41
|
+
subgraphID: z.string().describe("The subgraph ID to update"),
|
|
42
|
+
name: z.string().describe("Updated name for the subgraph"),
|
|
43
|
+
steps: z
|
|
44
|
+
.array(z.string())
|
|
45
|
+
.describe("Updated array of node IDs to include in the subgraph"),
|
|
46
|
+
}),
|
|
47
|
+
annotations: WRITE_ANNOTATIONS,
|
|
48
|
+
}, updateWorkspaceSubgraph),
|
|
49
|
+
defineDestructiveTool(server, client, "delete_workspace_subgraph", {
|
|
50
|
+
title: "Delete Workspace Subgraph",
|
|
51
|
+
description: "Delete a subgraph from a workspace. Destructive — the subgraph is removed but its member nodes are NOT deleted.\n\nArgs:\n - workspaceID (string, required): The workspace ID\n - subgraphID (string, required): The subgraph ID\n - confirmed (boolean, optional): Set to true after the user explicitly confirms deletion\n\nReturns:\n Confirmation message.",
|
|
52
|
+
inputSchema: z.object({
|
|
53
|
+
workspaceID: z.string().describe("The workspace ID"),
|
|
54
|
+
subgraphID: z.string().describe("The subgraph ID to delete"),
|
|
55
|
+
confirmed: z
|
|
56
|
+
.boolean()
|
|
57
|
+
.optional()
|
|
58
|
+
.describe("Set to true after the user explicitly confirms the deletion."),
|
|
59
|
+
}),
|
|
60
|
+
annotations: DESTRUCTIVE_ANNOTATIONS,
|
|
61
|
+
confirmMessage: (params) => `This will permanently delete subgraph "${params.subgraphID}" from workspace "${params.workspaceID}". Member nodes will NOT be deleted.`,
|
|
62
|
+
}, deleteWorkspaceSubgraph),
|
|
63
|
+
];
|
|
101
64
|
}
|
|
102
65
|
//# sourceMappingURL=subgraphs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subgraphs.js","sourceRoot":"","sources":["../../src/mcp/subgraphs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,
|
|
1
|
+
{"version":3,"file":"subgraphs.js","sourceRoot":"","sources":["../../src/mcp/subgraphs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,GAExB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE5E,MAAM,UAAU,mBAAmB,CACjC,MAAiB,EACjB,MAAsB;IAEtB,OAAO;QACP,gBAAgB,CAAC,MAAM,EAAE,0BAA0B,EAAE;YACnD,KAAK,EAAE,0BAA0B;YACjC,WAAW,EACT,kRAAkR;YACpR,WAAW,EAAE,gBAAgB,CAAC,MAAM,CAAC;gBACnC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC;aACrD,CAAC;YACF,WAAW,EAAE,qBAAqB;SACnC,EAAE,sBAAsB,CAAC;QAE1B,gBAAgB,CAAC,MAA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AC,MAAM,EAAE,CAAC;qBACjB,QAAQ,CAAC,sDAAsD,CAAC;aACpE,CAAC;YACF,WAAW,EAAE,iBAAiB;SAC/B,EAAE,uBAAuB,CAAC;QAE3B,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,2BAA2B,EAAE;YACjE,KAAK,EAAE,2BAA2B;YAClC,WAAW,EACT,qWAAqW;YACvW,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;gBACpB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC;gBACpD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;gBAC5D,SAAS,EAAE,CAAC;qBACT,OAAO,EAAE;qBACT,QAAQ,EAAE;qBACV,QAAQ,CAAC,8DAA8D,CAAC;aAC5E,CAAC;YACF,WAAW,EAAE,uBAAuB;YACpC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,0CAA0C,MAAM,CAAC,UAAU,qBAAqB,MAAM,CAAC,WAAW,sCAAsC;SACrK,EAAE,uBAAuB,CAAC;KAC1B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import type { CoalesceClient } from "../client.js";
|
|
4
|
+
import { type ToolDefinition } from "../coalesce/types.js";
|
|
5
|
+
type ToolAnnotations = {
|
|
6
|
+
readOnlyHint?: boolean;
|
|
7
|
+
idempotentHint?: boolean;
|
|
8
|
+
destructiveHint?: boolean;
|
|
9
|
+
openWorldHint?: boolean;
|
|
10
|
+
};
|
|
11
|
+
type ToolDef<S extends z.ZodType> = {
|
|
12
|
+
title: string;
|
|
13
|
+
description: string;
|
|
14
|
+
inputSchema: S;
|
|
15
|
+
annotations: ToolAnnotations;
|
|
16
|
+
sanitize?: boolean;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Define a simple passthrough tool: calls an API function with (client, params)
|
|
20
|
+
* and wraps the result in buildJsonToolResponse / handleToolError.
|
|
21
|
+
*/
|
|
22
|
+
export declare function defineSimpleTool<S extends z.ZodType>(client: CoalesceClient, name: string, def: ToolDef<S>, apiFunc: (client: CoalesceClient, params: z.infer<S>) => Promise<unknown>): ToolDefinition;
|
|
23
|
+
/**
|
|
24
|
+
* Define a local-only tool that does not call the Coalesce API.
|
|
25
|
+
* Provides the same error handling and response formatting as defineSimpleTool
|
|
26
|
+
* without requiring a CoalesceClient dependency.
|
|
27
|
+
*/
|
|
28
|
+
export declare function defineLocalTool<S extends z.ZodType>(name: string, def: ToolDef<S>, handler: (params: z.infer<S>) => unknown | Promise<unknown>): ToolDefinition;
|
|
29
|
+
/**
|
|
30
|
+
* Define a destructive tool that requires user confirmation before executing.
|
|
31
|
+
* The `server` parameter is still needed for elicitation.
|
|
32
|
+
*/
|
|
33
|
+
export declare function defineDestructiveTool<S extends z.ZodType>(server: McpServer, client: CoalesceClient, name: string, def: ToolDef<S> & {
|
|
34
|
+
confirmMessage: (params: z.infer<S>) => string;
|
|
35
|
+
}, apiFunc: (client: CoalesceClient, params: z.infer<S>) => Promise<unknown>): ToolDefinition;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=tool-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-helpers.d.ts","sourceRoot":"","sources":["../../src/mcp/tool-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,sBAAsB,CAAC;AAG9B,KAAK,eAAe,GAAG;IACrB,YAAY,CAAC,EAAE,OAAO,C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,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,GACxE,cAAc,CA2BhB"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { buildJsonToolResponse, handleToolError, getToolOutputSchema, sanitizeResponse, } from "../coalesce/types.js";
|
|
2
|
+
import { requireDestructiveConfirmation } from "../services/shared/elicitation.js";
|
|
3
|
+
/**
|
|
4
|
+
* Define a simple passthrough tool: calls an API function with (client, params)
|
|
5
|
+
* and wraps the result in buildJsonToolResponse / handleToolError.
|
|
6
|
+
*/
|
|
7
|
+
export function defineSimpleTool(client, name, def, apiFunc) {
|
|
8
|
+
return [
|
|
9
|
+
name,
|
|
10
|
+
{
|
|
11
|
+
title: def.title,
|
|
12
|
+
description: def.description,
|
|
13
|
+
inputSchema: def.inputSchema,
|
|
14
|
+
outputSchema: getToolOutputSchema(name),
|
|
15
|
+
annotations: def.annotations,
|
|
16
|
+
},
|
|
17
|
+
(async (params) => {
|
|
18
|
+
try {
|
|
19
|
+
const result = await apiFunc(client, params);
|
|
20
|
+
return buildJsonToolResponse(name, def.sanitize ? sanitizeResponse(result) : result);
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
return handleToolError(error);
|
|
24
|
+
}
|
|
25
|
+
}),
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Define a local-only tool that does not call the Coalesce API.
|
|
30
|
+
* Provides the same error handling and response formatting as defineSimpleTool
|
|
31
|
+
* without requiring a CoalesceClient dependency.
|
|
32
|
+
*/
|
|
33
|
+
export function defineLocalTool(name, def, handler) {
|
|
34
|
+
return [
|
|
35
|
+
name,
|
|
36
|
+
{
|
|
37
|
+
title: def.title,
|
|
38
|
+
description: def.description,
|
|
39
|
+
inputSchema: def.inputSchema,
|
|
40
|
+
outputSchema: getToolOutputSchema(name),
|
|
41
|
+
annotations: def.annotations,
|
|
42
|
+
},
|
|
43
|
+
(async (params) => {
|
|
44
|
+
try {
|
|
45
|
+
const result = await handler(params);
|
|
46
|
+
return buildJsonToolResponse(name, def.sanitize ? sanitizeResponse(result) : result);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
return handleToolError(error);
|
|
50
|
+
}
|
|
51
|
+
}),
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Define a destructive tool that requires user confirmation before executing.
|
|
56
|
+
* The `server` parameter is still needed for elicitation.
|
|
57
|
+
*/
|
|
58
|
+
export function defineDestructiveTool(server, client, name, def, apiFunc) {
|
|
59
|
+
return [
|
|
60
|
+
name,
|
|
61
|
+
{
|
|
62
|
+
title: def.title,
|
|
63
|
+
description: def.description,
|
|
64
|
+
inputSchema: def.inputSchema,
|
|
65
|
+
outputSchema: getToolOutputSchema(name),
|
|
66
|
+
annotations: def.annotations,
|
|
67
|
+
},
|
|
68
|
+
(async (params) => {
|
|
69
|
+
try {
|
|
70
|
+
const approvalResponse = await requireDestructiveConfirmation(server, name, def.confirmMessage(params), params.confirmed);
|
|
71
|
+
if (approvalResponse)
|
|
72
|
+
return approvalResponse;
|
|
73
|
+
const result = await apiFunc(client, params);
|
|
74
|
+
return buildJsonToolResponse(name, def.sanitize ? sanitizeResponse(result) : result);
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
return handleToolError(error);
|
|
78
|
+
}
|
|
79
|
+
}),
|
|
80
|
+
];
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=tool-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-helpers.js","sourceRoot":"","sources":["../../src/mcp/tool-helpers.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,gBAAgB,GAEjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,8BAA8B,EAAE,MAAM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} from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import type { CoalesceClient } from "../client.js";
|
|
3
|
-
|
|
3
|
+
import { type ToolDefinition } from "../coalesce/types.js";
|
|
4
|
+
export declare function defineUserTools(server: McpServer, client: CoalesceClient): ToolDefinition[];
|
|
4
5
|
//# sourceMappingURL=users.d.ts.map
|
package/dist/mcp/users.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../src/mcp/users.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../src/mcp/users.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAWnD,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,sBAAsB,CAAC;AAG9B,wBAAgB,eAAe,CAC7B,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,cAAc,GACrB,cAAc,EAAE,CA6GlB"}
|
package/dist/mcp/users.js
CHANGED
|
@@ -1,153 +1,100 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { listOrgUsers, getUserRoles, listUserRoles, setOrgRole, setProjectRole, deleteProjectRole, setEnvRole, deleteEnvRole, } from "../coalesce/api/users.js";
|
|
3
|
-
import { PaginationParams,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
description: "List roles for all users in the organization, optionally scoped.\n\nArgs:\n - projectID (string, optional): Scope to a project\n - environmentID (string, optional): Scope to an environment\n\nReturns:\n { data: RoleAssignment[], next?: string, total?: number }",
|
|
42
|
-
inputSchema: z.object({
|
|
43
|
-
projectID: z.string().optional().describe("Optional project scope filter"),
|
|
44
|
-
environmentID: z.string().optional().describe("Optional environment scope filter"),
|
|
45
|
-
}),
|
|
46
|
-
outputSchema: getToolOutputSchema("list_user_roles"),
|
|
47
|
-
annotations: READ_ONLY_ANNOTATIONS,
|
|
48
|
-
}, async (params) => {
|
|
49
|
-
try {
|
|
50
|
-
const result = await listUserRoles(client, params);
|
|
51
|
-
return buildJsonToolResponse("list_user_roles", result);
|
|
52
|
-
}
|
|
53
|
-
catch (error) {
|
|
54
|
-
return handleToolError(error);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
server.registerTool("set_org_role", {
|
|
58
|
-
title: "Set Org Role",
|
|
59
|
-
description: "Set the organization-level role for a user. Idempotent — safe to call multiple times.\n\nArgs:\n - userID (string, required): The user ID\n - role (string, required): Role to assign (e.g., 'admin', 'member', 'viewer')\n\nReturns:\n Updated role assignment.",
|
|
60
|
-
inputSchema: z.object({
|
|
61
|
-
userID: z.string().describe("The user ID"),
|
|
62
|
-
role: z.string().describe("The organization role to assign (e.g., 'admin', 'member', 'viewer')"),
|
|
63
|
-
}),
|
|
64
|
-
outputSchema: getToolOutputSchema("set_org_role"),
|
|
65
|
-
annotations: IDEMPOTENT_WRITE_ANNOTATIONS,
|
|
66
|
-
}, async (params) => {
|
|
67
|
-
try {
|
|
3
|
+
import { PaginationParams, READ_ONLY_ANNOTATIONS, IDEMPOTENT_WRITE_ANNOTATIONS, DESTRUCTIVE_ANNOTATIONS, } from "../coalesce/types.js";
|
|
4
|
+
import { defineSimpleTool, defineDestructiveTool } from "./tool-helpers.js";
|
|
5
|
+
export function defineUserTools(server, client) {
|
|
6
|
+
return [
|
|
7
|
+
defineSimpleTool(client, "list_org_users", {
|
|
8
|
+
title: "List Org Users",
|
|
9
|
+
description: "List all users in the Coalesce organization.\n\nArgs:\n - limit, startingFrom, orderBy, orderByDirection: Pagination controls\n\nReturns:\n { data: User[], next?: string, total?: number }",
|
|
10
|
+
inputSchema: PaginationParams,
|
|
11
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
12
|
+
}, listOrgUsers),
|
|
13
|
+
defineSimpleTool(client, "get_user_roles", {
|
|
14
|
+
title: "Get User Roles",
|
|
15
|
+
description: "Get roles assigned to a specific user, optionally scoped to a project or environment.\n\nArgs:\n - userID (string, required): The user ID\n - projectID (string, optional): Scope to a specific project\n - environmentID (string, optional): Scope to a specific environment\n\nReturns:\n Role assignments for the user.",
|
|
16
|
+
inputSchema: z.object({
|
|
17
|
+
userID: z.string().describe("The user ID"),
|
|
18
|
+
projectID: z.string().optional().describe("Optional project scope filter"),
|
|
19
|
+
environmentID: z.string().optional().describe("Optional environment scope filter"),
|
|
20
|
+
}),
|
|
21
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
22
|
+
}, getUserRoles),
|
|
23
|
+
defineSimpleTool(client, "list_user_roles", {
|
|
24
|
+
title: "List User Roles",
|
|
25
|
+
description: "List roles for all users in the organization, optionally scoped.\n\nArgs:\n - projectID (string, optional): Scope to a project\n - environmentID (string, optional): Scope to an environment\n\nReturns:\n { data: RoleAssignment[], next?: string, total?: number }",
|
|
26
|
+
inputSchema: z.object({
|
|
27
|
+
projectID: z.string().optional().describe("Optional project scope filter"),
|
|
28
|
+
environmentID: z.string().optional().describe("Optional environment scope filter"),
|
|
29
|
+
}),
|
|
30
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
31
|
+
}, listUserRoles),
|
|
32
|
+
defineSimpleTool(client, "set_org_role", {
|
|
33
|
+
title: "Set Org Role",
|
|
34
|
+
description: "Set the organization-level role for a user. Idempotent — safe to call multiple times.\n\nArgs:\n - userID (string, required): The user ID\n - role (string, required): Role to assign (e.g., 'admin', 'member', 'viewer')\n\nReturns:\n Updated role assignment.",
|
|
35
|
+
inputSchema: z.object({
|
|
36
|
+
userID: z.string().describe("The user ID"),
|
|
37
|
+
role: z.string().describe("The organization role to assign (e.g., 'admin', 'member', 'viewer')"),
|
|
38
|
+
}),
|
|
39
|
+
annotations: IDEMPOTENT_WRITE_ANNOTATIONS,
|
|
40
|
+
}, (client, params) => {
|
|
68
41
|
const { userID, ...body } = params;
|
|
69
|
-
|
|
70
|
-
return buildJsonToolResponse("set_org_role", result);
|
|
71
|
-
}
|
|
72
|
-
catch (error) {
|
|
73
|
-
return handleToolError(error);
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
server.registerTool("set_project_role", {
|
|
77
|
-
title: "Set Project Role",
|
|
78
|
-
description: "Set a user's role for a specific project. Idempotent.\n\nArgs:\n - userID (string, required): The user ID\n - projectID (string, required): The project ID\n - role (string, required): Role to assign (e.g., 'admin', 'developer', 'viewer')\n\nReturns:\n Updated role assignment.",
|
|
79
|
-
inputSchema: z.object({
|
|
80
|
-
userID: z.string().describe("The user ID"),
|
|
81
|
-
projectID: z.string().describe("The project ID"),
|
|
82
|
-
role: z.string().describe("The project role to assign (e.g., 'admin', 'developer', 'viewer')"),
|
|
83
|
-
}),
|
|
84
|
-
outputSchema: getToolOutputSchema("set_project_role"),
|
|
85
|
-
annotations: IDEMPOTENT_WRITE_ANNOTATIONS,
|
|
86
|
-
}, async (params) => {
|
|
87
|
-
try {
|
|
88
|
-
const { userID, projectID, ...body } = params;
|
|
89
|
-
const result = await setProjectRole(client, { userID, projectID, body });
|
|
90
|
-
return buildJsonToolResponse("set_project_role", result);
|
|
91
|
-
}
|
|
92
|
-
catch (error) {
|
|
93
|
-
return handleToolError(error);
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
server.registerTool("delete_project_role", {
|
|
97
|
-
title: "Delete Project Role",
|
|
98
|
-
description: "Remove a user's role from a specific project. Destructive — the user will lose project access.\n\nArgs:\n - userID (string, required): The user ID\n - projectID (string, required): The project ID\n\nReturns:\n Confirmation message.",
|
|
99
|
-
inputSchema: z.object({
|
|
100
|
-
userID: z.string().describe("The user ID"),
|
|
101
|
-
projectID: z.string().describe("The project ID"),
|
|
42
|
+
return setOrgRole(client, { userID, body });
|
|
102
43
|
}),
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
title: "Set Env Role",
|
|
116
|
-
description: "Set a user's role for a specific environment. Idempotent.\n\nArgs:\n - userID (string, required): The user ID\n - environmentID (string, required): The environment ID\n - role (string, required): Role to assign\n\nReturns:\n Updated role assignment.",
|
|
117
|
-
inputSchema: z.object({
|
|
118
|
-
userID: z.string().describe("The user ID"),
|
|
119
|
-
environmentID: z.string().describe("The environment ID"),
|
|
120
|
-
role: z.string().describe("The environment role to assign (e.g., 'admin', 'developer', 'viewer')"),
|
|
44
|
+
defineSimpleTool(client, "set_project_role", {
|
|
45
|
+
title: "Set Project Role",
|
|
46
|
+
description: "Set a user's role for a specific project. Idempotent.\n\nArgs:\n - userID (string, required): The user ID\n - projectID (string, required): The project ID\n - role (string, required): Role to assign (e.g., 'admin', 'developer', 'viewer')\n\nReturns:\n Updated role assignment.",
|
|
47
|
+
inputSchema: z.object({
|
|
48
|
+
userID: z.string().describe("The user ID"),
|
|
49
|
+
projectID: z.string().describe("The project ID"),
|
|
50
|
+
role: z.string().describe("The project role to assign (e.g., 'admin', 'developer', 'viewer')"),
|
|
51
|
+
}),
|
|
52
|
+
annotations: IDEMPOTENT_WRITE_ANNOTATIONS,
|
|
53
|
+
}, (client, params) => {
|
|
54
|
+
const { userID, projectID, role } = params;
|
|
55
|
+
return setProjectRole(client, { userID, projectID, body: { projectRole: role } });
|
|
121
56
|
}),
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
57
|
+
defineDestructiveTool(server, client, "delete_project_role", {
|
|
58
|
+
title: "Delete Project Role",
|
|
59
|
+
description: "Remove a user's role from a specific project. Destructive — the user will lose project access immediately.\n\nArgs:\n - userID (string, required): The user ID\n - projectID (string, required): The project ID\n - confirmed (boolean, optional): Set to true after the user explicitly confirms the role removal\n\nReturns:\n Confirmation message.",
|
|
60
|
+
inputSchema: z.object({
|
|
61
|
+
userID: z.string().describe("The user ID"),
|
|
62
|
+
projectID: z.string().describe("The project ID"),
|
|
63
|
+
confirmed: z
|
|
64
|
+
.boolean()
|
|
65
|
+
.optional()
|
|
66
|
+
.describe("Set to true after the user explicitly confirms the role removal."),
|
|
67
|
+
}),
|
|
68
|
+
annotations: DESTRUCTIVE_ANNOTATIONS,
|
|
69
|
+
confirmMessage: (params) => `This will remove the project role for user "${params.userID}" on project "${params.projectID}". The user will lose project access immediately.`,
|
|
70
|
+
}, deleteProjectRole),
|
|
71
|
+
defineSimpleTool(client, "set_env_role", {
|
|
72
|
+
title: "Set Env Role",
|
|
73
|
+
description: "Set a user's role for a specific environment. Idempotent.\n\nArgs:\n - userID (string, required): The user ID\n - environmentID (string, required): The environment ID\n - role (string, required): Role to assign\n\nReturns:\n Updated role assignment.",
|
|
74
|
+
inputSchema: z.object({
|
|
75
|
+
userID: z.string().describe("The user ID"),
|
|
76
|
+
environmentID: z.string().describe("The environment ID"),
|
|
77
|
+
role: z.string().describe("The environment role to assign (e.g., 'admin', 'developer', 'viewer')"),
|
|
78
|
+
}),
|
|
79
|
+
annotations: IDEMPOTENT_WRITE_ANNOTATIONS,
|
|
80
|
+
}, (client, params) => {
|
|
81
|
+
const { userID, environmentID, role } = params;
|
|
82
|
+
return setEnvRole(client, { userID, environmentID, body: { environmentRole: role } });
|
|
140
83
|
}),
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
84
|
+
defineDestructiveTool(server, client, "delete_env_role", {
|
|
85
|
+
title: "Delete Env Role",
|
|
86
|
+
description: "Remove a user's role from a specific environment. Destructive — the user will lose environment access immediately.\n\nArgs:\n - userID (string, required): The user ID\n - environmentID (string, required): The environment ID\n - confirmed (boolean, optional): Set to true after the user explicitly confirms the role removal\n\nReturns:\n Confirmation message.",
|
|
87
|
+
inputSchema: z.object({
|
|
88
|
+
userID: z.string().describe("The user ID"),
|
|
89
|
+
environmentID: z.string().describe("The environment ID"),
|
|
90
|
+
confirmed: z
|
|
91
|
+
.boolean()
|
|
92
|
+
.optional()
|
|
93
|
+
.describe("Set to true after the user explicitly confirms the role removal."),
|
|
94
|
+
}),
|
|
95
|
+
annotations: DESTRUCTIVE_ANNOTATIONS,
|
|
96
|
+
confirmMessage: (params) => `This will remove the environment role for user "${params.userID}" on environment "${params.environmentID}". The user will lose environment access immediately.`,
|
|
97
|
+
}, deleteEnvRole),
|
|
98
|
+
];
|
|
152
99
|
}
|
|
153
100
|
//# sourceMappingURL=users.js.map
|