OpenToolSDK.DotNet 0.2.1

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package OpenToolSDK.DotNet --version 0.2.1
                    
NuGet\Install-Package OpenToolSDK.DotNet -Version 0.2.1
                    
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.DotNet" Version="0.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OpenToolSDK.DotNet" Version="0.2.1" />
                    
Directory.Packages.props
<PackageReference Include="OpenToolSDK.DotNet" />
                    
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.DotNet --version 0.2.1
                    
#r "nuget: OpenToolSDK.DotNet, 0.2.1"
                    
#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.DotNet@0.2.1
                    
#: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.DotNet&version=0.2.1
                    
Install as a Cake Addin
#tool nuget:?package=OpenToolSDK.DotNet&version=0.2.1
                    
Install as a Cake Tool

OpenTool SDK for .NET Framework

English | 中文

The OpenTool SDK for .NET Framework 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 Framework

Add the following dependency in your NuGet configuration:

OpenToolSDK

Examples

  1. Implementing a sample Tool:

    public class MockTool : ITool
    {
        public Task<Dictionary<string, object>> Call(string name, Dictionary<string, object> arguments)
        {
            if (name == "count")
            {
                return Task.FromResult(new Dictionary<string, object>
                {
                    {"count", 42}
                });
            }
            else
            {
                throw new FunctionNotSupportedException(name);
            }
        }
    
        public Task<OpenTool> Load()
        {
            string jsonPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "example", "server", "mock_tool.json");
            var loader = new OpenToolJsonLoader();
            return Task.FromResult(loader.LoadFromFile(jsonPath));
        }
    }
    
  2. Starting the OpenTool Server:

    ITool tool = new MockTool();
    IServer server = new OpenToolServer(tool, version: "1.0.0", apiKeys: new List<string>
    {
        "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 Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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