Skip to content

Commit 46884a3

Browse files
committed
add properties to sync tool
1 parent cea9c1e commit 46884a3

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

packages/toolbox-core/src/toolbox_core/sync_tool.py

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,15 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import copy
1516
import asyncio
1617
from asyncio import AbstractEventLoop
1718
from inspect import Signature
1819
from threading import Thread
19-
from typing import Any, Callable, Mapping, TypeVar, Union
20+
from typing import Any, Callable, Mapping, TypeVar, Union, Sequence, Coroutine
21+
22+
from .protocol import ParameterSchema
23+
2024

2125
from .tool import ToolboxTool
2226

@@ -66,26 +70,32 @@ def __init__(
6670
self.__qualname__ = f"{self.__class__.__qualname__}.{self.__name__}"
6771

6872
@property
69-
def __name__(self) -> str:
70-
return self.__async_tool._name
73+
def _name(self) -> str:
74+
return self.__name__
75+
76+
@property
77+
def _description(self) -> str:
78+
return self.__async_tool._description
79+
80+
@property
81+
def _params(self) -> Sequence[ParameterSchema]:
82+
return self.__async_tool._params
83+
84+
@property
85+
def _bound_params(self) -> Mapping[str, Union[Callable[[], Any], Any]]:
86+
return self.__async_tool._bound_params
7187

7288
@property
73-
def __doc__(self) -> Union[str, None]: # type: ignore[override]
74-
# Standard Python object attributes like __doc__ are technically "writable".
75-
# But not defining a setter function makes this a read-only property.
76-
# Mypy flags this issue in the type checks.
77-
return self.__async_tool.__doc__
89+
def _required_auth_params(self) -> Mapping[str, list[str]]:
90+
return self.__async_tool._required_auth_params
7891

7992
@property
80-
def __signature__(self) -> Signature:
81-
return self.__async_tool.__signature__
93+
def _auth_service_token_getters(self) -> Mapping[str, Callable[[], str]]:
94+
return self.__async_tool._auth_service_token_getters
8295

8396
@property
84-
def __annotations__(self) -> dict[str, Any]: # type: ignore[override]
85-
# Standard Python object attributes like __doc__ are technically "writable".
86-
# But not defining a setter function makes this a read-only property.
87-
# Mypy flags this issue in the type checks.
88-
return self.__async_tool.__annotations__
97+
def _client_headers(self) -> Mapping[str, Union[Callable, Coroutine, str]]:
98+
return self.__async_tool._client_headers
8999

90100
def __call__(self, *args: Any, **kwargs: Any) -> str:
91101
"""

0 commit comments

Comments
 (0)