LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangChain
  • Browser
  • Universal
  • Hub
  • Node
  • Load
  • Serializable
  • Encoder Backed
  • File System
  • In Memory
  • Tools
LangChain Core
  • Agents
  • Caches
  • Base
  • Dispatch
  • Web
  • Manager
  • Promises
  • Chat History
  • Context
  • Base
  • Langsmith
  • Documents
  • Embeddings
  • Errors
  • Example Selectors
  • Indexing
  • Base
  • Chat Models
  • Compat
  • Event
  • Llms
  • Openai Completions Stream
  • Profile
  • Stream
  • Structured Output
  • Load
  • Serializable
  • Memory
  • Messages
  • Tool
  • Output Parsers
  • Openai Functions
  • Openai Tools
  • Outputs
  • Prompt Values
  • Prompts
  • Retrievers
  • Document Compressors
  • Runnables
  • Graph
  • Singletons
  • Stores
  • Structured Query
  • Testing
  • Tools
  • Base
  • Console
  • Log Stream
  • Run Collector
  • Tracer Langchain
  • Stream
  • Async Caller
  • Chunk Array
  • Context
  • Env
  • Event Source Parse
  • Format
  • Function Calling
  • Gateway
  • Hash
  • Json Patch
  • Json Schema
  • Math
  • Ssrf
  • Standard Schema
  • Stream
  • Testing
  • Tiktoken
  • Types
  • Uuid
  • Vectorstores
Text Splitters
MCP Adapters
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangChain
BrowserUniversalHubNodeLoadSerializableEncoder BackedFile SystemIn MemoryTools
LangChain Core
AgentsCachesBaseDispatchWebManagerPromisesChat HistoryContextBaseLangsmithDocumentsEmbeddingsErrorsExample SelectorsIndexingBaseChat ModelsCompatEventLlmsOpenai Completions StreamProfileStreamStructured OutputLoadSerializableMemoryMessagesToolOutput ParsersOpenai FunctionsOpenai ToolsOutputsPrompt ValuesPromptsRetrieversDocument CompressorsRunnablesGraphSingletonsStoresStructured QueryTestingToolsBaseConsoleLog StreamRun CollectorTracer LangchainStreamAsync CallerChunk ArrayContextEnvEvent Source ParseFormatFunction CallingGatewayHashJson PatchJson SchemaMathSsrfStandard SchemaStreamTestingTiktokenTypesUuidVectorstores
Text Splitters
MCP Adapters
Language
Theme
JavaScriptlangchainindexClearToolUsesEditConfig
Interfaceā—Since v1.0

ClearToolUsesEditConfig

Copy
interface ClearToolUsesEditConfig

Properties

View source on GitHub
property
clearToolInputs: boolean
property
excludeTools: string[]
property
keep: __type
property
placeholder: string
property
trigger: __type | __type[]
deprecatedproperty
clearAtLeast: number
deprecatedproperty
keepMessages: number
deprecatedproperty
triggerTokens: number

Configuration for clearing tool outputs when token limits are exceeded.

Whether 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.

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).

Copy
// 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 }
Copy
// 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 }