refactor!: MCP-only toolset — every tool over tools/call, with search/execute sessions and submitFeedback()
Rewrites the Node SDK as the 3.0 MCP-only client, matching python#210. Graded by StackOneHQ/sdk-conformance#5. Upgrading from 2.x is covered in MIGRATION.md.
What changes
MCP-only
- Tools are listed from
/mcpfor each account and executed overtools/callon the endpoint and account that listed them. - Non-header arguments are sent unchanged; the server maps them.
GET /accountsis the only request outside MCP. When no account is configured, the SDK discovers the active accounts linked to the API key, with one request shared by concurrent callers. - A tool returns the server's result exactly as the server wrote it:
{isError: false, result, defenderMetadata?, policyMetadata?}for action tools, bare JSON for search.isErrorraisesStackOneAPIErrorwith the status from its payload. - A file action returns UCA's single-use download link as
result, or raises with status 501 when no link can be issued. - Removed:
- the RPC client and envelope splitting;
- binary downloads;
- the
param-stylepin; - direct HTTP execution;
- client-side search;
- SDK-side Defender config, which is now managed in the dashboard;
- the client-side feedback tool.
Search, execute and feedback
search()ranks across every connector, appliestopKto the merged list, and puts the searchsession_idand the findingaccount_idon every hit.SearchResulttypesdescription,similarity_score,input_schemaandexample_request.execute(actionId, args, { sessionId })pins the caller'saction_id, so a model-supplied one can't replace it. When the action's connector is linked on more than one account in scope it throws rather than pick one; a hit'saccount_idinaccountIdschooses.submitFeedback()liststool-mode=search_executeon the lowest account id in scope and makes exactly onetools/callto the server'sstackone_submit_feedback.fetchTools()lists that tool once however many accounts serve it.
Schemas and security
toJsonSchema()passes the served schema through: root keywords,$defs, andrequiredin the served order.- Header arguments (entries of a nested
headersobject, or top-levelheaders_<name>) are forwarded only if the served schema declares them in the same form; an openheadersobject (as on*_execute_action) declares every name.Authorization,x-account-idandUser-Agentare never forwarded, and the SDK always sets them itself, so a model can't switch tenant. Dropped headers warn with the reason. - Every SDK error extends
StackOneError.
Also: executeOpenAIToolCalls(), a 2.x → 3.0 migration guide, and CI that runs the full conformance suite against the built package and the Python SDK.
Verification
pnpm test: 1206 passed, 4 skipped.tsc --noEmiton the root project and onexamplespasses.- oxlint with type-check, oxfmt 0.23.0, knip and the build are clean.
tests/vectors/is byte-identical to sdk-conformance7347926, the pinned commit, and every shared vector case passes.- The full conformance suite at
7347926(pnpm test -- --strict-schema, both SDKs, with Python atd307ed8) passes: 139 checks, and all 68 scenarios give identical results in Node and Python, warnings included. CI runs the same full suite against a pinned Python commit. - The override block below parses with release-please 17.11.2 into 33 entries, 17 breaking, one note per breaking entry, and next version 3.0.0 from 2.10.0.
BEGIN_COMMIT_OVERRIDE
refactor: execute every tool over MCP tools/call
BREAKING CHANGE: StackOneRpcTool, RpcExecuteConfig, BinaryDownloadResult and isBinaryDownloadResult are removed. Action results are the server's { isError, result, ... } object rather than the /actions/rpc body. A file action's result is the server's single-use { download_url, expires_at, file } instead of bytes, and the call raises StackOneAPIError with status 501 when no link can be issued. The /mcp URL no longer pins param-style=flat_prefixed, so tool argument names follow the server's own param style. dryRun returns { url, method: 'tools/call', name, arguments }.
refactor: rebuild the toolset on the served MCP catalog
BREAKING CHANGE: RequestBuilder and direct-HTTP execution are removed: ExecuteConfig has no http kind, ParameterLocation is no longer exported, and BaseTool#execute throws unless overridden. BaseTool no longer takes headers and loses getHeaders()/setHeaders() and connector; Tools#getConnectors() is removed. StackOneTool's fifth constructor argument is the account id. StackOneToolSetConfig loses authentication, strict and rpcClient. The constructor throws ToolSetConfigError without an API key. fetchTools() returns fresh tool instances on every call, ordered by account id, and discovers accounts when none is configured.
refactor: remove AuthenticationConfig and BaseToolSetConfig
BREAKING CHANGE: AuthenticationConfig and BaseToolSetConfig are no longer exported. Pass apiKey in StackOneToolSetConfig.
refactor: remove ToolExecution#headers
BREAKING CHANGE: ToolExecution, the execution metadata toAISDK() can attach, no longer carries headers, so it can no longer expose the request credential.
refactor: remove client-side search from the Node SDK
BREAKING CHANGE: searchTools(), searchActionNames(), getSearchTool(), SearchTool, the tool_search/tool_execute meta tools, openai({ mode: 'search_and_execute' }) and the search constructor option are removed. Use the server-side search() instead.
refactor: remove SemanticSearchClient and its types
BREAKING CHANGE: SemanticSearchClient, SemanticSearchError and the SemanticSearchOptions, SemanticSearchResponse and SemanticSearchResult types are no longer exported. search() runs on the server and returns SearchResult objects.
refactor: remove the client-side search option types
BREAKING CHANGE: the SearchMode, SearchToolsOptions, SearchActionNamesOptions and SearchConfig types are no longer exported. Use SearchOptions with search().
refactor: remove getSearchConfig() and getTools()
BREAKING CHANGE: StackOneToolSet#getSearchConfig() and StackOneToolSet#getTools() are removed. For search and execute meta tools, construct the toolset with toolMode: 'search_execute' and call fetchTools().
refactor: remove SDK-side defender configuration
BREAKING CHANGE: DefenderConfig, DefenderMode and DEFAULT_DEFENDER_CONFIG are no longer exported, and the defender option and StackOneToolSet#defenderMode are removed. Configure Defender in the StackOne dashboard.
refactor: remove the client-side feedback tool
BREAKING CHANGE: createFeedbackTool is no longer exported and fetchTools() no longer appends a tool_feedback tool. Use submitFeedback() or the served stackone_submit_feedback tool.
fix(toolsets): stop model-supplied headers from switching tenant
BREAKING CHANGE: headers a tool call supplies are dropped unless the tool's served schema declares them.
fix(tools): forward only the header arguments a served schema declares
BREAKING CHANGE: a header argument (an entry of a nested headers object, or a top-level headers_ argument) is forwarded only if the served schema declares it in the same form: headers.properties., any name when headers is an open map (type "object", no properties, and additionalProperties not false), or the headers_ property. Authorization, x-account-id and User-Agent are never forwarded as header arguments, even when declared. A top-level headers argument that is not a plain object is dropped unless the served schema declares headers as a non-object field, in which case it is an ordinary argument sent as given. A headers_ argument whose value is an array or object is dropped. Every other argument is sent unchanged.
fix(toolsets): ignore SDK-owned names in the headers option
BREAKING CHANGE: Authorization, x-account-id and User-Agent in the headers constructor option are ignored with a warning; the SDK always sets them itself. Use apiKey and accountId/accountIds instead.
refactor: root every SDK error at StackOneError
BREAKING CHANGE: ToolSetError (and so ToolSetConfigError and ToolSetLoadError) now extends StackOneError.
fix(errors): keep the message StackOneAPIError is given
BREAKING CHANGE: StackOneAPIError no longer appends responseBody.message to its message. Read the server's explanation from error.responseBody.
refactor(toolsets): stop reading STACKONE_ACCOUNT_ID
BREAKING CHANGE: the STACKONE_ACCOUNT_ID environment variable is no longer read. Pass the account id as accountId or accountIds; without one, the toolset discovers every active account linked to the API key.
fix(toolsets): reject an empty account id instead of widening to every account
BREAKING CHANGE: accountId: '' and an empty id in accountIds, execute.accountIds, setAccounts() or a call's accountIds now throw ToolSetConfigError. Before, an empty accountId fell back to STACKONE_ACCOUNT_ID or to account discovery. accountId: process.env.STACKONE_ACCOUNT_ID now throws when the variable is set but empty; pass process.env.STACKONE_ACCOUNT_ID || undefined to discover accounts instead.
fix: align error and warning messages with the Python SDK
feat: add search(), execute() and submitFeedback() with session ids
feat(tools): add executeOpenAIToolCalls()
feat(tool): preserve root schema keywords in toJsonSchema pass-through
feat: retry HTTP 429 with Retry-After or backoff, and fail the whole call when a 429 persists
feat(types): type execute() and submitFeedback() results as ActionResult
feat(errors): add ToolArgumentsError
A StackOneError subclass thrown when a tool's arguments are not a JSON object, or cannot be encoded as JSON, matching Python. tool.execute() and toolset.execute()/submitFeedback() throw it instead of a plain StackOneError in those cases, and arguments are now checked for JSON-encodability (Date, Map, Set, RegExp, functions, symbols, bigint, typed arrays/buffers and circular references all throw, naming the bad value's path). toolset.execute()/submitFeedback() also now treat sessionId: null the same as sessionId being unset, matching Python's None.
feat(retry): warn when a 429's wait would pass the deadline
feat(toolsets): warn when STACKONE_ACCOUNT_ID is set but ignored
A toolset constructed with no accountId, accountIds or execute.accountIds while STACKONE_ACCOUNT_ID is set warns once that the variable is ignored and every active shared account is used.
feat(search): tag each search hit with its account_id, and apply topK to the merged ranking
topK caps the whole result after ranking across every connector, as in 2.x. The same action linked on two accounts is two hits, each naming its account.
fix(execute): refuse an action whose connector is linked on more than one account
execute() throws ToolSetConfigError rather than pick an account. Pass a search hit's account_id in accountIds to route to it.
fix(tools): build every adapter from the first tool of each name
toOpenAI(), toAnthropic(), toOpenAIResponses(), toJsonSchema(), toAISDK() and toClaudeAgentSdk() keep the tool getTool() and executeOpenAIToolCalls() use when two accounts serve one name: the first listed, on the lowest account id. Each adapter that drops a duplicate warns.
fix(toolsets): cache healthy accounts and keep each failure when every account fails
An account that fails to list tools is left out of the cached catalog for 30 seconds, then retried. When every account fails with one HTTP status that StackOneAPIError is thrown; otherwise ToolSetLoadError carries each account's error as an AggregateError cause.
feat(feedback): add actionRunId, and send feedback on the lowest account id
fix(retry): report a timeout while retrying a 429 as the 429
feat(toolsets): send x-end-user-id for non-shared accounts
Whenever the toolset calls GET /accounts (discovery or fetchAccounts()), it records the origin_username of every account with shared: false and sends it as x-end-user-id on every MCP request for that account, overriding a value from the headers option. With explicit account ids and no GET /accounts it sends none of its own; an x-end-user-id in the headers option is passed through. A model-supplied x-end-user-id header argument is never forwarded, even when declared.
feat(toolsets): skip non-shared accounts during discovery unless includeNonShared
fix(toolsets): refuse to execute while a matching account failed to list
fix(toolsets): look up a non-shared account's end user when the API asks for it
fix(retry): clear the rate-limit flag once a retry succeeds
fix(toolsets): re-list only the failed accounts that could serve the action
execute() works out the action's connector from the accounts that listed and the known providers, and lists again at once only the failed accounts whose provider is that connector or unknown. A failed account on another provider no longer makes every execute() wait out its timeout.
fix(toolsets): look up the providers of failed accounts named explicitly before refusing an action
With explicit account ids, a failed account's provider is unknown until GET /accounts names it. execute() now makes one GET /accounts (joining one in flight) before deciding, so a dead account on another provider no longer refuses every action. If that GET /accounts fails, it still refuses.
fix(mcp-client): give the end-user refusal the failed lookup as its cause
fix(toolsets): fail discovery when every active account is non-shared
Discovery throws ToolSetConfigError naming how many active accounts there are, rather than leaving an empty catalog.
fix(toolsets): say shared accounts are used in the STACKONE_ACCOUNT_ID warning
fix(mcp-client): keep a retried 429 on record while another request in the session is answered
A timeout on a tools/list retried after a 429 is reported as that 429, even when the client's event-stream request is answered meanwhile, rather than as a plain timeout that skips the account.
fix(toolsets): rethrow a rate-limited provider lookup from execute()
A 429 from the GET /accounts execute() makes to learn a failed account's provider is now thrown as a StackOneAPIError, as the end-user lookup's is, rather than swallowed into a refusal.
fix(toolsets): remember when execute()'s provider lookup cannot name a failed account
When GET /accounts fails or does not list a failed account, execute() still refuses but neither looks it up nor lists it again early for 30 seconds, so each call no longer pays a GET /accounts and a listing.
END_COMMIT_OVERRIDE