Preparing search index...

    Holds the input parameters passed to a ChatTool's execute() call.

        // Parameters is the input wrapper handed to ChatTool.execute() by the AI
    // assistant. The assistant fills `data` per the JSON schema declared on
    // the tool's Descriptor; the tool reads it inside execute() and returns
    // a Result. The example below renames a SceneObject from a tool call.
    import { ChatTool, Descriptor, Parameters, Result } from 'LensStudio:ChatTool';

    export class RenameSceneObjectTool extends ChatTool {
    static descriptor(): Descriptor {
    const d = new Descriptor();
    d.id = 'com.example.renameSceneObject';
    d.name = 'Rename Scene Object';
    d.description = 'Rename a SceneObject in the active project.';
    // The schema dictates the shape of `parameters.data` the assistant
    // will produce when calling this tool.
    d.schema = {
    type: 'object',
    required: ['oldName', 'newName'],
    properties: {
    oldName: { type: 'string' },
    newName: { type: 'string' },
    },
    };
    return d;
    }

    async execute(parameters: Parameters): Promise<Result> {
    const { oldName, newName } = parameters.data as { oldName: string; newName: string };
    const model = this.pluginSystem.findInterface(Editor.Model.IModel) as Editor.Model.IModel;
    const scene = model.project.scene;
    const target = scene.rootSceneObjects.find(o => o.name === oldName);
    const result = new Result();
    if (target) {
    target.name = newName;
    result.data = { ok: true, renamed: { from: oldName, to: newName } };
    } else {
    result.error = `No SceneObject named "${oldName}"`;
    }
    return result;
    }
    }
    Index

    Constructors

    Properties

    Constructors

    • Constructs a new Parameters instance for configuring a ChatTool plugin descriptor.

      Returns Parameters

    Properties

    data: any

    Arbitrary payload containing the tool's input parameters, structured per the tool's schema.