Skip to content

fix: show error when required tool parameters are missing#1763

Open
areebahmeddd wants to merge 3 commits intokagent-dev:mainfrom
areebahmeddd:fix/mcp-param-error
Open

fix: show error when required tool parameters are missing#1763
areebahmeddd wants to merge 3 commits intokagent-dev:mainfrom
areebahmeddd:fix/mcp-param-error

Conversation

@areebahmeddd
Copy link
Copy Markdown

summary

closes #1722

  • if the llm skips a required tool parameter (like large file content hitting output token limits), the tool call now fails with a clear, actionable message instead of some vague downstream error
  • catches missing or nil required params in makebeforetoolcallback before the tool even runs, for both mcp tools and native function tools

ai 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

Copilot AI review requested due to automatic review settings April 27, 2026 19:10
@github-actions github-actions Bot added the bug Something isn't working label Apr 27, 2026
Signed-off-by: Areeb Ahmed <areebahmed0709@gmail.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 BeforeToolCallback guard that short-circuits tool execution when required parameters are missing or nil.
  • Implemented required-parameter extraction for both structured genai.Schema and opaque JSON-schema (ParametersJsonSchema) declarations.
  • Added unit tests covering required-field extraction and missing/nil required-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.

Comment thread go/adk/pkg/agent/agent.go
Comment thread go/adk/pkg/agent/agent.go Outdated
areebahmeddd and others added 2 commits April 27, 2026 22:18
Signed-off-by: Areeb Ahmed <areebahmed0709@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Values for MCP tool call parameters are unexpectedly size capped

2 participants