Skip to content

add show_on to ToolParameter#323

Open
zyqzyq wants to merge 1 commit into
langgenius:mainfrom
zyqzyq:feat/add_show_on
Open

add show_on to ToolParameter#323
zyqzyq wants to merge 1 commit into
langgenius:mainfrom
zyqzyq:feat/add_show_on

Conversation

@zyqzyq
Copy link
Copy Markdown

@zyqzyq zyqzyq commented May 14, 2026

Summary

Adds optional conditional form visibility for tool parameters by extending ToolParameter with show_on: list[FormShowOnObject] (default empty), reusing the existing FormShowOnObject model from dify_plugin.entities.model.provider. Tool YAML that omits show_on continues 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.md
    Note: This is an additive, optional field with default_factory=list. Existing tool manifests without show_on remain 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.md
    Note: Older Dify runtimes that do not understand show_on in 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.md
    N/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.md
    Note: No update to README.md version or manifest tables is included in this PR, because the change does not alter meta.version / meta.minimum_dify_version semantics by itself. Bump those only if product policy ties show_on to a new manifest or minimum Dify row.

Available Checks

  • just build has passed

  • Relevant documentation has been updated (if necessary)
    Note: Not updated; field name and type align with existing provider credential show_on patterns. Add docs if the project requires an explicit tool-parameter YAML example.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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")

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: tool plugin support show_on param

1 participant