Skip to content

Native tool

Defines the native tool schema.

Key

Defines valid keys in native tool.

NativeTool

Bases: BaseModel

Defines the native tool schema.

Attributes:

Name Type Description
type NativeToolType

The type of the native tool.

kwargs dict[str, Any]

The additional keyword arguments of the native tool.

code_interpreter(**kwargs) classmethod

Create a code interpreter native tool.

Parameters:

Name Type Description Default
**kwargs Any

Additional configuration for the code interpreter native tool.

{}

Returns:

Name Type Description
NativeTool NativeTool

A new code interpreter native tool.

from_str_or_dict(data) classmethod

Create a native tool from a string or a dictionary.

Parameters:

Name Type Description Default
data str | dict[str, Any]

The string or dictionary that represents the native tool.

required

Returns:

Name Type Description
NativeTool NativeTool

A new native tool.

mcp_connector(connector_id, name, auth=None, **kwargs) classmethod

Create a MCP connector native tool.

Parameters:

Name Type Description Default
connector_id str

The ID of the MCP connector.

required
name str

The name of the MCP connector.

required
auth str | OAuthCredentials | Callable[[], Awaitable[str]] | None

The authentication for the MCP connector. Supports the following types: 1. str: A static access token. 2. OAuthCredentials: An OAuth credentials object. 3. Callable[[], Awaitable[str]]: An asynchronous function that returns the access token. Defaults to None.

None
**kwargs Any

Additional configuration for the MCP connector native tool.

{}

Returns:

Name Type Description
NativeTool NativeTool

A new MCP connector native tool.

mcp_server(url, name, allowed_tools=None, **kwargs) classmethod

Create a MCP server native tool.

Parameters:

Name Type Description Default
url str

The URL of the MCP server.

required
name str

The name of the MCP server.

required
allowed_tools list[str] | None

The allowed tools of the MCP server. Defaults to None.

None
**kwargs Any

Additional configuration for the MCP server native tool.

{}

Returns:

Name Type Description
NativeTool NativeTool

A new MCP server native tool.

Create a web search native tool.

Parameters:

Name Type Description Default
**kwargs Any

Additional configuration for the web search native tool.

{}

Returns:

Name Type Description
NativeTool NativeTool

A new web search native tool.