feat(ai): add execute_workflow and get_workflow_execution_status to data_workflows_tool#87
Conversation
|
@bertenator you may need to rebase it |
PR 3 of 3 for DEVPL-3935. Adds data_workflows_tool to the public Webflow MCP server, calling GET /v2/sites/:site_id/workflows via raw fetch (no SDK method exists yet). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extends data_workflows_tool with two new actions alongside list_workflows: - execute_workflow: POST /v2/sites/:site_id/workflows/:workflow_id/execute - get_workflow_execution_status: GET /v2/sites/.../executions/:execution_id Also refactors fetch calls into a shared apiRequest helper. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
f0d6804 to
288ae31
Compare
src/mcp.ts
Outdated
| registerCommentsTools(server, getClient); | ||
| registerEnterpriseTools(server, getClient); | ||
| registerWebhookTools(server, getClient); | ||
| registerWorkflowsTools(server, getAccessToken); |
There was a problem hiding this comment.
remove the tool entry point from here
src/tools/workflows.ts
Outdated
| site_id: action.list_workflows.site_id, | ||
| token: getToken(), | ||
| }); | ||
| const content = await apiRequest( |
There was a problem hiding this comment.
can we move to its own helper function?
…ct helper - Remove registerWorkflowsTools from registerTools() — it's already registered via the dedicated registerWorkflowTools() export - Extract action dispatch loop into handleWorkflowActions() helper Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
src/tools/workflows.ts
Outdated
| @@ -36,6 +35,44 @@ async function listWorkflows(arg: { | |||
| return response.json(); | |||
There was a problem hiding this comment.
nit since it is always used only in this way
| return response.json(); | |
| return textContent(response.json()); |
src/tools/workflows.ts
Outdated
| token: string | ||
| ): Promise<unknown> { |
There was a problem hiding this comment.
nit since it is always used in this way
| token: string | |
| ): Promise<unknown> { | |
| ): Promise<unknown> { | |
| const token = getToken(); |
|
Hey @viratatwebflow — addressing the review feedback here:
|
- apiRequest now accepts getToken: () => string instead of a pre-evaluated token string, since callers always pass the getter - apiRequest returns Content directly via textContent(), removing the wrapping at each call site Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
JIRA: https://webflow.atlassian.net/browse/DEVPL-3947
Summary
Extends
data_workflows_toolwith two new actions, completing the execute workflow capability:execute_workflow—POST /v2/sites/:site_id/workflows/:workflow_id/execute— triggers an AI workflow; returns{ executionId, workflowId }get_workflow_execution_status—GET /v2/sites/:site_id/workflows/executions/:execution_id— polls an execution; returns{ executionId, status, startedAt, stoppedAt, isFinished }fetchcalls into a sharedapiRequesthelper, and extracts the action dispatch loop into ahandleWorkflowActionshelperDepends on: webflow/webflow#101439 (the OAuth v2 routes for execute + get-status)
Agent workflow this enables
Test plan
WEBFLOW_TOKENfor a site withAI_WORKFLOWSflag enableddata_workflows_toolwithexecute_workflow: { site_id, workflow_id }→ verify{ executionId, workflowId }returneddata_workflows_toolwithget_workflow_execution_status: { site_id, execution_id }→ verify{ status, isFinished }returned400surfaced viaformatErrorResponselist_workflows,execute_workflow,get_workflow_execution_status) work in the sameactionsarray call🤖 Generated with Claude Code