LiuTianyou commented on code in PR #3922:
URL: https://github.com/apache/hertzbeat/pull/3922#discussion_r2638558338
##########
hertzbeat-ai/src/main/java/org/apache/hertzbeat/ai/tools/impl/MonitorToolsImpl.java:
##########
@@ -194,44 +210,45 @@ public String queryMonitors(
@Override
@Tool(name = "add_monitor", description = """
- HertzBeat: Add a new monitoring target to HertzBeat with
comprehensive configuration.
- This tool dynamically handles different parameter requirements for
each monitor type.
-
- This tool creates monitors with proper app-specific parameters.
-
- *********
- VERY IMPORTANT:
- ALWAYS use get_monitor_additional_params to check the additional
required parameters for the chosen type before adding a monitor or even
mentioning it.
- Use list_monitor_types tool to see available monitor type names to
use here in the app parameter.
- Use the information obtained from this to query user for
parameters.
- If the User has not given any parameters, ask them to provide the
necessary parameters, until all the necessary parameters are provided.
- **********
-
- Examples of natural language requests this tool handles:
- - "Monitor website example.com with HTTPS on port 443"
- - "Add MySQL monitoring for database server at 192.168.1.10 with
user admin"
- - "Monitor Linux server health on host server.company.com via SSH"
- - "Set up Redis monitoring on localhost port 6379 with password"
-
- PARAMETER MAPPING: Use the 'params' parameter to pass all
monitor-specific configuration.
- The params should be a JSON string containing key-value pairs for
the monitor type.
- Use get_monitor_additional_params tool to see what parameters are
required for each monitor type.
-
- PARAMS EXAMPLES:
- - Website: {"host":"example.com", "port":"443",
"uri":"/api/health", "ssl":"true", "method":"GET"}
- - Linux: {"host":"192.168.1.10", "port":"22", "username":"root",
"password":"xxx"}
- - MySQL: {"host":"db.server.com", "port":"3306",
"username":"admin", "password":"xxx", "database":"mydb"}
- - Redis: {"host":"redis.server.com", "port":"6379",
"password":"xxx"}
- """)
+ HertzBeat: Add a new monitoring target to HertzBeat with comprehensive
configuration.
+ This tool dynamically handles different parameter requirements for
each monitor type.
+
+ This tool creates monitors with proper app-specific parameters.
+
+ *********
+ VERY IMPORTANT:
+ ALWAYS use get_monitor_additional_params to check the additional
required parameters for the chosen type before adding a monitor or even
mentioning it.
+ Use list_monitor_types tool to see available monitor type names to use
here in the app parameter.
+ Use the information obtained from this to query user for parameters.
+ If the User has not given any parameters, ask them to provide the
necessary parameters, until all the necessary parameters are provided.
+ **********
+
+ Examples of natural language requests this tool handles:
+ - "Monitor website example.com with HTTPS on port 443"
+ - "Add MySQL monitoring for database server at 192.168.1.10 with user
admin"
+ - "Monitor Linux server health on host server.company.com via SSH"
+ - "Set up Redis monitoring on localhost port 6379 with password"
+
+ PARAMETER MAPPING: Use the 'params' parameter to pass all
monitor-specific configuration.
+ The params should be a JSON string containing key-value pairs for the
monitor type.
+ Use get_monitor_additional_params tool to see what parameters are
required for each monitor type.
+
+ PARAMS EXAMPLES:
+ - Website: {"host":"example.com", "port":"443", "uri":"/api/health",
"ssl":"true", "method":"GET"}
+ - Linux: {"host":"192.168.1.10", "port":"22", "username":"root",
"password":"xxx"}
+ - MySQL: {"host":"db.server.com", "port":"3306", "username":"admin",
"password":"xxx", "database":"mydb"}
+ - Redis: {"host":"redis.server.com", "port":"6379", "password":"xxx"}
+ """)
public String addMonitor(
- @ToolParam(description = "Monitor name (required)", required =
true) String name,
- @ToolParam(description = "Monitor type: website, mysql,
postgresql, redis, linux, windows, etc.", required = true) String app,
- @ToolParam(description = "Collection interval in seconds (default:
600)", required = false) Integer intervals,
- @ToolParam(description = "Monitor-specific parameters as JSON
string. "
- + "Use get_monitor_additional_params to see required
fields. "
- + "Example: {\"host\":\"192.168.1.1\", \"port\":\"22\",
\"username\":\"root\"}",
- required = true) String params,
- @ToolParam(description = "Monitor description (optional)",
required = false) String description) {
+ @ToolParam(description = "The id for current conversation", required =
true) Long conversationId,
Review Comment:
Sorry, I overlooked the compatibility issue when the tool is called by MCP.
I should provide an additional tool through enhancing the existing add_monitor
tool, so that it can be invoked in scenarios where monitoring is added using
the secure form method, such as add_monitor_protected. The conversationId
parameter is only used in this tool.
--
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]