MCP tool optional input fields are surfaced in VS Code/Copilot as required #196147
Replies: 1 comment
-
|
💬 Your Product Feedback Has Been Submitted 🎉 Thank you for taking the time to share your insights with us! Your feedback is invaluable as we build a better GitHub experience for all our users. Here's what you can expect moving forward ⏩
Where to look to see what's shipping 👀
What you can do in the meantime 💻
As a member of the GitHub community, your participation is essential. While we can't promise that every suggestion will be implemented, we want to emphasize that your feedback is instrumental in guiding our decisions and priorities. Thank you once again for your contribution to making GitHub even better! We're grateful for your ongoing support and collaboration in shaping the future of our platform. ⭐ |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
🏷️ Discussion Type
Bug
💬 Feature/Topic Area
Copilot Agent Mode
Body
An MCP server is exposing tools whose input schema fields are optional, but the callable tool signature shown to the model in VS Code/Copilot presents those same fields as if they are all required. This loses semantic information and can push models into worse tool-use behavior.
In a created tool it is registered with optional fields:
A definition tool is also registered with optional fields:
Expected behavior
The tool contract exposed to the model should preserve optionality.
For the list tool, the model should understand:
all fields are optional
omitting 'query' is valid
omitting 'schemas' is valid
For the definition tool, the model should understand:
'fullName' alone is valid
or 'schemaName' plus 'objectName' is valid
Observed behavior
The live tool surface shown to the model in VS Code/Copilot appears as:
and
This presentation makes optional fields look required.
Why this appears to be client-side
The MCP SDK conversion path in
mcp.js uses 'zodToJsonSchema' on the registered Zod schema.
An independent 'zodToJsonSchema' check on the same shape produced JSON Schema with:
'properties'
no top-level required array
That indicates the server-side schema emission is preserving optionality correctly.
Impact
This causes models to over-constrain tool calls and make poorer decisions, for example:
assuming 'schemas' must always be supplied
assuming 'query' must always be supplied
assuming 'fullName', 'schemaName', and 'objectName' must all be supplied together
In practice, this led to unnecessary exploratory failures and forced prompt-side mitigations in descriptions to compensate for the incorrect callable signature.
Expected vs actual
Expected:
Optional JSON Schema fields remain visibly optional in the model-facing tool contract.
Actual:
Optional JSON Schema fields are rendered as plain typed fields with no indication of optionality, effectively appearing required.
Suggested investigation
Please inspect the VS Code/Copilot MCP client layer that transforms 'tools/list' responses into the tool signature shown to the model. The likely issue is in the rendering or intermediate normalization of JSON Schema object properties, where absence of 'required' is not being preserved semantically.
Beta Was this translation helpful? Give feedback.
All reactions