Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

from aiohttp import ClientSession
from toolbox_core.client import ToolboxClient as ToolboxCoreClient
from toolbox_core.protocol import Protocol

from .async_tools import AsyncToolboxTool

Expand All @@ -33,6 +34,7 @@ def __init__(
client_headers: Optional[
Mapping[str, Union[Callable[[], str], Callable[[], Awaitable[str]], str]]
] = None,
protocol: Protocol = Protocol.MCP,
):
"""
Initializes the AsyncToolboxClient for the Toolbox service at the given URL.
Expand All @@ -42,7 +44,7 @@ def __init__(
session: An HTTP client session.
"""
self.__core_client = ToolboxCoreClient(
url=url, session=session, client_headers=client_headers
url=url, session=session, client_headers=client_headers, protocol=protocol
)

async def aload_tool(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from typing import Any, Awaitable, Callable, Mapping, Optional, Union
from warnings import warn

from toolbox_core.protocol import Protocol
from toolbox_core.sync_client import ToolboxSyncClient as ToolboxCoreSyncClient

from .tools import ToolboxTool
Expand All @@ -29,6 +30,7 @@ def __init__(
client_headers: Optional[
Mapping[str, Union[Callable[[], str], Callable[[], Awaitable[str]], str]]
] = None,
protocol: Protocol = Protocol.MCP,
) -> None:
"""
Initializes the ToolboxClient for the Toolbox service at the given URL.
Expand All @@ -37,7 +39,7 @@ def __init__(
url: The base URL of the Toolbox service.
"""
self.__core_client = ToolboxCoreSyncClient(
url=url, client_headers=client_headers
url=url, client_headers=client_headers, protocol=protocol
)

async def aload_tool(
Expand Down
6 changes: 5 additions & 1 deletion packages/toolbox-langchain/tests/test_async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from aiohttp import ClientSession
from toolbox_core.client import ToolboxClient as ToolboxCoreClient
from toolbox_core.protocol import ParameterSchema as CoreParameterSchema
from toolbox_core.protocol import Protocol
from toolbox_core.tool import ToolboxTool as ToolboxCoreTool

from toolbox_langchain.async_client import AsyncToolboxClient
Expand Down Expand Up @@ -348,5 +349,8 @@ async def test_init_with_client_headers(
headers = {"X-Test-Header": "value"}
AsyncToolboxClient(URL, session=mock_session, client_headers=headers)
mock_core_client_constructor.assert_called_once_with(
url=URL, session=mock_session, client_headers=headers
url=URL,
session=mock_session,
client_headers=headers,
protocol=Protocol.MCP_v20250618,
)
3 changes: 2 additions & 1 deletion packages/toolbox-langchain/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import pytest
from pydantic import BaseModel
from toolbox_core.protocol import ParameterSchema as CoreParameterSchema
from toolbox_core.protocol import Protocol
from toolbox_core.sync_tool import ToolboxSyncTool as ToolboxCoreSyncTool
from toolbox_core.utils import params_to_pydantic_model

Expand Down Expand Up @@ -490,7 +491,7 @@ def test_init_with_client_headers(self, mock_core_client_constructor):
headers = {"X-Test-Header": "value"}
ToolboxClient(URL, client_headers=headers)
mock_core_client_constructor.assert_called_once_with(
url=URL, client_headers=headers
url=URL, client_headers=headers, protocol=Protocol.MCP_v20250618
)

@patch("toolbox_langchain.client.ToolboxCoreSyncClient")
Expand Down