3.2 工具 Schema 与四件套设计
工具好不好用,一半在实现,一半在"说明书"。这一节先讲怎么写说明书(Schema),再逐个拆解编码 Agent 的最小工具集:read / write / edit / bash 四件套的设计考量。

Schema:写给模型看的说明书
Schema 用 JSON Schema 格式描述工具叫什么、干什么、要什么参数:
python
{
"type": "function",
"function": {
"name": "read_file",
"description": "读取一个文本文件的完整内容",
"parameters": {
"type": "object",
"properties": {
"path": {"type": "string", "description": "文件路径"},
},
"required": ["path"],
},
},
}模型"决定用哪个工具"的全部依据就是这份说明书,它看不到你的函数实现。所以 Schema 质量直接决定工具的被使用质量,几条经验规则: