Skip to content

feat(tool): implement strict mode configuration for tools#1274

Merged
LearningGp merged 8 commits into
agentscope-ai:mainfrom
BEASTSHRIRAM:feat/tool-strict-mode-propagation
May 11, 2026
Merged

feat(tool): implement strict mode configuration for tools#1274
LearningGp merged 8 commits into
agentscope-ai:mainfrom
BEASTSHRIRAM:feat/tool-strict-mode-propagation

Conversation

@BEASTSHRIRAM

@BEASTSHRIRAM BEASTSHRIRAM commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

AgentScope-Java Version

1.0.12-SNAPSHOT

Description

This PR fixes strict mode propagation consistency across tool schema registration and conversion paths. #1243

Background:
ToolSchema already supports strict, and formatter layers already pass strict to model payloads when supported. However, strict was not preserved consistently in all tool registration flows.

What changed:

  • Added a backward-compatible strict accessor in AgentTool so AgentTool-based tools can expose strict.
  • Preserved strict when wrapping ToolSchema in SchemaOnlyTool.
  • Added strict option in the Tool annotation for annotation-based tools.
  • Propagated annotation strict value in Toolkit registration flow.
  • Propagated strict in ToolSchemaProvider when building final ToolSchema objects for model APIs.
  • Added regression tests for:
    • registerSchema and schema-only path strict preservation
    • Tool annotation strict propagation
    • AgentTool implementation strict propagation

How to test:

  1. Run targeted tests:
    mvn -pl agentscope-core -Dtest=SchemaOnlyToolTest,ExternalToolSupportTest,ToolSchemaProviderTest test
  2. Optional full module tests:
    mvn -pl agentscope-core test

Checklist

  • Code has been formatted and passes Spotless checks
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated (no user-facing docs changed in this PR)
  • Code is ready for review

@BEASTSHRIRAM BEASTSHRIRAM requested review from a team and Copilot April 23, 2026 17:08
@CLAassistant

CLAassistant commented Apr 23, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@codecov

codecov Bot commented Apr 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread .gitignore Outdated
@LearningGp

Copy link
Copy Markdown
Member
image

@BEASTSHRIRAM

Copy link
Copy Markdown
Contributor Author

@LearningGp I have fixed all the conflicts

@BEASTSHRIRAM

Copy link
Copy Markdown
Contributor Author

Hi @LearningGp Can you please merge this?

@LearningGp LearningGp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@LearningGp LearningGp merged commit 9d3c1ac into agentscope-ai:main May 11, 2026
5 checks passed
@BEASTSHRIRAM BEASTSHRIRAM deleted the feat/tool-strict-mode-propagation branch May 11, 2026 02:15
liangxingguang pushed a commit to liangxingguang/agentscope-java that referenced this pull request May 21, 2026
…-ai#1274)

## AgentScope-Java Version

1.0.12-SNAPSHOT

## Description

This PR fixes strict mode propagation consistency across tool schema
registration and conversion paths. agentscope-ai#1243

Background:
ToolSchema already supports strict, and formatter layers already pass
strict to model payloads when supported. However, strict was not
preserved consistently in all tool registration flows.

What changed:
- Added a backward-compatible strict accessor in AgentTool so
AgentTool-based tools can expose strict.
- Preserved strict when wrapping ToolSchema in SchemaOnlyTool.
- Added strict option in the Tool annotation for annotation-based tools.
- Propagated annotation strict value in Toolkit registration flow.
- Propagated strict in ToolSchemaProvider when building final ToolSchema
objects for model APIs.
- Added regression tests for:
  - registerSchema and schema-only path strict preservation
  - Tool annotation strict propagation
  - AgentTool implementation strict propagation

How to test:
1. Run targeted tests:
mvn -pl agentscope-core
-Dtest=SchemaOnlyToolTest,ExternalToolSupportTest,ToolSchemaProviderTest
test
2. Optional full module tests:
mvn -pl agentscope-core test

## Checklist

- [x] Code has been formatted and passes Spotless checks
- [x] All tests are passing (mvn test)
- [x] Javadoc comments are complete and follow project conventions
- [x] Related documentation has been updated (no user-facing docs
changed in this PR)
- [x] Code is ready for review
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.

4 participants