truncateToolResults
Purpose and behavior
Section titled “Purpose and behavior”Create a context strategy that cuts older tool results to maxCharacters, appending a truncation marker, and leaves the keepRecent most recent tool-result messages intact. It returns nothing while no older result exceeds the limit.
Complete example and detailed rules.
Parameters and properties
Section titled “Parameters and properties”optionsOptionalTruncateToolResultsOptions | undefinedNumber of recent tool results kept intact and the length older results are cut to.options.keepRecentOptionalnumber | undefinedNumber of most recent tool-result messages kept intact, default 4.options.maxCharactersOptionalnumber | undefinedLength older tool results are cut to, default 2000 characters.