Skip to content

Commit

Permalink
fix: check for entity id
Browse files Browse the repository at this point in the history
  • Loading branch information
Devanshusisodiya committed Feb 11, 2025
1 parent 590f9e8 commit fefebc2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions python/composio/tools/toolset.py
Original file line number Diff line number Diff line change
Expand Up @@ -1659,7 +1659,9 @@ def _validate_connection_ids(
return valid
raise InvalidConnectedAccount(f"Invalid connected accounts found: {invalid}")

def check_connected_account(self, action: ActionType) -> None:
def check_connected_account(
self, action: ActionType, entity_id: t.Optional[str] = None
) -> None:
"""Check if connected account is required and if required it exists or not."""
action = Action(action)
if action.no_auth or action.is_runtime:
Expand All @@ -1677,6 +1679,7 @@ def check_connected_account(self, action: ActionType) -> None:
if action.app not in [
connection.appUniqueId.upper() # Normalize app names/ids coming from API
for connection in self._connected_accounts
if connection.clientUniqueUserId == entity_id
]:
raise ConnectedAccountNotFoundError(
f"No connected account found for app `{action.app}`; "
Expand Down Expand Up @@ -1790,7 +1793,7 @@ def _execute_remote(
action=action
)
if auth is None:
self.check_connected_account(action=action)
self.check_connected_account(action=action, entity_id=entity_id)

output = self.client.get_entity( # pylint: disable=protected-access
id=entity_id
Expand Down

0 comments on commit fefebc2

Please sign in to comment.