Widget tools and targeting

CLI contract checked against 0.287.0 on 2026-10-16. Inspect installed help or connected MCP schemas if they differ. Examples use placeholders, not real IDs.

TaskCLIAccount MCP tool / operation
Read draft settingsvf widget getvoiceflow_widget / get
Patch draft settingsvf widget updatevoiceflow_widget / update
Get installation codevf widget get-snippetvoiceflow_widget / get_snippet

The public Knowledge MCP supplies documentation; it does not perform these account operations. If a tool is absent, rediscover tools/check connection before concluding the feature is unavailable. Do not invent an MCP command.

Read and get the snippet

vf widget get --project-id PROJECT_ID --environment-alias ENVIRONMENT_ALIAS --timeout 20s -o toon
vf widget get-snippet --project-id PROJECT_ID --environment-alias ENVIRONMENT_ALIAS --version-param published --timeout 20s -o toon

get reads the environment's draft, even if the website serves published content. get-snippet defaults to published; --version-param draft is for an explicitly requested preview. Do not install a draft snippet on the public site by accident. The output contains installation code: extract that code, not the CLI's surrounding structured envelope, for the site's HTML field.

MCP uses the operation.name / operation.payload envelope. Read its schema for projectID, environmentAlias, the snippet version selector, and update body placement. Do not translate the CLI's --version-param spelling into an invented MCP property. See the shared request shapes.

Patch only the intended settings

Read current settings first. A minimal color change uses common.primaryColor:

{"common":{"primaryColor":{"color":"#245D58"}}}

Save the body as widget-patch.json, then, for an authorized draft edit:

vf widget update --project-id PROJECT_ID --environment-alias ENVIRONMENT_ALIAS --timeout 20s -o toon < widget-patch.json

Read back the changed fields. The merge rules matter:

Preserve routing

Generated snippets contain the correct verification, runtime, and targeting fields for the selected project. Preserve them during framework adaptation. Never place an OAuth bearer token, personal key, or server API secret in browser code. A generated browser verification identifier is not a management credential.

The generic widget API can follow traffic allocation when no environment is pinned; an explicit environment overrides that behavior. The snippet operation instead takes a selected environment and version. Do not silently remove that pin or substitute legacy production/development values. If the user wants traffic-split routing, inspect the current API docs and existing snippet first.

Saved widget settings require publication to affect the published widget. Before publishing, inspect the environment's complete pending changes: a widget request is not permission to release unrelated agent edits. If authorization already covers that release, proceed; otherwise finish the reviewable draft and explain the specific publication decision. See environments.

Source: Widget API.