Skip to content

Commit c65a94a

Browse files
committed
make invoke method return str
1 parent fcf7da3 commit c65a94a

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async def tools_list(
4848
@abstractmethod
4949
async def tool_invoke(
5050
self, tool_name: str, arguments: dict, headers: Mapping[str, str]
51-
) -> dict:
51+
) -> str:
5252
"""Invokes a specific tool on the server."""
5353
pass
5454

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ async def __call__(self, *args: Any, **kwargs: Any) -> str:
290290
payload,
291291
headers,
292292
)
293-
return body.get("result", body)
293+
return body
294294

295295
def add_auth_token_getters(
296296
self,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ async def tool_invoke(
8888
if not resp.ok:
8989
err = body.get("error", f"unexpected status from server: {resp.status}")
9090
raise Exception(err)
91-
return body
91+
return body.get("result")
9292

9393
async def close(self):
9494
if self.__manage_session and not self.__session.closed:

packages/toolbox-core/tests/test_toolbox_transport.py

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

15-
from typing import AsyncGenerator, Mapping, Optional, Union
15+
from typing import AsyncGenerator, Mapping, Union, Optional
1616
from unittest.mock import AsyncMock
1717

1818
import pytest
@@ -135,7 +135,7 @@ async def test_tool_invoke_success(http_session: ClientSession):
135135
m.post(url, status=200, payload=response_payload)
136136
result = await transport.tool_invoke(TEST_TOOL_NAME, args, headers)
137137

138-
assert result == response_payload
138+
assert result == "success"
139139
m.assert_called_once_with(url, method="POST", json=args, headers=headers)
140140

141141

0 commit comments

Comments
 (0)