From 8fa5e781dac8a5cf3bc69e917a34f6a7125fd47c Mon Sep 17 00:00:00 2001 From: Pichinov-Jose Date: Sun, 17 May 2026 21:24:23 +0200 Subject: [PATCH] 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 --- htdocs/ai/tools/thirdparty.class.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/ai/tools/thirdparty.class.php b/htdocs/ai/tools/thirdparty.class.php index 2aea57b8137..2fa9541c612 100644 --- a/htdocs/ai/tools/thirdparty.class.php +++ b/htdocs/ai/tools/thirdparty.class.php @@ -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."]