@sanity/workflow-mcp 0.6.0 → 0.7.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 +32 -0
- package/README.md +22 -18
- package/dist/_chunks-es/index.js +234 -82
- package/dist/index.cjs +233 -80
- package/dist/index.d.cts +76 -6
- package/dist/index.d.ts +76 -6
- package/dist/stdio.js +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { ActionParam } from "@sanity/workflow-engine";
|
|
1
2
|
import type { Diagnosis } from "@sanity/workflow-engine";
|
|
2
3
|
import type { Engine } from "@sanity/workflow-engine";
|
|
4
|
+
import type { ExecutorClassification } from "@sanity/workflow-engine";
|
|
3
5
|
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4
6
|
import type { RequestHandlerExtra } from "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
5
7
|
import type { ServerNotification } from "@modelcontextprotocol/sdk/types.js";
|
|
@@ -27,6 +29,13 @@ export declare type GetWorkflowToolContext = (
|
|
|
27
29
|
input: unknown,
|
|
28
30
|
) => WorkflowToolContext | Promise<WorkflowToolContext>;
|
|
29
31
|
|
|
32
|
+
/**
|
|
33
|
+
* One invocable (fireAction-fired) action. Two whole classes of action never
|
|
34
|
+
* appear here: an action whose `filter` scoped it out for this actor is
|
|
35
|
+
* ABSENT (filter is existence — it might as well not exist, never "disabled"),
|
|
36
|
+
* and a cascade-fired (`when`) action is projected as a
|
|
37
|
+
* {@link ProjectedAutomation} instead — the engine fires it, no caller can.
|
|
38
|
+
*/
|
|
30
39
|
export declare interface ProjectedActionVerdict {
|
|
31
40
|
/** Action name — what to pass to `fire_action` as `action`. */
|
|
32
41
|
action: string;
|
|
@@ -36,6 +45,10 @@ export declare interface ProjectedActionVerdict {
|
|
|
36
45
|
allowed: boolean;
|
|
37
46
|
/** When `allowed` is false, a short reason describing why. */
|
|
38
47
|
disabledReason?: string;
|
|
48
|
+
/** The action's declared params — what `fire_action`'s `params` object must
|
|
49
|
+
* satisfy (each entry names the param and whether it is required). Absent
|
|
50
|
+
* when the action declares none. */
|
|
51
|
+
params?: ActionParam[];
|
|
39
52
|
}
|
|
40
53
|
|
|
41
54
|
export declare interface ProjectedActivity {
|
|
@@ -45,10 +58,57 @@ export declare interface ProjectedActivity {
|
|
|
45
58
|
title?: string;
|
|
46
59
|
/** Longer prose description, if provided. */
|
|
47
60
|
description?: string;
|
|
48
|
-
/** Current activity status.
|
|
49
|
-
|
|
50
|
-
|
|
61
|
+
/** Current activity status. Activities are active from stage entry; an
|
|
62
|
+
* activity whose `filter` scoped it out of this visit is absent from the
|
|
63
|
+
* projection, so `skipped` here always means an action resolved it so. */
|
|
64
|
+
status: "active" | "done" | "skipped" | "failed";
|
|
65
|
+
/**
|
|
66
|
+
* Who, if anyone, the activity waits on — `interactive` (only invocable
|
|
67
|
+
* actions), `autonomous` (only cascade-fired automation), `off-system`
|
|
68
|
+
* (work performed outside the system), or `hybrid` (both kinds).
|
|
69
|
+
*/
|
|
70
|
+
classification: ExecutorClassification;
|
|
71
|
+
/** Invocable actions on this activity, each with its allowed/disabled
|
|
72
|
+
* verdict. See {@link ProjectedActionVerdict} for what never appears. */
|
|
51
73
|
actions: ProjectedActionVerdict[];
|
|
74
|
+
/** Cascade-fired actions, narrated as automation ("fires when …").
|
|
75
|
+
* Present only when the activity declares any. */
|
|
76
|
+
automations?: ProjectedAutomation[];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* One cascade-fired (`when`) action, narrated as automation: the engine fires
|
|
81
|
+
* it on its own the moment the trigger holds — it is never invocable via
|
|
82
|
+
* `fire_action`, so it must not read as a button.
|
|
83
|
+
*/
|
|
84
|
+
export declare interface ProjectedAutomation {
|
|
85
|
+
/** The cascade-fired action's name. Not accepted by `fire_action`. */
|
|
86
|
+
action: string;
|
|
87
|
+
/** Human label, if provided. */
|
|
88
|
+
title?: string;
|
|
89
|
+
/** The trigger — the GROQ condition whose truth makes the engine fire it. */
|
|
90
|
+
firesWhen: string;
|
|
91
|
+
/** What still stands between the current state and the trigger, as one
|
|
92
|
+
* English line ("Needs: …"). Absent when the trigger is already satisfied
|
|
93
|
+
* or already fired this stage visit. */
|
|
94
|
+
pending?: string;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Result of `get_workflow_definition` — one deployed version's content.
|
|
99
|
+
* `definition` is the stored (desugared) form with the document envelope
|
|
100
|
+
* stripped — valid input for the validate/deploy tools as-is (their parse
|
|
101
|
+
* accepts stored form; parts of it, e.g. resolved guard `idRefs`, are NOT
|
|
102
|
+
* valid authoring shape): modify it and redeploy via
|
|
103
|
+
* `deploy_workflow_definition` to mint the next version.
|
|
104
|
+
*/
|
|
105
|
+
export declare interface ProjectedDefinition {
|
|
106
|
+
/** Definition `name`. */
|
|
107
|
+
name: string;
|
|
108
|
+
/** The deployed version this content came from. */
|
|
109
|
+
version: number;
|
|
110
|
+
/** The envelope-stripped definition content. */
|
|
111
|
+
definition: WorkflowDefinition;
|
|
52
112
|
}
|
|
53
113
|
|
|
54
114
|
/**
|
|
@@ -187,9 +247,10 @@ export declare function toolInputJsonSchema(
|
|
|
187
247
|
): ToolInputJsonSchema;
|
|
188
248
|
|
|
189
249
|
/**
|
|
190
|
-
*
|
|
191
|
-
* desugared form that would deploy
|
|
192
|
-
* `valid: false`, `error` is the
|
|
250
|
+
* Per-definition result inside {@link ValidateDefinitionsResult}. On
|
|
251
|
+
* `valid: true`, `definition` is the desugared form that would deploy
|
|
252
|
+
* (defaults filled, sugar expanded); on `valid: false`, `error` is the
|
|
253
|
+
* aggregated, path-prefixed list of problems.
|
|
193
254
|
*/
|
|
194
255
|
export declare type ValidateDefinitionResult =
|
|
195
256
|
| {
|
|
@@ -201,6 +262,15 @@ export declare type ValidateDefinitionResult =
|
|
|
201
262
|
error: string;
|
|
202
263
|
};
|
|
203
264
|
|
|
265
|
+
/**
|
|
266
|
+
* Result of `validate_workflow_definition`. `results` pairs positionally with
|
|
267
|
+
* the input `definitions`; `valid` is true only when every definition passed.
|
|
268
|
+
*/
|
|
269
|
+
export declare interface ValidateDefinitionsResult {
|
|
270
|
+
valid: boolean;
|
|
271
|
+
results: ValidateDefinitionResult[];
|
|
272
|
+
}
|
|
273
|
+
|
|
204
274
|
export declare const WORKFLOW_TOOLS: readonly WorkflowToolDef[];
|
|
205
275
|
|
|
206
276
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { ActionParam } from "@sanity/workflow-engine";
|
|
1
2
|
import type { Diagnosis } from "@sanity/workflow-engine";
|
|
2
3
|
import type { Engine } from "@sanity/workflow-engine";
|
|
4
|
+
import type { ExecutorClassification } from "@sanity/workflow-engine";
|
|
3
5
|
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4
6
|
import type { RequestHandlerExtra } from "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
5
7
|
import type { ServerNotification } from "@modelcontextprotocol/sdk/types.js";
|
|
@@ -27,6 +29,13 @@ export declare type GetWorkflowToolContext = (
|
|
|
27
29
|
input: unknown,
|
|
28
30
|
) => WorkflowToolContext | Promise<WorkflowToolContext>;
|
|
29
31
|
|
|
32
|
+
/**
|
|
33
|
+
* One invocable (fireAction-fired) action. Two whole classes of action never
|
|
34
|
+
* appear here: an action whose `filter` scoped it out for this actor is
|
|
35
|
+
* ABSENT (filter is existence — it might as well not exist, never "disabled"),
|
|
36
|
+
* and a cascade-fired (`when`) action is projected as a
|
|
37
|
+
* {@link ProjectedAutomation} instead — the engine fires it, no caller can.
|
|
38
|
+
*/
|
|
30
39
|
export declare interface ProjectedActionVerdict {
|
|
31
40
|
/** Action name — what to pass to `fire_action` as `action`. */
|
|
32
41
|
action: string;
|
|
@@ -36,6 +45,10 @@ export declare interface ProjectedActionVerdict {
|
|
|
36
45
|
allowed: boolean;
|
|
37
46
|
/** When `allowed` is false, a short reason describing why. */
|
|
38
47
|
disabledReason?: string;
|
|
48
|
+
/** The action's declared params — what `fire_action`'s `params` object must
|
|
49
|
+
* satisfy (each entry names the param and whether it is required). Absent
|
|
50
|
+
* when the action declares none. */
|
|
51
|
+
params?: ActionParam[];
|
|
39
52
|
}
|
|
40
53
|
|
|
41
54
|
export declare interface ProjectedActivity {
|
|
@@ -45,10 +58,57 @@ export declare interface ProjectedActivity {
|
|
|
45
58
|
title?: string;
|
|
46
59
|
/** Longer prose description, if provided. */
|
|
47
60
|
description?: string;
|
|
48
|
-
/** Current activity status.
|
|
49
|
-
|
|
50
|
-
|
|
61
|
+
/** Current activity status. Activities are active from stage entry; an
|
|
62
|
+
* activity whose `filter` scoped it out of this visit is absent from the
|
|
63
|
+
* projection, so `skipped` here always means an action resolved it so. */
|
|
64
|
+
status: "active" | "done" | "skipped" | "failed";
|
|
65
|
+
/**
|
|
66
|
+
* Who, if anyone, the activity waits on — `interactive` (only invocable
|
|
67
|
+
* actions), `autonomous` (only cascade-fired automation), `off-system`
|
|
68
|
+
* (work performed outside the system), or `hybrid` (both kinds).
|
|
69
|
+
*/
|
|
70
|
+
classification: ExecutorClassification;
|
|
71
|
+
/** Invocable actions on this activity, each with its allowed/disabled
|
|
72
|
+
* verdict. See {@link ProjectedActionVerdict} for what never appears. */
|
|
51
73
|
actions: ProjectedActionVerdict[];
|
|
74
|
+
/** Cascade-fired actions, narrated as automation ("fires when …").
|
|
75
|
+
* Present only when the activity declares any. */
|
|
76
|
+
automations?: ProjectedAutomation[];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* One cascade-fired (`when`) action, narrated as automation: the engine fires
|
|
81
|
+
* it on its own the moment the trigger holds — it is never invocable via
|
|
82
|
+
* `fire_action`, so it must not read as a button.
|
|
83
|
+
*/
|
|
84
|
+
export declare interface ProjectedAutomation {
|
|
85
|
+
/** The cascade-fired action's name. Not accepted by `fire_action`. */
|
|
86
|
+
action: string;
|
|
87
|
+
/** Human label, if provided. */
|
|
88
|
+
title?: string;
|
|
89
|
+
/** The trigger — the GROQ condition whose truth makes the engine fire it. */
|
|
90
|
+
firesWhen: string;
|
|
91
|
+
/** What still stands between the current state and the trigger, as one
|
|
92
|
+
* English line ("Needs: …"). Absent when the trigger is already satisfied
|
|
93
|
+
* or already fired this stage visit. */
|
|
94
|
+
pending?: string;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Result of `get_workflow_definition` — one deployed version's content.
|
|
99
|
+
* `definition` is the stored (desugared) form with the document envelope
|
|
100
|
+
* stripped — valid input for the validate/deploy tools as-is (their parse
|
|
101
|
+
* accepts stored form; parts of it, e.g. resolved guard `idRefs`, are NOT
|
|
102
|
+
* valid authoring shape): modify it and redeploy via
|
|
103
|
+
* `deploy_workflow_definition` to mint the next version.
|
|
104
|
+
*/
|
|
105
|
+
export declare interface ProjectedDefinition {
|
|
106
|
+
/** Definition `name`. */
|
|
107
|
+
name: string;
|
|
108
|
+
/** The deployed version this content came from. */
|
|
109
|
+
version: number;
|
|
110
|
+
/** The envelope-stripped definition content. */
|
|
111
|
+
definition: WorkflowDefinition;
|
|
52
112
|
}
|
|
53
113
|
|
|
54
114
|
/**
|
|
@@ -187,9 +247,10 @@ export declare function toolInputJsonSchema(
|
|
|
187
247
|
): ToolInputJsonSchema;
|
|
188
248
|
|
|
189
249
|
/**
|
|
190
|
-
*
|
|
191
|
-
* desugared form that would deploy
|
|
192
|
-
* `valid: false`, `error` is the
|
|
250
|
+
* Per-definition result inside {@link ValidateDefinitionsResult}. On
|
|
251
|
+
* `valid: true`, `definition` is the desugared form that would deploy
|
|
252
|
+
* (defaults filled, sugar expanded); on `valid: false`, `error` is the
|
|
253
|
+
* aggregated, path-prefixed list of problems.
|
|
193
254
|
*/
|
|
194
255
|
export declare type ValidateDefinitionResult =
|
|
195
256
|
| {
|
|
@@ -201,6 +262,15 @@ export declare type ValidateDefinitionResult =
|
|
|
201
262
|
error: string;
|
|
202
263
|
};
|
|
203
264
|
|
|
265
|
+
/**
|
|
266
|
+
* Result of `validate_workflow_definition`. `results` pairs positionally with
|
|
267
|
+
* the input `definitions`; `valid` is true only when every definition passed.
|
|
268
|
+
*/
|
|
269
|
+
export declare interface ValidateDefinitionsResult {
|
|
270
|
+
valid: boolean;
|
|
271
|
+
results: ValidateDefinitionResult[];
|
|
272
|
+
}
|
|
273
|
+
|
|
204
274
|
export declare const WORKFLOW_TOOLS: readonly WorkflowToolDef[];
|
|
205
275
|
|
|
206
276
|
/**
|
package/dist/stdio.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/workflow-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "MCP server exposing Sanity workflow tools to agents — operate running workflow instances and author new definitions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -56,14 +56,14 @@
|
|
|
56
56
|
"@sanity/client": "^7.22.1",
|
|
57
57
|
"@sanity/telemetry": "^1.1.0",
|
|
58
58
|
"zod": "^4.4.3",
|
|
59
|
-
"@sanity/workflow-engine": "0.
|
|
59
|
+
"@sanity/workflow-engine": "0.16.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@sanity/pkg-utils": "^10.5.2",
|
|
63
63
|
"@types/node": "^24.12.4",
|
|
64
64
|
"vitest": "^4.1.8",
|
|
65
|
-
"@sanity/workflow-engine-test": "0.
|
|
66
|
-
"@sanity/workflow-examples": "0.
|
|
65
|
+
"@sanity/workflow-engine-test": "0.11.0",
|
|
66
|
+
"@sanity/workflow-examples": "0.6.0"
|
|
67
67
|
},
|
|
68
68
|
"engines": {
|
|
69
69
|
"node": ">=20"
|