Loading...
Loading...
Compare original and translation side by side
db_*web_*db_*web_*list_userslist_eventscreate_eventschedule_eventlist_userslist_eventscreate_eventschedule_eventget_customercreate_ordercustomer_idididentifierget_customercreate_ordercustomer_idididentifierServerName:tool_nameundefinedServerName:tool_nameundefined
Without the server prefix, agents may fail to locate tools when multiple MCP servers are available. Establish naming conventions that include server context in all tool references.
如果没有服务器前缀,当存在多个MCP服务器时,Agent可能无法定位工具。建立包含服务器上下文的命名规范,并在所有工具引用中遵循该规范。def optimize_tool_description(tool_spec, failure_examples):
"""
Use an agent to analyze tool failures and improve descriptions.
Process:
1. Agent attempts to use tool across diverse tasks
2. Collect failure modes and friction points
3. Agent analyzes failures and proposes improvements
4. Test improved descriptions against same tasks
"""
prompt = f"""
Analyze this tool specification and the observed failures.
Tool: {tool_spec}
Failures observed:
{failure_examples}
Identify:
1. Why agents are failing with this tool
2. What information is missing from the description
3. What ambiguities cause incorrect usage
Propose an improved tool description that addresses these issues.
"""
return get_agent_response(prompt)def optimize_tool_description(tool_spec, failure_examples):
"""
Use an agent to analyze tool failures and improve descriptions.
Process:
1. Agent attempts to use tool across diverse tasks
2. Collect failure modes and friction points
3. Agent analyzes failures and proposes improvements
4. Test improved descriptions against same tasks
"""
prompt = f"""
Analyze this tool specification and the observed failures.
Tool: {tool_spec}
Failures observed:
{failure_examples}
Identify:
1. Why agents are failing with this tool
2. What information is missing from the description
3. What ambiguities cause incorrect usage
Propose an improved tool description that addresses these issues.
"""
return get_agent_response(prompt)def get_customer(customer_id: str, format: str = "concise"):
"""
Retrieve customer information by ID.
Use when:
- User asks about specific customer details
- Need customer context for decision-making
- Verifying customer identity
Args:
customer_id: Format "CUST-######" (e.g., "CUST-000001")
format: "concise" for key fields, "detailed" for complete record
Returns:
Customer object with requested fields
Errors:
NOT_FOUND: Customer ID not found
INVALID_FORMAT: ID must match CUST-###### pattern
"""def search(query):
"""Search the database."""
passdef get_customer(customer_id: str, format: str = "concise"):
"""
根据ID检索客户信息。
使用场景:
- 用户询问特定客户的详细信息
- 决策时需要客户上下文
- 验证客户身份
参数:
customer_id:格式为"CUST-######"(例如:"CUST-000001")
format:"concise"表示仅返回关键字段,"detailed"表示返回完整记录
返回:
包含请求字段的客户对象
错误:
NOT_FOUND:客户ID不存在
INVALID_FORMAT:ID必须符合CUST-######格式
"""def search(query):
"""Search the database."""
passxvalparam1ididentifiercustomer_idsearchServerName:tool_nameoptionsxvalparam1ididentifiercustomer_idsearchServerName:tool_nameoptions