perf(mcp-server): trigger workflow by id instead of listing all workflows (PRD-831) - #1805
Merged
christophebrun-forest merged 1 commit intoAug 6, 2026
Conversation
…lows triggerWorkflow no longer calls listMcpWorkflows before every trigger just to resolve the name/collection for the audit label. It now starts the run directly and reads workflowName/collectionName from the (enriched) start response, falling back to the workflowId when an older server omits them. A server 404 (unknown or MCP-disabled workflow) is mapped back to the existing "is not an MCP-enabled workflow" message so the LLM-facing contract is unchanged. The audit log is recorded after the run starts and is best-effort — the run is already ongoing, so a logging hiccup no longer fails the tool. fixes PRD-831 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Coverage Impact This PR will not change total coverage. Modified Files with Diff Coverage (2)
🛟 Help
|
christophebrun-forest
merged commit Aug 6, 2026
a4d3949
into
feature/prd-49-expose-workflow-tools-in-forest-mcp-server
55 of 61 checks passed
christophebrun-forest
deleted the
feature/prd-831-triggerworkflow-target-by-id
branch
August 6, 2026 08:54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Optimization from the PRD-49 review (stacked on #1792).
triggerWorkflowusedto call
listMcpWorkflowswithout filter before every trigger, then do aclient-side
find, only to resolve the workflowname+collectionNameneeded for the activity-log label. That added a useless HTTP round-trip per
trigger, duplicated the server's own validation, and would produce false
negatives if the listing ever got paginated.
Change
listMcpWorkflowscall and client-sidefind(and the PRD-831 comment) are gone.{ runId, runState, workflowName, collectionName }; the tool builds the auditlabel from those. When an older server omits them, it falls back to the
workflowId — deploys are order-independent, label enrichment simply lights
up once the server ships.
mapped back to the existing
"is not an MCP-enabled workflow"message, so theLLM-facing contract is unchanged.
{ runId, runState }only.Behavior note (reviewers)
The audit log is now written after the run starts (the collection is only
known from the response) and is best-effort: since the run is already
ongoing, an audit hiccup logs a warning instead of failing the tool. As a
consequence, failed triggers (404/409) are no longer audited — consistent with
the server dropping resource-less MCP logs, and with the pre-existing behavior
that unknown-workflow rejections weren't audited.
Tests
trigger-workflow tests reworked: direct-start happy path with the enriched
response, 404 → tool-error mapping, 409 passthrough, the workflowId fallback
when name/collection are absent, and that a failed audit-log write still
returns the run.
Merge order
Do not merge before the forestadmin-server PRD-831 PR (the fallback makes
deploy order safe, but the label only enriches once the server ships).
fixes PRD-831
🤖 Generated with Claude Code
Note
Trigger MCP workflow by ID directly instead of listing all workflows first
declareTriggerWorkflowTool(trigger-workflow.ts); the tool now callstriggerWorkflowdirectly using the workflow ID.workflowName/collectionNameechoed from the server response, falling back to theworkflowIdas label.workflowNameandcollectionNameas optional fields toWorkflowRunTriggerResult(types.ts) and passes them through inForestHttpApi.triggerMcpWorkflow.Macroscope summarized c64fc5e.