Overview
A tool returns its results as messages and variables. This page covers the message interfaces, variable creation, and output schema definitions.Message Types
Return different types of messages such as text, links, images, and JSON
Variables
Create and manipulate variables for workflow integration
Output Schema
Define custom output variables for workflow references
Data Structure
Message Return
Dify supports several message types—text, links, images, file blobs, and JSON—each returned through a dedicated interface. By default, a tool’s output in a workflow includes three fixed variables:files, text, and json. The methods below populate these variables.
Message Types
Parameters
Parameters
string
required
URL to an image that will be downloaded and displayed.
string
required
URL to display as a clickable link.
string
required
Text content to display.
bytes
required
Raw file data in bytes.
dict
File metadata, including:
mime_type: The MIME type of the file, for exampleimage/png.- Other metadata relevant to the file.
dict
required
Python dictionary to serialize as JSON.
Variables
Parameters
Parameters
Custom Output Variables
To reference a tool’s output variables in a Workflow application, declare which variables the tool might output using JSON Schema in the tool’s manifest.Define Output Schema
Schema Structure
Schema Structure