diff --git a/stackone_ai/tools.py b/stackone_ai/tools.py index 486b6aa..26cb869 100644 --- a/stackone_ai/tools.py +++ b/stackone_ai/tools.py @@ -42,7 +42,6 @@ ToolArgumentsError, ToolParameters, ToolsetConfigError, - ToolsetError, ToolsetLoadError, ) @@ -755,7 +754,7 @@ def _describe_mcp_failure(exc: BaseException, endpoint: str, timeout: float) -> seen.add(id(current)) # Our own errors are already descriptive. They reach here wrapped in an # ExceptionGroup because they are raised inside the session's TaskGroup. - if isinstance(current, StackOneError | ToolsetError): + if isinstance(current, StackOneError): return current if isinstance(current, httpx.HTTPStatusError): body = _response_body(current.response) diff --git a/stackone_ai/toolset.py b/stackone_ai/toolset.py index 0780659..f8d5561 100644 --- a/stackone_ai/toolset.py +++ b/stackone_ai/toolset.py @@ -52,7 +52,6 @@ ToolMode, ToolParameters, ToolsetConfigError, - ToolsetError, ToolsetLoadError, ) @@ -231,7 +230,6 @@ def __init__( self._account_ids: list[str] = self._validate_account_ids( execute.get("account_ids") if execute else None ) - self._execute_config: ExecuteToolsConfig | None = execute execute_timeout = execute.get("timeout") if execute else None self._timeout: float = ( timeout if timeout is not None else (execute_timeout if execute_timeout is not None else 60.0) @@ -398,7 +396,7 @@ def fetch_tools( return Tools(all_tools) - except (ToolsetError, StackOneError): + except StackOneError: # StackOneAPIError carries the HTTP status. Re-wrapping it below would throw # that away, so a caller could not tell a 401 from a 429. raise diff --git a/tests/test_integrations_pydantic_ai.py b/tests/test_integrations_pydantic_ai.py index 3bdc1cd..730757d 100644 --- a/tests/test_integrations_pydantic_ai.py +++ b/tests/test_integrations_pydantic_ai.py @@ -122,7 +122,6 @@ def test_tools_to_pydantic_ai_with_agent(sample_tool: StackOneTool, monkeypatch: def test_toolset_pydantic_ai_default_uses_fetch_tools(sample_tool: StackOneTool): toolset = StackOneToolSet.__new__(StackOneToolSet) toolset.fetch_tools = MagicMock(return_value=Tools([sample_tool])) # type: ignore[method-assign] - toolset._execute_config = None # type: ignore[attr-defined] tools = toolset.pydantic_ai() @@ -131,10 +130,9 @@ def test_toolset_pydantic_ai_default_uses_fetch_tools(sample_tool: StackOneTool) assert tools[0].name == "bamboohr_list_employees" -def test_toolset_pydantic_ai_account_ids_override(sample_tool: StackOneTool): +def test_toolset_pydantic_ai_passes_account_ids_through(sample_tool: StackOneTool): toolset = StackOneToolSet.__new__(StackOneToolSet) toolset.fetch_tools = MagicMock(return_value=Tools([sample_tool])) # type: ignore[method-assign] - toolset._execute_config = {"account_ids": ["from-config"]} # type: ignore[attr-defined] toolset.pydantic_ai(account_ids=["override"])