feat: replace draft output bind with general bind

This commit is contained in:
lda
2026-06-28 00:38:42 +07:00 Verified
parent b96ba0f7d1
commit 955c43d808
25 changed files with 1246 additions and 138 deletions
+5 -9
View File
@@ -243,18 +243,14 @@ class SetStepOutputMapRequest(BaseModel):
)
class BindOutputToStateRequest(BaseModel):
"""Typed MCP request for binding one step output to one root state field."""
class BindDraftRequest(BaseModel):
"""Typed MCP request for binding one draft step path with schema projection."""
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."
)
step_id: str = Field(description="Capability-backed draft step id.")
source_path: str = Field(description="Source path, for example input.x or local.y.")
target_path: str = Field(description="Target path, for example local.x or state.y.")
class AddStepFromCapabilityRequest(BaseModel):
+11 -10
View File
@@ -13,7 +13,7 @@ from wf_mcp.broker.service.workflow_operation_context import context_from_servic
from .models import (
AddStepFromCapabilityRequest,
BindOutputToStateRequest,
BindDraftRequest,
BranchDraftRequest,
CallCapabilityResult,
CompileDraftWorkspaceRequest,
@@ -461,23 +461,24 @@ def register_workflow_tools(server: FastMCP[Any], service: WfMcpService) -> None
)
@server.tool(
name="wf.workflow.bind_output_to_state",
title="Bind Output To State",
name="wf.workflow.bind",
title="Bind Draft",
description=(
"Declare one root state field from a draft step capability output "
"schema and bind local.<output> to that state path."
"Bind a capability step path and project the matching schema. "
"Use input/state -> local for step inputs and local -> state/output "
"for step outputs."
),
)
async def bind_output_to_state(
request: BindOutputToStateRequest,
async def bind_draft(
request: BindDraftRequest,
) -> DraftWorkspaceResult:
return DraftWorkspaceResult.model_validate(
await handlers.bind_output_to_state(
await handlers.bind_draft(
workspace_id=request.workspace_id,
revision=request.revision,
step_id=request.step_id,
output_field=request.output_field,
state_path=request.state_path,
source_path=request.source_path,
target_path=request.target_path,
)
)