add show_on to ToolParameter#323
Open
zyqzyq wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a show_on field to the tool parameter configuration, enabling conditional display logic for parameters. The reviewer suggested adding a description attribute to this new field to maintain consistency with existing fields and ensure proper documentation generation.
| options: list[ToolParameterOption] | None = None | ||
| # MCP object and array type parameters use this field to store the schema | ||
| input_schema: Mapping[str, Any] | None = None | ||
| show_on: list[FormShowOnObject] = Field(default_factory=list) |
Contributor
There was a problem hiding this comment.
To maintain consistency with other fields in the ToolParameter class and to ensure proper documentation generation via the @docs decorator, please add a description to the show_on field.
Suggested change
| show_on: list[FormShowOnObject] = Field(default_factory=list) | |
| show_on: list[FormShowOnObject] = Field(default_factory=list, description="The conditions to show the parameter") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds optional conditional form visibility for tool parameters by extending
ToolParameterwithshow_on: list[FormShowOnObject](default empty), reusing the existingFormShowOnObjectmodel fromdify_plugin.entities.model.provider. Tool YAML that omitsshow_oncontinues to deserialize as an empty list.Pull Request Checklist
Thank you for your contribution! Before submitting your PR, please make sure you have completed the following checks:
Compatibility Check
Fixes langgenius/dify#36141
I have checked whether this change affects the backward compatibility of the plugin declared in
README.mdNote: This is an additive, optional field with
default_factory=list. Existing tool manifests withoutshow_onremain valid. No removal or semantic change of existing fields.I have checked whether this change affects the forward compatibility of the plugin declared in
README.mdNote: Older Dify runtimes that do not understand
show_onin tool YAML may ignore unknown keys depending on their parser; the SDK simply models the field when present. If a specific minimum Dify version is required for UI behavior, that should be confirmed with maintainers and documented separately.If this change introduces a breaking change, I have discussed it with the project maintainer and specified the release version in the
README.mdN/A: No breaking change.
I have described the compatibility impact and the corresponding version number in the PR description
Impact: Backward-compatible schema extension; no SDK major bump implied by this change alone. Release version follows normal semver when the maintainers cut a release (current package version in tree: 0.8.0).
I have checked whether the plugin version is updated in the
README.mdNote: No update to
README.mdversion or manifest tables is included in this PR, because the change does not altermeta.version/meta.minimum_dify_versionsemantics by itself. Bump those only if product policy tiesshow_onto a new manifest or minimum Dify row.Available Checks
just buildhas passedRelevant documentation has been updated (if necessary)
Note: Not updated; field name and type align with existing provider credential
show_onpatterns. Add docs if the project requires an explicit tool-parameter YAML example.