From bdc453eaabbf327c44dc280a8ae7a5ba4538f54d Mon Sep 17 00:00:00 2001 From: arc53-machine <232052973+arc53-machine@users.noreply.github.com> Date: Tue, 29 Sep 2026 10:40:51 +0100 Subject: [PATCH] Show the model an account only where it tells tools apart Actions that different services share are described with the service alone; the account is named only when one service is connected twice. --- docsgpt/agents/tool_executor.py | 14 +++++++------- tests/connectors/test_runtime.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docsgpt/agents/tool_executor.py b/docsgpt/agents/tool_executor.py index 16ead218..4db23d1e 100644 --- a/docsgpt/agents/tool_executor.py +++ b/docsgpt/agents/tool_executor.py @@ -747,12 +747,10 @@ class ToolExecutor: result = [] for index, (tool_id, tool_name, action_name, action, is_client) in enumerate(entries): service, account = connected.get(index, (None, None)) - if service is None: - slug = "" - elif per_service[(action_name, service)] > 1: - slug = _account_slug(account) - else: - slug = _account_slug(service) + # The account is named only where it is what tells tools apart. + if service is not None and per_service[(action_name, service)] < 2: + account = None + slug = _account_slug(account or service) if name_counts[action_name] == 1 and len(action_name) <= _MAX_LLM_NAME_LEN: llm_name = action_name else: @@ -788,8 +786,10 @@ class ToolExecutor: ) description = action.get("description", "") - if service: + if account: description = f"{description} ({service} account: {account})".strip() + elif service: + description = f"{description} ({service})".strip() result.append( { "type": "function", diff --git a/tests/connectors/test_runtime.py b/tests/connectors/test_runtime.py index e13606c7..a39aaebf 100644 --- a/tests/connectors/test_runtime.py +++ b/tests/connectors/test_runtime.py @@ -315,7 +315,7 @@ class TestAccountsTellApartForTheModel: with _service_db(pg_conn): functions = {f["function"]["name"]: f["function"] for f in _executor().prepare_tools_for_llm(tools)} assert set(functions) == {"search_wiki", "search_tracker"} - assert functions["search_wiki"]["description"].startswith("Search (Wiki account:") + assert functions["search_wiki"]["description"] == "Search (Wiki)" def test_names_stay_within_provider_limits(self, pg_conn): tools = self._two_bots(pg_conn, ["x" * 80, "x" * 80])