Table of Contents

Interface IAssistantTool

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

A tool a server serves an assistant: what it is (Describe(CultureInfo)), and what a call of it answers (CallAsync(JsonObject, CancellationToken)).

public interface IAssistantTool

Remarks

The language server lists and calls the tools of its AssistantToolCatalog over rdcore/tools/list and rdcore/tools/call. AssistantTool<TArguments, TResult> implements this interface for a tool whose arguments and result are records, and derives their schemas from them.

A tool reads the workspace, or makes an edit that the client applies. It never writes a file of the workspace itself.

Properties

Name

The name a call gives (Name): letters, digits, _ and -, at most 64 characters, the same in every language.

string Name { get; }

Property Value

string

Methods

CallAsync(JsonObject, CancellationToken)

Calls the tool.

Task<ToolCallResult> CallAsync(JsonObject arguments, CancellationToken token)

Parameters

arguments JsonObject

The arguments of the call, as the tool's input schema describes them; an empty object for none.

token CancellationToken

Cancels the call: $/cancelRequest of the request that made it.

Returns

Task<ToolCallResult>

What the tool answers.

Exceptions

AssistantToolRefusedException

The tool refuses the call: the arguments are not valid, or what they name cannot be done.

OperationCanceledException

token was cancelled.

Describe(CultureInfo)

What the tool is, in a language: its description, the schema of its arguments and of its result, and its annotations.

ToolDescriptor Describe(CultureInfo culture)

Parameters

culture CultureInfo

The language of the client's user interface.

Returns

ToolDescriptor

The descriptor, whose Name is Name.