talonic_documents_set_display_name_rule
Set how documents get their readable name: off (show filenames; clears the readable names already stored), default (tidy the filename) or lua with a script. New documents follow the rule; apply it to existing ones with talonic_documents_backfill_display_names. Admin only, as in the web app; call only when the user asks.
A script reads record.filename and calls record:set('display_name', value). Try it first with talonic_documents_preview_display_name_rule.
A 403 names its reason (insufficient_scope, insufficient_role, no_person, person_inactive, workspace_read_only): the key's person must be allowed the same action in the Talonic web app, and an OAuth connection must have granted the scope. Tell the user; do not retry.
Availability
Listed per area (Spec runs, ingest, ingest settings, document organising, collections, saved filters, document types) when your role can use that area of the workspace. Being listed only means the tool is visible: Talonic checks your role again on every call.
Behaviour and cost
- Changes workspace data and can't be undone. Call it only when the user asked.
Parameters
| Parameter | Type | Description |
|---|---|---|
| mode * | "off" | "default" | "lua" | `off`, `default` or `lua`. |
| script | string | The rule script; required for `lua`, kept as a draft otherwise. |
Example
{
"mode": "off"
}Errors
A failed call comes back as a tool error with the HTTP status and a message that says what to change. Troubleshooting lists the common ones.