Loading...
Loading...
Compare original and translation side by side
ServerName:tool_nameundefinedServerName:tool_nameundefined
Without the server prefix, agents may fail to locate tools, especially when multiple MCP servers are available. Establish naming conventions that include server context in all tool references.
如果没有服务器前缀,Agent可能无法定位工具,尤其是在存在多个MCP服务器的情况下。建立在所有工具引用中包含服务器上下文的命名规范。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):
"""
使用Agent分析工具失败情况并改进描述。
流程:
1. Agent尝试在不同任务中使用工具
2. 收集失败模式和痛点
3. Agent分析失败并提出改进建议
4. 在相同任务中测试改进后的描述
"""
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."""
pass