Replies: 2 comments 5 replies
-
|
Hi @Area-Ivy! I'm Dosu and I’m helping the dify team. To make your custom tool output valid files in Dify, you need to handle both the backend response and the output schema correctly: Backend Implementation: Output Schema: {
"type": "object",
"properties": {
"attachments": {
"type": "arrayFile",
"description": "Supporting files"
}
}
}This schema ensures the frontend and backend recognize and display file outputs properly reference. Common Pitfalls:
Checklist:
If you follow these steps, your custom tool's To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
|
I see the confusion - the previous examples were for internal tools. For an external HTTP service, here's what you actually need: Quick Implementation Guide1. External Service Response Format: Your HTTP endpoint must return a JSON response with file metadata in this structure: {
"attachments": [
{
"dify_model_identity": "dify__file",
"transfer_method": "REMOTE_URL",
"related_id": "file_id_123",
"filename": "output.pdf",
"extension": ".pdf",
"mime_type": "application/pdf",
"url": "https://your-service.com/files/file_id_123?token=abc"
}
]
}2. Define Output Schema in Dify: When creating your custom tool, define the output schema as: {
"type": "object",
"properties": {
"attachments": {
"type": "arrayFile",
"description": "Generated files"
}
}
}3. Key Points for External Services:
4. Testing:
Common Issues:
This approach works for ANY external HTTP service without any Dify SDK dependencies. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Self Checks
1. Is this request related to a challenge you're experiencing? Tell me about your story.
When I try to use a custom tool and make it output a file, the files field in the output is always empty ("files": []). How can I make it work properly? Could you explain how I should implement my backend program and define the schema so that the file output is handled correctly?
2. Additional context or comments
No response
Beta Was this translation helpful? Give feedback.
All reactions