Interface IAssistantTool
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
Methods
CallAsync(JsonObject, CancellationToken)
Calls the tool.
Task<ToolCallResult> CallAsync(JsonObject arguments, CancellationToken token)
Parameters
argumentsJsonObjectThe arguments of the call, as the tool's input schema describes them; an empty object for none.
tokenCancellationTokenCancels the call:
$/cancelRequestof 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
tokenwas 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
cultureCultureInfoThe language of the client's user interface.