feat: fall back to model.parameters.tools when root tools absent#1330
feat: fall back to model.parameters.tools when root tools absent#1330jsonbailey merged 8 commits intomainfrom
Conversation
When root-level tools is absent, fall back to model.parameters.tools and parse it as our LDTool map format. Arrays or entries missing a name field are silently ignored. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@launchdarkly/js-sdk-common size report |
|
@launchdarkly/js-client-sdk-common size report |
|
@launchdarkly/js-client-sdk size report |
|
@launchdarkly/browser size report |
…s bad entries Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…root tools path, fall back to key name when name field absent Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 76068a6. Configure here.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add type guards for the parameters and customParameters fields in _parseToolsMap, consistent with existing guards on name, description, and type. Blind casts are replaced with null/object/array checks. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
🤖 I have created a release *beep* *boop* --- <details><summary>server-sdk-ai: 0.19.0</summary> ## [0.19.0](server-sdk-ai-v0.18.1...server-sdk-ai-v0.19.0) (2026-05-01) ### Features * Support fall back to model.parameters.tools when root tools absent ([#1330](#1330)) ([2c65c61](2c65c61)) </details> <details><summary>server-sdk-ai-langchain: 0.6.2</summary> ## [0.6.2](server-sdk-ai-langchain-v0.6.1...server-sdk-ai-langchain-v0.6.2) (2026-05-01) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/server-sdk-ai bumped from ^0.18.1 to ^0.19.0 * peerDependencies * @launchdarkly/server-sdk-ai bumped from ^0.18.1 to ^0.19.0 </details> <details><summary>server-sdk-ai-openai: 0.5.9</summary> ## [0.5.9](server-sdk-ai-openai-v0.5.8...server-sdk-ai-openai-v0.5.9) (2026-05-01) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/server-sdk-ai bumped from ^0.18.1 to ^0.19.0 * peerDependencies * @launchdarkly/server-sdk-ai bumped from ^0.18.1 to ^0.19.0 </details> <details><summary>server-sdk-ai-vercel: 0.5.9</summary> ## [0.5.9](server-sdk-ai-vercel-v0.5.8...server-sdk-ai-vercel-v0.5.9) (2026-05-01) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/server-sdk-ai bumped from ^0.18.1 to ^0.19.0 * peerDependencies * @launchdarkly/server-sdk-ai bumped from ^0.18.1 to ^0.19.0 </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Primarily a release/version-bump PR, but it publishes `@launchdarkly/server-sdk-ai@0.19.0` which changes runtime behavior around tool configuration fallback and could affect downstream integrations. > > **Overview** > Updates the release manifest and bumps versions for `@launchdarkly/server-sdk-ai` to `0.19.0` and its provider packages (`server-sdk-ai-langchain` `0.6.2`, `server-sdk-ai-openai` `0.5.9`, `server-sdk-ai-vercel` `0.5.9`). > > Propagates the new `@launchdarkly/server-sdk-ai@0.19.0` dependency range into provider `package.json` files and refreshes example app dependencies to the new package versions, along with changelog entries and the SDK version constant in `sdkInfo.ts`. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit ffc35f6. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

Summary
_resolveTools()toLDAIConfigUtils— checks root-leveltoolsfirst, falls back tomodel.parameters.toolsfor older AI configstoolsalways takes priority when presentmodel.parameters.toolsas an array or non-object is silently ignored (may be user-defined custom param)namestring are silently skipped; valid entries in the same map are still returnedBackground
The LaunchDarkly AI Config API now sends tools in two places: updated configs send them at both root and
model.parameters.tools; older configs only send them inmodel.parameters.tools. Previously the SDK only read root-level, leaving older configs with no tools.Test plan
model.parameters.toolswhen root key is absenttoolswins when both locations are presentmodel.parameters.toolsas array →undefinednameskipped; valid entries in same map returnedJira: AIC-1935
🤖 Generated with Claude Code
Note
Medium Risk
Changes how
toolsare derived for agent/completion configs by adding a fallback tomodel.parameters.toolsand new validation/logging, which could alter runtime tool availability for existing flags.Overview
Adds a new tool-resolution path for AI configs:
toolsare now taken from the root-leveltoolsmap when present, otherwise parsed frommodel.parameters.toolsto support older flag shapes.Tool parsing now validates that tools are object maps (not arrays/invalid types), normalizes entries (including defaulting missing
nameto the map key), and emits warnings via an optionally passed logger. Tests were expanded to cover the fallback, precedence rules, and invalid-shape handling.Reviewed by Cursor Bugbot for commit edcee1d. Bugbot is set up for automated code reviews on this repo. Configure here.