All docs
Tool·
decorator
Tool.source
registers a custom source kind on a read(cfg) function
Python
source(kind, *, label="", config=None)
Returns Callable — the decorated read(cfg) function, unchanged
Parameters#
| name | type | default | description |
|---|---|---|---|
kind |
str |
— | the source kind id, e.g. "rest-api" — used in the picker and in a load's source_kinds=(...) |
label |
str |
"" |
the human name shown in the source picker (defaults to kind) |
config |
dict | UINode |
None |
a UI tree whose field values are passed to the function as a dict |
Example#
Python
@tool.source("rest-api", label="REST API", config={"form": [{"text": {"name": "url"}}]})
def read(cfg) -> Table:
return Table(fetch(cfg["url"]))
Notes#
The config's field values arrive as a plain dict; the function returns a Table. Once registered,
the kind appears in every source picker, and a @tool.load step can restrict itself to it via
source_kinds=("rest-api", …).
See also#
Guides: Load steps · A file loader
By LSD Team · Last updated Jul 17, 2026
Ask on Discord
View as Markdown