Table of Contents

Class AssistantToolCatalog

Namespace
RDCore.SDK.Server.Assistant
Assembly
RDCore.SDK.dll

The tools a server serves an assistant, by name: what rdcore/tools/list lists and rdcore/tools/call calls.

public sealed class AssistantToolCatalog
Inheritance
AssistantToolCatalog
Inherited Members

Remarks

A call is answered with what the tool answers, its text cut at TextLength characters. A tool that refuses the call, by throwing an AssistantToolRefusedException or an RpcErrorException, is answered with a refusal (Refusal(string)): the call did nothing, and the assistant reads why. A call of a tool the catalog does not have is a JSON-RPC error (-32602), as the Model Context Protocol answers it.

Constructors

AssistantToolCatalog(IEnumerable<IAssistantTool>)

A catalog of tools.

public AssistantToolCatalog(IEnumerable<IAssistantTool> tools)

Parameters

tools IEnumerable<IAssistantTool>

The tools, in the order the catalog lists them.

Exceptions

ArgumentException

Two tools have the same name, or a name is not one a tool can have (Name).

Fields

UnknownToolCode

JSON-RPC "Invalid params": the code a call of a tool the catalog does not have is refused with.

public const int UnknownToolCode = -32602

Field Value

int

Properties

Tools

The tools, in the order the catalog lists them.

public IReadOnlyList<IAssistantTool> Tools { get; }

Property Value

IReadOnlyList<IAssistantTool>

Methods

CallAsync(ToolCallParams, CancellationToken)

Calls a tool (rdcore/tools/call).

public Task<ToolCallResult> CallAsync(ToolCallParams call, CancellationToken token)

Parameters

call ToolCallParams

The tool, and its arguments.

token CancellationToken

Cancels the call.

Returns

Task<ToolCallResult>

What the tool answers, or why it refuses the call.

Exceptions

RpcErrorException

The catalog has no tool by the name the call gives (UnknownToolCode).

OperationCanceledException

token was cancelled.

List(CultureInfo)

Lists the tools (rdcore/tools/list).

public ToolsListResult List(CultureInfo culture)

Parameters

culture CultureInfo

The language of the client's user interface.

Returns

ToolsListResult

The descriptor of each tool, in that language.