Skip to content

Commit 2dde384

Browse files
Deeven-Seruanubhav756
authored andcommitted
fix: build and checkstyle configuration
1 parent 7ac182a commit 2dde384

77 files changed

Lines changed: 2868 additions & 7 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

java.header

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
^/\*$
2+
^ \* Copyright \d\d\d\d,? Google (Inc\.|LLC)$
3+
^ \*$
4+
^ \* Licensed under the Apache License, Version 2\.0 \(the "License"\);$
5+
^ \* you may not use this file except in compliance with the License\.$
6+
^ \* You may obtain a copy of the License at$
7+
^ \*$
8+
^ \*[ ]+https?://www.apache.org/licenses/LICENSE-2\.0$
9+
^ \*$
10+
^ \* Unless required by applicable law or agreed to in writing, software$
11+
^ \* distributed under the License is distributed on an "AS IS" BASIS,$
12+
^ \* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.$
13+
^ \* See the License for the specific language governing permissions and$
14+
^ \* limitations under the License\.$
15+
^ \*/$

license-checks.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE module PUBLIC
3+
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
4+
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
5+
<module name="Checker">
6+
<module name="RegexpHeader">
7+
<property name="fileExtensions" value="java"/>
8+
<property name="headerFile" value="${checkstyle.header.file}"/>
9+
</module>
10+
</module>

pom.xml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535
<maven.compiler.target>17</maven.compiler.target>
3636
<jackson.version>2.15.2</jackson.version>
3737
<google.auth.version>1.23.0</google.auth.version>
38-
<langchain4j.version>0.24.0</langchain4j.version>
38+
<langchain4j.version>0.35.0</langchain4j.version>
39+
<checkstyle.header.file>java.header</checkstyle.header.file>
40+
<animal.sniffer.skip>true</animal.sniffer.skip>
3941
</properties>
4042

4143
<dependencies>
@@ -60,6 +62,12 @@
6062
<version>${langchain4j.version}</version>
6163
<optional>true</optional>
6264
</dependency>
65+
<dependency>
66+
<groupId>dev.langchain4j</groupId>
67+
<artifactId>langchain4j</artifactId>
68+
<version>${langchain4j.version}</version>
69+
<optional>true</optional>
70+
</dependency>
6371

6472
<!-- Testing -->
6573
<dependency>
@@ -78,6 +86,14 @@
7886

7987
<build>
8088
<plugins>
89+
<plugin>
90+
<groupId>org.apache.maven.plugins</groupId>
91+
<artifactId>maven-compiler-plugin</artifactId>
92+
<version>3.13.0</version>
93+
<configuration>
94+
<release>17</release>
95+
</configuration>
96+
</plugin>
8197
<plugin>
8298
<groupId>com.spotify.fmt</groupId>
8399
<artifactId>fmt-maven-plugin</artifactId>

src/main/java/com/google/cloud/mcp/LangChain4jTool.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
package com.google.cloud.mcp;
1818

