dify - ✅(Solved) Fix feat: tool plugin support show_on param [2 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
langgenius/dify#36141Fetched 2026-05-14 03:46:26
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
1
Author
Participants
Timeline (top)
cross-referenced ×3labeled ×1renamed ×1

PR fix notes

PR #36148: Feat: add tool show on param

Description (problem / solution / changelog)

[!IMPORTANT]

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Fixes #36141

Summary

This PR adds end-to-end show_on support so tool parameters (and select options) can be shown only when sibling fields satisfy AND‑joined { variable, value } rules, matching plugin / builtin YAML manifests.

Motivation: The workflow and plugin tool UIs need the same visibility semantics as the tool declaration. Without show_on in API responses and typed models, the frontend cannot hide dependent fields or filter select options.

Backend

  • Model show_on on PluginParameter and PluginParameterOption (plus a small PluginParameterShowOnCondition type) so ToolEntity.model_validate(...) keeps YAML / daemon fields and they flow through ToolApiEntity / jsonable_encoder to clients (e.g. GET /console/api/workspaces/current/tools/builtin).
  • Preserve show_on when merging runtime parameters in get_merged_runtime_parameters.
  • Unit test: ToolEntity round-trip from a dict containing parameter- and option-level show_on.

Frontend

  • Shared helpers for reasoning vs tool-setting value shapes, sibling comparisons, and option / tree filtering.
  • Wire show_on into tool form schemas, plain-value flattening for comparisons, reasoning config panels (visible schema list, reset when hidden), and related specs.

Dependencies: None beyond the existing API + web stack.

Screenshots

BeforeAfter
All tool fields visible regardless of sibling valuesFields and select options follow show_on; dependent inputs hide until conditions match

(Replace table cells with real UI screenshots if available.)

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran make lint && make type-check (backend) and cd web && pnpm exec vp staged (frontend) to appease the lint gods (checkout main branch commit id 91251ad5a57804474d68a3becfe6f1b44ab55d7f also cannot pass)

Changed files

  • api/core/plugin/entities/parameters.py (modified, +20/-0)
  • api/core/tools/__base/tool.py (modified, +1/-0)
  • api/tests/unit_tests/core/tools/test_tool_entities.py (modified, +45/-1)
  • web/app/components/plugins/plugin-detail-panel/tool-selector/components/reasoning-config-form.helpers.ts (modified, +23/-2)
  • web/app/components/plugins/plugin-detail-panel/tool-selector/components/reasoning-config-form.spec.tsx (added, +77/-0)
  • web/app/components/plugins/plugin-detail-panel/tool-selector/components/reasoning-config-form.tsx (modified, +54/-4)
  • web/app/components/plugins/plugin-detail-panel/tool-selector/utils/show-on.spec.ts (added, +113/-0)
  • web/app/components/plugins/plugin-detail-panel/tool-selector/utils/show-on.ts (added, +108/-0)
  • web/app/components/tools/types.ts (modified, +10/-0)
  • web/app/components/tools/utils/to-form-schema.spec.ts (added, +108/-0)
  • web/app/components/tools/utils/to-form-schema.ts (modified, +97/-23)
  • web/app/components/workflow/nodes/_base/components/__tests__/form-input-item.helpers.spec.ts (modified, +26/-0)
  • web/app/components/workflow/nodes/_base/components/form-input-item.helpers.ts (modified, +22/-2)
  • web/app/components/workflow/nodes/tool/components/tool-form/index.spec.tsx (added, +128/-0)
  • web/app/components/workflow/nodes/tool/components/tool-form/index.tsx (modified, +38/-3)

PR #732: tool add show_on

Description (problem / solution / changelog)

Description

Fixes langgenius/dify#36141

This pull request adds conditional visibility metadata for tool parameters and select options via show_on, aligned with the intent of the upstream change set

  • Introduces ToolParameterShowOnObject (variable + value) and attaches show_on to ToolParameter and ParameterOption.
  • Ensures JSON/YAML unmarshaling normalizes absent show_on to an empty slice (non-nil) for stable consumers and validation.
  • Adds unit tests covering tool-parameter and option-level show_on for both JSON and YAML (where applicable).

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Performance improvement
  • Other

Essential Checklist

Testing

  • I have tested the changes locally and confirmed they work as expected
  • I have added unit tests where necessary and they pass successfully

Bug Fix (if applicable)

  • I have used GitHub syntax to close the related issue (e.g., Fixes #123 or Closes #123)

Additional Information

  • Files touched: pkg/entities/plugin_entities/constant.go, pkg/entities/plugin_entities/tool_declaration.go, pkg/entities/plugin_entities/tool_declaration_test.go
  • Reviewers may want to run: go test ./pkg/entities/plugin_entities/... on a toolchain satisfying go.mod.

Changed files

  • pkg/entities/plugin_entities/constant.go (modified, +48/-3)
  • pkg/entities/plugin_entities/tool_declaration.go (modified, +68/-16)
  • pkg/entities/plugin_entities/tool_declaration_test.go (modified, +282/-0)
RAW_BUFFERClick to expand / collapse

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • Please do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing? Tell me about your story.

I hope the tool plugin can also support dynamic linkage display via show_on. However, I’ve only found that the model currently supports this feature.

2. Additional context or comments

No response

3. Can you help us with this feature?

  • I am interested in contributing to this feature.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

dify - ✅(Solved) Fix feat: tool plugin support show_on param [2 pull requests, 1 participants]