Repository navigation
fix(api): reject undeclared and off-enum tool arguments (policy R4) - #255
Open
Levalicious wants to merge 2 commits into
Open
Levalicious wants to merge 2 commits into
Levalicious wants to merge 2 commits into
Conversation
The server never validated call arguments against the advertised
inputSchemas, so anything undeclared was silently dropped. In practice:
open_nodes called with `cursor` (get_neighbors' page key) instead of
`relationCursor` re-served page 1 with an identical nextCursor, making
every relation past page 1 unreachable; an off-enum `direction` ("both")
ran without complaint.
dispatch now validates every call against the same tool definitions that
ListTools advertises. Undeclared keys and off-enum values fail with
VALIDATION_FAILED, listing every offender, and the tool does not run. A
misnamed cursor key names the cursor parameter(s) the tool does take.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B7UQfn7Vue83jAPFaWfmAZ
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B7UQfn7Vue83jAPFaWfmAZ
Contributor
Per-op benchmark — p50 cycles (base vs head)base runs: 5, head runs: 5 (median of mins) · freq-correction ×1.0038 · threshold head−base > max(40 cyc, 5%)
* head frequency-corrected to base via the No regressions beyond threshold. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The server never validated call arguments against the advertised
inputSchemas, so undeclared keys were silently dropped. Concretely:open_nodescalled withcursor(theget_neighborspage key) instead ofrelationCursorre-served page 1 with an identicalnextCursor— every relation past page 1 was unreachable, and it looked like open_nodes ignored cursors. An off-enumdirection: "both"also ran without complaint.Fix
toolDefinitions; ListTools returns it anddispatchvalidates every call against the same schemas (validateToolArgs).VALIDATION_FAILED, every offender listed indetails(argument,message,allowed), tool does not run (R2 validate-first).docs/api-error-policy.md: R4 now explicitly covers arguments.Existing per-field checks (
LIMIT_EXCEEDEDetc.) are untouched.Tests
tests/arg-validation.test.ts(6): 5 fail on develop, all pass here; the 6th drains a 120-edge backward list viarelationCursor(guards the correct path). Full suite 202/202, fuzz protoErr = 0.🤖 Generated with Claude Code
https://claude.ai/code/session_01B7UQfn7Vue83jAPFaWfmAZ