19+
import com.fasterxml.jackson.core.type.TypeReference;
20+
import com.fasterxml.jackson.databind.ObjectMapper;
21+
import dev.langchain4j.agent.tool.ToolExecutionRequest;
1922
import dev.langchain4j.agent.tool.ToolSpecification;
2023
import dev.langchain4j.service.tool.ToolExecutor;
2124
import java.util.Map;
@@ -24,6 +27,7 @@
2427
/** Adapter for LangChain4j Tools. */
2528
public class LangChain4jTool {
2629

30+
private static final ObjectMapper mapper = new ObjectMapper();
2731
private final Tool tool;
2832

2933
public LangChain4jTool(Tool tool) {
@@ -40,11 +44,17 @@ public ToolSpecification specification() {
4044
}
4145

4246
public ToolExecutor executor() {
43-
return (arguments, memoryId) -> {
44-
ToolResult result = tool.execute(arguments).join();
45-
return result.content().stream()
46-
.map(ToolResult.Content::text)
47-
.collect(Collectors.joining("\n"));
47+
return (request, memoryId) -> {
48+
try {
49+
Map<String, Object> arguments =
50+
mapper.readValue(request.arguments(), new TypeReference<Map<String, Object>>() {});
51+
ToolResult result = tool.execute(arguments).join();
52+
return result.content().stream()
53+
.map(ToolResult.Content::text)
54+
.collect(Collectors.joining("\n"));
55+
} catch (Exception e) {
56+
throw new RuntimeException("Failed to execute tool", e);
57+
}
4858
};
4959
}
5060
}

src/main/java/com/google/cloud/mcp/McpToolboxClientBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2026Google LLC
2+
* Copyright 2026 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

target/checkstyle-cachefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#Tue Feb 10 11:09:27 UTC 2026
2+
configuration*?=8E5978264A9991A7B8E309A56D06D003C7D1F7FE
3+
/home/DEV/.openclaw/workspace/mcp-toolbox-sdk-java/src/main/java/com/google/cloud/mcp/HttpMcpToolboxClient.java=1770721542030
4+
/home/DEV/.openclaw/workspace/mcp-toolbox-sdk-java/src/main/java/com/google/cloud/mcp/LangChain4jTool.java=1770721762300
5+
/home/DEV/.openclaw/workspace/mcp-toolbox-sdk-java/src/main/java/com/google/cloud/mcp/McpToolboxClient.java=1770721544545
6+
/home/DEV/.openclaw/workspace/mcp-toolbox-sdk-java/src/main/java/com/google/cloud/mcp/SyncMcpToolboxClient.java=1770721544545
7+
/home/DEV/.openclaw/workspace/mcp-toolbox-sdk-java/src/main/java/com/google/cloud/mcp/AuthTokenGetter.java=1770721542030
8+
module-resource*?\:file\:/home/DEV/.openclaw/workspace/mcp-toolbox-sdk-java/target/checkstyle-header.txt=AD1E8F63061677B8EBD24CDBE36864CA30D2DF96
9+
/home/DEV/.openclaw/workspace/mcp-toolbox-sdk-java/src/test/java/com/google/cloud/mcp/LangChain4jToolTest.java=1770721544546
10+
/home/DEV/.openclaw/workspace/mcp-toolbox-sdk-java/src/main/java/com/google/cloud/mcp/ToolDefinition.java=1770721542030
11+
/home/DEV/.openclaw/workspace/mcp-toolbox-sdk-java/src/main/java/com/google/cloud/mcp/ToolResult.java=1770721542030
12+
/home/DEV/.openclaw/workspace/mcp-toolbox-sdk-java/src/main/java/com/google/cloud/mcp/McpToolboxClientBuilder.java=1770721658998
13+
/home/DEV/.openclaw/workspace/mcp-toolbox-sdk-java/src/main/java/com/google/cloud/mcp/Tool.java=1770721542030

target/checkstyle-checker.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE module PUBLIC
3+
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
4+
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
5+
<module name="Checker">
6+
<module name="RegexpHeader">
7+
<property name="fileExtensions" value="java"/>
8+
<property name="headerFile" value="${checkstyle.header.file}"/>
9+
</module>
10+
</module>

target/checkstyle-header.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
^/\*$
2+
^ \* Copyright \d\d\d\d,? Google (Inc\.|LLC)$
3+
^ \*$
4+
^ \* Licensed under the Apache License, Version 2\.0 \(the "License"\);$
5+
^ \* you may not use this file except in compliance with the License\.$
6+
^ \* You may obtain a copy of the License at$
7+
^ \*$
8+
^ \*[ ]+https?://www.apache.org/licenses/LICENSE-2\.0$
9+
^ \*$
10+
^ \* Unless required by applicable law or agreed to in writing, software$
11+
^ \* distributed under the License is distributed on an "AS IS" BASIS,$
12+
^ \* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.$
13+
^ \* See the License for the specific language governing permissions and$
14+
^ \* limitations under the License\.$
15+
^ \*/$

target/checkstyle-result.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<checkstyle version="10.21.2">
3+
<file name="/home/DEV/.openclaw/workspace/mcp-toolbox-sdk-java/src/main/java/com/google/cloud/mcp/LangChain4jTool.java">
4+
</file>
5+
</checkstyle>
355 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)