example use, live MCP
told chat i dont want to use the fake ahh server we have (FakeAdapter). switch over, boom, errors.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from typing import Any, cast
|
||||
|
||||
import pytest
|
||||
|
||||
from examples.mcp_tool_workflow import run_example
|
||||
|
||||
|
||||
def test_mcp_tool_workflow_example_runs_discovered_tool() -> None:
|
||||
try:
|
||||
result = asyncio.run(run_example())
|
||||
except PermissionError as exc:
|
||||
pytest.skip(f"stdio MCP transport is not permitted in this environment: {exc}")
|
||||
|
||||
assert result["status"] == "completed"
|
||||
assert result["output"] == {"echoed": "hello from MCP"}
|
||||
catalog = cast(dict[str, Any], result["catalog"])
|
||||
node = catalog["nodes"][0]
|
||||
assert node["qualified_name"] == "fixture.personal.echo_tool"
|
||||
assert node["input_schema"]["properties"]["text"]["description"] == "Text to echo"
|
||||
@@ -196,10 +196,7 @@ def test_service_catalog_preserves_json_schema_description_metadata() -> None:
|
||||
node = service.get_catalog().as_payload()["nodes"][0]
|
||||
assert node["input_schema"]["type"] == "object"
|
||||
assert isinstance(node["input_schema"]["properties"], dict)
|
||||
assert (
|
||||
node["input_schema"]["properties"]["text"]["description"]
|
||||
== "Text to echo"
|
||||
)
|
||||
assert node["input_schema"]["properties"]["text"]["description"] == "Text to echo"
|
||||
assert node["output_schema"]["type"] == "object"
|
||||
assert isinstance(node["output_schema"]["properties"], dict)
|
||||
|
||||
@@ -226,7 +223,9 @@ def test_service_wrapped_tool_adapter_model_validates_simple_schema_types() -> N
|
||||
except ValueError as exc:
|
||||
assert "text" in str(exc)
|
||||
else:
|
||||
raise AssertionError("expected generated adapter model to reject non-string text")
|
||||
raise AssertionError(
|
||||
"expected generated adapter model to reject non-string text"
|
||||
)
|
||||
|
||||
|
||||
def test_service_records_tool_call_events() -> None:
|
||||
|
||||
Reference in New Issue
Block a user