Skip to content

fix(ui): handle object types in anyOf/oneOf schemas - #6421

Open
bogdanmariusc10 wants to merge 1 commit into
mainfrom
6420-bug-admin-ui-fails-to-recognize-object-types-in-anyofoneof-schemas
Open

fix(ui): handle object types in anyOf/oneOf schemas#6421
bogdanmariusc10 wants to merge 1 commit into
mainfrom
6420-bug-admin-ui-fails-to-recognize-object-types-in-anyofoneof-schemas

Conversation

@bogdanmariusc10

Copy link
Copy Markdown
Collaborator

Pull Request

🔗 Related Issue

Closes #6420


📝 Summary

Fixes Admin UI bug where object-type parameters wrapped in anyOf/oneOf JSON Schema constructs were treated as plain text, causing dict parameters to be sent as strings and triggering validation errors.

Updated mcpgateway/admin_ui/tools.js to detect object types inside anyOf/oneOf arrays in both form generation and submission logic.


📏 Reviewability

  • This PR has one clear purpose
  • The linked issue is not labeled triage
  • Unrelated bugs or improvements are tracked in separate issues/PRs
  • Tests are included with the code they validate
  • If AI-assisted, I understand and can explain the generated changes

🏷️ Type of Change

  • Bug fix
  • Feature / Enhancement
  • Documentation
  • Refactor
  • Chore (deps, CI, tooling)
  • Other (describe below)

🧪 Verification

Reproduction: MCP tools with schemas like {"anyOf": [{"type": "object"}, {"type": "null"}]} failed from Admin UI with "Input should be a valid dictionary" error.

Fix verification: Test scripts demonstrate before/after behavior:

  • test_ui_bug_reproduction.sh - reproduces bug (params sent as string)
  • test_ui_fix_verification.sh - verifies fix (params sent as dict)
Check Command Status
Lint suite make lint
Unit tests make test
Coverage ≥ 80% make coverage

✅ Checklist

  • Code formatted (make black isort pre-commit)
  • [] Tests added/updated for changes
  • Documentation updated (if applicable)
  • No secrets or credentials committed

📓 Notes (optional)

Changed lines: 2 locations in tools.js

  • Line 1649: Form generation detects object types in anyOf/oneOf
  • Line 3324: Form submission parses JSON for object types in anyOf/oneOf

Impact: Affects any MCP tool using nullable object parameters with proper JSON Schema validation.

Admin UI form generator now correctly detects object types wrapped in
anyOf/oneOf JSON Schema constructs. Previously, these were treated as
plain text fields, causing dict parameters to be sent as strings and
triggering validation errors.

Updated both form generation and submission logic in tools.js to check
for object types nested within anyOf/oneOf arrays.

Fixes issue where MCP tools with nullable object parameters (using
anyOf with object and null types) failed when invoked from Admin UI.

Signed-off-by: Bogdan-Marius-Catanus <bogdan-marius.catanus@ibm.com>
@bogdanmariusc10 bogdanmariusc10 added bug Something isn't working ui User Interface labels Aug 26, 2026
@bogdanmariusc10 bogdanmariusc10 linked an issue Aug 26, 2026 that may be closed by this pull request
7 tasks
@bogdanmariusc10 bogdanmariusc10 added the ica ICA related issues label Aug 26, 2026
@bogdanmariusc10

Copy link
Copy Markdown
Collaborator Author

@ja8zyjits @msureshkumar88 Could you please help me review this?

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

Labels

bug Something isn't working ica ICA related issues ui User Interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Admin UI fails to recognize object types in anyOf/oneOf schemas

1 participant