yanand0909 commented on code in PR #421:
URL: https://github.com/apache/flink-agents/pull/421#discussion_r2674347986
##########
docs/content/docs/development/tool_use.md:
##########
@@ -244,8 +243,83 @@ class ReviewAnalysisAgent(Agent):
tools=["notify_shipping_manager"], # Reference MCP tool by name
)
```
+{{< /tab >}}
+
+{{< tab "Java" >}}
+```java
+public class ReviewAnalysisAgent extends Agent {
+
+ @MCPServer
+ public static org.apache.flink.agents.integrations.mcp.MCPServer
reviewMcpServer() {
+ return org.apache.flink.agents.integrations.mcp.MCPServer
+ .builder("http://127.0.0.1:8000/mcp")
+ .timeout(Duration.ofSeconds(30))
+ .build();
+ }
+
+ @ChatModelSetup
+ public static ResourceDescriptor reviewModel() {
+ return
ResourceDescriptor.Builder.newBuilder(OllamaChatModelSetup.class.getName())
+ .addInitialArgument("connection", "ollamaChatModelConnection")
+ .addInitialArgument("model", "qwen3:8b")
+ .addInitialArgument("tools",
Collections.singletonList("notifyShippingManager")) // Reference MCP tool by
name
+ .build();
+ }
+}
+```
+{{< /tab >}}
+
+{{< /tabs >}}
**Key points:**
-- Use `@mcp_server` decorator to define MCP server connection
-- Reference MCP tools by their function name (e.g.,
`"notify_shipping_manager"`)
-- All tools from the MCP server are automatically registered
\ No newline at end of file
+- In Python, use `@mcp_server` decorator to define MCP server connection
+- In Java, use `@MCPServer` annotation to define MCP server connection
+- Use the builder pattern in Java to configure the MCP server with endpoint,
timeout, headers, and authentication
Review Comment:
Looks like I missed it, thanks for catching this
--
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]