@@ -136,7 +136,7 @@ pub fn validate_tool_arguments(schema: &Value, arguments: &Value) -> Result<(),
136136
137137fn validate_schema_value ( schema : & Value , value : & Value , path : & str ) -> Result < ( ) , String > {
138138 if let Some ( result) = validate_any_of ( schema, value, path) {
139- return result;
139+ result? ;
140140 }
141141
142142 validate_enum ( schema, value, path) ?;
@@ -337,7 +337,9 @@ pub fn oss_read_tool_specs() -> Vec<ToolSpec> {
337337 json!( {
338338 "query" : string_property( "User request or dataset search text." ) ,
339339 "selectedDataset" : { "type" : "string" } ,
340- "contextDataset" : { "type" : "string" }
340+ "contextDataset" : { "type" : "string" } ,
341+ "telemetryType" : { "type" : "string" , "enum" : [ "logs" , "metrics" , "traces" ] } ,
342+ "limit" : { "type" : "integer" , "minimum" : 1 , "maximum" : 20 , "default" : 5 }
341343 } ) ,
342344 & [ "query" ] ,
343345 ) ,
@@ -391,21 +393,29 @@ pub fn oss_read_tool_specs() -> Vec<ToolSpec> {
391393 "get_log_context" ,
392394 "Get surrounding log context" ,
393395 "Fetch records around an exact anchor log row." ,
394- object_schema(
395- json!( {
396- "dataset" : string_property( "Dataset containing the anchor row." ) ,
397- "pTimestamp" : string_property( "Exact p_timestamp from the anchor row." ) ,
398- "log" : { "type" : "string" } ,
399- "body" : { "type" : "string" } ,
400- "message" : { "type" : "string" } ,
401- "contextWindow" : { "type" : "string" } ,
402- "contextStartTime" : { "type" : "string" } ,
403- "contextEndTime" : { "type" : "string" } ,
404- "conditions" : { "type" : "object" , "additionalProperties" : true } ,
405- "pageSize" : { "type" : "integer" , "minimum" : 1 , "maximum" : 500 , "default" : 100 } ,
406- } ) ,
407- & [ "dataset" , "pTimestamp" ] ,
408- ) ,
396+ {
397+ let mut schema = object_schema(
398+ json!( {
399+ "dataset" : string_property( "Dataset containing the anchor row." ) ,
400+ "pTimestamp" : string_property( "Exact p_timestamp from the anchor row." ) ,
401+ "log" : string_property( "Exact log value from the anchor row. Provide exactly one of log, body, or message." ) ,
402+ "body" : string_property( "Exact body value from the anchor row. Provide exactly one of log, body, or message." ) ,
403+ "message" : string_property( "Exact message value from the anchor row. Provide exactly one of log, body, or message." ) ,
404+ "contextWindow" : { "type" : "string" } ,
405+ "contextStartTime" : { "type" : "string" } ,
406+ "contextEndTime" : { "type" : "string" } ,
407+ "conditions" : { "type" : "object" , "additionalProperties" : true } ,
408+ "pageSize" : { "type" : "integer" , "minimum" : 1 , "maximum" : 500 , "default" : 100 } ,
409+ } ) ,
410+ & [ "dataset" , "pTimestamp" ] ,
411+ ) ;
412+ schema[ "anyOf" ] = json!( [
413+ { "required" : [ "log" ] } ,
414+ { "required" : [ "body" ] } ,
415+ { "required" : [ "message" ] }
416+ ] ) ;
417+ schema
418+ } ,
409419 ) ,
410420 ToolSpec :: new(
411421 "list_log_errors" ,
@@ -1043,6 +1053,42 @@ mod tests {
10431053 . validate_arguments( & serde_json:: json!( { "dataset" : "logs" } ) )
10441054 . is_ok( )
10451055 ) ;
1056+
1057+ let resolve_tool = oss_tool_specs ( )
1058+ . into_iter ( )
1059+ . find ( |tool| tool. name == "resolve_dataset" )
1060+ . unwrap ( ) ;
1061+ assert ! (
1062+ resolve_tool
1063+ . validate_arguments( & serde_json:: json!( {
1064+ "query" : "metrics" ,
1065+ "telemetryType" : "metrics" ,
1066+ "limit" : 10
1067+ } ) )
1068+ . is_ok( )
1069+ ) ;
1070+
1071+ let context_tool = oss_tool_specs ( )
1072+ . into_iter ( )
1073+ . find ( |tool| tool. name == "get_log_context" )
1074+ . unwrap ( ) ;
1075+ assert ! (
1076+ context_tool
1077+ . validate_arguments( & serde_json:: json!( {
1078+ "dataset" : "logs" ,
1079+ "pTimestamp" : "2026-10-22T00:00:00Z"
1080+ } ) )
1081+ . is_err( )
1082+ ) ;
1083+ assert ! (
1084+ context_tool
1085+ . validate_arguments( & serde_json:: json!( {
1086+ "dataset" : "logs" ,
1087+ "pTimestamp" : "2026-10-22T00:00:00Z" ,
1088+ "message" : "failed"
1089+ } ) )
1090+ . is_ok( )
1091+ ) ;
10461092 }
10471093
10481094 #[ actix_web:: test]
0 commit comments