Skip to content

fix(ui): use antd Select for MCP ToolTestPanel bool inputs#25809

Merged
ryan-crabbe-berri merged 2 commits intolitellm_internal_stagingfrom
litellm_fix_tool_test_panel_bool_rendering
Apr 16, 2026
Merged

fix(ui): use antd Select for MCP ToolTestPanel bool inputs#25809
ryan-crabbe-berri merged 2 commits intolitellm_internal_stagingfrom
litellm_fix_tool_test_panel_bool_rendering

Conversation

@ryan-crabbe-berri
Copy link
Copy Markdown
Collaborator

@ryan-crabbe-berri ryan-crabbe-berri commented Apr 15, 2026

Summary

  • The boolean branch of ToolTestPanel's schema-driven form used a native HTML <select> wrapped in a Form.Item, with string-valued options. Native <select> forces option values to be strings on the DOM, so the form's native-boolean field value never strictly matches, and the control relies on fragile runtime coercion.
  • Replace with antd <Select> + <Select.Option value={true}> / value={false}, matching the fix already shipped in guardrail_optional_params.tsx / guardrail_provider_fields.tsx. antd Select does strict-equality matching on JS values, so native booleans flow through unchanged.
  • Update the existing test to query getByTitle("True") (antd renders the selected item as a span with a title attribute, not a native select).

Test plan

  • npx vitest run src/components/mcp_tools/ToolTestPanel.test.tsx — 3/3 pass
  • Manual: add an MCP server whose tool schema has a boolean input, open the Tool Testing Playground, confirm the bool field renders with the backend default pre-selected and submits as a native JSON boolean

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview, Comment Apr 16, 2026 5:43am

Request Review

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 15, 2026

Greptile Summary

This PR replaces the native HTML <select> used for boolean schema fields in ToolTestPanel with antd's <Select> component, fixing a type mismatch where native select option values are strings but antd Form expects booleans. The test is updated from getByDisplayValue (native select query) to getByTitle (antd Select's rendered DOM pattern). The handleSubmit function already contains defensive coercion (value === "true" || value === true) that handles both old and new paths, so no submission logic needed to change.

Confidence Score: 5/5

Safe to merge — targeted bug fix with correct antd patterns, no P0/P1 issues.

The change correctly addresses the boolean/string type mismatch by using antd Select with native JS boolean option values, following the same pattern already used in guardrail components. The Form.Item initialValue properly drives the controlled Select state. The handleSubmit coercion (value === 'true' || value === true) was already defensive and handles the new boolean path. The test update to getByTitle accurately reflects antd Select's DOM rendering of selected items. All findings are P2 or lower.

No files require special attention.

Important Files Changed

Filename Overview
ui/litellm-dashboard/src/components/mcp_tools/ToolTestPanel.tsx Native for boolean fields replaced with antd using boolean option values; Form.Item's initialValue correctly drives the controlled component state.
ui/litellm-dashboard/src/components/mcp_tools/ToolTestPanel.test.tsx Test assertion updated from getByDisplayValue("True") to getByTitle("True") to match antd Select's DOM rendering of the selected value; change is appropriate and doesn't weaken coverage.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["Schema property\n(type: boolean, default: true)"] --> B["buildDefaultValue()\n→ true (JS boolean)"]
    B --> C["Form.Item initialValue={true}"]

    subgraph OLD ["Old: native select"]
        C --> D1["value prop injected as boolean true\nbut option values are strings 'true'/'false'"]
        D1 --> E1["onChange emits string 'true' or 'false'"]
        E1 --> F1["handleSubmit coercion:\nvalue === 'true' || value === true"]
    end

    subgraph NEW ["New: antd Select"]
        C --> D2["value prop injected as boolean true\nSelect.Option value={true} matches exactly"]
        D2 --> E2["onChange emits boolean true or false"]
        E2 --> F2["handleSubmit coercion:\nvalue === 'true' || value === true\n(boolean path hit directly)"]
    end

    F1 --> G["Submitted as boolean"]
    F2 --> G
Loading

Reviews (2): Last reviewed commit: "Merge remote-tracking branch 'origin/lit..." | Re-trigger Greptile

@ryan-crabbe-berri ryan-crabbe-berri changed the base branch from litellm_internal_staging to main April 15, 2026 22:31
@ryan-crabbe-berri ryan-crabbe-berri changed the base branch from main to litellm_internal_staging April 15, 2026 22:53
@ryan-crabbe-berri ryan-crabbe-berri merged commit 18c93e0 into litellm_internal_staging Apr 16, 2026
89 of 97 checks passed
@ryan-crabbe-berri ryan-crabbe-berri deleted the litellm_fix_tool_test_panel_bool_rendering branch April 16, 2026 05:50
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.

2 participants