Skip to main content


Tools are interfaces that an agent can use to interact with the world. They combine a few things:

  1. The name of the tool
  2. A description of what the tool is
  3. Schema of what the inputs to the tool are
  4. The function to call
  5. Whether the result of a tool should be returned directly to the user

It is useful to have all this information because this information can be used to build action-taking systems! The name, description, and Schema can be used the prompt the LLM so it knows how to specify what action to take, and then the function to call is equivalent to taking that action.

The simpler the input to a tool is, the easier it is for an LLM to be able to use it. Many agents will only work with tools that have a single string input. For a list of agent types and which ones work with more complicated inputs, please see this documentation

Importantly, the name, description, and schema (if used) are all used in the prompt. Therefore, it is really important that they are clear and describe exactly how the tool should be used. You may need to change the default name, description, or schema if the LLM is not understanding how to use the tool.

Default Tools

Let's take a look at how to work with tools. To do this, let's look at a built in tool that takes a simple string input:

import { WikipediaQueryRun } from "@langchain/community/tools/wikipedia_query_run";

const tool = new WikipediaQueryRun({
topKResults: 1,
maxDocContentLength: 100,




A tool for interacting with and fetching data from the Wikipedia API.

const res = await tool.invoke("Langchain");


Page: LangChain
Summary: LangChain is a framework designed to simplify the creation of applications

You can define more complex StructuredTools as well that require object inputs with several different parameters.

Help us out by providing feedback on this documentation page: