feat: add workflow output draft command
This commit is contained in:
@@ -50,6 +50,7 @@ _SEARCH_ALWAYS_VISIBLE_TOOL_NAMES = [
|
||||
"wf.workflow.set_draft_route",
|
||||
"wf.workflow.set_step_input_map",
|
||||
"wf.workflow.set_step_output_map",
|
||||
"wf.workflow.set_workflow_output_map",
|
||||
"wf.workflow.create_minimal_draft_workspace",
|
||||
"wf.workflow.create_artifact_from_workspace",
|
||||
"wf.workflow.create_wrapper_from_workspace",
|
||||
|
||||
@@ -243,6 +243,21 @@ class SetStepOutputMapRequest(BaseModel):
|
||||
)
|
||||
|
||||
|
||||
class SetWorkflowOutputMapRequest(BaseModel):
|
||||
"""Typed MCP request for replacing or merging workflow output projection."""
|
||||
|
||||
workspace_id: WorkspaceId
|
||||
revision: int = Field(ge=1, description="Expected current workspace revision.")
|
||||
output_map: DraftPathMap
|
||||
merge: bool = Field(
|
||||
default=False,
|
||||
description=(
|
||||
"When false, replace the full workflow output map. When true, "
|
||||
"preserve existing bindings and add/update only output_map entries."
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
class BindDraftRequest(BaseModel):
|
||||
"""Typed MCP request for binding one draft step path with schema projection."""
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ from .models import (
|
||||
SetDraftRouteRequest,
|
||||
SetStepInputMapRequest,
|
||||
SetStepOutputMapRequest,
|
||||
SetWorkflowOutputMapRequest,
|
||||
TraceRange,
|
||||
ValidateDeploymentResult,
|
||||
ValidateDraftWorkspaceRequest,
|
||||
@@ -463,6 +464,27 @@ def register_workflow_tools(server: FastMCP[Any], service: WfMcpService) -> None
|
||||
)
|
||||
)
|
||||
|
||||
@server.tool(
|
||||
name="wf.workflow.set_workflow_output_map",
|
||||
title="Set Workflow Output Map",
|
||||
description=(
|
||||
"Replace or merge the top-level workflow output projection. "
|
||||
"Map graph source paths such as state.markdown to public output "
|
||||
"fields such as markdown."
|
||||
),
|
||||
)
|
||||
async def set_workflow_output_map(
|
||||
request: SetWorkflowOutputMapRequest,
|
||||
) -> DraftWorkspaceResult:
|
||||
return DraftWorkspaceResult.model_validate(
|
||||
await handlers.set_workflow_output_map(
|
||||
workspace_id=request.workspace_id,
|
||||
revision=request.revision,
|
||||
output_map=request.output_map,
|
||||
merge=request.merge,
|
||||
)
|
||||
)
|
||||
|
||||
@server.tool(
|
||||
name="wf.workflow.bind",
|
||||
title="Bind Draft",
|
||||
|
||||
Reference in New Issue
Block a user