passdrill
AI & LLM Engineering · AI Agents & Tool Use · Card 012/012 hard

Using Anthropic's Claude API tool use, a developer defines a `get_weather` tool and sends a user's question. Claude's response contains a content block requesting that tool be called, along with a unique identifier for that specific request. The developer's code runs the weather lookup and needs to send the result back to Claude in a follow-up request so Claude can use it to answer. How must that result be returned according to Claude's tool-use API?

  1. As a new message containing a content block whose type marks it as the tool's result and whose identifier matches the unique identifier from Claude's original tool-call block, so Claude can associate the result with the specific request it made
  2. As plain unstructured text appended to the end of the original user question, with no reference back to which tool call it answers, since Claude infers the link automatically from message order alone
  3. As a modification to the original request that already contained the tool definitions, replacing the tool's description with the looked-up weather value
  4. As a system-level instruction rather than as part of the conversation's messages, since tool results are not permitted to appear inside user or assistant messages
Next card → Shuffle