你去餐厅点菜,你希望菜单上有菜名、价格、配料表,而不是服务员说「那个……就是挺好吃的那个……你懂的」。Structured Tool Output就是让工具返回「正经菜单」而不是「你懂的」——有明确的字段、类型和格式,Agent一看就知道怎么用。
// 非结构化输出 (不友好)
"搜索结果:找到了3篇文章,第一篇是关于MCP的,
发表在2026年6月,作者是张三,链接是https://..."
// 结构化输出 (友好)
{
"results": [
{
"title": "MCP协议详解",
"author": "张三",
"date": "2026-06-10",
"url": "https://example.com/mcp",
"summary": "本文详细介绍了MCP协议..."
}
],
"total": 3,
"page": 1
}# MCP协议定义了标准的工具输出格式
{
"content": [
{"type": "text", "text": "结果文本"},
{"type": "image", "data": "base64...", "mimeType": "image/png"}
],
"isError": false
}
# 在SKILL.md中定义工具输出Schema
{
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"title": {"type": "string"},
"url": {"type": "string"},
"snippet": {"type": "string"}
}
}
},
"total": {"type": "integer"}
}
}