[bug] capture tools ignore their advertised schema #1380

Closed
opened 2026-10-27 13:40:09 +00:00 by sam · 1 comment
Owner

ValidateCaptureArgs (internal/agentexec/helpers.go) checks only the derived top-level constraint lists (required fields, non-empty strings, booleans, required_when_true). The JSON Schema a capture tool advertises through Parameters -- enums, numeric types, nested objects, array shapes -- is shown to the agent over MCP but never enforced, so an agent can record a workflow value the schema forbids (e.g. triage's workflow enum) and the call is accepted.

Design

Resolve spec.Parameters once per call and validate the arguments against it with github.com/google/jsonschema-go (already in the module graph behind the MCP SDK), after the derived checks that give friendlier wording. Resolve the schema at definition time in agentResultTool so an unusable schema is refused where it is produced. A declared-output tool's schema permits null for value, which decodeCapturedOutput reads as not written.

Acceptance criteria

A triage-shaped schema rejects an out-of-enum workflow, a mistyped nested field, a bad array item and an over-long array, naming the field; a valid call passes; a shipped definition still parses.


Imported from beads archie-core-ij6r · GitHub #1562 · type bug · priority P2 · created 2026-10-08

ValidateCaptureArgs (internal/agentexec/helpers.go) checks only the derived top-level constraint lists (required fields, non-empty strings, booleans, required_when_true). The JSON Schema a capture tool advertises through Parameters -- enums, numeric types, nested objects, array shapes -- is shown to the agent over MCP but never enforced, so an agent can record a workflow value the schema forbids (e.g. triage's workflow enum) and the call is accepted. ### Design Resolve spec.Parameters once per call and validate the arguments against it with github.com/google/jsonschema-go (already in the module graph behind the MCP SDK), after the derived checks that give friendlier wording. Resolve the schema at definition time in agentResultTool so an unusable schema is refused where it is produced. A declared-output tool's schema permits null for value, which decodeCapturedOutput reads as not written. ### Acceptance criteria A triage-shaped schema rejects an out-of-enum workflow, a mistyped nested field, a bad array item and an over-long array, naming the field; a valid call passes; a shipped definition still parses. --- _Imported from beads `archie-core-ij6r` · GitHub #1562 · type bug · priority P2 · created 2026-10-08_
sam added the mediumbug labels 2026-10-27 13:40:09 +00:00
sam self-assigned this 2026-10-27 13:40:09 +00:00
Author
Owner

Already fixed by 0a47a95cc: ValidateCaptureArgs validates against spec.Parameters via jsonschema-go, invalid schemas are refused at definition time in agentResultTool; covered by TestValidateCaptureArgsEnforcesSchema.

Already fixed by 0a47a95cc: ValidateCaptureArgs validates against spec.Parameters via jsonschema-go, invalid schemas are refused at definition time in agentResultTool; covered by TestValidateCaptureArgsEnforcesSchema.
sam closed this issue 2026-11-14 04:07:05 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#1380