Skip to content

Conversation

markacianfrani
Copy link
Contributor

There's a bug in the number inputs for tools where you can't enter negative numbers. (You can paste them or use the little browser UI down arrow, but that thing is a joke). I can create a minimum test MCP server if requested, but you should be able to see the issue using any number number.

Motivation and Context

Number inputs were immediately converting values to Number() on every keystroke, which prevented users from typing negative numbers since the intermediate "-" character cannot be converted to a valid number.

Now the input stores the raw string value and only converts to Number when the value is non-empty, allowing proper negative number entry.

How Has This Been Tested?

  • Manually with an MCP server that exposes floats as params.
  • Added a unit test, but that might've been overkill

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

Real world use case: A tool that exposes latitude and longitude coordinates and you're constantly copy and pasting them into the inspector but when you double click the longitude coordinate, it never selects the "-" and so you end up just pasting the part that you can select and manually type the "-" in the inspector field, but that doesn't work so now you're either performing surgery trying to select the "-" and the number, or performing surgery trying to click the little down arrow in the browser UI.

Number inputs were immediately converting values to Number() on every
keystroke, which prevented users from typing negative numbers since
the intermediate "-" character cannot be converted to a valid number.

Now the input stores the raw string value and only converts to Number
when the value is non-empty, allowing proper negative number entry.
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.

Thank you!

(Edit: Tested this locally with Everything Server)

@olaservo olaservo merged commit fbe6c11 into modelcontextprotocol:main Jun 28, 2025
4 checks passed
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