> ## Documentation Index
> Fetch the complete documentation index at: https://langchain-5e9cc07a-preview-fjmorr-1775764099-0906e2d.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Use tools in a prompt

Tools allow language models to interact with external systems and perform actions beyond just generating text. In the Playground, you can use two types of tools:

1. [**Built-in tools**](#built-in-tools): Pre-configured tools provided by model providers (like OpenAI and Anthropic) that are ready to use. Use built-in tools when you need common capabilities like web search or code interpretation.
2. [**Custom tools**](#create-a-custom-tool): Functions you define to perform specific tasks. These are useful when you need to integrate with your own systems or create specialized functionality. When you define custom tools within the Playground, you can verify that the model correctly identifies and calls these tools with the correct arguments.

When you create a custom tool, you can save it to the current prompt only, or save it directly to the workspace-wide [tool registry](#manage-tools-with-the-registry). Saving to the registry also adds the tool to the current prompt.

## Built-in tools

The Playground has native support for a variety of tools from OpenAI and Anthropic. If you want to use a tool that isn't explicitly listed in the Playground, you can still add it by manually specifying its `type` and any required arguments.

### OpenAI tools

* **Web search**: [Search the web for real-time information](https://platform.openai.com/docs/guides/tools-web-search?api-mode=responses).
* **Image generation**: [Generate images based on a text prompt](https://platform.openai.com/docs/guides/tools-image-generation).
* **MCP**: [Gives the model access to tools hosted on a remote MCP server](https://platform.openai.com/docs/guides/tools-remote-mcp).
* [View all OpenAI tools](https://platform.openai.com/docs/guides/tools?api-mode=responses).

### Anthropic tools

* **Web search**: [Search the web for up-to-date information](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool).
* [View all Anthropic tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview).

## Add and use tools

The Playground lets you quickly [add tools](#add-a-tool) to any prompt with a single click. You can choose from built-in tools provided by model providers like OpenAI and Anthropic, or define your own [custom tools](#create-a-custom-tool) tailored to your specific needs. Custom tools are saved to the current prompt by default. You can save them to the workspace-wide [tool registry](#manage-tools-with-the-registry) to reuse them across prompts without recreating them.

### Add a tool

To add a tool to your prompt, click the **+ Tool** button at the bottom of the prompt editor.

<img className="block dark:hidden" src="https://mintcdn.com/langchain-5e9cc07a-preview-fjmorr-1775764099-0906e2d/-l9tUOffojHmETfq/langsmith/images/add-tool-light.png?fit=max&auto=format&n=-l9tUOffojHmETfq&q=85&s=2fd34107ff9cf1be8df85ae983116323" alt="The prompt interface with the + Tool button following the editing boxes." width="644" height="316" data-path="langsmith/images/add-tool-light.png" />

<img className="hidden dark:block" src="https://mintcdn.com/langchain-5e9cc07a-preview-fjmorr-1775764099-0906e2d/-l9tUOffojHmETfq/langsmith/images/add-tool-dark.png?fit=max&auto=format&n=-l9tUOffojHmETfq&q=85&s=611b28b51127076afd5a98097051c5ba" alt="The prompt interface with the + Tool button following the editing boxes." width="642" height="311" data-path="langsmith/images/add-tool-dark.png" />

### Use a built-in tool

1. In the tool section, select the built-in tool you want to use. You'll only see the tools that are compatible with the provider and model you've chosen.
2. When the model calls the tool, the Playground will display the response.

   <img src="https://mintcdn.com/langchain-5e9cc07a-preview-fjmorr-1775764099-0906e2d/LrNjOlqsWhfPELWc/langsmith/images/web-search-tool.gif?s=3be62763f7359b7db0af8f046265314d" alt="Web search tool" width="1036" height="720" data-path="langsmith/images/web-search-tool.gif" />

### Create a custom tool

To create a custom tool, you'll need to provide:

* **Name**: A descriptive name for your tool.
* **Description**: Clear explanation of what the tool does.
* **Arguments**: The inputs your tool requires.

<img src="https://mintcdn.com/langchain-5e9cc07a-preview-fjmorr-1775764099-0906e2d/bUUFVjm7pHEaiOMj/langsmith/images/custom-tool.gif?s=1291a739536b85965517a2e9ff3240e2" alt="Custom tool" width="1028" height="720" data-path="langsmith/images/custom-tool.gif" />

When running a custom tool in the Playground, the model will respond with a JSON object containing the tool name and the tool call.

<img src="https://mintcdn.com/langchain-5e9cc07a-preview-fjmorr-1775764099-0906e2d/64vC5oh80E6FqKd7/langsmith/images/tool-call.png?fit=max&auto=format&n=64vC5oh80E6FqKd7&q=85&s=ce06b58ee1c75560cefe3a0d113aa0c0" alt="Tool call" width="1488" height="747" data-path="langsmith/images/tool-call.png" />

### Manage tools with the registry

The Playground includes a [workspace](/langsmith/administration-overview#workspaces)-scoped **tool registry** for saving and reusing tools across prompts and sessions. When you create a custom tool, you can save it to the current prompt only, or save it directly to the registry. Saving to the registry also adds the tool to the current prompt.

Click the **+ Tool** button in the Playground to open **Manage tools**. From the **Available Tools** tab, you can:

* Click **+** in the tools list to create a new tool.
* Click **Add from registry** to add an existing registry tool to the current prompt.
* Click a tool in the list to view and edit it.

Registry tools are identified by a key icon in the tools list and display a **Workspace registry tool** badge when selected. The available actions depend on whether a tool is prompt-local or saved to the registry:

* **Prompt-local tools**: Click **Add to Registry** to save the tool to the workspace registry, or **Delete** to remove it from the current prompt.

  <img className="block dark:hidden" src="https://mintcdn.com/langchain-5e9cc07a-preview-fjmorr-1775764099-0906e2d/mZ0eB4e1igvgCyX6/langsmith/images/prompt-local-tool-light.png?fit=max&auto=format&n=mZ0eB4e1igvgCyX6&q=85&s=708fa79d22db0c319d3f4b71ec20f8e6" alt="Manage tools dialog showing a prompt-local tool with Add to Registry and Delete buttons." width="801" height="902" data-path="langsmith/images/prompt-local-tool-light.png" />

  <img className="hidden dark:block" src="https://mintcdn.com/langchain-5e9cc07a-preview-fjmorr-1775764099-0906e2d/mZ0eB4e1igvgCyX6/langsmith/images/prompt-local-tool-dark.png?fit=max&auto=format&n=mZ0eB4e1igvgCyX6&q=85&s=735d238aa4b3f62822c523180cd70336" alt="Manage tools dialog showing a prompt-local tool with Add to Registry and Delete buttons." width="795" height="900" data-path="langsmith/images/prompt-local-tool-dark.png" />

* **Registry tools**: Click **Remove from prompt** to detach the tool from the current prompt without affecting the registry, **Duplicate for this prompt** to create a prompt-local copy independent of the registry version, or **Delete from registry** to remove it from the workspace registry entirely.

  <img className="block dark:hidden" src="https://mintcdn.com/langchain-5e9cc07a-preview-fjmorr-1775764099-0906e2d/64vC5oh80E6FqKd7/langsmith/images/tool-registry-manage-light.png?fit=max&auto=format&n=64vC5oh80E6FqKd7&q=85&s=357f61a7dffe16389324504cb5676893" alt="Manage tools dialog showing the tools list with registry tools marked by a key icon, and tool editing options." width="801" height="900" data-path="langsmith/images/tool-registry-manage-light.png" />

  <img className="hidden dark:block" src="https://mintcdn.com/langchain-5e9cc07a-preview-fjmorr-1775764099-0906e2d/64vC5oh80E6FqKd7/langsmith/images/tool-registry-manage-dark.png?fit=max&auto=format&n=64vC5oh80E6FqKd7&q=85&s=1edf937cd5a44df616187eb1dbf37309" alt="Manage tools dialog showing the tools list with registry tools marked by a key icon, and tool editing options." width="796" height="885" data-path="langsmith/images/tool-registry-manage-dark.png" />

## Tool choice settings

Some models provide control over which tools are called. To configure this:

1. Select **+ Tool** under the prompt editor.
2. Navigate to the **Tool Choice Setting** tab.
3. Select your tool choice.

To understand the available tool choice options, check the documentation for your specific provider. For example, [OpenAI's documentation on tool choice](https://platform.openai.com/docs/guides/function-calling/function-calling-behavior?api-mode=responses#tool-choice).

<img className="block dark:hidden" src="https://mintcdn.com/langchain-5e9cc07a-preview-fjmorr-1775764099-0906e2d/64vC5oh80E6FqKd7/langsmith/images/tool-choice-light.png?fit=max&auto=format&n=64vC5oh80E6FqKd7&q=85&s=374f994945318e0d2f98b3238dee393b" alt="Select tools from the Tool Choice Settings tab." width="1732" height="1156" data-path="langsmith/images/tool-choice-light.png" />

<img className="hidden dark:block" src="https://mintcdn.com/langchain-5e9cc07a-preview-fjmorr-1775764099-0906e2d/64vC5oh80E6FqKd7/langsmith/images/tool-choice-dark.png?fit=max&auto=format&n=64vC5oh80E6FqKd7&q=85&s=031ba58a674a3a7830016d9c22304c42" alt="Select tools from the Tool Choice Settings tab." width="1724" height="1118" data-path="langsmith/images/tool-choice-dark.png" />

***

<div className="source-links">
  <Callout icon="edit">
    [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/langsmith/use-tools.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>

  <Callout icon="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>
</div>
