inspector icon indicating copy to clipboard operation
inspector copied to clipboard

fix: allow empty elicitation form data when all fields are optional

Open bolinfest opened this issue 1 month ago • 2 comments

Summary

When all of the fields of the schema for an elicitation are optional, it should be possible to hit the Submit button (sending "accept") without filling in any of the fields. Prior to this change, this would fail in the UI with:

Validation Error: data should be object

Previously, in this case, generateDefaultValue() would produce undefined as the default value, but as of this change, it produces {} instead. The undefined would fail the check here:

https://github.com/modelcontextprotocol/inspector/blob/dff91a869683a309c69aaf2868e7982f76cc22f4/client/src/components/ElicitationRequest.tsx#L82-L90

Now it passes.

Note: Inspector V2 is under development to address architectural and UX improvements. See CONTRIBUTING.md for information about V2 development.

Type of Change

  • [x] Bug fix (non-breaking change that fixes an issue)
  • [ ] New feature (non-breaking change that adds functionality)
  • [ ] Documentation update
  • [ ] Refactoring (no functional changes)
  • [ ] Test updates
  • [ ] Build/CI improvements

Changes Made

Related Issues

Testing

  • [x] Tested in UI mode
  • [ ] Tested in CLI mode
  • [x] Tested with STDIO transport
  • [ ] Tested with SSE transport
  • [ ] Tested with Streamable HTTP transport
  • [ ] Added/updated automated tests
  • [x] Manual testing performed

Test Results and/or Instructions

Screenshots are encouraged to share your testing results for this change.

Checklist

  • [x] Code follows the style guidelines (ran npm run prettier-fix)
  • [x] Self-review completed
  • [x] Code is commented where necessary
  • [x] Documentation updated (README, comments, etc.)

Breaking Changes

Additional Context

bolinfest avatar Nov 20 '25 01:11 bolinfest

I don't understand what happened: why did an action in an unrelated repo close this PR?

bolinfest avatar Nov 21 '25 00:11 bolinfest

@olaservo added proposed tests

bolinfest avatar Dec 01 '25 18:12 bolinfest

@cliffhall would you be willing to take a look?

bolinfest avatar Dec 08 '25 17:12 bolinfest

Thanks so much @olaservo!

bolinfest avatar Dec 12 '25 07:12 bolinfest