Fix: ToolThirdParty inputSchema JSON Schema 2020-12 compliance (#38290)

Several tool schemas in ToolThirdParty::getDefinitions() declared
'required' => true inside individual properties. This is not valid
JSON Schema draft 2020-12, which requires 'required' to be an array
of property names at the parent object level.

Strict validators (such as Anthropic's Claude API used by Claude
Desktop Custom Connectors and Claude Code) reject these schemas with
HTTP 400 'input_schema is invalid', causing the entire MCP connection
to fail before any tool can be called.

This patch:
- Moves 'required: true' flags from individual properties to a proper
  'required: [...]' array at the parent level
- Adds the missing parent-level required array to get_thirdparty_details
  (which previously had no way to mark id as required in a compliant manner)
- Fixes 5 tools in total: get_thirdparty_details, create_thirdparty,
  update_thirdparty, list_thirdparty_contacts, add_thirdparty_contact

Tested with:
- Claude Desktop Custom Connectors (BETA): tools/list now succeeds
- Claude Code CLI: 32 MCP tools load without 400 errors
This commit is contained in:
Pichinov-Jose 2026-05-17 21:24:23 +02:00 committed by GitHub
parent d84479e30f
commit 8fa5e781da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -72,8 +72,9 @@ class ToolThirdParty extends McpTool
"inputSchema" => [
"type" => "object",
"properties" => [
"id" => ["type" => "integer", "required" => true]
]
"id" => ["type" => "integer", "description" => "The unique numerical ID of the thirdparty."]
],
"required" => ["id"]
]
],
[
@ -82,7 +83,7 @@ class ToolThirdParty extends McpTool
"inputSchema" => [
"type" => "object",
"properties" => [
"name" => ["type" => "string", "description" => "Name of the thirdparty", "required" => true],
"name" => ["type" => "string", "description" => "Name of the thirdparty"],
"type" => ["type" => "string", "enum" => ["customer", "prospect", "supplier", "both", "none"], "default" => "customer", "description" => "Type of thirdparty. 'none' means not a customer or prospect."],
"email" => ["type" => "string", "description" => "Email address"],
"phone" => ["type" => "string", "description" => "Phone number"],
@ -105,7 +106,7 @@ class ToolThirdParty extends McpTool
"inputSchema" => [
"type" => "object",
"properties" => [
"id" => ["type" => "integer", "description" => "The ID of the thirdparty to update.", "required" => true],
"id" => ["type" => "integer", "description" => "The ID of the thirdparty to update."],
"name" => ["type" => "string", "description" => "The new name for the thirdparty."],
"email" => ["type" => "string", "description" => "The new email address."],
"phone" => ["type" => "string", "description" => "The new phone number."],
@ -123,7 +124,7 @@ class ToolThirdParty extends McpTool
"inputSchema" => [
"type" => "object",
"properties" => [
"id" => ["type" => "integer", "description" => "The ID of the thirdparty.", "required" => true]
"id" => ["type" => "integer", "description" => "The ID of the thirdparty."]
],
"required" => ["id"]
]
@ -136,11 +137,10 @@ class ToolThirdParty extends McpTool
"properties" => [
"thirdparty_identifier" => [
"type" => ["string", "integer"],
"description" => "The ID or name of the thirdparty to add the contact to.",
"required" => true
"description" => "The ID or name of the thirdparty to add the contact to."
],
"firstname" => ["type" => "string", "description" => "Contact's first name.", "required" => true],
"lastname" => ["type" => "string", "description" => "Contact's last name.", "required" => true],
"firstname" => ["type" => "string", "description" => "Contact's first name."],
"lastname" => ["type" => "string", "description" => "Contact's last name."],
"email" => ["type" => "string", "description" => "Contact's email address."],
"phone" => ["type" => "string", "description" => "Contact's phone number."],
"role" => ["type" => "string", "description" => "Contact's role or position within the company."]