-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
MCP tools with $defs/$ref in inputSchema fail — parameters can't be constructed
Describe the bug
MCP tool calls fail with Input validation error: 'X' is a required property when the MCP server's tool inputSchema uses $defs + $ref to define parameter types. The $ref references are never resolved, so the client cannot construct or validate the required parameters.
Tools that don't use $ref (e.g., simple tools with no required params) work fine on the same MCP connection.
Affected version
0.0.423
Root cause analysis
The PagerDuty MCP server (https://mcp.pagerduty.com/mcp) returns tool schemas like this (abbreviated):
{
"name": "list_schedules",
"inputSchema": {
"$defs": {
"ScheduleQuery": {
"properties": {
"query": { "type": "string", "default": null },
"team_ids": { "type": "array", "default": null },
"limit": { "type": "integer", "default": 20 }
},
"type": "object"
}
},
"properties": {
"query_model": { "$ref": "#/$defs/ScheduleQuery" }
},
"required": ["query_model"],
"type": "object"
}
}This is valid JSON Schema. The $defs block is present in the same schema object and $ref points to it. However, the Copilot CLI MCP client:
- Presents the tool parameter as just
"query_model": {"$ref": "#/$defs/ScheduleQuery"}— the reference is never inlined - The model has no visibility into the actual properties of
query_model - Every call fails validation because
query_modelis required but the model can't construct it
Steps to reproduce
- Configure the PagerDuty MCP server:
{
"pagerduty": {
"url": "https://mcp.pagerduty.com/mcp",
"type": "http",
"headers": {
"Authorization": "Token token=${PAGERDUTY_API_TOKEN}"
}
}
}- Start
copilot - Ask: "Who is on call?"
- The agent attempts to call
list_schedulesorlist_oncalls - Every call fails with:
MCP server 'pagerduty': Input validation error: 'query_model' is a required property
What works vs. what doesn't
| Tool | Has $ref? |
Result |
|---|---|---|
get_user_data |
No (no params) | ✅ Works |
get_incident |
No (incident_id is a plain string) |
✅ Works |
list_schedules |
Yes (query_model: $ref ScheduleQuery) |
❌ Fails |
list_oncalls |
Yes (query_model: $ref OncallQuery) |
❌ Fails |
list_incidents |
Yes (query_model: $ref IncidentQuery) |
❌ Fails |
Expected behavior
The MCP client should resolve $ref references within inputSchema (at minimum local $defs references) before presenting tool parameters to the model, so it can construct valid inputs.
Additional context
- The PagerDuty server's schemas are valid JSON Schema and work correctly when called via
curl - This likely affects any MCP server that uses
$defs/$refininputSchema(a common pattern in Python MCP servers using Pydantic models) - Related: Empty Input Schema Breaks Copilot CLI #1825 (another
inputSchemahandling issue)