Skip to content

Comments

.Net: preserve root $defs/definitions when wrapping AIFunction tools#13568

Open
OiPunk wants to merge 1 commit intomicrosoft:mainfrom
OiPunk:codex/semantic-kernel-13447-preserve-schema-defs
Open

.Net: preserve root $defs/definitions when wrapping AIFunction tools#13568
OiPunk wants to merge 1 commit intomicrosoft:mainfrom
OiPunk:codex/semantic-kernel-13447-preserve-schema-defs

Conversation

@OiPunk
Copy link

@OiPunk OiPunk commented Feb 19, 2026

Summary

Preserves root-level JSON schema definitions ($defs / definitions) when wrapping AIFunction tools as KernelFunction.

Fixes #13447.

Problem

AIFunctionKernelFunction currently builds schema metadata from parameter properties. During that conversion, root-level schema sections like $defs / definitions are dropped.

When a property schema still contains $ref (for example #/$defs/Node), this produces an incomplete tool schema for model calls.

Changes

  • AIFunctionKernelFunction now stores and returns the original aiFunction.JsonSchema.
  • Added regression test to verify root-level $defs are preserved.
  • Added streaming invocation test for the wrapper behavior path.

Validation

  • GITHUB_ACTIONS=1 dotnet test dotnet/src/SemanticKernel.UnitTests/SemanticKernel.UnitTests.csproj --configuration Release --filter FullyQualifiedName~AIFunctionKernelFunctionTests
    • Passed: 14, Failed: 0
  • GITHUB_ACTIONS=1 dotnet test dotnet/src/SemanticKernel.UnitTests/SemanticKernel.UnitTests.csproj --configuration Release --no-build --filter FullyQualifiedName~AIFunctionKernelFunctionTests --collect:"XPlat Code Coverage"
    • AIFunctionKernelFunction line-rate: 1.0 (100%)

@OiPunk OiPunk requested a review from a team as a code owner February 19, 2026 14:07
@moonbox3 moonbox3 added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel kernel.core labels Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kernel.core kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.Net: Bug: AIFunctionKernelFunction does not preserve definitions / $defs in function schema

2 participants