Tools

Tool Definition

Tools can extend the capabilities of LLMs (Language Learning Models), such as performing web searches, scientific calculations, or generating images, thereby enhancing the LLM's ability to connect with the external world. Dify provides two types of tools: First-party Tools and Custom Tools.

You can directly use the first-party built-in tools provided by the Dify ecosystem, or easily import custom API tools (currently supporting OpenAPI / Swagger and OpenAI Plugin specifications).

Functions of Tools:

  1. Tools allow users to create more powerful AI applications on Dify. For example, you can arrange suitable tools for an intelligent assistant application (Agent) that can complete complex tasks through task reasoning, step-by-step breakdown, and tool invocation.

  2. They facilitate connecting your application with other systems or services and interacting with the external environment, such as code execution or access to proprietary information sources.

How to Configure First-party Tools

Dify currently supports:

We welcome you to contribute your developed tools to Dify. For detailed methods on how to contribute, please refer to the Dify Development Contribution Documentation. Your support is invaluable to us.

First-party Tool Authorization

If you need to use the first-party built-in tools provided by the Dify ecosystem, you need to configure the corresponding credentials before using them.

Once the credentials are successfully verified, the tool will display an "Authorized" status. After configuring the credentials, all members in the workspace can use this tool when arranging applications.

How to Create Custom Tools

You can import custom API tools in the "Tools - Custom Tools" section, currently supporting OpenAPI / Swagger and ChatGPT Plugin specifications. You can directly paste the OpenAPI schema content or import it from a URL. For the OpenAPI / Swagger specification, you can refer to the official documentation.

Currently, tools support two authentication methods: No Authentication and API Key.

After importing the schema content, the system will automatically parse the parameters in the file, and you can preview the specific parameters, methods, and paths of the tool. You can also test the tool parameters here.

Once the custom tool is created, all members in the workspace can use this tool when arranging applications in the "Studio."

Cloudflare Workers

You can also use dify-tools-worker to quickly deploy custom tools. This tool provides:

  • Routes that can be imported into Dify https://difytoolsworker.yourname.workers.dev/doc, offering an OpenAPI-compatible interface documentation.

  • API implementation code that can be directly deployed to Cloudflare Workers.

How to Use Tools in Applications

Currently, you can use the configured tools when creating intelligent assistant applications in the "Studio."

For example, after adding tools in a financial analysis application, the intelligent assistant will autonomously invoke tools when needed to query financial report data, analyze the data, and complete the conversation with the user.

Last updated