Skip to content

feat(mcp-server): add getWorkflowRun tool (PRD-740) - #1785

Merged
christophebrun-forest merged 4 commits into
feature/prd-49-expose-workflow-tools-in-forest-mcp-serverfrom
feature/prd-740-mcp-ms8-getworkflowrun-tool
Jul 29, 2026
Merged

feat(mcp-server): add getWorkflowRun tool (PRD-740)#1785
christophebrun-forest merged 4 commits into
feature/prd-49-expose-workflow-tools-in-forest-mcp-serverfrom
feature/prd-740-mcp-ms8-getworkflowrun-tool

Conversation

@christophebrun-forest

@christophebrun-forest christophebrun-forest commented Jul 28, 2026

Copy link
Copy Markdown
Member

Description

Story MS8 of PRD-49 · Iteration 4 (observation).

Exposes the getWorkflowRun polling tool so the LLM can observe a run's status, closing the discover (listWorkflows) → trigger (triggerWorkflow) → poll (getWorkflowRun) loop.

Report-only in v1: a run parked on a human-gated step reports waitingForHumanInput: true but is not resumable via MCP — such runs are finished from the Forest UI (resume tracked in PRD-441).

Changes

@forestadmin/forestadmin-client

  • New types WorkflowRunStep, WorkflowRunStatus, GetMcpWorkflowRunParams; getMcpWorkflowRun added to WorkflowsServiceInterface and ForestAdminServerInterface
  • ForestHttpApi.getMcpWorkflowRun()GET /api/workflow-orchestrator/mcp-workflows/runs/:runId (rendering-id header, url-encoded runId)
  • WorkflowsService.getMcpWorkflowRun() delegation + public exports

@forestadmin/mcp-server

  • New getWorkflowRun tool (readOnlyHint: true, zod arg runId: string; no activity log since read-only)
  • getWorkflowRun on the ForestServerClient http-client
  • Registration wiring in server.ts (ToolName union, allTools, allToolNames, SAFE_ARGUMENTS_FOR_LOGGING)

Acceptance criteria

  • Returns runState, currentStep, waitingForHumanInput, terminal result/error, scoped to the caller
  • Human-gated runs report waitingForHumanInput: true, not resumable via MCP (v1)
  • Unknown/forbidden runId → tool error 404/403

Tests

forestadmin-client (299) + mcp-server (667) green; lint + build clean on both packages. Added coverage for the HTTP path/headers/url-encode, service delegation, http-client delegation, and the tool (registration, identity+args forwarding, human-gated reporting, missing auth, 404, 403).

Notes

  • Depends on the MS7 server endpoint (PRD-739, forestadmin-server PR #8407).
  • ⚠️ Assumes a top-level (non JSON:API-wrapped) response payload, consistent with the existing workflow endpoints — to confirm against the live MS7 response.

fixes PRD-740

🤖 Generated with Claude Code

Note

Add getWorkflowRun MCP tool to fetch workflow run status

  • Adds a new getWorkflowRun tool in packages/mcp-server/src/tools/get-workflow-run.ts that accepts a runId, extracts auth context, and returns the workflow run status as JSON.
  • Adds getMcpWorkflowRun to WorkflowsService and ForestHttpApi, performing a GET to /api/workflow-orchestrator/mcp-workflows/runs/{runId} with bearer token and rendering ID header.
  • Extends WorkflowsServiceInterface, ForestAdminServerInterface, and ForestServerClient with the new method signature, and exports the new WorkflowRunStatus, WorkflowRunStep, and GetMcpWorkflowRunParams types from forestadmin-client.

Macroscope summarized e02cf17.

Expose the getWorkflowRun polling tool so the LLM can observe a run's
status, closing the discover -> trigger -> poll loop. Report-only in v1:
human-gated runs report waitingForHumanInput but cannot be resumed via
MCP (tracked in PRD-441).

Threads a getMcpWorkflowRun call through forestadmin-client (types, HTTP
api, workflows service) to the MS7 read endpoint, and registers a
read-only getWorkflowRun MCP tool scoped to the caller.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@linear-code

linear-code Bot commented Jul 28, 2026

Copy link
Copy Markdown

PRD-740

christophebrun-forest and others added 3 commits July 28, 2026 11:38
…ools-in-forest-mcp-server' into feature/prd-740-mcp-ms8-getworkflowrun-tool
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@qltysh

qltysh Bot commented Jul 29, 2026

Copy link
Copy Markdown

Qlty


Coverage Impact

Unable to calculate total coverage change because base branch coverage was not found.

Modified Files with Diff Coverage (6)

RatingFile% DiffUncovered Line #s
New Coverage rating: A
packages/mcp-server/src/tools/get-workflow-run.ts100.0%
New Coverage rating: D
packages/agent-testing/src/forest-admin-client-mock.ts100.0%
New Coverage rating: A
packages/forestadmin-client/src/workflows/index.ts100.0%
New Coverage rating: A
packages/mcp-server/src/http-client/mcp-http-client.ts100.0%
New Coverage rating: A
packages/mcp-server/src/server.ts100.0%
New Coverage rating: A
packages/forestadmin-client/src/permissions/forest-http-api.ts100.0%
Total100.0%
🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@christophebrun-forest
christophebrun-forest merged commit e87448d into feature/prd-49-expose-workflow-tools-in-forest-mcp-server Jul 29, 2026
32 checks passed
@christophebrun-forest
christophebrun-forest deleted the feature/prd-740-mcp-ms8-getworkflowrun-tool branch July 29, 2026 15:24
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.

1 participant