This is an automated email from the ASF dual-hosted git repository.

Aias00 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new 29d0723e03 [type: bug] Fix createParameterSchema not writing required 
array (#6887) (#6994)
29d0723e03 is described below

commit 29d0723e03f88959ee8c22247f68de599b76b93a
Author: Arvin <[email protected]>
AuthorDate: Thu Sep 3 18:44:51 2026 +0800

    [type: bug] Fix createParameterSchema not writing required array (#6887) 
(#6994)
    
    Signed-off-by: zhang-arvin <[email protected]>
    Co-authored-by: aias00 <[email protected]>
---
 .../apache/shenyu/plugin/mcp/server/utils/JsonSchemaUtil.java    | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git 
a/shenyu-plugin/shenyu-plugin-mcp-server/src/main/java/org/apache/shenyu/plugin/mcp/server/utils/JsonSchemaUtil.java
 
b/shenyu-plugin/shenyu-plugin-mcp-server/src/main/java/org/apache/shenyu/plugin/mcp/server/utils/JsonSchemaUtil.java
index e15dc76209..8f9aeab48d 100644
--- 
a/shenyu-plugin/shenyu-plugin-mcp-server/src/main/java/org/apache/shenyu/plugin/mcp/server/utils/JsonSchemaUtil.java
+++ 
b/shenyu-plugin/shenyu-plugin-mcp-server/src/main/java/org/apache/shenyu/plugin/mcp/server/utils/JsonSchemaUtil.java
@@ -18,6 +18,7 @@
 package org.apache.shenyu.plugin.mcp.server.utils;
 
 import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.github.victools.jsonschema.generator.SchemaVersion;
 import io.micrometer.common.util.StringUtils;
@@ -62,6 +63,14 @@ public final class JsonSchemaUtil {
             recursionConstructPropertiesNodes(parameter, property);
         }
 
+        // Collect required parameters
+        ArrayNode requiredArray = schema.putArray("required");
+        for (McpServerToolParameter parameter : parameters) {
+            if (parameter.isRequired()) {
+                requiredArray.add(parameter.getName());
+            }
+        }
+
         processSchemaOptions(schemaOptions, schema);
         return schema.toPrettyString();
     }

Reply via email to