invokeTool static method
Universally invoke a registered tool by name.
name is the tool name (e.g. tomAi_readFile). arguments is the
tool's argument map. Returns the tool's string result; unknown tools and
execution failures surface as an error string (the tool registry never
throws across the bridge for these cases).
Gated by the active Anthropic profile, enforced server-side. Only tools the current profile permits can be invoked; a name the profile hides — or any name while the Send-to-Chat target is Copilot — is refused inside the extension before the executor runs, returning an error string. This package applies no filtering of its own; the extension is the sole authority. The set of invokable tools matches the names returned by getToolsJson.
Implementation
static Future<String> invokeTool(
String name, [
Map<String, dynamic> arguments = const {},
]) async {
final result = await _requireAdapter.sendRequest('tools.invokeVce', {
'name': name,
'arguments': arguments,
});
return result['result'] as String? ?? '';
}