A Tool Is Like a Button on a Remote
Ideally a tool you give an Agent is like a button on a remote: you can tell what it does at a glance, and pressing it does just one thing.
Single Responsibility: One Tool Does One Thing
Don't build a "Swiss Army knife" tool. Cram too many functions into one tool and the model struggles to tell when to use it and how to fill in the parameters.
# 不好:一个工具啥都干
def handle_user(action, data): ...
# 好:拆成单一职责
def get_user(user_id: str) -> dict:
"""按用户 ID 查询用户资料。"""
...
def update_user_email(user_id: str, email: str) -> bool:
"""更新指定用户的邮箱。"""
...The Description Is the Manual the Model Reads
The model decides when to call a tool based on its name + description. Write the description clearly and call accuracy jumps right up.
def send_invoice(order_id: str) -> str:
"""给指定订单生成并发送发票。仅在用户明确要发票时调用。"""
...自测 · 学完检查一下
想真正动手做题、记进度、攒连胜?到互动课里练。
What's the benefit of a "single-responsibility" tool?
答案:Clearer purpose and parameters, so the model picks better
A tool that does just one thing makes it easier for the model to judge when to use it and how to fill in the parameters.
Judge: stuffing multiple functions into one "all-purpose tool" helps the model use it more accurately.
答案:False
Piling functions together actually makes it harder for the model to judge when to use it and how to fill in parameters—split into single responsibilities.
Judge: is the tool below well designed?
def do(t, v):
return run(t, v)答案:Not well
The name `do` and parameters `t`/`v` reveal no meaning, and there's no description—the model has no basis to judge when to call it.
Which tool definition best meets the standard of a "good tool"?
答案:def get_order_status(order_id: str) -> str: Query the current status of a given order.
A clear name, single responsibility, meaningful parameters, and a description that states the purpose—that's a good tool.
The model mainly relies on a tool's name and ___ to decide when to call it.
答案:description
Name plus description is the manual the model reads; write it clearly and it calls accurately.
Judge: if a vague tool description leads to misuse, the problem is mainly in the tool design, not the model.
答案:True
The description is the manual for the model; if the manual is vague, the fault for a wrong call lies with the designer.