Skip to content

Conversation

@bolinfest
Copy link
Contributor

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:

const ajv = new Ajv();
const validate = ajv.compile(request.request.requestedSchema);
const isValid = validate(formData);
if (!isValid) {
const errorMessage = ajv.errorsText(validate.errors);
setValidationError(errorMessage);
return;
}

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

  • 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

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

Test Results and/or Instructions

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

Checklist

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

Breaking Changes

Additional Context

@bolinfest
Copy link
Contributor Author

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

@bolinfest
Copy link
Contributor Author

@olaservo added proposed tests

takumi-earth pushed a commit to earthlings-dev/codex that referenced this pull request Dec 2, 2025
Using appropriate message/title fields, I think this looks better now:

<img width="3370" height="3208" alt="image"
src="https://github.com/user-attachments/assets/e9bbf906-4ba8-4563-affc-62cdc6c97342"
/>

Though note that in the current version of the Inspector (`0.17.2`), you
cannot hit **Submit** until you fill out the field. I believe this is a
bug in the Inspector, as it does not properly handle the case when all
fields are optional. I put up a fix:

modelcontextprotocol/inspector#926
@bolinfest
Copy link
Contributor Author

@cliffhall would you be willing to take a look?

Copy link
Member

@olaservo olaservo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - I tested with this tool triggering an elicitation with all optional inputs, and also tested that elicitations in the latest everything server built from main still worked after this change.

@olaservo olaservo merged commit 5778a3a into modelcontextprotocol:main Dec 12, 2025
4 checks passed
@bolinfest
Copy link
Contributor Author

Thanks so much @olaservo!

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