Many models support the use of external tools to enrich data or provide additional context. These tools can be used to call external APIs, run custom scripts, or perform any other operation that can be defined in code.

The definitions of these tools are passed into the model as part of the prompt, making the model aware of their functionality. This allows the model to call the tool when needed via a structured response.

Tools

Tool definitions in Prompt Foundry are independent of prompt definitions. This means you can define a tool once and use it across multiple prompts, allowing you to iterate on the tool separately from the prompts.

These tools are managed in the Tools section of the platform.

Tool Definition

The tool definition follows a JSON schema with the following properties:

PropertyDescription
nameThe name of the tool.
descriptionA detailed description of the tool’s purpose and functionality, helping guide when the model should call the tool.
parametersThe available input parameters for the tool call. Each parameter should have a detailed description and type so the model understands the structure and data required to call the tool.

Here is an example of a tool definition for a tool that gets the current weather:

get_current_weather
{
  "name": "get_current_weather",
  "description": "Get the current weather",
  "parameters": {
    "type": "object",
    "properties": {
      "location": {
        "type": "string",
        "description": "The city and state, e.g. San Francisco, CA"
      },
      "format": {
        "type": "string",
        "enum": ["celsius", "fahrenheit"],
        "description": "The temperature unit to use. Infer this from the users location."
      }
    },
    "required": ["location", "format"]
  }
}

Using Tools

To use the tool within your prompt, click the model tools button in the prompt editor. This will open a modal where you can select the tools you want to enable for your prompt.

Tool Choice

Tool choice allows you to provide additional guidance to the model on when to use the tool.

ValueDescription
autoEnables the model to call the tool whenever it deems necessary.
requiredRequires the model to use a tool in its response, but does not specify which one. This is useful when you want the model to choose between multiple actions to perform next.
<TOOL_NAME>Specifies a particular tool by