10. Language model tools for VS Code chat
The extension contributes languageModelTools in package.json and registers them with vscode.lm.registerTool (AI-12).
Esta página está em inglês; a tradução está a caminho.
10.1 Contributed tools#
The extension contributes languageModelTools in package.json and registers them with
vscode.lm.registerTool (AI-12). Names and input schemas are the Figma tool names and schemas, as in §5.2.
Tool name |
toolReferenceName |
Mutates | Confirmation |
|---|---|---|---|
use_figma |
udUseFigma |
yes | yes: “Run script on app.design: |
get_metadata |
udMetadata |
no | no |
get_screenshot |
udScreenshot |
no | no |
get_design_context |
udDesignContext |
no | no |
get_variable_defs |
udVariables |
no | no |
search_design_system |
udSearchDesignSystem |
no | no |
Users reference them in chat as #udUseFigma etc., or group them with the tool set #uiDesigner. Each tool’s
modelDescription carries a short form of the ui-designer gotchas (colours 0–1, load fonts, clone paints,
return ids), because chat agents do not load skills.
10.2 Behaviour#
- Calls run in the extension host against the open editor (no bridge needed), or headless when the file is
not open. Each
use_figmais one undo step signed with the chat agent’s name (Copilotfor Copilot agent mode; elseud.ai.lm.actor, defaultChat agent). prepareInvocationshows the confirmation for mutating calls; VS Code’s “always allow” applies per workspace.- Screenshots are returned as
LanguageModelDataPartimages; text asLanguageModelTextPart. - Licence as in §5.6: the tools are gated like
ud, not as “AI features” — reads work on every plan,use_figmaneeds the planudneeds for a mutation and otherwise returns alicenceerror.ud.ai.enabledapplies too: with AI disabled, the tools are not registered. - The AI panel’s proposals do not apply to chat agents (AI-5 covers the panel, §6.5); their changes are
reviewable through history,
ud diffand undo, and the confirmation above shows the script first.
10.3 vscode.lm as the panel’s backend#
When ud.ai.backend is vscode-lm (or Claude Code is unavailable), the panel runs its own tool loop with
vscode.lm.selectChatModels and sendRequest, offering the same tools as §5.2 (in-process) and the bundled
ui-designer skill text as the system prompt. Proposals, limits, Cancel and review work the same. Read-only
workspace tools are provided in-process (read file, search). Quality depends on the selected model; the
scenario suite (§12) is run against it as a separate, non-blocking column.