Tips // Claude in practice

Tips for working better with Claude

One short tip at a time, with an example you can copy. Move through them at random or search for what you need.

MCPIntermediateMCP

In an MCP tool, "no results" is not the same as "failed"

If a search that failed returns an empty list, the agent concludes there is no data and does not retry: separate the two cases.

A valid empty result means the search ran fine and nothing matched. A failure (timeout, permissions) has to be flagged with isError and a category, so the agent knows whether to retry, change the query or escalate. A generic "Operation failed" gives it nothing to decide with. Include what was attempted and, if there are any, partial results.

Example
No matches (success):
{"results": []}

Failure (error):
{"isError": true, "content": {"errorCategory": "transient", "isRetryable": true, "message": "Timeout querying orders", "attempted_query": "order_id=12345"}}
#errors#tools#tool-design