docs(tool-design): require advertised prerequisites, served-schema parity and producer-owned recovery (#15344)

This commit is contained in:
morluto authored and GitHub committed 2026-11-30 18:25:39 -05:00
1 parent 4b19f283d3
commit 4bd5f2eaef
1 file changed
+31
+31
View File
@@ -109,6 +109,15 @@ both `source.kind: "retained-evidence"` and `view: {kind: "native", facet:
Use the producer's handoff for other supported views rather than maintaining
another supposedly exhaustive list in the shared consumer description.
State prerequisites in the listing. A tool that acts on state an earlier call
establishes, such as an open target, a resource-only session or a debugger
session, says so in its advertised description and names the tool that
establishes it. Derive that statement from the contract's availability
declaration rather than writing it per tool, so the listing, `binary_session`
availability and the refusal agree. A call made without the prerequisite gets
recovery that names that tool, including when its arguments also fail
validation; schema guidance alone sends the agent back to the wrong fix.
Make an input refusal teach the rule it applies. Below the first level the
compact profile keeps no refinement, `pattern`, `not` or description, so a
nested rule reaches the agent only when a call is refused. Report the issue
@@ -189,6 +198,16 @@ them through provider readiness, capability discovery, doctor and CLI/MCP output
An error description is not a repair instruction. Do not make each consumer
guess the fix from diagnostic text or invent another list of prerequisites.
Make the producer state recovery and retry semantics, and make the error type
require them. Each refusal carries its remediation and whether the unchanged
request, a changed request or no retry can succeed; shared projection formats
those facts for CLI and MCP but does not fill them in from a code table or
default text. A typed limit refusal supplies them through its limit facts. A
refusal that conforms to the input contract never falls back to schema
guidance. When a field is optional, producers omit it and the default wins
silently; a required field turns each missing recovery into a compile error
at the producer that owns it.
Keep recovery within the selected target, provider, project and authority. If
another context could help, describe it as an explicit choice and state any
relevant loss of state; do not switch or select a candidate automatically.
@@ -863,6 +882,18 @@ malformed, unavailable, cancellation, and partial outcomes through affected
consumers. Real-engine claims require the matching provider lane; see
[testing.md](testing.md).
Test the schema clients receive. Schema parity tests run against the served
listing, after compact presentation and dialect projection, not against a
schema registered directly from the canonical contract. Root-level facts
survive in the served schema or in generated guidance: patterns such as the
absolute-path envelope, enum values, defaults, numeric and alignment bounds,
cross-field rules and prerequisites. For each constrained canonical field, a
value the handler rejects is either rejected by the served schema or named in
the tool's advertised guidance. A refusal must not claim that arguments fail
the advertised schema when the served schema accepts them. Nested rules the
compact profile drops are taught by the refusal, as described in
[descriptions](#write-descriptions-for-selection-and-a-valid-first-call).
For fixed tuples in public contracts, use `src/domain/fixedTupleSchema.ts`:
Zod's tuple projection omits implicit length bounds and Draft 2020-12 `items`,
which some clients require even alongside `prefixItems`. Tuples with a rest