KeelMatrix.AiToolContract
0.1.0
Prefix Reserved
dotnet add package KeelMatrix.AiToolContract --version 0.1.0
NuGet\Install-Package KeelMatrix.AiToolContract -Version 0.1.0
<PackageReference Include="KeelMatrix.AiToolContract" Version="0.1.0" />
<PackageVersion Include="KeelMatrix.AiToolContract" Version="0.1.0" />
<PackageReference Include="KeelMatrix.AiToolContract" />
paket add KeelMatrix.AiToolContract --version 0.1.0
#r "nuget: KeelMatrix.AiToolContract, 0.1.0"
#:package KeelMatrix.AiToolContract@0.1.0
#addin nuget:?package=KeelMatrix.AiToolContract&version=0.1.0
#tool nuget:?package=KeelMatrix.AiToolContract&version=0.1.0
KeelMatrix.AiToolContract
Capture and review the model-visible contracts of Microsoft.Extensions.AI tools.
Install
dotnet add package KeelMatrix.AiToolContract --version 0.1.0
Quick Start
Pass the application’s real AIFunction instances to capture, write the returned baseline explicitly, and compare later captures with AiToolContractVerifier.
using KeelMatrix.AiToolContract;
using Microsoft.Extensions.AI;
var tool = AIFunctionFactory.Create((string query, int limit) => $"{query}:{limit}");
var capture = AiToolContractCapture.Capture(new AITool[] { tool });
if (!capture.Succeeded)
throw new InvalidOperationException(capture.Diagnostic!.Message);
var baselineJson = AiToolContractJson.Serialize(capture.Baseline!);
var baseline = AiToolContractJson.Parse(baselineJson);
var verification = AiToolContractVerifier.Verify(baseline, new AITool[] { tool });
Console.WriteLine(verification.IsClean); // True
This library is offline. It does not call a model, provider, network endpoint, or captured function. Structural compatibility also cannot prove that a model will make the same tool-selection decisions after a description or provider change.
Supported frameworks
The package targets net8.0 and netstandard2.0 and is intended for cross-platform .NET applications on Windows, Linux, and macOS.
Malformed schemas and valid schema forms whose semantics are not represented by the closed normalized model fail closed with an explicit diagnostic. Standard JSON Schema type arrays express nullability; the OpenAPI nullable keyword is unsupported.
Newly required declarations retain unsupported default, format, reference, and item-schema transitions at each required child level. Both acceptance methods reject those differences. Schema counter, canonical-encoding, and malformed-string diagnostics identify the input or return schema and the affected location.
Arbitrary schema member names use quoted path segments, including failures before keyword validation; unrecognized keywords remain rejected.
Input compatibility preserves accepted calls; return compatibility preserves output guarantees. A newly nullable return, removed required return property, expanded return enum, or relaxed return bound is Breaking. Supported member changes compose; declaration and required-membership changes are reported independently. A declaration for an existing required name is compared against its previously unconstrained values. Acceptance requires the exact immutable candidate instance used by its comparison; compare again after recapturing or parsing a candidate. See the compatibility guide for classifications and escaped diagnostic paths.
The configured AiToolContractLimits are enforced consistently during capture, baseline parsing, comparison, and serialization. This includes schema members, actual properties entries, nested schemas, every supported array-valued schema/default family, schema bytes, logical depth (including nested enum/default values), tools, and reported changes. Logical depth includes the root and has a stack-safety ceiling of 256 even when a larger limit is supplied. A derived aggregate UTF-8 budget also bounds the complete baseline envelope, tool names/descriptions, and canonical JSON in both directions of a parse/serialize round trip. Escaped output budgets are checked before constructing oversized output. Boundary values are accepted and overflows return a resource diagnostic. Oversized schema elements are rejected before copying their text. Persisted strings must contain valid Unicode: unmatched UTF-16 surrogates fail capture or baseline parsing instead of being replaced.
See the JSON Schema support matrix for the version-one keyword surface. See the repository documentation for baseline acceptance, compatibility categories, limits, and privacy guidance.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Extensions.AI.Abstractions (>= 10.0.0 && < 11.0.0)
-
net8.0
- Microsoft.Extensions.AI.Abstractions (>= 10.0.0 && < 11.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0 | 100 | 11/8/2026 |
Initial public release.