OpenToolSDK 0.2.3

dotnet add package OpenToolSDK --version 0.2.3
                    
NuGet\Install-Package OpenToolSDK -Version 0.2.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="OpenToolSDK" Version="0.2.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OpenToolSDK" Version="0.2.3" />
                    
Directory.Packages.props
<PackageReference Include="OpenToolSDK" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add OpenToolSDK --version 0.2.3
                    
#r "nuget: OpenToolSDK, 0.2.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package OpenToolSDK@0.2.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=OpenToolSDK&version=0.2.3
                    
Install as a Cake Addin
#tool nuget:?package=OpenToolSDK&version=0.2.3
                    
Install as a Cake Tool

OpenTool SDK for .NET

English | 中文

The OpenTool SDK for .NET supports Tool Server and Client communication over the JSON-RPC protocol, implementing the core capabilities defined in the OpenTool specification.

Features

  • OpenTool JSON parser
  • JSON-RPC over HTTP Client and Server
  • API Key authorization middleware
  • Interoperability with OpenTool Client/Server implemented in C# .NET

Add the following dependency in your NuGet configuration:

OpenToolSDK

Examples

  1. Implementing a sample Tool:

    public class MockTool : ITool
    {
        private readonly MockUtil _mockUtil = new();
    
       public Task<Dictionary<string, object>> Call(string name, Dictionary<string, object> arguments)
       {
          switch (name)
          {
           case "count":
               return Task.FromResult(new Dictionary<string, object>
               {
                   { "count", _mockUtil.Count() }
               });
    
           default:
               throw new FunctionNotSupportedException(name);
          }
       }
    
       public async ValueTask<OpenTool?> Load()
       {
          string assemblyPath = Path.GetDirectoryName(typeof(MockTool).Assembly.Location)!;
          string jsonPath = Path.Combine(assemblyPath, "mock_tool.json");
    
          var loader = new OpenToolJsonLoader();
          var openTool = loader.LoadFromFile(jsonPath);
          return await Task.FromResult(openTool);
       }
    }
    
  2. Starting the OpenTool Server:

    var tool = new MockTool();
    var server = new OpenToolServer(
       tool: tool,
       version: "1.0.0",
       apiKeys:
       [
           "6621c8a3-2110-4e6a-9d62-70ccd467e789",
           "bb31b6a6-1fda-4214-8cd6-b1403842070c"
       ]
    );
    
    await server.Start();
    

Usage Notes

  1. The default port is 9627. You can change it via the OpenToolServer constructor.
  2. A new Tool must implement the ITool interface, specifically the Call method. It is recommended to implement Load to load OpenTool JSON descriptions.
  3. It is recommended to use OpenTool specification JSON files to define tools. Constructing OpenTool objects programmatically is also supported.
Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

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.2.3 328 9/16/2025