promptdojo_

Write extract_text_and_tools(response) that takes a response object (real anthropic.types.Message OR a MockMessage with matching attribute access) and returns a tuple (text_parts, tool_calls):

  • text_parts is a list of strings, one per text block in response.content, in order.
  • tool_calls is a list of dicts, one per tool_use block, each shaped {"id": ..., "name": ..., "input": ...}.

Iterate response.content, branch on block.type, build both lists. Skip blocks whose type is neither "text" nor "tool_use" (forward-compat for thinking blocks — they exist but you don't need them here).

The script will run two cases. Expected output:

text=['Let me look that up.'] tools=[{'id': 'toolu_01', 'name': 'search', 'input': {'q': 'ramen'}}]
text=['Found a 2026 guide.', 'Hope this helps!'] tools=[]

this step needs the editor

on desktop today; in the app (coming soon). save your spot and we'll bring you back here when you're ready.

open this same url on a laptop to keep going today.