Bug
ExecuteToolsConfig.account_ids passed to the StackOneToolSet constructor does not populate self._account_ids. When tool_search is called, it invokes search_tools() which calls fetch_tools(account_ids=self._account_ids) — but _account_ids is empty, so the MCP request to https://api.stackone.com/mcp has no x-account-id header, resulting in a 400 Bad Request.
Reproduction
from stackone_ai import StackOneToolSet
toolset = StackOneToolSet(
search={"method": "auto", "top_k": 5},
execute={"account_ids": ["my-account-id"], "timeout": 60},
)
# This fails with: ToolsetLoadError: Error fetching tools: unhandled errors in a TaskGroup (1 sub-exception)
# Root cause: httpx.HTTPStatusError: Client error '400 Bad Request' for url 'https://api.stackone.com/mcp'
toolset.execute("tool_search", {"query": "list orders"})
Workaround
Calling set_accounts() explicitly after construction fixes it:
toolset = StackOneToolSet(
search={"method": "auto", "top_k": 5},
execute={"account_ids": account_ids, "timeout": 60},
)
toolset.set_accounts(account_ids) # <-- this is needed
# Now works
toolset.execute("tool_search", {"query": "list orders"})
Root cause
In StackOneToolSet.__init__(), the execute config is stored as self._execute_config but its account_ids are never copied to self._account_ids. The search_tools() method reads from self._account_ids (line 871), which is always [] unless set_accounts() is called explicitly.
Expected behavior
ExecuteToolsConfig.account_ids should populate self._account_ids during __init__(), so that tool_search works without requiring a separate set_accounts() call.
Bug
ExecuteToolsConfig.account_idspassed to theStackOneToolSetconstructor does not populateself._account_ids. Whentool_searchis called, it invokessearch_tools()which callsfetch_tools(account_ids=self._account_ids)— but_account_idsis empty, so the MCP request tohttps://api.stackone.com/mcphas nox-account-idheader, resulting in a400 Bad Request.Reproduction
Workaround
Calling
set_accounts()explicitly after construction fixes it:Root cause
In
StackOneToolSet.__init__(), theexecuteconfig is stored asself._execute_configbut itsaccount_idsare never copied toself._account_ids. Thesearch_tools()method reads fromself._account_ids(line 871), which is always[]unlessset_accounts()is called explicitly.Expected behavior
ExecuteToolsConfig.account_idsshould populateself._account_idsduring__init__(), so thattool_searchworks without requiring a separateset_accounts()call.