fix: show error when required tool parameters are missing#1763
Open
areebahmeddd wants to merge 3 commits intokagent-dev:mainfrom
Open
fix: show error when required tool parameters are missing#1763areebahmeddd wants to merge 3 commits intokagent-dev:mainfrom
areebahmeddd wants to merge 3 commits intokagent-dev:mainfrom
Conversation
Signed-off-by: Areeb Ahmed <areebahmed0709@gmail.com>
5a7a4c0 to
9ff0898
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves tool-call robustness in the Go ADK agent by detecting missing/nil required tool parameters early and returning a clearer, actionable error response instead of allowing opaque downstream failures (e.g., when large parameter values get dropped).
Changes:
- Added a
BeforeToolCallbackguard that short-circuits tool execution when required parameters are missing ornil. - Implemented required-parameter extraction for both structured
genai.Schemaand opaque JSON-schema (ParametersJsonSchema) declarations. - Added unit tests covering required-field extraction and missing/
nilrequired-parameter detection.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| go/adk/pkg/agent/agent.go | Adds required-parameter introspection and pre-execution validation in makeBeforeToolCallback. |
| go/adk/pkg/agent/agent_test.go | Adds tests for JSON-schema required extraction and missing/nil required parameter detection. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Areeb Ahmed <areebahmed0709@gmail.com>
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.
summary
closes #1722
makebeforetoolcallbackbefore the tool even runs, for both mcp tools and native function toolsai model disclosure
used vscode copilot (claude sonnet 4.6) to understand the issue context and help generate a fix. changes were self-reviewed and verified via:
go build ./adk/... go test ./adk/pkg/agent/... make lint