Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
Feat: Add support for enable/disable tags and search in toolkits (#2305)
Musthaq Ahamada76b0027051e
diff --git a/.changeset/dry-rings-turn.md b/.changeset/dry-rings-turn.mdnew file mode 100644index 000000000..b55f6a31e--- /dev/null+++ b/.changeset/dry-rings-turn.md@@ -0,0 +1,5 @@+---+'@composio/core': patch+---++Add support for enable/disable tags and search toolkits in tool routerdiff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 5f35add32..a3eeac94f 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -13,8 +13,8 @@ catalogs:specifier: ^4.20250917.0version: 4.20250917.0'@composio/client':- specifier: 0.1.0-alpha.51- version: 0.1.0-alpha.51+ specifier: 0.1.0-alpha.52+ version: 0.1.0-alpha.52'@modelcontextprotocol/sdk':specifier: ^1.24.0version: 1.24.1@@ -819,7 +819,7 @@ importers:version: 1.0.0-alpha.1'@composio/client':specifier: 'catalog:'- version: 0.1.0-alpha.51+ version: 0.1.0-alpha.52'@composio/core':specifier: workspace:*version: link:../core@@ -913,7 +913,7 @@ importers:dependencies:'@composio/client':specifier: 'catalog:'- version: 0.1.0-alpha.51+ version: 0.1.0-alpha.52'@composio/json-schema-to-zod':specifier: workspace:*version: link:../json-schema-to-zod@@ -1620,8 +1620,8 @@ packages:'@cloudflare/[email protected]':resolution: {integrity: sha512-Lsn9dZoRYZZCXXHZNa50cMP8kWhQZG9M7WjxNSiXFzC8bk4Wh/0SYYo4YINxEjEt6h2o69LmAhFaJ+qgaJTh8Q==}- '@composio/[email protected]':- resolution: {integrity: sha512-Qy7Ag2G2/6t226cXNZnCJmaVO3zMmKWnX4zHewvmqAgufUSwKAc/l4t5TTPN5EjMGUuzCwGE0FeHXODJffBNQg==}+ '@composio/[email protected]':+ resolution: {integrity: sha512-IFPa77R/v4JUX0QeRHRTEkJCBZ+OqMQBh1rIn4Nv5PIP1eP3sZqxlTYJUKPS4qLNnwBJRD+Vn7/jUs5J7pdv5g==}'@composio/[email protected]':resolution: {integrity: sha512-IpbfST0SSs/CEv+PIf6+EL0feNuJhQyUrOHJLPge8NhyLLrCyVqvujRIPyRUUjy0NDsked/Mm5VpJmYM6OACbg==}@@ -8037,7 +8037,7 @@ snapshots:'@cloudflare/[email protected]': {}- '@composio/[email protected]': {}+ '@composio/[email protected]': {}'@composio/[email protected]': {}@@ -10904,14 +10904,6 @@ snapshots:chai: 5.2.0tinyrainbow: 2.0.0- '@vitest/[email protected]([email protected](@types/[email protected])([email protected])([email protected])([email protected]))':- dependencies:- '@vitest/spy': 3.2.4- estree-walker: 3.0.3- magic-string: 0.30.21- optionalDependencies:-'@vitest/[email protected]([email protected](@types/[email protected])([email protected])([email protected])([email protected]))':dependencies:'@vitest/spy': 3.2.4@@ -10920,22 +10912,6 @@ snapshots:optionalDependencies:- '@vitest/[email protected]([email protected](@types/[email protected])([email protected])([email protected])([email protected]))':- dependencies:- '@vitest/spy': 3.2.4- estree-walker: 3.0.3- magic-string: 0.30.21- optionalDependencies:-- '@vitest/[email protected]([email protected](@types/[email protected])([email protected])([email protected])([email protected]))':- dependencies:- '@vitest/spy': 3.2.4- estree-walker: 3.0.3- magic-string: 0.30.21- optionalDependencies:-'@vitest/[email protected]':dependencies:tinyrainbow: 2.0.0@@ -10965,7 +10941,7 @@ snapshots:sirv: 3.0.1tinyglobby: 0.2.14tinyrainbow: 2.0.0- vitest: 3.2.4(@types/[email protected])(@vitest/[email protected])([email protected])([email protected])([email protected])+ vitest: 3.2.4(@types/[email protected])(@vitest/[email protected])([email protected])([email protected])([email protected])'@vitest/[email protected]':dependencies:diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yamlindex 57621ce55..c615f206a 100644--- a/pnpm-workspace.yaml+++ b/pnpm-workspace.yaml@@ -15,7 +15,7 @@ packages:catalog:'@cloudflare/vitest-pool-workers': ^0.9.2'@cloudflare/workers-types': ^4.20250917.0- '@composio/client': 0.1.0-alpha.51+ '@composio/client': 0.1.0-alpha.52'@modelcontextprotocol/sdk': ^1.24.0ai: 5.0.52openai: ^5.20.3diff --git a/python/composio/core/models/tool_router.py b/python/composio/core/models/tool_router.pyindex 607bde7f8..eeab85881 100644--- a/python/composio/core/models/tool_router.py+++ b/python/composio/core/models/tool_router.py@@ -12,6 +12,7 @@ from dataclasses import dataclassfrom enum import Enumfrom composio_client import omit+from composio_client.types.tool_router import session_create_paramsimport typing_extensions as tefrom composio.client import HttpClient@@ -40,6 +41,12 @@ class ToolsFn(t.Protocol):...+# Type alias for MCP tag literals+ToolRouterTag = t.Literal[+ "readOnlyHint", "destructiveHint", "idempotentHint", "openWorldHint"+]++class ToolRouterToolkitsEnableConfig(te.TypedDict, total=False):"""Configuration for enabling specific toolkits in tool router session.@@ -84,13 +91,12 @@ class ToolRouterToolsTagsConfig(te.TypedDict, total=False):"""Configuration for filtering tools by MCP tags.Attributes:- tags: List of MCP tags to filter tools by.- Only tools with these tags will be available.+ tags: Tags configuration - can be a list of tags (shorthand for enable)+ or an object with enable/disable keys.+ Only tools matching these tags will be available."""- tags: t.List[- t.Literal["readOnlyHint", "destructiveHint", "idempotentHint", "openWorldHint"]- ]+ tags: ToolRouterConfigTags# Type alias for per-toolkit tool configuration@@ -107,6 +113,35 @@ ToolRouterToolsConfig = t.Union[]+class ToolRouterTagsEnableDisableConfig(te.TypedDict, total=False):+ """Configuration for tags in tool router session.++ Attributes:+ enable: List of tags to enable in the tool router session.+ disable: List of tags to disable in the tool router session.+ """++ enable: t.Optional[t.List[ToolRouterTag]]+ disable: t.Optional[t.List[ToolRouterTag]]+++# Type alias for tags configuration+# Can be:+# - List[ToolRouterTag]: List of tag literals (shorthand for enable)+# - ToolRouterTagsEnableDisableConfig: Dict with 'enable' and/or 'disable' keys+ToolRouterConfigTags = t.Union[+ t.List[ToolRouterTag],+ ToolRouterTagsEnableDisableConfig,+]+++def _is_tools_tags_config(+ config: ToolRouterToolsConfig,+) -> t.TypeGuard[ToolRouterToolsTagsConfig]:+ """Type guard to check if config is ToolRouterToolsTagsConfig."""+ return isinstance(config, dict) and "tags" in config++class ToolRouterWorkbenchConfig(te.TypedDict, total=False):"""Configuration for workbench settings in tool router session.@@ -392,6 +427,7 @@ class ToolRouter(Resource, t.Generic[TProvider]):next_cursor: t.Optional[str] = None,limit: t.Optional[int] = None,is_connected: t.Optional[bool] = None,+ search: t.Optional[str] = None,) -> ToolkitConnectionsDetails:"""Get toolkit connection states for the session.@@ -409,7 +445,7 @@ class ToolRouter(Resource, t.Generic[TProvider]):- True: Only return toolkits with active connections- False: Only return toolkits without active connections- None: Return all toolkits regardless of connection status-+ search: Search term to filter toolkits by name.Returns:ToolkitConnectionsDetails: Object containing:- items: List of ToolkitConnectionState objects with:@@ -459,6 +495,8 @@ class ToolRouter(Resource, t.Generic[TProvider]):toolkits_params["toolkits"] = toolkitsif is_connected is not None:toolkits_params["is_connected"] = is_connected+ if search is not None:+ toolkits_params["search"] = searchresult = self._client.tool_router.session.toolkits(session_id=session_id,@@ -638,6 +676,45 @@ class ToolRouter(Resource, t.Generic[TProvider]):return tools_fn+ def _transform_tags_params(+ self, tags: t.Optional[ToolRouterConfigTags]+ ) -> t.Optional[session_create_params.TagsUnionMember1]:+ """Transform tags configuration to API format.++ Args:+ tags: Tags configuration - can be a list (shorthand for enable)+ or an object with enable/disable keys.++ Returns:+ Transformed tags payload in API format, or None if tags is None.+ """+ if tags is None:+ return None++ if isinstance(tags, list):+ # List shorthand means enable these tags+ # Return value structure matches TagsUnionMember1: {"enable": [...]}+ return {"enable": tags}+ elif isinstance(tags, dict):+ # Object format with enable/disable+ # Only include keys that are present and not None+ # Return value structure matches TagsUnionMember1+ enable_value = tags.get("enable")+ disable_value = tags.get("disable")++ # Build result dict only with non-None values+ if enable_value is not None and disable_value is not None:+ return {+ "enable": enable_value,+ "disable": disable_value,+ }+ elif enable_value is not None:+ return {"enable": enable_value}+ elif disable_value is not None:+ return {"disable": disable_value}+ else:+ return None+def create(self,*,@@ -650,13 +727,7 @@ class ToolRouter(Resource, t.Generic[TProvider]):]] = None,tools: t.Optional[t.Dict[str, ToolRouterToolsConfig]] = None,- tags: t.Optional[- t.List[- t.Literal[- "readOnlyHint", "destructiveHint", "idempotentHint", "openWorldHint"- ]- ]- ] = None,+ tags: t.Optional[ToolRouterConfigTags] = None,manage_connections: t.Optional[t.Union[bool, ToolRouterManageConnectionsConfig]] = None,@@ -684,7 +755,9 @@ class ToolRouter(Resource, t.Generic[TProvider]):- ToolRouterToolsDisableConfig: Dict with 'disable' key.Example: {'disable': ['GMAIL_DELETE_EMAIL']}- ToolRouterToolsTagsConfig: Dict with 'tags' key.+ Tags can be a list (shorthand for enable) or object with enable/disable.Example: {'tags': ['readOnlyHint', 'idempotentHint']}+ Example: {'tags': {'enable': ['readOnlyHint'], 'disable': ['destructiveHint']}}Example: {'gmail': ['GMAIL_SEND_EMAIL', 'GMAIL_SEARCH'],'github': {'enable': ['GITHUB_CREATE_ISSUE']},@@ -692,9 +765,13 @@ class ToolRouter(Resource, t.Generic[TProvider]):'linear': {'tags': ['readOnlyHint']}}:param tags: Optional global MCP tags to filter tools by.- Must be a list of literal values: 'readOnlyHint', 'destructiveHint',- 'idempotentHint', or 'openWorldHint'.- Example: ['readOnlyHint', 'destructiveHint', 'idempotentHint', 'openWorldHint']+ Can be:+ - List[str]: List of tag literals (shorthand for enable).+ Example: ['readOnlyHint', 'idempotentHint']+ - ToolRouterTagsEnableDisableConfig: Dict with 'enable' and/or 'disable' keys.+ Example: {'enable': ['readOnlyHint'], 'disable': ['destructiveHint']}+ Available tag values: 'readOnlyHint', 'destructiveHint',+ 'idempotentHint', 'openWorldHint'.Toolkit-level tags override this global setting.:param manage_connections: Optional connection management configuration. Can be:- bool: Simple boolean to enable/disable.@@ -745,7 +822,7 @@ class ToolRouter(Resource, t.Generic[TProvider]):tags=['readOnlyHint', 'idempotentHint'])- # Create a session with toolkit-specific tag filtering+ # Create a session with toolkit-specific tag filtering (array format)session = tool_router.create(user_id='user_123',tools={@@ -754,6 +831,15 @@ class ToolRouter(Resource, t.Generic[TProvider]):})+ # Create a session with toolkit-specific tag filtering (object format)+ session = tool_router.create(+ user_id='user_123',+ tools={+ 'gmail': {'tags': {'enable': ['readOnlyHint']}},+ 'github': {'tags': {'enable': ['readOnlyHint'], 'disable': ['destructiveHint']}}+ }+ )+# Create a session with connection managementsession = tool_router.create(user_id='user_123',@@ -807,9 +893,32 @@ class ToolRouter(Resource, t.Generic[TProvider]):# List shorthand means enable these toolstools_payload[toolkit_slug] = {"enable": config}elif isinstance(config, dict):- # Already in dict format with 'enable', 'disable', or 'tags'- # Pass through as-is since it matches the client SDK format- tools_payload[toolkit_slug] = dict(config)+ # Transform config dict - handle 'tags' specially if present+ # Build the transformed config explicitly to maintain proper typing+ transformed_config: t.Dict[+ str,+ t.Union[+ t.List[str],+ session_create_params.TagsUnionMember1,+ ],+ ] = {}+ # Copy existing keys (enable, disable) if present+ if "enable" in config:+ # config is ToolRouterToolsEnableConfig when "enable" is present+ enable_config = t.cast(ToolRouterToolsEnableConfig, config)+ transformed_config["enable"] = enable_config["enable"]+ if "disable" in config:+ # config is ToolRouterToolsDisableConfig when "disable" is present+ disable_config = t.cast(ToolRouterToolsDisableConfig, config)+ transformed_config["disable"] = disable_config["disable"]+ # Use type guard to narrow the type when "tags" is present+ if _is_tools_tags_config(config):+ # Type narrowed: config is now ToolRouterToolsTagsConfig+ tags_value = config["tags"]+ transformed_tags = self._transform_tags_params(tags_value)+ if transformed_tags is not None:+ transformed_config["tags"] = transformed_tags+ tools_payload[toolkit_slug] = transformed_config# Parse callback_uricallback_url = (@@ -845,8 +954,10 @@ class ToolRouter(Resource, t.Generic[TProvider]):if tools_payload:create_params["tools"] = tools_payload- if tags is not None:- create_params["tags"] = tags+ # Transform tags config+ tags_payload = self._transform_tags_params(tags)+ if tags_payload is not None:+ create_params["tags"] = tags_payloadif workbench is not None:execution_payload: t.Dict[str, t.Any] = {}@@ -925,6 +1036,9 @@ __all__ = ["ToolRouterToolsDisableConfig","ToolRouterToolsTagsConfig","ToolRouterToolsConfig",+ "ToolRouterTag",+ "ToolRouterTagsEnableDisableConfig",+ "ToolRouterConfigTags","ToolRouterManageConnectionsConfig","ToolRouterWorkbenchConfig","ToolkitConnectionState",diff --git a/python/composio/core/models/tools.py b/python/composio/core/models/tools.pyindex f3a2afbd8..19fb5d8e8 100644--- a/python/composio/core/models/tools.py+++ b/python/composio/core/models/tools.py@@ -357,9 +357,11 @@ class Tools(Resource, t.Generic[TProvider]):processed_arguments = modified_params.get("arguments", arguments)# Execute the tool via the session's execute_meta endpoint+ # Note: execute_meta accepts regular tool slugs at runtime, not just meta tool slugs+ # The type signature expects Literal meta tool slugs, but runtime accepts any strresponse = self._client.tool_router.session.execute_meta(session_id=session_id,- slug=slug,+ slug=slug, # type: ignore[arg-type]arguments=processed_arguments,)diff --git a/python/providers/anthropic/pyproject.toml b/python/providers/anthropic/pyproject.tomlindex 60c15a8e4..54c80f121 100644--- a/python/providers/anthropic/pyproject.toml+++ b/python/providers/anthropic/pyproject.toml@@ -1,6 +1,6 @@[project]name = "composio-anthropic"-version = "0.10.2"+version = "0.10.3"description = "Use Composio to get an array of tools with your Anthropic LLMs."readme = "README.md"requires-python = ">=3.10,<4"diff --git a/python/providers/anthropic/setup.py b/python/providers/anthropic/setup.pyindex fe2315d81..964ad545d 100644--- a/python/providers/anthropic/setup.py+++ b/python/providers/anthropic/setup.py@@ -8,7 +8,7 @@ from setuptools import setupsetup(name="composio_anthropic",- version="0.10.2",+ version="0.10.3",author="Composio",author_email="[email protected]",description="Use Composio to get an array of tools with your Anthropic LLMs.",diff --git a/python/providers/autogen/pyproject.toml b/python/providers/autogen/pyproject.tomlindex 665570eb4..bb2c718be 100644--- a/python/providers/autogen/pyproject.toml+++ b/python/providers/autogen/pyproject.toml@@ -1,6 +1,6 @@[project]name = "composio-autogen"-version = "0.10.2"+version = "0.10.3"description = "Use Composio to get an array of tools with your autogen agent."readme = "README.md"requires-python = ">=3.9,<4"diff --git a/python/providers/autogen/setup.py b/python/providers/autogen/setup.pyindex d60bbd7e8..0cc54fb60 100644--- a/python/providers/autogen/setup.py+++ b/python/providers/autogen/setup.py@@ -8,7 +8,7 @@ from setuptools import setupsetup(name="composio_autogen",- version="0.10.2",+ version="0.10.3",author="Composio",author_email="[email protected]",description="Use Composio to get an array of tools with your Autogen agent.",diff --git a/python/providers/claude_code_agents/pyproject.toml b/python/providers/claude_code_agents/pyproject.tomlindex 20e836ae8..4860f3ca0 100644--- a/python/providers/claude_code_agents/pyproject.toml+++ b/python/providers/claude_code_agents/pyproject.toml@@ -1,6 +1,6 @@[project]name = "composio-claude-code-agents"-version = "0.10.2"+version = "0.10.3"description = "Use Composio to get an array of tools with Claude Code Agents SDK."readme = "README.md"requires-python = ">=3.10,<4"diff --git a/python/providers/claude_code_agents/setup.py b/python/providers/claude_code_agents/setup.pyindex 98df142f1..ebeb10dd2 100644--- a/python/providers/claude_code_agents/setup.py+++ b/python/providers/claude_code_agents/setup.py@@ -8,7 +8,7 @@ from setuptools import find_packages, setupsetup(name="composio_claude_code_agents",- version="0.10.1",+ version="0.10.3",author="Composio",author_email="[email protected]",description="Use Composio to get array of tools for Claude Code Agents SDK",diff --git a/python/providers/crewai/pyproject.toml b/python/providers/crewai/pyproject.tomlindex fddec519b..31e72db8e 100644--- a/python/providers/crewai/pyproject.toml+++ b/python/providers/crewai/pyproject.toml@@ -1,6 +1,6 @@[project]name = "composio-crewai"-version = "0.10.2"+version = "0.10.3"description = "Use Composio to get an array of tools with your CrewAI agent."readme = "README.md"requires-python = ">=3.9,<4"diff --git a/python/providers/crewai/setup.py b/python/providers/crewai/setup.pyindex 677a88591..f24654085 100644--- a/python/providers/crewai/setup.py+++ b/python/providers/crewai/setup.py@@ -6,7 +6,7 @@ from setuptools import setupsetup(name="composio_crewai",- version="0.10.2",+ version="0.10.3",author="Composio",author_email="[email protected]",description="Use Composio to get an array of tools with your CrewAI agent.",diff --git a/python/providers/gemini/pyproject.toml b/python/providers/gemini/pyproject.tomlindex b990d7570..b250b02b2 100644--- a/python/providers/gemini/pyproject.toml+++ b/python/providers/gemini/pyproject.toml@@ -1,6 +1,6 @@[project]name = "composio-gemini"-version = "0.10.2"+version = "0.10.3"description = "Use Composio to get an array of tools with your Gemini agent."readme = "README.md"requires-python = ">=3.9,<4"diff --git a/python/providers/gemini/setup.py b/python/providers/gemini/setup.pyindex bfb47952d..7848233a3 100644--- a/python/providers/gemini/setup.py+++ b/python/providers/gemini/setup.py@@ -8,7 +8,7 @@ from setuptools import setupsetup(name="composio_gemini",- version="0.10.2",+ version="0.10.3",author="Composio",author_email="[email protected]",description="Use Composio to get an array of tools with your Gemini agent.",diff --git a/python/providers/google/pyproject.toml b/python/providers/google/pyproject.tomlindex be1b3ab30..68a2ecaae 100644--- a/python/providers/google/pyproject.toml+++ b/python/providers/google/pyproject.toml@@ -1,6 +1,6 @@[project]name = "composio-google"-version = "0.10.2"+version = "0.10.3"description = "Use Composio to get an array of tools with your Google AI Python Gemini model."readme = "README.md"requires-python = ">=3.9,<4"diff --git a/python/providers/google/setup.py b/python/providers/google/setup.pyindex f92a833e3..2e688a9f7 100644--- a/python/providers/google/setup.py+++ b/python/providers/google/setup.py@@ -8,7 +8,7 @@ from setuptools import setupsetup(name="composio_google",- version="0.10.2",+ version="0.10.3",author="Composio",author_email="[email protected]",description="Use Composio to get an array of tools with your Google AI Python Gemini model.",diff --git a/python/providers/google_adk/pyproject.toml b/python/providers/google_adk/pyproject.tomlindex a6d0c5c72..4f58ba5b1 100644--- a/python/providers/google_adk/pyproject.toml+++ b/python/providers/google_adk/pyproject.toml@@ -1,6 +1,6 @@[project]name = "composio-google-adk"-version = "0.10.2"+version = "0.10.3"description = "Use Composio to get an array of tools with your Google AI Python Gemini model."readme = "README.md"requires-python = ">=3.9,<4"diff --git a/python/providers/google_adk/setup.py b/python/providers/google_adk/setup.pyindex d846d5912..4a497fb88 100644--- a/python/providers/google_adk/setup.py+++ b/python/providers/google_adk/setup.py@@ -8,7 +8,7 @@ from setuptools import setupsetup(name="composio_google_adk",- version="0.10.2",+ version="0.10.3",author="Composio",author_email="[email protected]",description="Use Composio to get an array of tools with your Google AI Python Gemini model.",diff --git a/python/providers/langchain/pyproject.toml b/python/providers/langchain/pyproject.tomlindex 57663b233..1430324be 100644--- a/python/providers/langchain/pyproject.toml+++ b/python/providers/langchain/pyproject.toml@@ -1,6 +1,6 @@[project]name = "composio-langchain"-version = "0.10.2"+version = "0.10.3"description = "Use Composio to get an array of tools with your Langchain agent."readme = "README.md"requires-python = ">=3.9,<4"diff --git a/python/providers/langchain/setup.py b/python/providers/langchain/setup.pyindex 2c9a6b670..d1d1bd754 100644--- a/python/providers/langchain/setup.py+++ b/python/providers/langchain/setup.py@@ -8,7 +8,7 @@ from setuptools import setupsetup(name="composio_langchain",- version="0.10.2",+ version="0.10.3",author="composio",author_email="[email protected]",description="Use Composio to get an array of tools with your Langchain agent.",diff --git a/python/providers/langgraph/pyproject.toml b/python/providers/langgraph/pyproject.tomlindex 6b5e1cba9..b564d5a04 100644--- a/python/providers/langgraph/pyproject.toml+++ b/python/providers/langgraph/pyproject.toml@@ -1,6 +1,6 @@[project]name = "composio-langgraph"-version = "0.10.2"+version = "0.10.3"description = "Use Composio to get array of tools with LangGraph Agent Workflows."readme = "README.md"requires-python = ">=3.9,<4"diff --git a/python/providers/langgraph/setup.py b/python/providers/langgraph/setup.pyindex a7aa490e5..b1c04c933 100644--- a/python/providers/langgraph/setup.py+++ b/python/providers/langgraph/setup.py@@ -8,7 +8,7 @@ from setuptools import setupsetup(name="composio_langgraph",- version="0.10.2",+ version="0.10.3",author="composio",author_email="[email protected]",description="Use Composio to get array of tools with LangGraph Agent Workflows",diff --git a/python/providers/llamaindex/pyproject.toml b/python/providers/llamaindex/pyproject.tomlindex 5032b407f..a84bdee3d 100644--- a/python/providers/llamaindex/pyproject.toml+++ b/python/providers/llamaindex/pyproject.toml@@ -1,6 +1,6 @@[project]name = "composio-llamaindex"-version = "0.10.2"+version = "0.10.3"description = "Use Composio to get array of tools with LlamaIndex Agent Workflows."readme = "README.md"requires-python = ">=3.9,<4"diff --git a/python/providers/llamaindex/setup.py b/python/providers/llamaindex/setup.pyindex 0be825bfd..77e9dc435 100644--- a/python/providers/llamaindex/setup.py+++ b/python/providers/llamaindex/setup.py@@ -8,7 +8,7 @@ from setuptools import setupsetup(name="composio_llamaindex",- version="0.10.2",+ version="0.10.3",author="composio",author_email="[email protected]",description="Use Composio to get array of tools with LlamaIndex Agent Workflows",diff --git a/python/providers/openai/pyproject.toml b/python/providers/openai/pyproject.tomlindex d46da914c..6aef2c1de 100644--- a/python/providers/openai/pyproject.toml+++ b/python/providers/openai/pyproject.toml@@ -1,6 +1,6 @@[project]name = "composio-openai"-version = "0.10.2"+version = "0.10.3"description = "Use Composio to get an array of tools with your OpenAI Function Call."readme = "README.md"requires-python = ">=3.9,<4"diff --git a/python/providers/openai/setup.py b/python/providers/openai/setup.pyindex 4bba70c73..21ba457f4 100644--- a/python/providers/openai/setup.py+++ b/python/providers/openai/setup.py@@ -8,7 +8,7 @@ from setuptools import setupsetup(name="composio_openai",- version="0.10.2",+ version="0.10.3",author="Composio",author_email="[email protected]",description="Use Composio to get an array of tools with your OpenAI Function Call.",diff --git a/python/providers/openai_agents/pyproject.toml b/python/providers/openai_agents/pyproject.tomlindex d8a10c525..f04006a43 100644--- a/python/providers/openai_agents/pyproject.toml+++ b/python/providers/openai_agents/pyproject.toml@@ -1,6 +1,6 @@[project]name = "composio-openai-agents"-version = "0.10.2"+version = "0.10.3"description = "Use Composio to get array of strongly typed tools for OpenAI Agents"readme = "README.md"requires-python = ">=3.9,<4"diff --git a/python/providers/openai_agents/setup.py b/python/providers/openai_agents/setup.pyindex d6bd20603..07d912127 100644--- a/python/providers/openai_agents/setup.py+++ b/python/providers/openai_agents/setup.py@@ -8,7 +8,7 @@ from setuptools import find_packages, setupsetup(name="composio_openai_agents",- version="0.10.2",+ version="0.10.3",author="Composio",author_email="[email protected]",description="Use Composio to get array of strongly typed tools for OpenAI Agents",diff --git a/python/pyproject.toml b/python/pyproject.tomlindex 6fdc6c069..ae00b5a82 100644--- a/python/pyproject.toml+++ b/python/pyproject.toml@@ -1,13 +1,13 @@[project]name = "composio"-version = "0.10.2"+version = "0.10.3"description = "SDK for integrating Composio with your applications."readme = "README.md"requires-python = ">=3.10,<4"dependencies = ["pysher>=1.0.8","pydantic>=2.6.4",- "composio-client>=1.21.0",+ "composio-client>=1.22.0","typing-extensions>=4.0.0","openai",]diff --git a/python/tests/test_tool_router.py b/python/tests/test_tool_router.pyindex 25b82ecfd..c9e4bc0ed 100644--- a/python/tests/test_tool_router.py+++ b/python/tests/test_tool_router.py@@ -164,21 +164,73 @@ class TestToolRouter:assert kwargs["tools"]["github"] == {"enable": ["GITHUB_CREATE_ISSUE"]}def test_create_session_with_global_tags(self, tool_router, mock_client):- """Test creating a session with global tag filtering."""+ """Test creating a session with global tag filtering (array format)."""session = tool_router.create(user_id="user_123", tags=["readOnlyHint", "idempotentHint"])assert session.session_id == "session_123"- # Verify the API was called with tags at top level+ # Verify the API was called with tags transformed to enable formatcall_args = mock_client.tool_router.session.create.call_argskwargs = call_args.kwargsassert "tags" in kwargs- assert kwargs["tags"] == ["readOnlyHint", "idempotentHint"]+ assert kwargs["tags"] == {"enable": ["readOnlyHint", "idempotentHint"]}++ def test_create_session_with_global_tags_object_enable(+ self, tool_router, mock_client+ ):+ """Test creating a session with global tags using object format with enable."""+ session = tool_router.create(+ user_id="user_123", tags={"enable": ["readOnlyHint", "idempotentHint"]}+ )++ assert session.session_id == "session_123"++ call_args = mock_client.tool_router.session.create.call_args+ kwargs = call_args.kwargs+ assert "tags" in kwargs+ assert kwargs["tags"] == {"enable": ["readOnlyHint", "idempotentHint"]}++ def test_create_session_with_global_tags_object_disable(+ self, tool_router, mock_client+ ):+ """Test creating a session with global tags using object format with disable."""+ session = tool_router.create(+ user_id="user_123", tags={"disable": ["destructiveHint"]}+ )++ assert session.session_id == "session_123"++ call_args = mock_client.tool_router.session.create.call_args+ kwargs = call_args.kwargs+ assert "tags" in kwargs+ assert kwargs["tags"] == {"disable": ["destructiveHint"]}++ def test_create_session_with_global_tags_object_both(+ self, tool_router, mock_client+ ):+ """Test creating a session with global tags using object format with both enable and disable."""+ session = tool_router.create(+ user_id="user_123",+ tags={+ "enable": ["readOnlyHint", "idempotentHint"],+ "disable": ["destructiveHint"],+ },+ )++ assert session.session_id == "session_123"++ call_args = mock_client.tool_router.session.create.call_args+ kwargs = call_args.kwargs+ assert "tags" in kwargs+ assert kwargs["tags"] == {+ "enable": ["readOnlyHint", "idempotentHint"],+ "disable": ["destructiveHint"],+ }def test_create_session_with_toolkit_specific_tags(self, tool_router, mock_client):- """Test creating a session with per-toolkit tag filtering."""+ """Test creating a session with per-toolkit tag filtering (array format)."""session = tool_router.create(user_id="user_123",tools={@@ -192,8 +244,76 @@ class TestToolRouter:call_args = mock_client.tool_router.session.create.call_argskwargs = call_args.kwargsassert "tools" in kwargs- assert kwargs["tools"]["gmail"] == {"tags": ["readOnlyHint"]}- assert kwargs["tools"]["github"] == {"tags": ["readOnlyHint", "idempotentHint"]}+ assert kwargs["tools"]["gmail"] == {"tags": {"enable": ["readOnlyHint"]}}+ assert kwargs["tools"]["github"] == {+ "tags": {"enable": ["readOnlyHint", "idempotentHint"]}+ }++ def test_create_session_with_toolkit_specific_tags_object_enable(+ self, tool_router, mock_client+ ):+ """Test creating a session with per-toolkit tags using object format with enable."""+ session = tool_router.create(+ user_id="user_123",+ tools={+ "gmail": {"tags": {"enable": ["readOnlyHint", "idempotentHint"]}},+ },+ )++ assert session.session_id == "session_123"++ call_args = mock_client.tool_router.session.create.call_args+ kwargs = call_args.kwargs+ assert "tools" in kwargs+ assert kwargs["tools"]["gmail"] == {+ "tags": {"enable": ["readOnlyHint", "idempotentHint"]}+ }++ def test_create_session_with_toolkit_specific_tags_object_disable(+ self, tool_router, mock_client+ ):+ """Test creating a session with per-toolkit tags using object format with disable."""+ session = tool_router.create(+ user_id="user_123",+ tools={+ "gmail": {"tags": {"disable": ["destructiveHint"]}},+ },+ )++ assert session.session_id == "session_123"++ call_args = mock_client.tool_router.session.create.call_args+ kwargs = call_args.kwargs+ assert "tools" in kwargs+ assert kwargs["tools"]["gmail"] == {"tags": {"disable": ["destructiveHint"]}}++ def test_create_session_with_toolkit_specific_tags_object_both(+ self, tool_router, mock_client+ ):+ """Test creating a session with per-toolkit tags using object format with both enable and disable."""+ session = tool_router.create(+ user_id="user_123",+ tools={+ "gmail": {+ "tags": {+ "enable": ["readOnlyHint", "idempotentHint"],+ "disable": ["destructiveHint"],+ }+ },+ },+ )++ assert session.session_id == "session_123"++ call_args = mock_client.tool_router.session.create.call_args+ kwargs = call_args.kwargs+ assert "tools" in kwargs+ assert kwargs["tools"]["gmail"] == {+ "tags": {+ "enable": ["readOnlyHint", "idempotentHint"],+ "disable": ["destructiveHint"],+ }+ }def test_create_session_with_open_world_hint_tag(self, tool_router, mock_client):"""Test creating a session with openWorldHint tag."""@@ -207,7 +327,7 @@ class TestToolRouter:call_args = mock_client.tool_router.session.create.call_argskwargs = call_args.kwargsassert "tags" in kwargs- assert kwargs["tags"] == ["openWorldHint", "readOnlyHint"]+ assert kwargs["tags"] == {"enable": ["openWorldHint", "readOnlyHint"]}def test_create_session_with_mixed_tools_config(self, tool_router, mock_client):"""Test creating a session with mixed tool configuration (enable, disable, tags)."""@@ -226,7 +346,71 @@ class TestToolRouter:kwargs = call_args.kwargsassert kwargs["tools"]["gmail"] == {"enable": ["GMAIL_SEND_EMAIL"]}assert kwargs["tools"]["slack"] == {"disable": ["SLACK_DELETE_MESSAGE"]}- assert kwargs["tools"]["github"] == {"tags": ["readOnlyHint"]}+ assert kwargs["tools"]["github"] == {"tags": {"enable": ["readOnlyHint"]}}++ def test_create_session_with_global_and_toolkit_tags(+ self, tool_router, mock_client+ ):+ """Test creating a session with both global tags and toolkit-specific tags."""+ session = tool_router.create(+ user_id="user_123",+ tags=["readOnlyHint"], # Global tags+ tools={+ "gmail": {+ "tags": {+ "enable": ["idempotentHint"],+ "disable": ["destructiveHint"],+ }+ },+ },+ )++ assert session.session_id == "session_123"++ call_args = mock_client.tool_router.session.create.call_args+ kwargs = call_args.kwargs+ assert kwargs["tags"] == {"enable": ["readOnlyHint"]}+ assert kwargs["tools"]["gmail"] == {+ "tags": {"enable": ["idempotentHint"], "disable": ["destructiveHint"]}+ }++ def test_create_session_with_empty_tags_array(self, tool_router, mock_client):+ """Test creating a session with empty tags array."""+ session = tool_router.create(+ user_id="user_123",+ tags=[],+ )++ assert session.session_id == "session_123"++ call_args = mock_client.tool_router.session.create.call_args+ kwargs = call_args.kwargs+ assert kwargs["tags"] == {"enable": []}++ def test_create_session_with_all_tag_types(self, tool_router, mock_client):+ """Test creating a session with all available tag types."""+ session = tool_router.create(+ user_id="user_123",+ tags=[+ "readOnlyHint",+ "destructiveHint",+ "idempotentHint",+ "openWorldHint",+ ],+ )++ assert session.session_id == "session_123"++ call_args = mock_client.tool_router.session.create.call_args+ kwargs = call_args.kwargs+ assert kwargs["tags"] == {+ "enable": [+ "readOnlyHint",+ "destructiveHint",+ "idempotentHint",+ "openWorldHint",+ ]+ }def test_create_session_with_manage_connections_boolean(self, tool_router, mock_client@@ -469,6 +653,92 @@ class TestToolRouter:assert github_toolkit.connection.auth_config is Noneassert github_toolkit.connection.connected_account is None+ def test_toolkits_function_with_search(self, tool_router, mock_client):+ """Test the toolkits function with search parameter."""+ session = tool_router.create(user_id="user_123")++ session.toolkits(search="gmail")++ # Verify toolkits was called with search param+ call_args = mock_client.tool_router.session.toolkits.call_args+ assert call_args.kwargs.get("search") == "gmail"+ assert call_args.kwargs["session_id"] == "session_123"++ def test_toolkits_function_with_search_and_toolkits_filter(+ self, tool_router, mock_client+ ):+ """Test the toolkits function with search and toolkits filter together."""+ session = tool_router.create(user_id="user_123")++ session.toolkits(search="github", toolkits=["github", "slack"])++ # Verify toolkits was called with both search and toolkits params+ call_args = mock_client.tool_router.session.toolkits.call_args+ assert call_args.kwargs.get("search") == "github"+ assert call_args.kwargs.get("toolkits") == ["github", "slack"]+ assert call_args.kwargs["session_id"] == "session_123"++ def test_toolkits_function_with_search_and_is_connected(+ self, tool_router, mock_client+ ):+ """Test the toolkits function with search and is_connected filter."""+ session = tool_router.create(user_id="user_123")++ session.toolkits(search="mail", is_connected=True)++ # Verify toolkits was called with search and is_connected params+ call_args = mock_client.tool_router.session.toolkits.call_args+ assert call_args.kwargs.get("search") == "mail"+ assert call_args.kwargs.get("is_connected") is True+ assert call_args.kwargs["session_id"] == "session_123"++ def test_toolkits_function_with_search_and_pagination(+ self, tool_router, mock_client+ ):+ """Test the toolkits function with search and pagination parameters."""+ session = tool_router.create(user_id="user_123")++ session.toolkits(search="slack", next_cursor="cursor_xyz", limit=5)++ # Verify toolkits was called with search and pagination params+ call_args = mock_client.tool_router.session.toolkits.call_args+ assert call_args.kwargs.get("search") == "slack"+ assert call_args.kwargs.get("cursor") == "cursor_xyz"+ assert call_args.kwargs.get("limit") == 5+ assert call_args.kwargs["session_id"] == "session_123"++ def test_toolkits_function_with_search_all_params(self, tool_router, mock_client):+ """Test the toolkits function with search and all other parameters."""+ session = tool_router.create(user_id="user_123")++ session.toolkits(+ search="gmail",+ toolkits=["gmail", "github"],+ next_cursor="cursor_123",+ limit=20,+ is_connected=False,+ )++ # Verify toolkits was called with all params including search+ call_args = mock_client.tool_router.session.toolkits.call_args+ assert call_args.kwargs.get("search") == "gmail"+ assert call_args.kwargs.get("toolkits") == ["gmail", "github"]+ assert call_args.kwargs.get("cursor") == "cursor_123"+ assert call_args.kwargs.get("limit") == 20+ assert call_args.kwargs.get("is_connected") is False+ assert call_args.kwargs["session_id"] == "session_123"++ def test_toolkits_function_with_empty_search(self, tool_router, mock_client):+ """Test the toolkits function with empty search string."""+ session = tool_router.create(user_id="user_123")++ session.toolkits(search="")++ # Verify toolkits was called with empty search string+ call_args = mock_client.tool_router.session.toolkits.call_args+ assert call_args.kwargs.get("search") == ""+ assert call_args.kwargs["session_id"] == "session_123"+@patch("composio.core.models.tools.Tools")def test_tools_function(self, mock_tools_class, tool_router, mock_client, mock_providerdiff --git a/ts/packages/core/src/lib/toolRouterParams.ts b/ts/packages/core/src/lib/toolRouterParams.tsindex 68e16b7c8..6db26eca9 100644--- a/ts/packages/core/src/lib/toolRouterParams.ts+++ b/ts/packages/core/src/lib/toolRouterParams.ts@@ -1,5 +1,6 @@import { SessionCreateParams } from '@composio/client/resources/tool-router.mjs';import {+ ToolRouterConfigTags,ToolRouterConfigTools,ToolRouterConfigToolsSchema,ToolRouterToolsParam,@@ -34,7 +35,10 @@ export const transformToolRouterToolsParams = (} else if ('disable' in data) {acc[key] = { disable: data.disable };} else if ('tags' in data) {- acc[key] = { tags: data.tags };+ const tags = transformToolRouterTagsParams(data.tags);+ if (tags) {+ acc[key] = { tags };+ }}} else {throw new ValidationError(parsedResult.error.message);@@ -52,3 +56,19 @@ export const transformToolRouterToolsParams = (return result;}};++export const transformToolRouterTagsParams = (+ params?: ToolRouterConfigTags+): SessionCreateParams.Tags['tags'] | undefined => {+ if (!params) {+ return undefined;+ }+ if (Array.isArray(params)) {+ return { enable: params };+ } else if (typeof params === 'object') {+ return {+ enable: params.enable,+ disable: params.disable,+ };+ }+};diff --git a/ts/packages/core/src/models/ToolRouter.ts b/ts/packages/core/src/models/ToolRouter.tsindex 4c806f8aa..54190fac1 100644--- a/ts/packages/core/src/models/ToolRouter.ts+++ b/ts/packages/core/src/models/ToolRouter.ts@@ -45,7 +45,10 @@ import { ConnectedAccountStatuses } from '../types/connectedAccounts.types';import { transform } from '../utils/transform';import { SessionCreateParams } from '@composio/client/resources/tool-router.mjs';import { ValidationError } from '../errors';-import { transformToolRouterToolsParams } from '../lib/toolRouterParams';+import {+ transformToolRouterTagsParams,+ transformToolRouterToolsParams,+} from '../lib/toolRouterParams';export class ToolRouter<TToolCollection,@@ -115,6 +118,7 @@ export class ToolRouter<limit: toolkitOptions.data.limit,toolkits: toolkitOptions.data.toolkits,is_connected: toolkitOptions.data.isConnected,+ search: toolkitOptions.data.search,});const toolkitConnectedStates = result.items.map(item => {@@ -261,6 +265,7 @@ export class ToolRouter<? { enable: routerConfig.toolkits }: routerConfig.toolkits;+ const tags = transformToolRouterTagsParams(routerConfig.tags);const tools = transformToolRouterToolsParams(routerConfig.tools);const payload: SessionCreateParams = {@@ -269,7 +274,7 @@ export class ToolRouter<auth_configs: routerConfig.authConfigs,connected_accounts: routerConfig.connectedAccounts,tools: tools,- tags: routerConfig.tags,+ tags: tags,manage_connections: {enable: manageConnectedAccounts,callback_url:diff --git a/ts/packages/core/src/models/Tools.ts b/ts/packages/core/src/models/Tools.tsindex d7af582f2..bf6ab479b 100644--- a/ts/packages/core/src/models/Tools.ts+++ b/ts/packages/core/src/models/Tools.ts@@ -52,6 +52,7 @@ import { ComposioConfig } from '../composio';import { getToolkitVersion } from '../utils/toolkitVersion';import { handleToolExecutionError } from '../errors/ToolErrors';import { ToolExecuteMetaParams } from '../types/tool.types';+import { SessionExecuteMetaParams } from '@composio/client/resources/tool-router.mjs';/*** This class is used to manage tools in the Composio SDK.* It provides methods to list, get, and execute tools.@@ -911,7 +912,8 @@ export class Tools<);const response = await this.client.toolRouter.session.executeMeta(body.sessionId, {- slug: toolSlug,+ // assert this because backend might keep adding more tool slugs+ slug: toolSlug as SessionExecuteMetaParams['slug'],arguments: params,});diff --git a/ts/packages/core/src/types/toolRouter.types.ts b/ts/packages/core/src/types/toolRouter.types.tsindex d45c0f2cb..2defad89a 100644--- a/ts/packages/core/src/types/toolRouter.types.ts+++ b/ts/packages/core/src/types/toolRouter.types.ts@@ -56,25 +56,22 @@ export const ToolRouterManageConnectionsConfigSchema = z.object({// Tagsexport const ToolRouterTagsParamSchema = z- .array(z.string())- .describe('The tags to use in the tool router session');-export const ToolRouterEnabledTagsConfigSchema = z- .object({- enable: ToolRouterTagsParamSchema.describe('The tags to enable in the tool router session'),- })- .strict();-export const ToolRouterDisabledTagsConfigSchema = z+ .array(z.enum(['readOnlyHint', 'destructiveHint', 'idempotentHint', 'openWorldHint']))+ .describe('The tags to filter the tools by');+export const ToolRouterTagsEnableDisableSchema = z.object({- disable: ToolRouterTagsParamSchema.describe('The tags to disable in the tool router session'),+ enable: ToolRouterTagsParamSchema.optional().describe(+ 'The tags to enable in the tool router session'+ ),+ disable: ToolRouterTagsParamSchema.optional().describe(+ 'The tags to disable in the tool router session'+ ),}).strict();export const ToolRouterConfigTagsSchema = z- .union([- ToolRouterTagsParamSchema,- ToolRouterEnabledTagsConfigSchema,- ToolRouterDisabledTagsConfigSchema,- ])+ .union([ToolRouterTagsParamSchema, ToolRouterTagsEnableDisableSchema]).describe('The tags to use in the tool router session');+export type ToolRouterConfigTags = z.infer<typeof ToolRouterConfigTagsSchema>;/*** Tools config - Configure tools per toolkit using toolkit slug as key@@ -103,11 +100,6 @@ export const ToolRouterToolsParamSchema = z.describe('The tools to use in the tool router session');export type ToolRouterToolsParam = z.infer<typeof ToolRouterToolsParamSchema>;-export const ToolRouterToolsTagsParamSchema = z- .array(z.enum(['readOnlyHint', 'destructiveHint', 'idempotentHint', 'openWorldHint']))- .describe('The tags to filter the tools by');-export type ToolRouterToolsTagsParam = z.infer<typeof ToolRouterToolsTagsParamSchema>;-export const ToolRouterConfigToolsSchema = z.union([ToolRouterToolsParamSchema,@@ -127,7 +119,7 @@ export const ToolRouterConfigToolsSchema = z.strict(),z.object({- tags: ToolRouterToolsTagsParamSchema.describe(+ tags: ToolRouterConfigTagsSchema.describe('The tags to filter the tools by, this will override the global tags'),})@@ -155,7 +147,7 @@ export const ToolRouterCreateSessionConfigSchema = z.optional().describe('The tools to use in the tool router session'),- tags: ToolRouterToolsTagsParamSchema.optional().describe('Global tags to filter the tools by'),+ tags: ToolRouterConfigTagsSchema.optional().describe('Global tags to filter the tools by'),toolkits: z.union([@@ -284,6 +276,7 @@ export const ToolRouterToolkitsOptionsSchema = z.object({nextCursor: z.string().optional(),limit: z.number().optional(),isConnected: z.boolean().optional(),+ search: z.string().optional(),});export type ToolRouterToolkitsOptions = z.infer<typeof ToolRouterToolkitsOptionsSchema>;diff --git a/ts/packages/core/test/lib/toolRouterParams.test.ts b/ts/packages/core/test/lib/toolRouterParams.test.tsnew file mode 100644index 000000000..7362bf07c--- /dev/null+++ b/ts/packages/core/test/lib/toolRouterParams.test.ts@@ -0,0 +1,129 @@+import { describe, it, expect } from 'vitest';+import { transformToolRouterTagsParams } from '../../src/lib/toolRouterParams';+import { ToolRouterConfigTags } from '../../src/types/toolRouter.types';++describe('transformToolRouterTagsParams', () => {+ describe('with undefined input', () => {+ it('should return undefined when params is undefined', () => {+ const result = transformToolRouterTagsParams(undefined);+ expect(result).toBeUndefined();+ });+ });++ describe('with array input', () => {+ it('should transform array of tags to enable format', () => {+ const params: ToolRouterConfigTags = ['readOnlyHint', 'idempotentHint'];+ const result = transformToolRouterTagsParams(params);++ expect(result).toEqual({+ enable: ['readOnlyHint', 'idempotentHint'],+ });+ });++ it('should handle single tag in array', () => {+ const params: ToolRouterConfigTags = ['readOnlyHint'];+ const result = transformToolRouterTagsParams(params);++ expect(result).toEqual({+ enable: ['readOnlyHint'],+ });+ });++ it('should handle all tag types', () => {+ const params: ToolRouterConfigTags = [+ 'readOnlyHint',+ 'destructiveHint',+ 'idempotentHint',+ 'openWorldHint',+ ];+ const result = transformToolRouterTagsParams(params);++ expect(result).toEqual({+ enable: ['readOnlyHint', 'destructiveHint', 'idempotentHint', 'openWorldHint'],+ });+ });++ it('should handle empty array', () => {+ const params: ToolRouterConfigTags = [];+ const result = transformToolRouterTagsParams(params);++ expect(result).toEqual({+ enable: [],+ });+ });+ });++ describe('with object input', () => {+ it('should transform object with enable property', () => {+ const params: ToolRouterConfigTags = {+ enable: ['readOnlyHint', 'idempotentHint'],+ };+ const result = transformToolRouterTagsParams(params);++ expect(result).toEqual({+ enable: ['readOnlyHint', 'idempotentHint'],+ });+ });++ it('should transform object with disable property', () => {+ const params: ToolRouterConfigTags = {+ disable: ['destructiveHint'],+ };+ const result = transformToolRouterTagsParams(params);++ expect(result).toEqual({+ enable: undefined,+ disable: ['destructiveHint'],+ });+ });++ it('should transform object with both enable and disable properties', () => {+ const params: ToolRouterConfigTags = {+ enable: ['readOnlyHint', 'idempotentHint'],+ disable: ['destructiveHint'],+ };+ const result = transformToolRouterTagsParams(params);++ expect(result).toEqual({+ enable: ['readOnlyHint', 'idempotentHint'],+ disable: ['destructiveHint'],+ });+ });++ it('should handle object with only enable property', () => {+ const params: ToolRouterConfigTags = {+ enable: ['readOnlyHint'],+ };+ const result = transformToolRouterTagsParams(params);++ expect(result).toEqual({+ enable: ['readOnlyHint'],+ });+ });++ it('should handle object with only disable property', () => {+ const params: ToolRouterConfigTags = {+ disable: ['destructiveHint', 'openWorldHint'],+ };+ const result = transformToolRouterTagsParams(params);++ expect(result).toEqual({+ enable: undefined,+ disable: ['destructiveHint', 'openWorldHint'],+ });+ });++ it('should handle empty arrays in object', () => {+ const params: ToolRouterConfigTags = {+ enable: [],+ disable: [],+ };+ const result = transformToolRouterTagsParams(params);++ expect(result).toEqual({+ enable: [],+ disable: [],+ });+ });+ });+});diff --git a/ts/packages/core/test/models/toolRouter.test.ts b/ts/packages/core/test/models/toolRouter.test.tsindex 38c6ac923..0373d0cfe 100644--- a/ts/packages/core/test/models/toolRouter.test.ts+++ b/ts/packages/core/test/models/toolRouter.test.ts@@ -305,6 +305,181 @@ describe('ToolRouter', () => {});});+ describe('tags configuration', () => {+ it('should create a session with tags as array', async () => {+ mockClient.toolRouter.session.create.mockResolvedValueOnce(mockSessionCreateResponse);++ const config: ToolRouterCreateSessionConfig = {+ tags: ['readOnlyHint', 'idempotentHint'],+ };++ await toolRouter.create(userId, config);++ expect(mockClient.toolRouter.session.create).toHaveBeenCalledWith({+ user_id: userId,+ toolkits: undefined,+ auth_configs: undefined,+ connected_accounts: undefined,+ tools: undefined,+ tags: {+ enable: ['readOnlyHint', 'idempotentHint'],+ },+ manage_connections: createExpectedManageConnections(),+ workbench: undefined,+ });+ });++ it('should create a session with tags object with enable property', async () => {+ mockClient.toolRouter.session.create.mockResolvedValueOnce(mockSessionCreateResponse);++ const config: ToolRouterCreateSessionConfig = {+ tags: {+ enable: ['readOnlyHint', 'idempotentHint'],+ },+ };++ await toolRouter.create(userId, config);++ expect(mockClient.toolRouter.session.create).toHaveBeenCalledWith({+ user_id: userId,+ toolkits: undefined,+ auth_configs: undefined,+ connected_accounts: undefined,+ tools: undefined,+ tags: {+ enable: ['readOnlyHint', 'idempotentHint'],+ },+ manage_connections: createExpectedManageConnections(),+ workbench: undefined,+ });+ });++ it('should create a session with tags object with disable property', async () => {+ mockClient.toolRouter.session.create.mockResolvedValueOnce(mockSessionCreateResponse);++ const config: ToolRouterCreateSessionConfig = {+ tags: {+ disable: ['destructiveHint'],+ },+ };++ await toolRouter.create(userId, config);++ expect(mockClient.toolRouter.session.create).toHaveBeenCalledWith({+ user_id: userId,+ toolkits: undefined,+ auth_configs: undefined,+ connected_accounts: undefined,+ tools: undefined,+ tags: {+ enable: undefined,+ disable: ['destructiveHint'],+ },+ manage_connections: createExpectedManageConnections(),+ workbench: undefined,+ });+ });++ it('should create a session with tags object with both enable and disable properties', async () => {+ mockClient.toolRouter.session.create.mockResolvedValueOnce(mockSessionCreateResponse);++ const config: ToolRouterCreateSessionConfig = {+ tags: {+ enable: ['readOnlyHint', 'idempotentHint'],+ disable: ['destructiveHint'],+ },+ };++ await toolRouter.create(userId, config);++ expect(mockClient.toolRouter.session.create).toHaveBeenCalledWith({+ user_id: userId,+ toolkits: undefined,+ auth_configs: undefined,+ connected_accounts: undefined,+ tools: undefined,+ tags: {+ enable: ['readOnlyHint', 'idempotentHint'],+ disable: ['destructiveHint'],+ },+ manage_connections: createExpectedManageConnections(),+ workbench: undefined,+ });+ });++ it('should create a session with single tag in array', async () => {+ mockClient.toolRouter.session.create.mockResolvedValueOnce(mockSessionCreateResponse);++ const config: ToolRouterCreateSessionConfig = {+ tags: ['readOnlyHint'],+ };++ await toolRouter.create(userId, config);++ expect(mockClient.toolRouter.session.create).toHaveBeenCalledWith({+ user_id: userId,+ toolkits: undefined,+ auth_configs: undefined,+ connected_accounts: undefined,+ tools: undefined,+ tags: {+ enable: ['readOnlyHint'],+ },+ manage_connections: createExpectedManageConnections(),+ workbench: undefined,+ });+ });++ it('should create a session with all tag types', async () => {+ mockClient.toolRouter.session.create.mockResolvedValueOnce(mockSessionCreateResponse);++ const config: ToolRouterCreateSessionConfig = {+ tags: ['readOnlyHint', 'destructiveHint', 'idempotentHint', 'openWorldHint'],+ };++ await toolRouter.create(userId, config);++ expect(mockClient.toolRouter.session.create).toHaveBeenCalledWith({+ user_id: userId,+ toolkits: undefined,+ auth_configs: undefined,+ connected_accounts: undefined,+ tools: undefined,+ tags: {+ enable: ['readOnlyHint', 'destructiveHint', 'idempotentHint', 'openWorldHint'],+ },+ manage_connections: createExpectedManageConnections(),+ workbench: undefined,+ });+ });++ it('should create a session with tags combined with toolkits', async () => {+ mockClient.toolRouter.session.create.mockResolvedValueOnce(mockSessionCreateResponse);++ const config: ToolRouterCreateSessionConfig = {+ toolkits: ['gmail', 'slack'],+ tags: ['readOnlyHint'],+ };++ await toolRouter.create(userId, config);++ expect(mockClient.toolRouter.session.create).toHaveBeenCalledWith({+ user_id: userId,+ toolkits: {+ enable: ['gmail', 'slack'],+ },+ auth_configs: undefined,+ connected_accounts: undefined,+ tools: undefined,+ tags: {+ enable: ['readOnlyHint'],+ },+ manage_connections: createExpectedManageConnections(),+ workbench: undefined,+ });+ });+ });+// describe('tools configuration', () => {// it('should create a session with tools overrides as array', async () => {// mockClient.toolRouter.session.create.mockResolvedValueOnce(mockSessionCreateResponse);diff --git a/uv.lock b/uv.lockindex ac3f286fa..98b3dfe4b 100644--- a/uv.lock+++ b/uv.lock@@ -477,7 +477,7 @@ wheels = [[[package]]name = "composio"-version = "0.10.2"+version = "0.10.3"source = { virtual = "python" }dependencies = [{ name = "composio-client" },@@ -506,7 +506,7 @@ dev = [[package.metadata]requires-dist = [- { name = "composio-client", specifier = ">=1.21.0" },+ { name = "composio-client", specifier = ">=1.22.0" },{ name = "openai" },{ name = "pydantic", specifier = ">=2.6.4" },{ name = "pysher", specifier = ">=1.0.8" },@@ -532,7 +532,7 @@ dev = [[[package]]name = "composio-anthropic"-version = "0.10.2"+version = "0.10.3"source = { virtual = "python/providers/anthropic" }dependencies = [{ name = "anthropic" },@@ -547,7 +547,7 @@ requires-dist = [[[package]]name = "composio-client"-version = "1.21.0"+version = "1.22.0"source = { registry = "https://pypi.org/simple" }dependencies = [{ name = "anyio" },@@ -557,14 +557,14 @@ dependencies = [{ name = "sniffio" },{ name = "typing-extensions" },]-sdist = { url = "https://files.pythonhosted.org/packages/27/9a/1bd2d84b133442537b757d713666e8883738f47b19e6405c2ab631f35d4a/composio_client-1.21.0.tar.gz", hash = "sha256:d994615932275442202ff994325ab85e59604799fc8ad0369970d89942dd366d", size = 185285 }+sdist = { url = "https://files.pythonhosted.org/packages/44/a7/81fe217a855992ee3854acd07939c0eed893d9b8019ea544e28fd0aa1b86/composio_client-1.22.0.tar.gz", hash = "sha256:13dd4ecf3b1289cfd6acdb538f9144d123d0344c03b387aa411d6fb0f1dec6d0", size = 185804 }wheels = [- { url = "https://files.pythonhosted.org/packages/e1/db/066255019b8457e16a8418f821c2ccb89da37e0c8ce986b0c487231b0663/composio_client-1.21.0-py3-none-any.whl", hash = "sha256:a5f1f737c0c6f9a74dcc6cb5fb598a923f6a2e44364cd71fc14b0a1903ddf073", size = 200987 },+ { url = "https://files.pythonhosted.org/packages/8f/1f/2abe83f3363edc3d5be94002f97eafed9ea95d7129fe6ea1c33655751aeb/composio_client-1.22.0-py3-none-any.whl", hash = "sha256:3afe32fd3206c3bd2a7183d729817908fdc4bfac2b52da22144334fab2384932", size = 201474 },][[package]]name = "composio-crewai"-version = "0.10.2"+version = "0.10.3"source = { virtual = "python/providers/crewai" }dependencies = [{ name = "composio" },@@ -579,7 +579,7 @@ requires-dist = [[[package]]name = "composio-gemini"-version = "0.10.2"+version = "0.10.3"source = { virtual = "python/providers/gemini" }dependencies = [{ name = "composio" },@@ -594,7 +594,7 @@ requires-dist = [[[package]]name = "composio-google"-version = "0.10.2"+version = "0.10.3"source = { virtual = "python/providers/google" }dependencies = [{ name = "composio" },@@ -609,7 +609,7 @@ requires-dist = [[[package]]name = "composio-google-adk"-version = "0.10.2"+version = "0.10.3"source = { virtual = "python/providers/google_adk" }dependencies = [{ name = "composio" },@@ -624,7 +624,7 @@ requires-dist = [[[package]]name = "composio-langchain"-version = "0.10.2"+version = "0.10.3"source = { virtual = "python/providers/langchain" }dependencies = [{ name = "composio" },@@ -639,7 +639,7 @@ requires-dist = [[[package]]name = "composio-openai"-version = "0.10.2"+version = "0.10.3"source = { virtual = "python/providers/openai" }dependencies = [{ name = "composio" },@@ -654,7 +654,7 @@ requires-dist = [[[package]]name = "composio-openai-agents"-version = "0.10.2"+version = "0.10.3"source = { virtual = "python/providers/openai_agents" }dependencies = [{ name = "composio" },