Progressive Discovery ahh
This commit is contained in:
@@ -96,7 +96,7 @@ def test_create_broker_server_exposes_tools_resources_and_prompts() -> None:
|
||||
server.call_tool("list_sources", {})
|
||||
)
|
||||
all_sources_payload = cast(dict[str, Any], cast(object, all_sources_payload_raw))
|
||||
all_sources = all_sources_payload["result"]
|
||||
all_sources = all_sources_payload["sources"]
|
||||
all_source_ids = {source["id"] for source in all_sources}
|
||||
assert "wf.admin" in all_source_ids
|
||||
assert "demo.personal" in all_source_ids
|
||||
|
||||
@@ -45,6 +45,7 @@ def test_server_exposes_upstream_admin_and_workflow_tools() -> None:
|
||||
assert "wf.admin.get_catalog" in names
|
||||
assert "wf.admin.get_planner_catalog" in names
|
||||
assert "wf.admin.list_sources" in names
|
||||
assert "wf.admin.inspect_source" in names
|
||||
assert "wf.admin.read_resource" in names
|
||||
assert "wf.admin.render_prompt" in names
|
||||
assert "wf.admin.invoke_method" in names
|
||||
@@ -75,7 +76,8 @@ def test_server_exposes_upstream_admin_and_workflow_tools() -> None:
|
||||
assert _structured(capability_result)["outcome"] == "ok"
|
||||
assert _structured(capability_result)["output"] == {"value": "hello"}
|
||||
source_ids = {
|
||||
source["id"] for source in _structured(sources_result)["result"]
|
||||
source["id"]
|
||||
for source in _structured(sources_result)["sources"]
|
||||
}
|
||||
assert "wf.admin" in source_ids
|
||||
assert "wf.mcp" in source_ids
|
||||
|
||||
@@ -130,6 +130,17 @@ def test_service_lists_all_capability_sources_with_owned_capability_names() -> N
|
||||
assert "wf.admin.list_sources" in admin_source["capabilities"]["tools"]
|
||||
|
||||
|
||||
def test_service_lists_compact_source_summaries() -> None:
|
||||
service = WfMcpService(store=FileStore(local_temp_root() / "source_summaries"))
|
||||
|
||||
payload = service.list_source_summaries(limit=2)
|
||||
|
||||
assert len(payload["sources"]) == 2
|
||||
assert payload["total"] >= 2
|
||||
assert payload["next_cursor"] == "2"
|
||||
assert "capabilities" not in payload["sources"][0]
|
||||
|
||||
|
||||
def test_wf_std_source_contains_authoring_ops() -> None:
|
||||
service = WfMcpService(store=FileStore(local_temp_root() / "stdlib_source_store"))
|
||||
specs = service.capability_sources["wf.std"].capabilities.node_specs
|
||||
|
||||
@@ -77,14 +77,29 @@ def test_workflow_surface_lists_artifact_catalog_entries() -> None:
|
||||
def test_workflow_surface_lists_planner_visible_capabilities() -> None:
|
||||
handlers = _handlers(FileWorkflowArtifactStore(local_temp_root() / "surface_caps"))
|
||||
|
||||
payload = asyncio.run(handlers.list_capabilities())
|
||||
payload = asyncio.run(handlers.list_capabilities(limit=2))
|
||||
names = [capability["name"] for capability in payload["capabilities"]]
|
||||
|
||||
assert "wf.std.runtime_error" in names
|
||||
assert "wf.mcp.call_tool" in names
|
||||
assert len(names) == 2
|
||||
assert payload["total"] >= 2
|
||||
assert payload["next_cursor"] == "2"
|
||||
assert "description" in payload["capabilities"][0]
|
||||
assert "input_schema" not in payload["capabilities"][0]
|
||||
assert "wf.admin.list_sources" not in names
|
||||
|
||||
|
||||
def test_workflow_surface_filters_capabilities_by_source() -> None:
|
||||
handlers = _handlers(
|
||||
FileWorkflowArtifactStore(local_temp_root() / "surface_filtered_caps")
|
||||
)
|
||||
|
||||
payload = asyncio.run(handlers.list_capabilities(source_id="wf.mcp"))
|
||||
|
||||
assert [capability["name"] for capability in payload["capabilities"]] == [
|
||||
"wf.mcp.call_tool"
|
||||
]
|
||||
|
||||
|
||||
def test_workflow_surface_inspects_one_capability() -> None:
|
||||
handlers = _handlers(
|
||||
FileWorkflowArtifactStore(local_temp_root() / "surface_inspect_cap")
|
||||
|
||||
Reference in New Issue
Block a user