diff --git a/api/schemas/tool.py b/api/schemas/tool.py index 1e1c0650..3a4609b4 100644 --- a/api/schemas/tool.py +++ b/api/schemas/tool.py @@ -266,10 +266,6 @@ class TransferCallConfig(BaseModel): @model_validator(mode="after") def validate_destination_source_config(self): - if self.destination_source == "static" and not self.destination.strip(): - raise ValueError( - "config.destination is required when destination_source is static" - ) if self.destination_source == "dynamic" and self.resolver is None: raise ValueError( "config.resolver is required when destination_source is dynamic" diff --git a/api/tests/test_tool_schema.py b/api/tests/test_tool_schema.py index fd97f62d..ac2ef640 100644 --- a/api/tests/test_tool_schema.py +++ b/api/tests/test_tool_schema.py @@ -17,9 +17,11 @@ def test_transfer_call_destination_accepts_provider_specific_literal(): assert config.destination == "provider-specific-destination" -def test_transfer_call_static_requires_destination(): - with pytest.raises(ValueError, match="destination is required"): - TransferCallConfig(destination_source="static", destination="") +def test_transfer_call_static_allows_empty_draft_destination(): + config = TransferCallConfig(destination_source="static", destination="") + + assert config.destination_source == "static" + assert config.destination == "" def test_transfer_call_dynamic_requires_resolver(): diff --git a/ui/src/app/tools/page.tsx b/ui/src/app/tools/page.tsx index 18d9573b..78615d47 100644 --- a/ui/src/app/tools/page.tsx +++ b/ui/src/app/tools/page.tsx @@ -39,6 +39,7 @@ import { SelectValue, } from "@/components/ui/select"; import { Skeleton } from "@/components/ui/skeleton"; +import { detailFromError } from "@/lib/apiError"; import { useAuth } from "@/lib/auth"; import { @@ -154,8 +155,7 @@ export default function ToolsPage() { }); if (response.error) { - const errorDetail = (response.error as { detail?: string })?.detail; - setCreateError(errorDetail || "Failed to create tool"); + setCreateError(detailFromError(response.error, "Failed to create tool")); return; }