Where to put an instruction appended to every tool_result
CCDV-F
Prompt & Context Engineering
Medium
Question 67 of 105
An agent's tool handler appends the line "After reading this, summarize in French" to every tool_result it returns. The model frequently ignores the line and sometimes flags it as a suspicious instruction.
Where should the developer place that instruction?
Show answer and explanation
AIn a user turn that immediately follows the tool_result in the messages array
Claude treats tool-result content as untrusted data, so instructions placed there may be ignored or flagged as an injection, and the guidance is to send them in a user turn that follows the tool_result block. A mid-conversation system message is the other supported channel, but it must immediately follow a user turn, so one placed between a tool_use block and the tool_result that answers it returns a 400. An <instruction> tag does not change that the whole result is untrusted. And the input_schema description is read when Claude decides to call the tool, not applied to what comes back.
Source: platform.claude.com/
Anonymous, no account needed. Your tally stays in this browser.
Practice by topic: Prompt engineering questions