Copilot commented on code in PR #7893:
URL: https://github.com/apache/incubator-seata/pull/7893#discussion_r2647378569


##########
console/src/main/java/org/apache/seata/mcp/tools/GlobalLockTools.java:
##########
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.seata.mcp.tools;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.seata.common.result.PageResult;
+import org.apache.seata.common.util.StringUtils;
+import org.apache.seata.mcp.core.constant.RPCConstant;
+import org.apache.seata.mcp.core.props.MCPProperties;
+import org.apache.seata.mcp.core.props.NameSpaceDetail;
+import org.apache.seata.mcp.core.utils.DateUtils;
+import org.apache.seata.mcp.entity.dto.McpGlobalLockParamDto;
+import org.apache.seata.mcp.entity.param.McpGlobalLockDeleteParam;
+import org.apache.seata.mcp.entity.param.McpGlobalLockParam;
+import org.apache.seata.mcp.entity.vo.McpGlobalLockVO;
+import org.apache.seata.mcp.service.ConsoleApiService;
+import org.apache.seata.mcp.service.ModifyConfirmService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springaicommunity.mcp.annotation.McpTool;
+import org.springaicommunity.mcp.annotation.McpToolParam;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Service
+public class GlobalLockTools {
+
+    private final Logger logger = 
LoggerFactory.getLogger(GlobalLockTools.class);
+
+    private final ConsoleApiService mcpRPCService;
+
+    private final MCPProperties mcpProperties;
+
+    private final ModifyConfirmService modifyConfirmService;
+
+    private final ObjectMapper objectMapper;
+
+    public GlobalLockTools(
+            ConsoleApiService mcpRPCService,
+            MCPProperties mcpProperties,
+            ModifyConfirmService modifyConfirmService,
+            ObjectMapper objectMapper) {
+        this.mcpRPCService = mcpRPCService;
+        this.mcpProperties = mcpProperties;
+        this.modifyConfirmService = modifyConfirmService;
+        this.objectMapper = objectMapper;
+    }
+
+    @McpTool(description = "Query the global lock information")
+    public PageResult<McpGlobalLockVO> queryGlobalLock(
+            @McpToolParam(description = "Specify the namespace of the TC 
node") NameSpaceDetail nameSpaceDetail,
+            @McpToolParam(description = "Global lock parameters") 
McpGlobalLockParamDto paramDto) {
+        McpGlobalLockParam param = 
McpGlobalLockParam.convertFromParamDto(paramDto);
+        Long timeStart = param.getTimeStart();
+        Long timeEnd = param.getTimeEnd();
+        Long maxQueryDuration = mcpProperties.getQueryDuration();
+        if (timeStart != null || timeEnd != null) {
+            if (timeStart == null) {
+                timeStart = timeEnd - maxQueryDuration;
+                param.setTimeStart(timeStart);
+            }
+            if (timeEnd == null) {
+                timeEnd = timeStart + maxQueryDuration;
+                param.setTimeEnd(timeEnd);
+            }
+            if (DateUtils.judgeExceedTimeDuration(timeStart, timeEnd, 
maxQueryDuration)) {
+                return PageResult.failure(
+                        "",
+                        String.format(
+                                "The query time span is not allowed to exceed 
the max query duration: %s hours",
+                                
DateUtils.convertToHourFromTimeStamp(maxQueryDuration)));
+            }
+        }
+        PageResult<McpGlobalLockVO> result = null;
+        String response = mcpRPCService.getCallTC(
+                nameSpaceDetail, RPCConstant.GLOBAL_LOCK_BASE_URL + "/query", 
param, null, null);
+        try {
+            result = objectMapper.readValue(response, new 
TypeReference<PageResult<McpGlobalLockVO>>() {});
+        } catch (JsonProcessingException e) {
+            logger.error(e.getMessage());
+        }
+        if (result == null) {
+            return PageResult.failure("", "query global lock failed");
+        } else {
+            return result;
+        }
+    }
+
+    @McpTool(description = "Delete the global lock, Get the modify key before 
you delete")
+    public String deleteGlobalLock(
+            @McpToolParam(description = "Specify the namespace of the TC 
node") NameSpaceDetail nameSpaceDetail,
+            @McpToolParam(description = "Global lock delete parameters") 
McpGlobalLockDeleteParam param,
+            @McpToolParam(description = "Modify key") String modifyKey) {
+        if (!modifyConfirmService.isValidKey(modifyKey)) {
+            return "The modify key is not available";
+        }
+        String result = mcpRPCService.deleteCallTC(
+                nameSpaceDetail, RPCConstant.GLOBAL_LOCK_BASE_URL + "/delete", 
param, null, null);
+        if (StringUtils.isBlank(result)) {
+            return String.format(
+                    "delete global lock failed, xid: %s, branchId: %s", 
param.getXid(), param.getBranchId());
+        } else {
+            return result;
+        }
+    }
+
+    @McpTool(description = "Check if the lock exist the branch session")

Review Comment:
   The description "Check if the lock exist the branch session" has a 
grammatical error. It should be "Check if the lock exists in the branch 
session" or "Check if the branch session has a lock".



##########
console/src/main/java/org/apache/seata/mcp/entity/vo/McpBranchSessionVO.java:
##########
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.seata.mcp.entity.vo;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.apache.seata.mcp.core.config.TimestampToStringDeserializer;
+
+import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY;
+import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
+
+@JsonAutoDetect(getterVisibility = NONE, fieldVisibility = ANY)
+public class McpBranchSessionVO extends 
org.apache.seata.server.console.entity.vo.BranchSessionVO {
+
+    private String gmtCreate;
+    private String gmtModified;
+
+    @JsonProperty("gmtCreate")
+    @JsonDeserialize(using = TimestampToStringDeserializer.class)
+    public String getCreate() {
+        return gmtCreate;
+    }
+
+    public void setGmtCreate(String gmtCreate) {
+        this.gmtCreate = gmtCreate;
+    }
+
+    @JsonProperty("gmtModified")
+    @JsonDeserialize(using = TimestampToStringDeserializer.class)
+    public String getModified() {

Review Comment:
   The method name is inconsistently named as `getModified()` when the field 
name is `gmtModified`. For clarity and consistency with Java Bean conventions, 
it should be named `getGmtModified()` to match the field name.
   ```suggestion
       public String getGmtModified() {
   ```



##########
console/src/main/java/org/apache/seata/mcp/entity/dto/McpGlobalSessionParamDto.java:
##########
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.seata.mcp.entity.dto;
+
+import org.apache.seata.common.util.StringUtils;
+import org.apache.seata.mcp.entity.param.McpGlobalAbnormalSessionParam;
+import org.springaicommunity.mcp.annotation.McpToolParam;
+
+import java.io.Serializable;
+
+public class McpGlobalSessionParamDto implements Serializable {
+
+    private static final long serialVersionUID = 115488252809011284L;
+
+    @McpToolParam(description = "GLOBAL TRANSACTIONS id", required = false)
+    private String xid;
+
+    @McpToolParam(description = "applicationId", required = false)
+    private String applicationId;
+
+    @McpToolParam(description = "the state enumeration class is in example", 
required = false)

Review Comment:
   The description "the state enumeration class is in example" is unclear. It 
should provide concrete information about where the status enum values can be 
found, such as "the status values are defined in 
org.apache.seata.core.model.GlobalStatus enum" or include examples of valid 
status codes.
   ```suggestion
       @McpToolParam(
               description = "Global transaction status. The valid values are 
defined in org.apache.seata.core.model.GlobalStatus enum.",
               required = false)
   ```



##########
console/src/main/java/org/apache/seata/mcp/tools/GlobalSessionTools.java:
##########
@@ -0,0 +1,231 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.seata.mcp.tools;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.seata.common.result.PageResult;
+import org.apache.seata.common.util.StringUtils;
+import org.apache.seata.core.model.GlobalStatus;
+import org.apache.seata.mcp.core.constant.RPCConstant;
+import org.apache.seata.mcp.core.props.MCPProperties;
+import org.apache.seata.mcp.core.props.NameSpaceDetail;
+import org.apache.seata.mcp.core.utils.DateUtils;
+import org.apache.seata.mcp.entity.dto.McpGlobalSessionParamDto;
+import org.apache.seata.mcp.entity.param.McpGlobalAbnormalSessionParam;
+import org.apache.seata.mcp.entity.param.McpGlobalSessionParam;
+import org.apache.seata.mcp.entity.vo.McpGlobalSessionVO;
+import org.apache.seata.mcp.service.ConsoleApiService;
+import org.apache.seata.mcp.service.ModifyConfirmService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springaicommunity.mcp.annotation.McpTool;
+import org.springaicommunity.mcp.annotation.McpToolParam;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class GlobalSessionTools {
+
+    private final Logger logger = 
LoggerFactory.getLogger(GlobalSessionTools.class);
+
+    private final ConsoleApiService mcpRPCService;
+
+    private final MCPProperties mcpProperties;
+
+    private final ObjectMapper objectMapper;
+
+    private final ModifyConfirmService modifyConfirmService;
+
+    private final List<Integer> exceptionStatus = new ArrayList<>();
+
+    public static final int ABNORMAL_SESSION_PAGE_SIZE = 30;
+
+    public GlobalSessionTools(
+            ConsoleApiService mcpRPCService,
+            MCPProperties mcpProperties,
+            ObjectMapper objectMapper,
+            ModifyConfirmService modifyConfirmService) {
+        this.mcpRPCService = mcpRPCService;
+        this.mcpProperties = mcpProperties;
+        this.objectMapper = objectMapper;
+        this.modifyConfirmService = modifyConfirmService;
+        exceptionStatus.add(GlobalStatus.CommitFailed.getCode());
+        exceptionStatus.add(GlobalStatus.TimeoutRollbackFailed.getCode());
+        exceptionStatus.add(GlobalStatus.RollbackFailed.getCode());
+    }
+
+    @McpTool(description = "Query global transactions")
+    public PageResult<McpGlobalSessionVO> queryGlobalSession(
+            @McpToolParam(description = "Specify the namespace of the TC 
node") NameSpaceDetail nameSpaceDetail,
+            @McpToolParam(description = "Query parameter objects") 
McpGlobalSessionParamDto paramDto) {
+        McpGlobalSessionParam param = 
McpGlobalSessionParam.convertFromDtoParam(paramDto);
+        Long timeStart = param.getTimeStart();
+        Long timeEnd = param.getTimeEnd();
+        Long maxQueryDuration = mcpProperties.getQueryDuration();
+        if (timeStart != null || timeEnd != null) {
+            if (timeStart == null) {
+                timeStart = timeEnd - maxQueryDuration;
+                param.setTimeStart(timeStart);
+            }
+            if (timeEnd == null) {
+                timeEnd = timeStart + maxQueryDuration;
+                param.setTimeEnd(timeEnd);
+            }
+            if (DateUtils.judgeExceedTimeDuration(timeStart, timeEnd, 
maxQueryDuration)) {
+                return PageResult.failure(
+                        "",
+                        String.format(
+                                "The query time span is not allowed to exceed 
the max query duration: %s hours",
+                                
DateUtils.convertToHourFromTimeStamp(maxQueryDuration)));
+            }
+        }
+        PageResult<McpGlobalSessionVO> pageResult = null;
+        String result = mcpRPCService.getCallTC(
+                nameSpaceDetail, RPCConstant.GLOBAL_SESSION_BASE_URL + 
"/query", param, null, null);
+        try {
+            pageResult = objectMapper.readValue(result, new 
TypeReference<PageResult<McpGlobalSessionVO>>() {});
+        } catch (JsonProcessingException e) {
+            logger.error(e.getMessage());
+        }
+        if (pageResult == null) {
+            return PageResult.failure("", "query global session failed");
+        } else {
+            return pageResult;
+        }
+    }
+
+    @McpTool(description = "Delete the global session, Get the modify key 
before you delete")
+    public String deleteGlobalSession(
+            @McpToolParam(description = "Specify the namespace of the TC 
node") NameSpaceDetail nameSpaceDetail,
+            @McpToolParam(description = "Global transaction id") String xid,
+            @McpToolParam(description = "Modify key") String modifyKey) {
+        if (!modifyConfirmService.isValidKey(modifyKey)) {
+            return "The modify key is not available";
+        }
+        Map<String, String> pathParams = new HashMap<>();
+        pathParams.put("xid", xid);
+        String result = mcpRPCService.deleteCallTC(
+                nameSpaceDetail, RPCConstant.GLOBAL_SESSION_BASE_URL + 
"/deleteGlobalSession", null, pathParams, null);
+        if (StringUtils.isBlank(result)) {
+            return String.format("delete global session failed, xid: %s", xid);
+        } else {
+            return result;
+        }
+    }
+
+    @McpTool(description = "Stop the global session retry, Get the modify key 
before you stop")
+    public String stopGlobalSession(
+            @McpToolParam(description = "Specify the namespace of the TC 
node") NameSpaceDetail nameSpaceDetail,
+            @McpToolParam(description = "Global transaction id") String xid,
+            @McpToolParam(description = "Modify key") String modifyKey) {
+        if (!modifyConfirmService.isValidKey(modifyKey)) {
+            return "The modify key is not available";
+        }
+        Map<String, String> pathParams = new HashMap<>();
+        pathParams.put("xid", xid);
+        String result = mcpRPCService.putCallTC(
+                nameSpaceDetail, RPCConstant.GLOBAL_SESSION_BASE_URL + 
"/stopGlobalSession", null, pathParams, null);
+        if (StringUtils.isBlank(result)) {
+            return String.format("stop global session retry failed, xid: %s", 
xid);
+        } else {
+            return result;
+        }
+    }
+
+    @McpTool(description = "Start the global session retry, Get the modify key 
before you start")
+    public String startGlobalSession(
+            @McpToolParam(description = "Specify the namespace of the TC 
node") NameSpaceDetail nameSpaceDetail,
+            @McpToolParam(description = "Global transaction id") String xid,
+            @McpToolParam(description = "Modify key") String modifyKey) {
+        if (!modifyConfirmService.isValidKey(modifyKey)) {
+            return "The modify key is not available";
+        }
+        Map<String, String> pathParams = new HashMap<>();
+        pathParams.put("xid", xid);
+        String result = mcpRPCService.putCallTC(
+                nameSpaceDetail, RPCConstant.GLOBAL_SESSION_BASE_URL + 
"/startGlobalSession", null, pathParams, null);
+        if (StringUtils.isBlank(result)) {
+            return String.format("start the global session retry failed, xid: 
%s", xid);
+        } else {
+            return result;
+        }
+    }
+
+    @McpTool(description = "Send global session to commit or rollback to rm, 
Get the modify key before you send")
+    public String sendCommitOrRollback(
+            @McpToolParam(description = "Specify the namespace of the TC 
node") NameSpaceDetail nameSpaceDetail,
+            @McpToolParam(description = "Global transaction id") String xid,
+            @McpToolParam(description = "Modify key") String modifyKey) {
+        if (!modifyConfirmService.isValidKey(modifyKey)) {
+            return "The modify key is not available";
+        }
+        Map<String, String> pathParams = new HashMap<>();
+        pathParams.put("xid", xid);
+        String result = mcpRPCService.putCallTC(
+                nameSpaceDetail, RPCConstant.GLOBAL_SESSION_BASE_URL + 
"/sendCommitOrRollback", null, pathParams, null);
+        if (StringUtils.isBlank(result)) {
+            return String.format("send global session to commit or rollback to 
rm failed, xid: %s", xid);
+        } else {
+            return result;
+        }
+    }
+
+    @McpTool(
+            description =
+                    "Change the global session status, Used to change 
transactions that are in a failed commit or rollback failed state to a retry 
state, Get the modify key before you change")
+    public String changeGlobalStatus(
+            @McpToolParam(description = "Specify the namespace of the TC 
node") NameSpaceDetail nameSpaceDetail,
+            @McpToolParam(description = "Global transaction id") String xid,
+            @McpToolParam(description = "Modify key") String modifyKey) {
+        if (!modifyConfirmService.isValidKey(modifyKey)) {
+            return "The modify key is not available";
+        }
+        Map<String, String> pathParams = new HashMap<>();
+        pathParams.put("xid", xid);
+        String result = mcpRPCService.putCallTC(
+                nameSpaceDetail, RPCConstant.GLOBAL_SESSION_BASE_URL + 
"/changeGlobalStatus", null, pathParams, null);
+        if (StringUtils.isBlank(result)) {
+            return String.format("change the global session status failed, 
xid: %s", xid);
+        } else {
+            return result;
+        }
+    }
+
+    @McpTool(description = "Check out the abnormal transaction information,You 
can specify the time")

Review Comment:
   The description text "Check out the abnormal transaction information" is 
unclear. It should be more precise, such as "Query abnormal transaction 
information" or "Retrieve abnormal transactions" to better describe the 
functionality.



##########
console/src/main/java/org/apache/seata/mcp/entity/vo/McpGlobalSessionVO.java:
##########
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.seata.mcp.entity.vo;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.apache.seata.mcp.core.config.TimestampToStringDeserializer;
+
+import java.util.Set;
+
+import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY;
+import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
+
+@JsonAutoDetect(getterVisibility = NONE, fieldVisibility = ANY)
+public class McpGlobalSessionVO extends 
org.apache.seata.server.console.entity.vo.GlobalSessionVO {
+
+    private String beginTime;
+    private String gmtCreate;
+    private String gmtModified;
+    private Set<McpBranchSessionVO> mcpBranchSessionVOS;
+
+    @JsonProperty("beginTime")
+    @JsonDeserialize(using = TimestampToStringDeserializer.class)
+    public String getBegin() {
+        return beginTime;
+    }
+

Review Comment:
   The method name is inconsistently named as `getBegin()` when the field name 
is `beginTime`. For clarity and consistency with Java Bean conventions, it 
should be named `getBeginTime()` to match the field name.
   ```suggestion
       public String getBeginTime() {
           return beginTime;
       }
   
       /**
        * @deprecated use {@link #getBeginTime()} instead.
        */
       @Deprecated
       public String getBegin() {
           return getBeginTime();
       }
   ```



##########
console/src/main/java/org/apache/seata/mcp/entity/vo/McpGlobalSessionVO.java:
##########
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.seata.mcp.entity.vo;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.apache.seata.mcp.core.config.TimestampToStringDeserializer;
+
+import java.util.Set;
+
+import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY;
+import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
+
+@JsonAutoDetect(getterVisibility = NONE, fieldVisibility = ANY)
+public class McpGlobalSessionVO extends 
org.apache.seata.server.console.entity.vo.GlobalSessionVO {
+
+    private String beginTime;
+    private String gmtCreate;
+    private String gmtModified;
+    private Set<McpBranchSessionVO> mcpBranchSessionVOS;
+
+    @JsonProperty("beginTime")
+    @JsonDeserialize(using = TimestampToStringDeserializer.class)
+    public String getBegin() {
+        return beginTime;
+    }
+
+    public void setBeginTime(String beginTime) {
+        this.beginTime = beginTime;
+    }
+
+    @JsonProperty("gmtCreate")
+    @JsonDeserialize(using = TimestampToStringDeserializer.class)
+    public String getCreate() {
+        return gmtCreate;
+    }
+
+    public void setGmtCreate(String gmtCreate) {
+        this.gmtCreate = gmtCreate;
+    }
+
+    @JsonProperty("gmtModified")
+    @JsonDeserialize(using = TimestampToStringDeserializer.class)
+    public String getModified() {

Review Comment:
   The method name is inconsistently named as `getModified()` when the field 
name is `gmtModified`. For clarity and consistency with Java Bean conventions, 
it should be named `getGmtModified()` to match the field name.
   ```suggestion
       public String getGmtModified() {
   ```



##########
console/src/main/java/org/apache/seata/mcp/entity/dto/McpGlobalSessionParamDto.java:
##########
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.seata.mcp.entity.dto;
+
+import org.apache.seata.common.util.StringUtils;
+import org.apache.seata.mcp.entity.param.McpGlobalAbnormalSessionParam;
+import org.springaicommunity.mcp.annotation.McpToolParam;
+
+import java.io.Serializable;
+
+public class McpGlobalSessionParamDto implements Serializable {
+
+    private static final long serialVersionUID = 115488252809011284L;
+
+    @McpToolParam(description = "GLOBAL TRANSACTIONS id", required = false)
+    private String xid;
+
+    @McpToolParam(description = "applicationId", required = false)
+    private String applicationId;
+
+    @McpToolParam(description = "the state enumeration class is in example", 
required = false)
+    private Integer status;
+
+    @McpToolParam(description = "The name of the transaction", required = 
false)
+    private String transactionName;
+
+    @McpToolParam(description = "Whether or not it contains branch transaction 
information", required = false)
+    private boolean withBranch;
+
+    @McpToolParam(description = "PAGE NUMBER")
+    private int pageNum;
+
+    @McpToolParam(description = "PageSize")

Review Comment:
   The descriptions "PAGE NUMBER" and "PageSize" are inconsistent in their 
capitalization style. They should both follow the same pattern, either "Page 
number" and "Page size" or "PAGE_NUMBER" and "PAGE_SIZE", to maintain 
consistency.
   ```suggestion
       @McpToolParam(description = "Page number")
       private int pageNum;
   
       @McpToolParam(description = "Page size")
   ```



##########
console/src/main/java/org/apache/seata/mcp/tools/NameSpaceTools.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.seata.mcp.tools;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.seata.common.result.SingleResult;
+import org.apache.seata.mcp.core.constant.RPCConstant;
+import org.apache.seata.mcp.service.ConsoleApiService;
+import org.springaicommunity.mcp.annotation.McpTool;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Service
+public class NameSpaceTools {
+
+    private final ConsoleApiService mcpRPCService;
+
+    private final ObjectMapper objectMapper;
+
+    public NameSpaceTools(ConsoleApiService mcpRPCService, ObjectMapper 
objectMapper) {
+        this.mcpRPCService = mcpRPCService;
+        this.objectMapper = objectMapper;
+    }
+
+    @McpTool(description = "Get the namespace and cluster or vgroup where all 
TC/Servers are located")
+    public SingleResult<?> getTCNameSpaces() {
+        String result = 
mcpRPCService.getCallNameSpace(RPCConstant.GET_NAMESPACE_PATH);
+        Map<String, Object> nameSpacesVo = new HashMap<>();
+        try {
+            JsonNode root = objectMapper.readTree(result);
+            JsonNode dataNode = root.get("data");
+            if (dataNode != null && !dataNode.isNull()) {
+                nameSpacesVo.put("namespaces", dataNode.toString());
+            }
+        } catch (JsonProcessingException e) {
+            return SingleResult.failure("get namespace failed:" + 
e.getMessage());

Review Comment:
   The error message "get namespace failed:" uses inconsistent capitalization. 
For consistency with other error messages in the codebase, it should start with 
a capital letter: "Get namespace failed:".



##########
console/src/main/java/org/apache/seata/mcp/entity/vo/McpGlobalSessionVO.java:
##########
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.seata.mcp.entity.vo;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.apache.seata.mcp.core.config.TimestampToStringDeserializer;
+
+import java.util.Set;
+
+import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY;
+import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
+
+@JsonAutoDetect(getterVisibility = NONE, fieldVisibility = ANY)
+public class McpGlobalSessionVO extends 
org.apache.seata.server.console.entity.vo.GlobalSessionVO {
+
+    private String beginTime;
+    private String gmtCreate;
+    private String gmtModified;
+    private Set<McpBranchSessionVO> mcpBranchSessionVOS;
+
+    @JsonProperty("beginTime")
+    @JsonDeserialize(using = TimestampToStringDeserializer.class)
+    public String getBegin() {
+        return beginTime;
+    }
+
+    public void setBeginTime(String beginTime) {
+        this.beginTime = beginTime;
+    }
+
+    @JsonProperty("gmtCreate")
+    @JsonDeserialize(using = TimestampToStringDeserializer.class)
+    public String getCreate() {

Review Comment:
   The method name is inconsistently named as `getCreate()` when the field name 
is `gmtCreate`. For clarity and consistency with Java Bean conventions, it 
should be named `getGmtCreate()` to match the field name.
   ```suggestion
       public String getGmtCreate() {
   ```



##########
console/src/main/java/org/apache/seata/mcp/entity/param/McpGlobalAbnormalSessionParam.java:
##########
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.seata.mcp.entity.param;
+
+import org.springaicommunity.mcp.annotation.McpToolParam;
+
+public class McpGlobalAbnormalSessionParam {
+    @McpToolParam(
+            description = "Whether or not it contains branch transaction 
information, default is true",
+            required = false)
+    private boolean withBranch = true;
+
+    @McpToolParam(description = "The transaction start time is after this time 
(yyyy-MM-dd HH:mm:ss)", required = false)
+    private String timeStart;
+
+    @McpToolParam(
+            description = "The transaction start time is before this time 
(yyyy-MM-dd HH:mm:ss)",
+            required = false)
+    private String timeEnd;
+
+    @McpToolParam(description = "PAGE NUMBER")

Review Comment:
   The description "PAGE NUMBER" at line 35 is inconsistent with the other 
parameter descriptions which use proper case (e.g., "Query Param" at line 217). 
It should be "Page number" for consistency.
   ```suggestion
       @McpToolParam(description = "Page number")
   ```



##########
console/src/main/java/org/apache/seata/mcp/entity/vo/McpGlobalSessionVO.java:
##########
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.seata.mcp.entity.vo;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.apache.seata.mcp.core.config.TimestampToStringDeserializer;
+
+import java.util.Set;
+
+import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY;
+import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
+
+@JsonAutoDetect(getterVisibility = NONE, fieldVisibility = ANY)
+public class McpGlobalSessionVO extends 
org.apache.seata.server.console.entity.vo.GlobalSessionVO {
+
+    private String beginTime;
+    private String gmtCreate;
+    private String gmtModified;
+    private Set<McpBranchSessionVO> mcpBranchSessionVOS;
+
+    @JsonProperty("beginTime")
+    @JsonDeserialize(using = TimestampToStringDeserializer.class)
+    public String getBegin() {
+        return beginTime;
+    }
+
+    public void setBeginTime(String beginTime) {
+        this.beginTime = beginTime;
+    }
+
+    @JsonProperty("gmtCreate")
+    @JsonDeserialize(using = TimestampToStringDeserializer.class)
+    public String getCreate() {
+        return gmtCreate;
+    }
+
+    public void setGmtCreate(String gmtCreate) {
+        this.gmtCreate = gmtCreate;
+    }
+
+    @JsonProperty("gmtModified")
+    @JsonDeserialize(using = TimestampToStringDeserializer.class)
+    public String getModified() {
+        return gmtModified;
+    }
+
+    public void setGmtModified(String gmtModified) {
+        this.gmtModified = gmtModified;
+    }
+
+    @JsonProperty("branchSessionVOs")
+    public Set<McpBranchSessionVO> getBranchSessionVO() {
+        return mcpBranchSessionVOS;
+    }
+
+    public void setBranchSessionVO(Set<McpBranchSessionVO> 
mcpBranchSessionVOS) {

Review Comment:
   Similar to the getter, the setter method name `setBranchSessionVO()` is 
inconsistent with the field name `mcpBranchSessionVOS` (plural). It should be 
named `setBranchSessionVOs()` to match the plural nature of the Set.
   ```suggestion
       public void setBranchSessionVOs(Set<McpBranchSessionVO> 
mcpBranchSessionVOS) {
   ```



##########
console/src/main/java/org/apache/seata/mcp/entity/vo/McpBranchSessionVO.java:
##########
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.seata.mcp.entity.vo;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.apache.seata.mcp.core.config.TimestampToStringDeserializer;
+
+import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY;
+import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
+
+@JsonAutoDetect(getterVisibility = NONE, fieldVisibility = ANY)
+public class McpBranchSessionVO extends 
org.apache.seata.server.console.entity.vo.BranchSessionVO {
+
+    private String gmtCreate;
+    private String gmtModified;
+
+    @JsonProperty("gmtCreate")
+    @JsonDeserialize(using = TimestampToStringDeserializer.class)
+    public String getCreate() {
+        return gmtCreate;

Review Comment:
   The method name is inconsistently named as `getCreate()` when the field name 
is `gmtCreate`. For clarity and consistency with Java Bean conventions, it 
should be named `getGmtCreate()` to match the field name.



##########
console/src/main/java/org/apache/seata/mcp/entity/dto/McpGlobalSessionParamDto.java:
##########
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.seata.mcp.entity.dto;
+
+import org.apache.seata.common.util.StringUtils;
+import org.apache.seata.mcp.entity.param.McpGlobalAbnormalSessionParam;
+import org.springaicommunity.mcp.annotation.McpToolParam;
+
+import java.io.Serializable;
+
+public class McpGlobalSessionParamDto implements Serializable {
+
+    private static final long serialVersionUID = 115488252809011284L;
+
+    @McpToolParam(description = "GLOBAL TRANSACTIONS id", required = false)

Review Comment:
   The description "GLOBAL TRANSACTIONS id" should use consistent 
capitalization. It should be "Global transaction ID" to match the style of 
other parameter descriptions in the codebase.
   ```suggestion
       @McpToolParam(description = "Global transaction ID", required = false)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


Reply via email to