@@ -102,6 +102,8 @@ pub struct AddRoom {
102102 pub wing_id : String ,
103103 pub name : String ,
104104 pub hall_type : String ,
105+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
106+ pub description : Option < String > ,
105107}
106108
107109/// Check whether content is a near-duplicate of an existing drawer.
@@ -124,6 +126,15 @@ pub struct KgAdd {
124126 pub object : String ,
125127 #[ serde( skip_serializing_if = "Option::is_none" ) ]
126128 pub confidence : Option < f64 > ,
129+ /// RFC 3339 start of validity window.
130+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
131+ pub valid_from : Option < String > ,
132+ /// RFC 3339 end of validity window.
133+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
134+ pub valid_to : Option < String > ,
135+ /// Classification: "fact", "observation", "inference", "hypothesis".
136+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
137+ pub statement_type : Option < String > ,
127138}
128139
129140/// Query triples for an entity, optionally at a point in time.
@@ -325,9 +336,10 @@ pub fn tool_catalog() -> Vec<ToolDefinition> {
325336 "description" => "string"
326337 } ) ,
327338 tool_def!( "add_room" , "Create a new room in an existing wing." , {
328- "wing_id" => "string" ;
329- "name" => "string" ;
330- "hall_type" => "string"
339+ "wing_id" => "string" ;
340+ "name" => "string" ;
341+ "hall_type" => "string" ;
342+ "description" => "string" , optional: true
331343 } ) ,
332344 tool_def!( "check_duplicate" , "Check whether content is a near-duplicate of an existing drawer." , {
333345 "content" => "string" ;
@@ -336,10 +348,13 @@ pub fn tool_catalog() -> Vec<ToolDefinition> {
336348
337349 // ── Knowledge Graph ─────────────────────────────────────────
338350 tool_def!( "kg_add" , "Add a (subject, predicate, object) triple to the knowledge graph." , {
339- "subject" => "string" ;
340- "predicate" => "string" ;
341- "object" => "string" ;
342- "confidence" => "number" , optional: true
351+ "subject" => "string" ;
352+ "predicate" => "string" ;
353+ "object" => "string" ;
354+ "confidence" => "number" , optional: true ;
355+ "valid_from" => "string" , optional: true ;
356+ "valid_to" => "string" , optional: true ;
357+ "statement_type" => "string" , optional: true
343358 } ) ,
344359 tool_def!( "kg_query" , "Query triples for an entity, optionally at a point in time." , {
345360 "entity" => "string" ;
@@ -552,6 +567,20 @@ mod tests {
552567 wing_id : "w1" . into ( ) ,
553568 name : "Quantum" . into ( ) ,
554569 hall_type : "topic" . into ( ) ,
570+ description : None ,
571+ } ;
572+ let json = serde_json:: to_string ( & t) . unwrap ( ) ;
573+ let back: AddRoom = serde_json:: from_str ( & json) . unwrap ( ) ;
574+ assert_eq ! ( t, back) ;
575+ }
576+
577+ #[ test]
578+ fn add_room_with_description_roundtrip ( ) {
579+ let t = AddRoom {
580+ wing_id : "w1" . into ( ) ,
581+ name : "Quantum" . into ( ) ,
582+ hall_type : "topic" . into ( ) ,
583+ description : Some ( "Quantum mechanics research" . into ( ) ) ,
555584 } ;
556585 let json = serde_json:: to_string ( & t) . unwrap ( ) ;
557586 let back: AddRoom = serde_json:: from_str ( & json) . unwrap ( ) ;
@@ -575,8 +604,29 @@ mod tests {
575604 predicate : "discovered" . into ( ) ,
576605 object : "relativity" . into ( ) ,
577606 confidence : Some ( 0.99 ) ,
607+ valid_from : None ,
608+ valid_to : None ,
609+ statement_type : None ,
610+ } ;
611+ let json = serde_json:: to_string ( & t) . unwrap ( ) ;
612+ let back: KgAdd = serde_json:: from_str ( & json) . unwrap ( ) ;
613+ assert_eq ! ( t, back) ;
614+ }
615+
616+ #[ test]
617+ fn kg_add_temporal_roundtrip ( ) {
618+ let t = KgAdd {
619+ subject : "Earth" . into ( ) ,
620+ predicate : "orbits" . into ( ) ,
621+ object : "Sun" . into ( ) ,
622+ confidence : Some ( 1.0 ) ,
623+ valid_from : Some ( "2026-01-01T00:00:00+00:00" . into ( ) ) ,
624+ valid_to : None ,
625+ statement_type : Some ( "fact" . into ( ) ) ,
578626 } ;
579627 let json = serde_json:: to_string ( & t) . unwrap ( ) ;
628+ assert ! ( json. contains( "valid_from" ) ) ;
629+ assert ! ( json. contains( "statement_type" ) ) ;
580630 let back: KgAdd = serde_json:: from_str ( & json) . unwrap ( ) ;
581631 assert_eq ! ( t, back) ;
582632 }
0 commit comments