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

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangChain
UniversalHubNodeLoadSerializableEncoder BackedFile SystemIn Memory
LangChain Core
AgentsCachesBaseDispatchWebManagerPromisesChat HistoryContextBaseLangsmithDocumentsEmbeddingsErrorsExample SelectorsIndexingBaseChat ModelsLlmsProfileLoadSerializableMemoryMessagesToolOutput ParsersOpenai FunctionsOpenai ToolsOutputsPrompt ValuesPromptsRetrieversDocument CompressorsRunnablesGraphSingletonsStoresStructured QueryToolsBaseConsoleLog StreamRun CollectorTracer LangchainStreamAsync CallerChunk ArrayContextEnvEvent Source ParseFormatFunction CallingHashJson PatchJson SchemaMathSsrfStreamTestingTiktokenTypesVectorstores
Text Splitters
MCP Adapters
Language
Theme
JavaScript@langchain/coretoolsToolInterface
Interface●Since v1.0

ToolInterface

A special interface for tools that accept a string input, usually defined with the Tool class.

Copy
interface ToolInterface

Bases

StructuredToolInterface<SchemaT, SchemaInputT, ToolOutputT>

Properties

property
description: string

A description of what the function does, used by the model to choose when and how to call the function.

property
extras: Record<string, unknown>

Optional provider-specific extra fields for the tool.

This is used to pass provider-specific configuration that doesn't fit into standard tool fields.

property
lc_namespace: string[]

A path to the module that contains the class, eg. ["langchain", "llms"] Usually should be the same as the entrypoint the class is exported from.

property
lc_serializable: boolean
property
name: string
property
returnDirect: boolean

Whether to return the tool's output directly.

Setting this to true means that after the tool is called, an agent should stop looping.

property
lc_id: string[]
deprecatedproperty
schema: SchemaT

Methods

method
batch→ Promise<RunOutput[]>

Default implementation of batch, which calls invoke N times. Subclasses should override this method if they can batch more efficiently.

method
getName→ string
method
invoke→ Promise<RunOutput>

Method to invoke the document transformation. This method calls the transformDocuments method with the provided input.

method
stream→ Promise<IterableReadableStream<RunOutput>>

Stream output in chunks.

method
transform→ AsyncGenerator<RunOutput>

Default implementation of transform, which buffers input and then calls stream. Subclasses should override this method if they can start producing output while input is still being generated.

deprecatedmethod
call→ Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>>

Inherited fromStructuredToolInterface

Properties

Pdescription: string
—

A description of what the function does, used by the model to choose when and

Pextras: Record<string, unknown>
—

Optional provider-specific extra fields for the tool.

Plc_namespace: ["langchain_core", "callbacks", string]
—

A path to the module that contains the class, eg. ["langchain", "llms"]

Plc_serializable: booleanPname: stringPreturnDirect: boolean
—

Whether to return the tool's output directly.

Pschema: InteropZodType<RunOutput> | Record<string, any>Plc_id: string[]

Methods

Mbatch→ Promise<RunOutput[]>
—

Default implementation of batch, which calls invoke N times.

Mcall→ Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>>MgetName→ stringMinvoke→ Promise<RunOutput>
—

Method to invoke the document transformation. This method calls the

Mstream→ Promise<IterableReadableStream<RunOutput>>
—

Stream output in chunks.

Mtransform→ AsyncGenerator<RunOutput>
—

Default implementation of transform, which buffers input and then calls stream.

Inherited fromRunnableInterface

Properties

Plc_serializable: booleanPlc_id: string[]

Methods

Mbatch→ Promise<RunOutput[]>
—

Default implementation of batch, which calls invoke N times.

MgetName→ stringMinvoke→ Promise<RunOutput>
—

Method to invoke the document transformation. This method calls the

Mstream→ Promise<IterableReadableStream<RunOutput>>
—

Stream output in chunks.

Mtransform→ AsyncGenerator<RunOutput>
—

Default implementation of transform, which buffers input and then calls stream.

Inherited fromSerializableInterface

Properties

Plc_id: string[]
View source on GitHub