-
Notifications
You must be signed in to change notification settings - Fork 965
Open
Description
Inspector Version
- 0.17.2
Describe the bug
ToolsTab does not correctly handle input schema with anyOf/$ref/enum:
- anyOf=[$ref, null] (e.g., role) is not resolved, so enum is lost and UI cannot render a dropdown.
- When falling back to nested/complex rendering, ToolsTab passes a trimmed schema (type/properties/description/items only) to DynamicJsonForm, dropping anyOf/$ref/enum.
- String enum select in ToolsTab has no clear/empty option; optional fields become effectively required after selection.
To Reproduce
- Open Inspector, Tools tab.
- Select a tool whose input schema matches the minimal schema below (role anyOf $ref|null, is_active boolean|null).
- Observe: role is not rendered as an enum dropdown; selecting a string enum (where present) cannot be cleared back to undefined/null.
Expected behavior
- anyOf=[$ref, null] renders as a dropdown with enum values and supports null/clearing.
- Optional enum fields can be cleared (undefined or null per schema).
- Downstream forms receive full schema (including anyOf/$ref/enum) for accurate rendering.
Screenshots
- N/A (UI shows non-dropdown for role; optional enum cannot be cleared).
Environment (please complete the following information):
- OS: e.g. macOS (darwin 24.5.0)
- Browser: e.g. Chrome xx
Additional context
- Minimal inputSchema to reproduce:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"role": {
"title": "Role",
"description": "Filter by role",
"anyOf": [
{ "$ref": "#/$defs/UserRole" },
{ "type": "null" }
]
},
"is_active": {
"title": "Is Active",
"description": "Filter by active status",
"anyOf": [
{ "type": "boolean" },
{ "type": "null" }
]
}
},
"$defs": {
"UserRole": {
"title": "UserRole",
"type": "string",
"enum": ["customer", "admin", "moderator"]
}
}
}-
Affected areas/files:
- client/src/utils/schemaUtils.ts (normalizeUnionType)
- client/src/components/ToolsTab.tsx
- client/src/components/DynamicJsonForm.tsx
-
Suggested fixes (summary):
- Resolve
$refwithin normalize (frominputSchema.$defs) and preserve enum as{ type: "string", enum, nullable: true }. - Pass full property schema to DynamicJsonForm (avoid trimming anyOf/$ref/enum).
- Add clear/empty option to enum selects (or cleanParams before calling the tool to omit optional empties).
- Resolve
Metadata
Metadata
Assignees
Labels
No labels