This is an automated email from the ASF dual-hosted git repository. asf-gitbox-commits pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cayenne.git
commit 25a8af0e36001de465ae526e607bc74c2d430b7a Author: Andrus Adamchik <[email protected]> AuthorDate: Tue May 19 08:01:24 2026 -0400 CAY-2943 cleanup --- .../apache/cayenne/mcp/tools/cgen/CgenRunTool.java | 20 ++++++++++++-------- .../mcp/tools/openproject/OpenProjectTool.java | 19 +++++++++---------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/cayenne-mcp-server/src/main/java/org/apache/cayenne/mcp/tools/cgen/CgenRunTool.java b/cayenne-mcp-server/src/main/java/org/apache/cayenne/mcp/tools/cgen/CgenRunTool.java index 0a6e45417..50a247a79 100644 --- a/cayenne-mcp-server/src/main/java/org/apache/cayenne/mcp/tools/cgen/CgenRunTool.java +++ b/cayenne-mcp-server/src/main/java/org/apache/cayenne/mcp/tools/cgen/CgenRunTool.java @@ -77,15 +77,18 @@ public class CgenRunTool { McpSchema.Tool descriptor = new McpSchema.Tool( NAME, null, - "Run Cayenne class generator (cgen) for a named DataMap. " + - "Returns a JSON report of what was written, what was already up-to-date, and any errors.", + """ + Run Cayenne class generator (cgen) for a named DataMap. Returns a JSON report of what was \ + written, what was already up-to-date, and any errors.""", new McpSchema.JsonSchema( "object", Map.of( - "projectPath", Map.of("type", "string", "description", - "Absolute path to the top-level Cayenne project descriptor (cayenne-*.xml), not a DataMap file"), - "dataMap", Map.of("type", "string", "description", - "Name of the target DataMap as it appears in the <map name='...'> element of the project descriptor") + "projectPath", Map.of( + "type", "string", + "description", "Absolute path to the top-level Cayenne project descriptor (cayenne-*.xml), not a DataMap file"), + "dataMap", Map.of( + "type", "string", + "description", "Name of the target DataMap as it appears in the <map name='...'> element of the project descriptor") ), List.of("projectPath", "dataMap"), null, null, null @@ -104,8 +107,9 @@ public class CgenRunTool { try { json = jsonMapper.writeValueAsString(result); } catch (IOException e) { - json = "{\"status\":\"error\",\"error\":{\"code\":\"cgen_runtime_error\"," + - "\"message\":\"Serialization failed: " + e.getMessage() + "\"}}"; + json = """ + {"status":"error","error":{"code":"cgen_runtime_error",\ + "message":"Serialization failed: %s"}}""".formatted(e.getMessage()); } return McpSchema.CallToolResult.builder() diff --git a/cayenne-mcp-server/src/main/java/org/apache/cayenne/mcp/tools/openproject/OpenProjectTool.java b/cayenne-mcp-server/src/main/java/org/apache/cayenne/mcp/tools/openproject/OpenProjectTool.java index 4af3ba1e8..b29e6d270 100644 --- a/cayenne-mcp-server/src/main/java/org/apache/cayenne/mcp/tools/openproject/OpenProjectTool.java +++ b/cayenne-mcp-server/src/main/java/org/apache/cayenne/mcp/tools/openproject/OpenProjectTool.java @@ -65,13 +65,14 @@ public class OpenProjectTool { NAME, null, """ - Launch CayenneModeler with the given project file. Non-blocking; waits for \ - the Modeler to report a startup handshake before returning.""", + Launch CayenneModeler with the given project file. Non-blocking; waits for \ + the Modeler to report a startup handshake before returning.""", new McpSchema.JsonSchema( "object", Map.of( - "projectPath", Map.of("type", "string", "description", - "Absolute path to the top-level Cayenne project descriptor (cayenne-*.xml)") + "projectPath", Map.of( + "type", "string", + "description", "Absolute path to the top-level Cayenne project descriptor (cayenne-*.xml)") ), List.of("projectPath"), null, null, null @@ -90,8 +91,8 @@ public class OpenProjectTool { json = jsonMapper.writeValueAsString(result); } catch (IOException e) { json = """ - {"status":"error","error":{"code":"launch_failed","message":"Serialization failed: %s"}}\ - """.formatted(e.getMessage()); + {"status":"error","error":{"code":"launch_failed","message":"Serialization failed: %s"}}\ + """.formatted(e.getMessage()); } return McpSchema.CallToolResult.builder() @@ -126,9 +127,7 @@ public class OpenProjectTool { Optional<Path> mcpDir = McpJarLocator.locate(OpenProjectTool.class); if (mcpDir.isEmpty()) { return validationFailed(OpenProjectErrorCode.mcp_jar_location_unresolved, - """ - Could not resolve the running MCP server jar's location via ProtectionDomain. \ - This is expected only in exotic launch configurations.""", + "Could not resolve the running MCP server jar's location", new OpenProjectValidation(true, false, null)); } @@ -222,7 +221,7 @@ public class OpenProjectTool { } private static OpenProjectResult validationFailed(OpenProjectErrorCode code, String message, - OpenProjectValidation validation) { + OpenProjectValidation validation) { return new OpenProjectResult( "validation_failed", null,
