HarperFast / HarperFast/harper

[Agent Loop] Tool argument validation (toolArgValidation strict/lenient)

Open
#853 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
89
Forks
10
Avg merge
2d 6h
Merged PRs (30d)
200

Description

Part of #612.

Implement `toolArgValidation: 'strict' | 'lenient'` — validate model-emitted tool-call arguments against the tool's `parameters` JSON Schema before dispatch. Today the loop throws `501` at entry for anything but the default `'none'`; the `ToolValidationError(400)` class and the option surface are already in place.

## Why deferred

Harper validates internally with Joi and passes JSON Schema through to backends untouched. Strict arg validation needs a JSON Schema validator in-process — adopting Ajv (or equivalent) is a separate dependency/decision, not a loop change.

## Acceptance

- [ ] `'strict'` (the issue's intended default) rejects args that don't satisfy the schema with `ToolValidationError(400)` carrying the validation errors.
- [ ] `'lenient'` coerces/logs but proceeds.
- [ ] `'none'` passes through (current behavior).
- [ ] Tests across each mode.

---

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.