docs for client and for fastmcp patches

This commit is contained in:
lda
2026-05-17 00:12:52 +07:00 Verified
parent b5c896b77b
commit 16591f3560
5 changed files with 51 additions and 16 deletions
+18 -11
View File
@@ -1,28 +1,35 @@
from __future__ import annotations
import json
from mcp.server.fastmcp import FastMCP
from .service import WfMcpService
_WORKFLOW_AUTHORING_GUIDE = """\
Build workflows from current capabilities instead of assuming a stale catalog.
Use `get_planner_catalog` when you need the current workflow-capability view.
Use `list_sources` and `list_spec_sources` when you need to understand what is
available and which sources are planner-visible.
Use `call_broker_tool` to test an upstream MCP tool manually before wrapping it
into a workflow.
Prefer namespaced capabilities, inspect before you rely on them, and test the
smallest reusable piece before saving a larger workflow artifact.
"""
def register_broker_prompts(server: FastMCP, service: WfMcpService) -> None:
"""Register broker prompt handlers on a FastMCP server."""
@server.prompt(
name="plan_with_catalog",
description="Provide the broker catalog as planning context.",
name="workflow_authoring_guide",
description="Explain how to inspect capabilities and test tools before authoring.",
)
def plan_with_catalog() -> list[dict[str, str]]:
payload = json.dumps(service.get_catalog().as_payload(), indent=2)
def workflow_authoring_guide() -> list[dict[str, str]]:
_ = service
return [
{
"role": "user",
"content": (
"Plan a workflow using this broker catalog. "
"Prefer existing namespaced capabilities.\n\n"
f"{payload}"
),
"content": _WORKFLOW_AUTHORING_GUIDE,
}
]