Configuration for clearing tool outputs when token limits are exceeded.
interface ClearToolUsesEditConfigWhether to clear the originating tool call parameters on the AI message.
List of tool names to exclude from clearing.
Context retention policy applied after editing. Specify how many tool results to preserve using messages, tokens, or fraction.
// Keep 3 most recent tool results
keep: { messages: 3 }
// Keep tool results that fit within 1000 tokens
keep: { tokens: 1000 }
// Keep tool results that fit within 30% of model's max input tokens
keep: { fraction: 0.3 }Placeholder text inserted for cleared tool outputs.
Trigger conditions for context editing. Can be a single condition object (all properties must be met) or an array of conditions (any condition must be met).
// Single condition: trigger if tokens >= 100000 AND messages >= 50
trigger: { tokens: 100000, messages: 50 }
// Multiple conditions: trigger if (tokens >= 100000 AND messages >= 50) OR (tokens >= 50000 AND messages >= 100)
trigger: [
{ tokens: 100000, messages: 50 },
{ tokens: 50000, messages: 100 }
]
// Fractional trigger: trigger at 80% of model's max input tokens
trigger: { fraction: 0.8 }