Sandbox — LSD is in active testing. All systems operational·payments are test-mode (no real charges).
Overview Use Cases News Docs Tool Store Support Community Get LSD
All docs
Docs/ API Reference/ Tool/ action
Tool· decorator

Tool.action

registers a routed action that UI can invoke by route

Python
action(route, *, label=None, icon=None)

Returns Callable — the decorated (ctx, **values) function, unchanged

Parameters#

name type default description
route str the action route: app/<verb>, entity/<type>/<verb>, or another namespace
label str None the menu / button label (defaults to a humanized last route segment)
icon str None a symbolic icon name for the menu item or context action

Example#

Python
@tool.action("app/refresh", label="Refresh", icon="view-refresh-symbolic")
def refresh(ctx, **values):
    ctx.rerun()

An entity context-menu action:

Python
@tool.action("entity/drillholes/export")
def export(ctx, path: str = "out.csv"):
    ctx.entity.step("desurvey").table().write_csv(path)

Notes#

The function is (ctx: Context, **values). At mount, app/<verb> routes become Run-menu items and entity/<type>/<verb> routes become entity context-menu actions; actions are also exposed as MCP tools. Any route is reachable programmatically via dispatch.

See also#

API: dispatch · command · Context

Guides: Commands & actions

By LSD Team · Last updated Jul 17, 2026 Ask on Discord View as Markdown