Skip to content

Native tool

Defines the native tool schema.

Authors

Henry Wicaksono (henry.wicaksono@gdplabs.id)

References

NONE

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_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.