Describe the problem/error/question
Hello,
I have set up an MCP server that retrieves information from a Microsoft SQL Server database. It works perfectly for text data.
However, I am having trouble returning images. In my SQL Server (2022) database, the field type is “Image”. My sub-workflow correctly returns a JSON object to my MCP server as follows:
[{
"Photo":
{
"type":
"Buffer",
"data": [255,216,255,225,xxxxx,14]
}
}
]
What is the error message (if any)?
OpenWebUi ask to MCP and get Json but show that it can’t display it. Is there a way ton convert it ?
Thanks
Sorry I’m just starting N8N, but where should I use this python script ?
I’ve added Javascript Convertion to my workflow. It returns now in openwebui :
{
“results”: [
{
“Photo”: “/9j/4Q4vRXhpZgAASUkqAAgAAAAOAAABAwABAAAAzxxxxx”
}
]
}
But openwebui won’t display it
I’ve do exactly the same in python FastMCP serv and it works
@mcp.tool()
def get_employe_picture(employee_id: str) -> ImageContent:
"""
Retourne la photo d'un employé au format Image MCP par son employee_id.
Ce tool nécessite un employee_id obtenu via rechercher_employe.
"""
logging.info("get_employe_picture called" + " " + employee_id)
photo_bytes = tools.get_employee_photo(employee_id)
if photo_bytes is None:
raise ValueError(f"Aucune photo trouvée pour l'employé {employee_id}")
image = Image(
data=photo_bytes,
format="png" # adapte si nécessaire : "jpeg", "webp", etc.
)
# Conversion explicite en ImageContent MCP
return image.to_image_content()