Specify parameters, results and allowed states for each tool.
Understand the method
A tool contract defines capability, input and evidence of the result. save_draft stores a draft and returns its identifier and status; it does not have sending permission. Task identifiers must be checked against the current user’s access rather than accepted blindly.
Store a proposed action separately from execution facts. planned means intended, running means executing, and succeeded requires a receipt. unknown after a timeout requires a status lookup. Log necessary identifiers and errors without credentials, full customer records or private contacts.
- 1Check access
- 2Record intent
- 3Call tool
- 4Verify result
Included material
Rehearsal contract: save_draft({taskId, text, idempotencyKey}) → {draftId, status}. A key binds to the same task and content; do not reuse it for changed content.Work through the steps
- Write contracts for read_feedback, classify and save_draft.
- Record a plan before each call and update it from the receipt.
- Rehearse a repeated save with the same key and verify one logical draft.
Worked example
taskId: feedback-week-01
operation: save_draft
idempotencyKey: feedback-week-01-draft-v1
state: planned → running → succeeded
receipt: {draftId: "rehearsal-draft-01", status: "saved"}
Mode: MANUAL REHEARSAL, not a live tool receipt.Your exercise
If a paragraph changes, should you keep the v1 idempotency key? Write the new version record and explain why.
Check before delivery
- The tool contract does not implicitly grant sending or deletion.
- Rehearsal results are clearly distinct from live receipts.
Finish the exercise, then view the reference
Changed content needs a v2 operation with a new key and a relation to v1. Reusing a key with different content should conflict rather than silently overwrite.
An original course with teaching exercises. Reading records, practice outcomes and independent certification are distinct.