MCP
Result Handling
Normalize and consume MCP tool results.
Anvia normalizes MCP tool results into strings before sending them back to the model.
Text Results
MCP text content is joined together.
{
content: [
{ type: "text", text: "First line." },
{ type: "text", text: "Second line." }
]
}The model receives:
First line.Second line.If you need separators, return them from the MCP server as part of the text.
Structured Results
Some MCP servers return toolResult. Anvia serializes it like normal tool output.
{
toolResult: {
status: "ok",
count: 3
}
}The model receives:
{"status":"ok","count":3}Images and Resources
Image content becomes a data URL.
data:image/png;base64,...Resource content becomes:
data:text/plain;file:///tmp/report.txt:contentsUse these result types only when the downstream model and provider can handle the content meaningfully.
MCP Error Results
If the MCP server returns isError: true, Anvia throws using the text content as the error message.
{
isError: true,
content: [{ type: "text", text: "Access denied." }]
}During an agent run, tool errors are returned to the model as tool result text, the same as local tool errors.
