Tools

This section describes the tools functionality in the Dify client.

Tool Providers

class ToolProvider

Base class for tool providers.

classmethod create(client: DifyBaseClient, id: str, type: Literal['workflow', 'builtin']) ToolProvider

Factory method to create a tool provider.

property tool_info

Get tool provider information.

class WorkflowToolProvider

Provider for workflow-based tools.

property info WorkflowToolProviderInfo

Get workflow tool provider information.

property tools list[WorkflowTool]

Get list of workflow tools.

class BuiltinToolProvider

Provider for built-in tools.

property tools list[BuiltinTool]

Get list of built-in tools.

property tools_info dict[str, ToolInfo]

Get information about all tools.

update_credentials(credentials: dict)

Update provider credentials.

Tools

class Tool

Base class for tools.

classmethod create(client: DifyBaseClient, provider: ToolProvider, name: str, mode: Literal['workflow', 'builtin']) Tool

Factory method to create a tool.

property info ToolInfo

Get tool information.

class WorkflowTool

Workflow-based tool implementation.

property workflow_app_id str

Get associated workflow app ID.

property info ToolInfo

Get tool information.

class BuiltinTool

Built-in tool implementation.

property info ToolInfo

Get tool information.

Data Models

class ToolInfo

Information about a tool.

author: str
Tool author
name: str
Tool name
label: Union[dict, str]
Display label
description: Union[dict, str]
Tool description
parameters: list[ToolParameter]
Tool parameters
labels: list[str]
Tool labels
class ToolParameter

Tool parameter configuration.

name: str
Parameter name
label: Union[dict, str]
Display label
human_description: Optional[Union[dict, str]]
Human-readable description
placeholder: Optional[Union[dict, str]]
Placeholder text
type: Literal["string", "number", "boolean", "select", "file", "files", "secret-input"]
Parameter type
form: Literal["llm", "form"]
Form type
llm_description: Optional[str]
Description for LLM
required: bool
Whether parameter is required
class WorkflowToolProviderInfo

Information about a workflow tool provider.

name: str
Provider name
label: str
Display label
workflow_tool_id: Optional[str]
Tool ID
workflow_app_id: str
Associated workflow app ID
description: str
Provider description
parameters: list[WorkflowToolParameter]
Tool parameters