Tool support depends on the specific AI provider and model. Check your
provider’s documentation for compatibility.
Enabling Tools in a Prompt
To make tools available to your prompt, list them under thetools
key in the prompt’s configuration block (---
).
Built-in Latitude Tools
Latitude provides several powerful built-in tools that you can enable directly:latitude/search
: Performs web searches to find up-to-date information.latitude/code
: Executes code snippets.latitude/extract
: Extracts structured data from text.
latitude/search
) in the tools
list.
Learn more about using Latitude Tools.
Defining Custom Tools
For capabilities beyond the built-in tools, you can define your own custom tools. When the model decides to use a custom tool, Latitude will request its execution from your application via the SDK. Define custom tools directly within the configuration block, outside the maintools
list:
description
: A clear explanation for the AI model of what the tool does.parameters
: A JSON Schema defining the expected input arguments for the tool.
Handling Custom Tool Calls
When the AI model decides to useget_stock_price
, the Latitude SDK in your application will receive a tool call request. Your code needs to:
- Execute the actual logic (e.g., call a financial API).
- Return the result back to Latitude.
JSON Schema for Parameters
Tool parameters must be defined using JSON Schema to specify their structure, types, and requirements. This helps the model understand how to call the tool correctly. Key schema components:type
:object
,string
,number
,integer
,boolean
,array
.description
: Essential for explaining parameters to the model.properties
(forobject
type): Defines nested parameters.required
(forobject
type): Lists mandatory properties.enum
(forstring
,number
): Specifies allowed values.items
(forarray
type): Defines the schema for array elements.
Tools without Parameters
If you want to define a tool without parameters, for example a tool that generates a random number, you can omit the parameters key. However, providers such as Anthropic or Google, always requires parameters. In this case, the best option is to define an empty object as parameters:Next Steps
- Explore Latitude’s Built-in Tools in more detail.
- Learn how to build powerful Agents that leverage tools.
- Test tool interactions in the Playground.