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
URL to an image that will be downloaded and displayed.
URL to display as a clickable link.
Text content to display.
Raw file data in bytes.
File metadata, including:
mime_type: The MIME type of the file, for exampleimage/png.- Other metadata relevant to the file.
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
Root object defining the tool’s output schema.
Must be
object for tool output schemas.Dictionary of all possible output variables.
Definition of each output variable, including its type and description.