@camera.ui/sdk / plugin / AssistantToolProvider
Interface: AssistantToolProvider ​
Defined in: plugin/assistant.ts:152
Implemented by plugins that list PluginInterface.AssistantTools in their contract. The host asks for the tool list once after the plugin is ready and dispatches calls by name.
Example ​
class MyPlugin extends BasePlugin implements AssistantToolProvider {
assistantTools(): AssistantToolSpec[] {
return [queryEvents];
}
async callAssistantTool(name: string, input: Record<string, unknown>, ctx: AssistantToolContext): Promise<AssistantToolResult> {
if (name === 'query_events') return { content: await this.store.query(input.from as string, input.to as string) };
return { error: `Unknown tool ${name}` };
}
}Methods ​
assistantTools() ​
assistantTools():
AssistantToolSpec[] |Promise<AssistantToolSpec[]>
Defined in: plugin/assistant.ts:158
List the tools this plugin offers. Called once per plugin start.
Returns ​
AssistantToolSpec[] | Promise<AssistantToolSpec[]>
The tool specs, empty when the plugin currently has none.
callAssistantTool() ​
callAssistantTool(
name,input,ctx):Promise<AssistantToolResult>
Defined in: plugin/assistant.ts:172
Run one tool. Validate input against the declared schema, the host does not.
Parameters ​
name ​
string
Tool name as declared in AssistantToolSpec.name.
input ​
Record<string, unknown>
Parsed arguments the model produced.
ctx ​
Who is asking and in which language.
Returns ​
Promise<AssistantToolResult>
Text, JSON or images for the model, or an error it may repair.