Skip to content

feat: support reset_on_change for tool parameters - #378

Open
zyqzyq wants to merge 1 commit into
langgenius:mainfrom
zyqzyq:feat/reset-on-change
Open

feat: support reset_on_change for tool parameters#378
zyqzyq wants to merge 1 commit into
langgenius:mainfrom
zyqzyq:feat/reset-on-change

Conversation

@zyqzyq

@zyqzyq zyqzyq commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Fixes langgenius/dify#40180

Summary

This PR adds reset_on_change support to the Python SDK's ToolParameter model.

Plugin developers can declare sibling parameters that should reset the current parameter to its default or empty value when changed:

reset_on_change:
  - country
  - region

The field defaults to an empty list, preserving the behavior of existing plugin declarations.

Unit tests have been added to verify:

  • Parsing reset_on_change from a tool parameter declaration
  • JSON serialization
  • Model dump and validation round trips
  • Default empty-list behavior when the field is omitted

Compatibility Impact

This is an additive and backward-compatible change. Existing plugin declarations do not need to define reset_on_change and will continue to work as before.

Plugins using reset_on_change require compatible Dify platform and plugin daemon versions. This change does not introduce a breaking schema change, so no plugin declaration version or README version update is required.

Pull Request Checklist

Thank you for your contribution! Before submitting your PR, please make sure you have completed the following checks:

Compatibility Check

  • I have checked whether this change affects the backward compatibility of the plugin declared in README.md
  • I have checked whether this change affects the forward compatibility of the plugin declared in README.md
  • If this change introduces a breaking change, I have discussed it with the project maintainer and specified the release version in the README.md (Not applicable: this is not a breaking change)
  • I have described the compatibility impact and the corresponding version number in the PR description
  • I have checked whether the plugin version is updated in the README.md (No version update is required)

Available Checks

  • just build has passed
  • Relevant documentation has been updated (Not applicable: no documentation update is required)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: support reset_on_change for tool parameters

1 participant