feat: bind draft outputs to state
This commit is contained in:
@@ -251,6 +251,20 @@ class AddStateFromOutputRequest(BaseModel):
|
||||
)
|
||||
|
||||
|
||||
class BindOutputToStateRequest(BaseModel):
|
||||
"""Typed MCP request for binding one step output to one root state field."""
|
||||
|
||||
workspace_id: WorkspaceId
|
||||
revision: int = Field(ge=1, description="Expected current workspace revision.")
|
||||
step_id: str = Field(description="Draft step id whose capability output is used.")
|
||||
output_field: str = Field(
|
||||
description="Top-level output field to bind, for example after."
|
||||
)
|
||||
state_path: str = Field(
|
||||
description="Root state path to declare and bind, for example state.after."
|
||||
)
|
||||
|
||||
|
||||
class DeleteDraftWorkspaceRequest(BaseModel):
|
||||
"""Typed MCP request payload for deleting one draft workspace."""
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ from wf_mcp.broker.service.workflow_operation_context import context_from_servic
|
||||
|
||||
from .models import (
|
||||
AddStateFromOutputRequest,
|
||||
BindOutputToStateRequest,
|
||||
CallCapabilityResult,
|
||||
CreateArtifactFromWorkspaceRequest,
|
||||
CreateDraftWorkspaceFromCapabilityRequest,
|
||||
@@ -461,6 +462,27 @@ def register_workflow_tools(server: FastMCP[Any], service: WfMcpService) -> None
|
||||
)
|
||||
)
|
||||
|
||||
@server.tool(
|
||||
name="wf.workflow.bind_output_to_state",
|
||||
title="Bind Output To State",
|
||||
description=(
|
||||
"Declare one root state field from a draft step capability output "
|
||||
"schema and bind local.<output> to that state path."
|
||||
),
|
||||
)
|
||||
async def bind_output_to_state(
|
||||
request: BindOutputToStateRequest,
|
||||
) -> DraftWorkspaceResult:
|
||||
return DraftWorkspaceResult.model_validate(
|
||||
await handlers.bind_output_to_state(
|
||||
workspace_id=request.workspace_id,
|
||||
revision=request.revision,
|
||||
step_id=request.step_id,
|
||||
output_field=request.output_field,
|
||||
state_path=request.state_path,
|
||||
)
|
||||
)
|
||||
|
||||
@server.tool(
|
||||
name="wf.workflow.create_minimal_draft_workspace",
|
||||
title="Create Minimal Draft Workspace",
|
||||
|
||||
Reference in New Issue
Block a user