Skip to content

expose function to get kagent / adk metadata#1339

Merged
EItanya merged 1 commit intokagent-dev:mainfrom
supreme-gg-gg:chore/expose-metadata-getter
Feb 19, 2026
Merged

expose function to get kagent / adk metadata#1339
EItanya merged 1 commit intokagent-dev:mainfrom
supreme-gg-gg:chore/expose-metadata-getter

Conversation

@supreme-gg-gg
Copy link
Contributor

No description provided.

Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
Copilot AI review requested due to automatic review settings February 19, 2026 23:01
Copy link
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 pull request extracts a previously private function getMetadataValue from the chat TUI component and exposes it as a public utility function GetMetadataValue in a new go/pkg/utils package. This refactoring enables code reuse across the codebase for handling A2A metadata lookups that support both the adk_ and kagent_ prefixes for backward compatibility.

Changes:

  • Created new go/pkg/utils package with GetMetadataValue function for looking up metadata values with prefix fallback
  • Removed private getMetadataValue function from chat.go and updated usage to reference the new public utility

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
go/pkg/utils/utils.go New utility package containing GetMetadataValue function for A2A metadata lookups with adk_/kagent_ prefix support
go/cli/internal/tui/chat.go Removed duplicate getMetadataValue function and updated to use utils.GetMetadataValue

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +7 to +18
func GetMetadataValue(metadata map[string]any, key string) (any, bool) {
if metadata == nil {
return nil, false
}
if v, ok := metadata["adk_"+key]; ok {
return v, true
}
if v, ok := metadata["kagent_"+key]; ok {
return v, true
}
return nil, false
}
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

The GetMetadataValue function lacks test coverage. Given that other packages in go/pkg/ (like adk and app) have comprehensive test files, this package should follow the same convention. Consider adding a utils_test.go file with test cases covering:

  • Nil metadata map
  • Key found with adk_ prefix
  • Key found with kagent_ prefix (fallback)
  • Key not found with either prefix
  • Priority when both prefixes exist (adk_ should take precedence)

Copilot uses AI. Check for mistakes.
@EItanya EItanya merged commit 815b7f9 into kagent-dev:main Feb 19, 2026
22 checks passed
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.

3 participants