Context
Tools with multiple parameter options that have different costs.
Problem
Agents don't know which approach is faster or cheaper.
Solution
Include performance guidance:
- Prefer X: "conversation_id is faster than channel_name"
- Use Y for batch: "For multiple items, use batch_get"
- Warn about cost: "Large exports may take minutes"
- Prefer X: "conversation_id is faster than channel_name"
- Use Y for batch: "For multiple items, use batch_get"
- Warn about cost: "Large exports may take minutes"
Examples
Python
@tool
def get_messages(
conversation_id: str | None = None,
channel_name: str | None = None # Note in docs
) -> list[Message]:
"""Get messages from a conversation.
Args:
conversation_id: Direct ID (faster, preferred)
channel_name: Channel name (requires lookup)
Performance: Prefer conversation_id when available.
""" Considerations
- Be specific about why one approach is better
- Include performance notes in tool description
- Consider separate tools for bulk vs single operations
- When tool evaluation shows LLM adherence to the performance hint is flaky, consider applying prompt engineering techniques in the tool description