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

rombert pushed a commit to branch issue/SLING-13213
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-mcp-server-contributions.git

commit 02fa9eb07d787ae7449185db70964e997e4f31dd
Merge: 2ded2c9 8513c1a
Author: Robert Munteanu <[email protected]>
AuthorDate: Fri May 22 17:13:46 2026 +0200

    Merge remote-tracking branch 'origin/master' into issue/SLING-13188

 pom.xml                                                | 18 +++++++++++++++++-
 src/main/features/main.json                            |  8 ++++++++
 .../mcp/server/impl/contribs/LogToolContribution.java  | 12 ++++++------
 3 files changed, 31 insertions(+), 7 deletions(-)

diff --cc 
src/main/java/org/apache/sling/mcp/server/impl/contribs/LogToolContribution.java
index b9a3945,3ae4067..993f451
--- 
a/src/main/java/org/apache/sling/mcp/server/impl/contribs/LogToolContribution.java
+++ 
b/src/main/java/org/apache/sling/mcp/server/impl/contribs/LogToolContribution.java
@@@ -44,8 -43,10 +44,10 @@@ import org.osgi.service.component.annot
  @Component
  public class LogToolContribution implements McpServerContribution {
  
+     private static final int DEFAULT_MAX_LOGS = 200;
+ 
      @Reference
 -    private StructuredLogBuffer structuredLogBuffer;
 +    private LogStore logStore;
  
      @Reference
      private McpJsonMapperSupplier jsonMapper;
@@@ -97,17 -99,16 +98,16 @@@
  
                      // Parse parameters
                      int maxEntries = DEFAULT_MAX_LOGS;
-                     if (maxEntriesObj instanceof Number) {
-                         maxEntries = ((Number) maxEntriesObj).intValue();
-                         maxEntries = Math.min(maxEntries, 1000); // Cap at 
1000
+                     if (maxEntriesObj instanceof Number maxEntriesNumber) {
+                         maxEntries = Math.min(maxEntriesNumber.intValue(), 
1000); // Cap at 1000
                      }
  
 -                    String minLogLevel = 
structuredLogBuffer.getHighestLogLevelName();
 +                    LogLevel minLogLevel = getHighestLogLevel();
                      if (logLevelStr != null && !logLevelStr.isEmpty()) {
 -                        if 
(!structuredLogBuffer.isValidLogLevel(logLevelStr)) {
 +                        if (!isValidLogLevel(logLevelStr)) {
                              return CallToolResult.builder()
                                      .addTextContent("Invalid log level: " + 
logLevelStr + ". Valid options are: "
 -                                            + String.join(", ", 
structuredLogBuffer.getValidLogLevelNames()))
 +                                            + String.join(", ", 
getValidLogLevelNames()))
                                      .isError(true)
                                      .build();
                          }
@@@ -167,9 -168,9 +167,9 @@@
          return result.toString();
      }
  
 -    private void formatLogEntry(LogSnapshot entry, int index, StringBuilder 
result) {
 +    private void formatLogEntry(LogEntry entry, int index, StringBuilder 
result) {
          result.append("[").append(index).append("] ");
-         result.append(DATE_FORMAT.format(new Date(entry.timeMillis())));
+         result.append(dateFormat.format(new Date(entry.timeMillis())));
          result.append(" [").append(entry.level()).append("] ");
          result.append("[")
                  .append(entry.loggerName() != null ? entry.loggerName() : 
"(unknown logger)")

Reply via email to