Skip to content

Commit 9ead5bb

Browse files
bertenatorclaude
andcommitted
fix(workflows): update workflow endpoints to match new API naming
- Rename execute_workflow → run_workflow (POST .../run) - Rename get_workflow_execution_status → get_workflow_run (GET .../runs/:run_id) - Add workflow_id param to get_workflow_run for new endpoint shape Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 01d2b53 commit 9ead5bb

1 file changed

Lines changed: 22 additions & 19 deletions

File tree

src/tools/workflows.ts

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ async function apiRequest(
3939
async function handleWorkflowActions(
4040
actions: Array<{
4141
list_workflows?: { site_id: string };
42-
execute_workflow?: { site_id: string; workflow_id: string };
43-
get_workflow_execution_status?: { site_id: string; execution_id: string };
42+
run_workflow?: { site_id: string; workflow_id: string };
43+
get_workflow_run?: { site_id: string; workflow_id: string; run_id: string };
4444
}>,
4545
getToken: () => string
4646
): Promise<Content[]> {
@@ -55,20 +55,20 @@ async function handleWorkflowActions(
5555
)
5656
);
5757
}
58-
if (action.execute_workflow) {
58+
if (action.run_workflow) {
5959
result.push(
6060
await apiRequest(
6161
"POST",
62-
`/v2/sites/${action.execute_workflow.site_id}/workflows/${action.execute_workflow.workflow_id}/execute`,
62+
`/v2/sites/${action.run_workflow.site_id}/workflows/${action.run_workflow.workflow_id}/run`,
6363
getToken
6464
)
6565
);
6666
}
67-
if (action.get_workflow_execution_status) {
67+
if (action.get_workflow_run) {
6868
result.push(
6969
await apiRequest(
7070
"GET",
71-
`/v2/sites/${action.get_workflow_execution_status.site_id}/workflows/executions/${action.get_workflow_execution_status.execution_id}`,
71+
`/v2/sites/${action.get_workflow_run.site_id}/workflows/${action.get_workflow_run.workflow_id}/runs/${action.get_workflow_run.run_id}`,
7272
getToken
7373
)
7474
);
@@ -90,7 +90,7 @@ export function registerWorkflowsTools(
9090
openWorldHint: false,
9191
},
9292
description:
93-
"Data tool - Workflows tool to list AI workflows, execute a workflow, and poll execution status.",
93+
"Data tool - Workflows tool to list AI workflows, run a workflow, and get a workflow run.",
9494
inputSchema: {
9595
actions: z.array(
9696
z
@@ -106,48 +106,51 @@ export function registerWorkflowsTools(
106106
.describe(
107107
"List all AI workflows configured for a site. Returns each workflow's ID, name, active status, and template slug."
108108
),
109-
// POST https://api.webflow.com/v2/sites/:site_id/workflows/:workflow_id/execute
110-
execute_workflow: z
109+
// POST https://api.webflow.com/v2/sites/:site_id/workflows/:workflow_id/run
110+
run_workflow: z
111111
.object({
112112
site_id: z
113113
.string()
114114
.describe("Unique identifier for the site."),
115115
workflow_id: z
116116
.string()
117-
.describe("Unique identifier for the workflow to execute."),
117+
.describe("Unique identifier for the workflow to run."),
118118
})
119119
.optional()
120120
.describe(
121-
"Execute an AI workflow. The workflow must be active. Returns an execution_id to poll with get_workflow_execution_status."
121+
"Run an AI workflow. The workflow must be active. Returns a run_id to poll with get_workflow_run."
122122
),
123-
// GET https://api.webflow.com/v2/sites/:site_id/workflows/executions/:execution_id
124-
get_workflow_execution_status: z
123+
// GET https://api.webflow.com/v2/sites/:site_id/workflows/:workflow_id/runs/:run_id
124+
get_workflow_run: z
125125
.object({
126126
site_id: z
127127
.string()
128128
.describe("Unique identifier for the site."),
129-
execution_id: z
129+
workflow_id: z
130+
.string()
131+
.describe("Unique identifier for the workflow."),
132+
run_id: z
130133
.string()
131134
.describe(
132-
"Execution ID returned by execute_workflow. Poll until isFinished is true."
135+
"Run ID returned by run_workflow. Poll until isFinished is true."
133136
),
134137
})
135138
.optional()
136139
.describe(
137-
"Get the status of a workflow execution. Returns status, start/stop times, and isFinished."
140+
"Get the status of a workflow run. Returns status, start/stop times, and isFinished."
138141
),
139142
})
140143
.strict()
141144
.refine(
142145
(d) =>
143146
[
144147
d.list_workflows,
145-
d.execute_workflow,
146-
d.get_workflow_execution_status,
148+
d.run_workflow,
149+
d.get_workflow_run,
147150
].filter(Boolean).length >= 1,
148151
{
149152
message:
150-
"Provide at least one of list_workflows, execute_workflow, get_workflow_execution_status.",
153+
"Provide at least one of list_workflows, run_workflow, get_workflow_run.",
151154
}
152155
)
153156
),

0 commit comments

Comments
 (0)