Skip to content

Commit ef2bc4e

Browse files
bertenatorclaude
andauthored
feat(workflows): add list_workflow_runs action to data_workflows_tool (#100)
Adds GET /v2/sites/:site_id/workflows/:workflow_id/runs to retrieve the run history for a given workflow. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5c81881 commit ef2bc4e

1 file changed

Lines changed: 27 additions & 2 deletions

File tree

src/tools/workflows.ts

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ async function handleWorkflowActions(
4040
actions: Array<{
4141
list_workflows?: { site_id: string };
4242
run_workflow?: { site_id: string; workflow_id: string };
43+
list_workflow_runs?: { site_id: string; workflow_id: string };
4344
get_workflow_run?: { site_id: string; workflow_id: string; run_id: string };
4445
}>,
4546
getToken: () => string
@@ -64,6 +65,15 @@ async function handleWorkflowActions(
6465
)
6566
);
6667
}
68+
if (action.list_workflow_runs) {
69+
result.push(
70+
await apiRequest(
71+
"GET",
72+
`/v2/sites/${action.list_workflow_runs.site_id}/workflows/${action.list_workflow_runs.workflow_id}/runs`,
73+
getToken
74+
)
75+
);
76+
}
6777
if (action.get_workflow_run) {
6878
result.push(
6979
await apiRequest(
@@ -90,7 +100,7 @@ export function registerWorkflowsTools(
90100
openWorldHint: false,
91101
},
92102
description:
93-
"Data tool - Workflows tool to list AI workflows, run a workflow, and get a workflow run.",
103+
"Data tool - Workflows tool to list AI workflows, run a workflow, list workflow runs, and get a workflow run.",
94104
inputSchema: {
95105
actions: z.array(
96106
z
@@ -120,6 +130,20 @@ export function registerWorkflowsTools(
120130
.describe(
121131
"Run an AI workflow. The workflow must be active. Returns a run_id to poll with get_workflow_run."
122132
),
133+
// GET https://api.webflow.com/v2/sites/:site_id/workflows/:workflow_id/runs
134+
list_workflow_runs: z
135+
.object({
136+
site_id: z
137+
.string()
138+
.describe("Unique identifier for the site."),
139+
workflow_id: z
140+
.string()
141+
.describe("Unique identifier for the workflow."),
142+
})
143+
.optional()
144+
.describe(
145+
"List the run history for a workflow. Returns all runs with their status, start/stop times, and isFinished."
146+
),
123147
// GET https://api.webflow.com/v2/sites/:site_id/workflows/:workflow_id/runs/:run_id
124148
get_workflow_run: z
125149
.object({
@@ -146,11 +170,12 @@ export function registerWorkflowsTools(
146170
[
147171
d.list_workflows,
148172
d.run_workflow,
173+
d.list_workflow_runs,
149174
d.get_workflow_run,
150175
].filter(Boolean).length >= 1,
151176
{
152177
message:
153-
"Provide at least one of list_workflows, run_workflow, get_workflow_run.",
178+
"Provide at least one of list_workflows, run_workflow, list_workflow_runs, get_workflow_run.",
154179
}
155180
)
156181
),

0 commit comments

Comments
 (0)