Skip to content

feat(ai): add execute_workflow and get_workflow_execution_status to data_workflows_tool#87

Merged
bertenator merged 4 commits intosaifrom
achang/DEVPL-3935-execute-workflow-public-mcp
Mar 18, 2026
Merged

feat(ai): add execute_workflow and get_workflow_execution_status to data_workflows_tool#87
bertenator merged 4 commits intosaifrom
achang/DEVPL-3935-execute-workflow-public-mcp

Conversation

@bertenator
Copy link
Member

@bertenator bertenator commented Mar 17, 2026

JIRA: https://webflow.atlassian.net/browse/DEVPL-3947

Summary

Extends data_workflows_tool with two new actions, completing the execute workflow capability:

  • execute_workflowPOST /v2/sites/:site_id/workflows/:workflow_id/execute — triggers an AI workflow; returns { executionId, workflowId }
  • get_workflow_execution_statusGET /v2/sites/:site_id/workflows/executions/:execution_id — polls an execution; returns { executionId, status, startedAt, stoppedAt, isFinished }
  • Also refactors the per-action fetch calls into a shared apiRequest helper, and extracts the action dispatch loop into a handleWorkflowActions helper

Depends on: webflow/webflow#101439 (the OAuth v2 routes for execute + get-status)

Agent workflow this enables

list_workflows → pick a workflow_id
execute_workflow → get execution_id
get_workflow_execution_status (poll) → wait for isFinished: true

Test plan

  • Set WEBFLOW_TOKEN for a site with AI_WORKFLOWS flag enabled
  • Call data_workflows_tool with execute_workflow: { site_id, workflow_id } → verify { executionId, workflowId } returned
  • Call data_workflows_tool with get_workflow_execution_status: { site_id, execution_id } → verify { status, isFinished } returned
  • Call with an inactive workflow → verify 400 surfaced via formatErrorResponse
  • All three actions (list_workflows, execute_workflow, get_workflow_execution_status) work in the same actions array call

🤖 Generated with Claude Code

@bertenator bertenator requested a review from a team as a code owner March 17, 2026 22:13
@bertenator bertenator requested review from 4vanger and removed request for a team March 17, 2026 22:13
@viratatwebflow viratatwebflow changed the base branch from main to sai March 17, 2026 22:43
@viratatwebflow
Copy link
Collaborator

@bertenator you may need to rebase it

bertenator and others added 2 commits March 17, 2026 16:42
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>
@bertenator bertenator force-pushed the achang/DEVPL-3935-execute-workflow-public-mcp branch from f0d6804 to 288ae31 Compare March 17, 2026 23:42
src/mcp.ts Outdated
registerCommentsTools(server, getClient);
registerEnterpriseTools(server, getClient);
registerWebhookTools(server, getClient);
registerWorkflowsTools(server, getAccessToken);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the tool entry point from here

site_id: action.list_workflows.site_id,
token: getToken(),
});
const content = await apiRequest(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@@ -36,6 +35,44 @@ async function listWorkflows(arg: {
return response.json();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit since it is always used only in this way

Suggested change
return response.json();
return textContent(response.json());

Comment on lines +16 to +17
token: string
): Promise<unknown> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit since it is always used in this way

Suggested change
token: string
): Promise<unknown> {
): Promise<unknown> {
const token = getToken();

@bertenator
Copy link
Member Author

Hey @viratatwebflow — addressing the review feedback here:

  1. "remove the tool entry point from here" (mcp.ts) — removed registerWorkflowsTools from registerTools(). It's already registered via the dedicated registerWorkflowTools() export so it was a duplicate.

  2. "can we move to its own helper function?" (workflows.ts) — extracted the action dispatch loop into handleWorkflowActions(). The tool handler is now just a 4-line try/catch.

  3. Rebase — branch is up to date with sai, no rebase needed.

  4. Dependency — webflow/webflow#101439 is now in production, so this is unblocked and ready to merge.

- 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>
@bertenator bertenator requested a review from memo-pineda March 18, 2026 21:28
@bertenator bertenator merged commit afb338c into sai Mar 18, 2026
6 checks passed
@bertenator bertenator deleted the achang/DEVPL-3935-execute-workflow-public-mcp branch March 18, 2026 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants