Skip to content

feat(tool): expose API to add registered tool to group - #2836

Open
guslegend0510 wants to merge 4 commits into
agentscope-ai:mainfrom
guslegend0510:codex/feat-2835-multi-tool-groups
Open

feat(tool): expose API to add registered tool to group#2836
guslegend0510 wants to merge 4 commits into
agentscope-ai:mainfrom
guslegend0510:codex/feat-2835-multi-tool-groups

Conversation

@guslegend0510

Copy link
Copy Markdown
Contributor

AgentScope-Java Version

2.0.3-SNAPSHOT

Description

Closes #2835.

ToolGroupManager already supports an n:m relationship between tools and tool groups, but Toolkit did not expose a public API for assigning an already-registered tool to an additional group.

This PR:

  • Adds Toolkit#addToolToGroup(String groupName, String toolName).
  • Validates that both the target group and tool exist.
  • Preserves the existing registered tool instance and metadata.
  • Keeps repeated assignments idempotent.
  • Replaces the duplicate-registration workaround in the multi-group regression test.
  • Adds validation coverage for unknown groups and unregistered tools.

Testing

  • mvn -pl agentscope-core -Dtest=ToolkitTest test
    • 37 tests passed
  • mvn -pl agentscope-core test
    • 2295 tests passed
    • 0 failures
    • 0 errors
    • 9 skipped
  • git diff --check
  • Spotless check passed

Checklist

  • Code formatting has been verified with Spotless
  • All affected module tests are passing
  • Javadoc comments are complete and follow project conventions
  • Public API behavior is covered by regression tests
  • Code is ready for review

@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

[Feature]: Public API to register a tool into multiple tool groups (n:m already supported internally)

2 participants