@@ -42,6 +42,7 @@ export function createPruneTool(
4242 const sessionId = toolCtx . sessionID
4343
4444 if ( ! args . ids || args . ids . length === 0 ) {
45+ logger . debug ( "Prune tool called but args.ids is empty or undefined: " + JSON . stringify ( args ) )
4546 return "No IDs provided. Check the <prunable-tools> list for available IDs to prune."
4647 }
4748
@@ -50,13 +51,15 @@ export function createPruneTool(
5051 const reason = args . ids [ 0 ] ;
5152 const validReasons = [ "completion" , "noise" , "consolidation" ] as const
5253 if ( typeof reason !== "string" || ! validReasons . includes ( reason as any ) ) {
54+ logger . debug ( "Invalid pruning reason provided: " + reason )
5355 return "No valid pruning reason found. Use 'completion', 'noise', or 'consolidation' as the first element."
5456 }
5557
5658 const numericToolIds : number [ ] = args . ids . slice ( 1 )
5759 . map ( id => parseInt ( id , 10 ) )
5860 . filter ( ( n ) : n is number => ! isNaN ( n ) )
5961 if ( numericToolIds . length === 0 ) {
62+ logger . debug ( "No numeric tool IDs provided for pruning, yet prune tool was called: " + JSON . stringify ( args ) )
6063 return "No numeric IDs provided. Format: [reason, id1, id2, ...] where reason is 'completion', 'noise', or 'consolidation'."
6164 }
6265
@@ -73,6 +76,7 @@ export function createPruneTool(
7376
7477 // Validate that all numeric IDs are within bounds
7578 if ( numericToolIds . some ( id => id < 0 || id >= toolIdList . length ) ) {
79+ logger . debug ( "Invalid tool IDs provided: " + numericToolIds . join ( ", " ) )
7680 return "Invalid IDs provided. Only use numeric IDs from the <prunable-tools> list."
7781 }
7882
0 commit comments