Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

fix: custom tool cache creation

angrybayblade0b32a62304d5
diff --git a/python/composio/core/models/custom_tools.py b/python/composio/core/models/custom_tools.py
index 541f47740..7d1075279 100644
--- a/python/composio/core/models/custom_tools.py
+++ b/python/composio/core/models/custom_tools.py
@@ -25,8 +25,9 @@ class ExecuteRequestFn(t.Protocol):
method: t.Literal["GET", "POST", "PUT", "DELETE", "PATCH"],
body: t.Dict | NotGiven = HttpClient.not_given,
connected_account_id: str | NotGiven = HttpClient.not_given,
- parameters: t.Iterable[tool_proxy_params.Parameter]
- | NotGiven = HttpClient.not_given,
+ parameters: (
+ t.Iterable[tool_proxy_params.Parameter] | NotGiven
+ ) = HttpClient.not_given,
) -> tool_proxy_response.ToolProxyResponse: ...
@@ -70,10 +71,10 @@ class CustomTool:
self.description = t.cast(str, f.__doc__)
self.toolkit = toolkit
self.client = client
- self.info = self.__parse_info()
if self.toolkit is not None:
self.name = f"{self.toolkit.lower()}_{self.name}"
self.slug = f"{self.toolkit.upper()}_{self.slug}"
+ self.info = self.__parse_info()
def __parse_info(self) -> Tool:
"""Parse the parameters of the custom tool."""
diff --git a/python/composio/core/models/tools.py b/python/composio/core/models/tools.py
index 79580b1c3..7bf171ae6 100644
--- a/python/composio/core/models/tools.py
+++ b/python/composio/core/models/tools.py
@@ -114,7 +114,10 @@ class Tools(Resource, t.Generic[TProvider]):
if tools is not None:
tools, custom_tools = self._filter_custom_tools(tools=tools)
tools_list.extend(custom_tools)
- tools_list.extend(self._client.tools.list(tool_slugs=",".join(tools)).items)
+ if len(tools):
+ tools_list.extend(
+ self._client.tools.list(tool_slugs=",".join(tools)).items
+ )
# Search tools by toolkit slugs and search term
if toolkits is not None or search is not None: