Home
Use tools
Get tool definitions

Get Formatted Tool Definitions

When calling tools directly, it can be useful to get tool definitions in a specific model provider's format. The Arcade Client provides methods for getting a tool's definition and also for listing the definitions of multiple tools in a specific model provider's format.

For a complete list of supported model providers, see the model integrations page.

Get a single tool definition formatted for a model

It can be useful to get a tool's definition in a specific model provider's format. For example, you may want to get the Github.SetStarred tool's definition in OpenAI's format.

To do this, you can use the client.tools.formatted.get method and specify the tool name and format.

from arcadepy import Arcade
 
client = Arcade()
 
# Get a specific tool formatted for OpenAI
github_star_repo = client.tools.formatted.get(
    tool_id="Github.SetStarred", format="openai"
)
 
print(github_star_repo)

Get all tool definitions in a toolkit formatted for a model

It can be useful to list tool definitions for a toolkit in a specific model provider's format. For example, you may want to get the definitions of tools in the Github toolkit in OpenAI's format.

To do this, you can use the client.tools.formatted.list method and specify the toolkit and format. Since this method returns an iterator of pages, you can cast to a list to get all the tools.

from arcadepy import Arcade
 
client = Arcade()
 
# Get all tools in the Github toolkit formatted for OpenAI
github_tools = list(client.tools.formatted.list(format="openai", toolkit="github"))
 
# Print the number of tools in the Github toolkit
print(len(github_tools))

Get all tool definitions formatted for a model

To get all tools formatted for OpenAI, you can use the client.tools.formatted.list method without specifying a toolkit.

from arcadepy import Arcade
 
client = Arcade()
 
 
# Get all tools formatted for OpenAI
all_tools = list(client.tools.formatted.list(format="openai"))
 
# Print the number of tools
print(len(all_tools))