LensStudio:ChatTool.Descriptor
ClassDefines a ChatTool's identity and metadata, including id, name, description, and dependencies.
Index
Properties
Methods
Example
// ChatTool Descriptor extends BaseDescriptor with a `schema` property —
// a JSON Schema object that defines the parameters accepted by execute().
//
// Inherited from BaseDescriptor: id, name, description, dependencies
// ChatTool-specific: schema (any) — JSON Schema for tool parameters
export class LensStudioChatToolDescriptorExampleTool extends ChatTool {
connections: any[];
static descriptor() {
const d = new Descriptor();
d.id = 'com.docs.LensStudioChatToolDescriptorExample';
d.name = 'Find Assets By Type';
d.description = 'Finds assets of a given type in the project';
d.dependencies = [Editor.Model.IModel];
// The schema property defines the JSON Schema for the tool's parameters
d.schema = {
type: 'object',
properties: {
assetType: { type: 'string', description: 'Asset type to search for (e.g. Material)' },
limit: { type: 'number', description: 'Max results to return' },
},
required: ['assetType'],
};
return d;
}
constructor(pluginSystem: Editor.PluginSystem, descriptor?: Descriptor) {
super(pluginSystem, descriptor);
this.connections = [];
}
async execute(parameters: any): Promise<any> {
const result = new Result();
try {
const assetType = parameters?.data?.assetType ?? 'Material';
const limit = parameters?.data?.limit ?? 20;
const model = this.pluginSystem.findInterface(Editor.Model.IModel) as unknown as Editor.Model.IModel;
const found = model.project.assetManager.assets
.filter((a: Editor.Assets.Asset) => a.type === assetType)
.slice(0, limit)
.map((a: Editor.Assets.Asset) => a.name);
result.data = { assets: found, count: found.length };
} catch (e: any) {
result.error = `Failed: ${e?.message ?? e}`;
}
return result;
}
}
Extends
Constructors
Constructor
new Descriptor():
Descriptor
Constructs a new ChatTool Descriptor with default values for id, name, description, and dependencies.
Returns
Descriptor
Overrides
BaseDescriptor.constructor
Properties
dependencies
dependencies:
InterfaceId[]
Array of interface IDs that this plugin requires to function.
Inherited from
description
description:
string
Human-readable description of the plugin shown in the plugin manager.
Inherited from
id
id:
string
Unique identifier for the plugin, typically in reverse domain notation.
Inherited from
intendedPlatforms
intendedPlatforms:
TargetPlatform[]
Array of target platforms (Snapchat, Spectacles) where this plugin is intended to run.
Inherited from
BaseDescriptor.intendedPlatforms
interfaces
interfaces:
InterfaceId[]
Array of interface IDs that this plugin provides or implements.
Inherited from
name
name:
string
Display name of the plugin.
Inherited from
schema
schema:
any
JSON schema object defining the parameters accepted by the chat tool's execute() method.
Methods
getTypeName()
staticgetTypeName():string
Returns the type name of this class.
Returns
string
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object is of the specified type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object refers to the same instance as the given object.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean