Preparing search index...

    Defines a ChatTool's identity and metadata, including id, name, description, and dependencies.

    // 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;
    }
    }

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    dependencies: InterfaceId[]

    Array of interface IDs that this plugin requires to function.

    description: string

    Human-readable description of the plugin shown in the plugin manager.

    id: string

    Unique identifier for the plugin, typically in reverse domain notation.

    interfaces: InterfaceId[]

    Array of interface IDs that this plugin provides or implements.

    name: string

    Display name of the plugin.

    schema: any

    JSON schema object defining the parameters accepted by the chat tool's execute() method.

    Methods

    • Returns true if the object is of the specified type.

      Parameters

      • type: string

      Returns boolean