Skip to content

[Feature]: Support strict mode consistently across all tool definition paths #1243

Closed

Description

@willenigma

Is your feature request related to a problem? Please describe.

ToolSchema already exposes a strict field, and the OpenAI formatter also has support for propagating strict into the final tool/function definition.

However, strict mode is not consistently preserved across all tool definition and registration paths.

For example, when building a tool schema manually, it is possible to set strict mode explicitly:

ToolSchema.builder()
    .name(...)
    .description(...)
    .parameters(parameters)
    .strict(true)
    .build();

But in practice, this support is not consistently available through all higher-level tool registration flows.

In particular, when registering a schema through Toolkit#registerSchema, the provided ToolSchema appears to be wrapped into a SchemaOnlyTool, and during that process the original ToolSchema is not preserved as-is. As a result, the strict flag is effectively lost and does not reach the final tool definition sent to the model API.

This creates an inconsistency:

  • ToolSchema already exposes strict
  • the formatter layer already supports strict
  • but some framework registration paths do not preserve or propagate it

This makes it difficult to rely on strict mode as a first-class capability.

Describe the solution you'd like

I’d like strict mode to be supported consistently across all tool schema definition and registration paths, including:

  1. Manual ToolSchema.builder(...)
  2. Toolkit#registerSchema(...)
  3. @Tool annotation-based tools
  4. AgentTool interface / implementation-based tools
  5. Any other framework-provided path that eventually produces a ToolSchema or tool definition for model APIs

Concretely, it would be helpful if:

  • ToolSchema.strict is always preserved when a tool is wrapped, converted, or re-registered
  • higher-level APIs such as @Tool and AgentTool expose a way to configure strict mode
  • all internal tool conversion paths propagate the strict flag into the final model API payload when the provider supports it

Describe alternatives you've considered

The current workaround is to avoid some higher-level registration paths and manually control tool schema construction as much as possible.

However, this has several downsides:

  • it reduces the value of the higher-level abstractions
  • it makes strict mode behavior depend on which registration path is used
  • it is not obvious to users that strict may be silently lost during registration or wrapping
  • it makes the API less consistent and less predictable

Another workaround would be to customize framework internals, but that is much heavier than having first-class support.

Additional context

According to the OpenAI function calling documentation, strict: true improves schema adherence for tool/function calling and is recommended when developers want reliable structured arguments.

Because of this, strict mode is not just a minor optional flag — it can materially affect tool calling reliability and schema correctness.

It would be great if AgentScope Java could provide a unified strict-mode experience across all tool-definition styles.

Activity

  1. added
    enhancement
    on Apr 18, 2026
  2. BEASTSHRIRAM commented on Apr 22, 2026

    @BEASTSHRIRAM
    Contributor

    Hi,can you assign this to me?

  3. BEASTSHRIRAM commented on Apr 23, 2026

    @BEASTSHRIRAM
    Contributor

    @LearningGp implemented the feature in #1274, could you take a look when you get a chance?

  4. added
    area/core/tool
    on May 28, 2026
  5. juruoO-o commented on Nov 12, 2026

    @juruoO-o
    Collaborator

    Closing as implemented by #1274 (merged): strict mode configuration is now consistent across tool schema registration and conversion paths. Reopen if a path still ignores strict.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/core/toolenhancement

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions