-
Notifications
You must be signed in to change notification settings - Fork 816
Open
Labels
bugSomething isn't workingSomething isn't working
Description
MCP Inspector automatically sends empty arrays [] for optional array parameters instead of omitting
them from tool call arguments, causing issues with OpenAPI servers that expect optional parameters
to be completely absent when not specified.
To Reproduce
Steps to reproduce the behavior:
- Connect MCP Inspector to an OpenAPI server with optional array parameters (e.g., fields[mesh],
include) - Call a tool without specifying values for optional array parameters
- Observe that Inspector sends empty arrays [] instead of omitting the parameters
- Check server logs to see the received arguments contain "parameter_name": []
Expected behavior
When optional array parameters are not specified by the user, they should be completely omitted
from the tool call arguments JSON, not sent as empty arrays. According to MCP best practices:
- Parameter should NOT be assigned a default value
- Parameter should NOT be sent as null or []
- Parameter should be completely absent from the request
Logs
Server receives tool call arguments with unwanted empty arrays:
{
"mesh_id": "urn:gltf-live:mesh:0198e08e-8b97-7950-9822-347f217b628e",
"fields_mesh": [],
"include": [],
"timeout_seconds": 30
}
Additional context
- Root cause is in
inspector/client/src/utils/schemaUtils.ts
Lines 111 to 114 in 0ef91d2
case "array": return []; case "object": { if (!schema.properties) return {}; generateDefaultValue
returns[]
for
optional arrays or{}
for optional objects - A similar issue was previously fixed:
When argument to a tool is not specified it should not be default and send via MCP request as a NULL value. #357 - The fix should update the function to return
undefined
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working