Skip to content

fix(agent-core): add schema hints to tool arg errors#923

Open
tt-a1i wants to merge 1 commit into
MoonshotAI:mainfrom
tt-a1i:fix/tool-validation-hints
Open

fix(agent-core): add schema hints to tool arg errors#923
tt-a1i wants to merge 1 commit into
MoonshotAI:mainfrom
tt-a1i:fix/tool-validation-hints

Conversation

@tt-a1i

@tt-a1i tt-a1i commented Jun 20, 2026

Copy link
Copy Markdown

Related Issue

Resolve #819

Problem

Tool argument validation errors currently say which argument is wrong, but not which names or types the model should use instead.

What changed

  • Added schema-aware hints for unknown tool arguments, listing valid properties from the current object schema.
  • Added expected type hints for missing required arguments when the schema declares a type.
  • Kept generic AJV error formatting unchanged for other validation failures.
  • Added coverage for the Read tool argument case, nested object properties, and schemas without an obvious type.

Validation

  • pnpm --filter @moonshot-ai/agent-core exec vitest run test/tools/input-schema-io.test.ts
  • pnpm --filter @moonshot-ai/agent-core run test
  • pnpm --filter @moonshot-ai/agent-core run typecheck
  • pnpm exec oxlint --type-aware packages/agent-core/src/tools/args-validator.ts packages/agent-core/test/tools/input-schema-io.test.ts --quiet
  • pnpm --filter @moonshot-ai/agent-core run build
  • git diff --check

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

AI Assistance Disclosure

I used Codex to review the changes, sanity-check the implementation against existing patterns, and help spot potential edge cases.

@changeset-bot

changeset-bot Bot commented Jun 20, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 089d415

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@tt-a1i tt-a1i marked this pull request as ready for review June 20, 2026 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve tool-call error feedback for faster model self-correction

1 participant