Daily use

Databases

The 9 tools for databases. Before an agent first makes one, it reads guide topic databases.

create_database

Make a database in a space: Airtable-style tables of records with typed fields (text, numbers, choices, dates, people, attachments, links between tables). People see each table as a grid, add and edit records in it, and open a record's fields in a side panel. Give its tables with their fields and records; link fields can point at any table given; a record given as { values, page } also gets its page of notes (Markdown). Read guide topic "databases" first; check it with render_database.

Parameters

space_idstringrequired
titlestringrequired
tablesobject[]required
Show child attributes
namestringrequired
fieldsobject[]required
In column order. The first field names each record (a name or title, as text).
Show child attributes
namestringrequired
What it holds, short: "Company", "Deal size", "Owner".
typestringrequired
text (one line), long_text (notes), number, checkbox, select (one of its choices), multi_select (any of them), date (YYYY-MM-DD), url, email, phone, file (attachments), person (a member of the space), link (records of another table in this database). One of text, long_text, number, checkbox, select, multi_select, date, url, email, phone, file, person, link.
choicesstring[]
select, multi_select: the choices, in order. A value that is not one is added as a new choice.
formatstring
number: how it shows. percent takes 0.25 for 25%. One of plain, currency, percent.
currencystring
number with format currency: its code, default USD.
decimalsinteger
number: decimal places shown.
linkstring
link: the table its records point at (name or id).
recordsobject[]
Show child attributes
valuesobjectrequired
Values by field name: text and numbers as they are; checkbox true/false; select a choice; multi_select a list; date "YYYY-MM-DD"; person a member's name or email; link a list of the linked records' first-field values (or ids); file a list of {url, name}.
pagestringrequired
The record's page: notes, a brief, a description — Markdown, shown under its fields.

read_database

A database as it is now, people's edits included: each table with its id, fields (id, name, type, choices, format, the table a link points at) and how many records. list_records gives the records.

Parameters

item_idstringrequired

list_records

Records of one table, each with its id (what update_records, delete_records and comment take) and its values by field name as people read them (a person by name, links by the names of the records); pages: true adds each record's page (its notes, Markdown). Filter, search (fields and pages), sort and page through them; total says how many match.

Parameters

item_idstringrequired
tablestringrequired
Its name or id.
filtersobject[]
All must hold. gt/lt compare numbers, and dates as YYYY-MM-DD.
Show child attributes
fieldstringrequired
opstringrequired
One of is, is_not, contains, not_contains, gt, gte, lt, lte, empty, not_empty.
valueany
searchstring
Words in any field.
sortobject[]
Show child attributes
fieldstringrequired
descboolean
fieldsstring[]
Only these fields (default all).
pagesboolean
Include each record's page (Markdown). Without it, has_page says which have one.
limitinteger
Default 100.
offsetinteger

add_records

Add records to a table (up to 1000 a call), at the end or after a record. Returns their ids. A select value that is not a choice yet is added as one.

Parameters

item_idstringrequired
tablestringrequired
Its name or id.
recordsobject[]required
Show child attributes
valuesobjectrequired
Values by field name: text and numbers as they are; checkbox true/false; select a choice; multi_select a list; date "YYYY-MM-DD"; person a member's name or email; link a list of the linked records' first-field values (or ids); file a list of {url, name}.
pagestringrequired
The record's page: notes, a brief, a description — Markdown, shown under its fields.
afterstring
A record id: the new records go after it (default: at the end).

update_records

Change records of a table by id: only the fields given change; null or "" clears one. page replaces the record's page (Markdown; "" clears it).

Parameters

item_idstringrequired
tablestringrequired
recordsobject[]required
Show child attributes
idstringrequired
valuesobject
Values by field name: text and numbers as they are; checkbox true/false; select a choice; multi_select a list; date "YYYY-MM-DD"; person a member's name or email; link a list of the linked records' first-field values (or ids); file a list of {url, name}.
pagestring
The record's whole page, in Markdown.

delete_records

Delete records of a table by id; links to them from other tables are taken off.

Parameters

item_idstringrequired
tablestringrequired
idsstring[]required

update_database

Change a database's shape. Any of: title; add_tables (with fields and records); rename_tables; remove_tables (with their records; links into them become text); add_fields; change_fields (by table and field name or id: a new name, type — values are converted through their text, what does not read is cleared — choices, format, link); remove_fields; move_fields (to a 0-based column; 0 makes it the first field, which names records). Applied in that order, all or none.

Parameters

item_idstringrequired
titlestring
add_tablesobject[]
Show child attributes
namestringrequired
fieldsobject[]required
In column order. The first field names each record (a name or title, as text).
Show child attributes
namestringrequired
What it holds, short: "Company", "Deal size", "Owner".
typestringrequired
text (one line), long_text (notes), number, checkbox, select (one of its choices), multi_select (any of them), date (YYYY-MM-DD), url, email, phone, file (attachments), person (a member of the space), link (records of another table in this database). One of text, long_text, number, checkbox, select, multi_select, date, url, email, phone, file, person, link.
choicesstring[]
select, multi_select: the choices, in order. A value that is not one is added as a new choice.
formatstring
number: how it shows. percent takes 0.25 for 25%. One of plain, currency, percent.
currencystring
number with format currency: its code, default USD.
decimalsinteger
number: decimal places shown.
linkstring
link: the table its records point at (name or id).
recordsobject[]
Show child attributes
valuesobjectrequired
Values by field name: text and numbers as they are; checkbox true/false; select a choice; multi_select a list; date "YYYY-MM-DD"; person a member's name or email; link a list of the linked records' first-field values (or ids); file a list of {url, name}.
pagestringrequired
The record's page: notes, a brief, a description — Markdown, shown under its fields.
rename_tablesobject[]
Show child attributes
tablestringrequired
namestringrequired
remove_tablesstring[]
add_fieldsobject[]
Show child attributes
tablestringrequired
fieldobjectrequired
Show child attributes
namestringrequired
What it holds, short: "Company", "Deal size", "Owner".
typestringrequired
text (one line), long_text (notes), number, checkbox, select (one of its choices), multi_select (any of them), date (YYYY-MM-DD), url, email, phone, file (attachments), person (a member of the space), link (records of another table in this database). One of text, long_text, number, checkbox, select, multi_select, date, url, email, phone, file, person, link.
choicesstring[]
select, multi_select: the choices, in order. A value that is not one is added as a new choice.
formatstring
number: how it shows. percent takes 0.25 for 25%. One of plain, currency, percent.
currencystring
number with format currency: its code, default USD.
decimalsinteger
number: decimal places shown.
linkstring
link: the table its records point at (name or id).
atinteger
0-based column; default last.
change_fieldsobject[]
Show child attributes
tablestringrequired
fieldstringrequired
changesobjectrequired
Show child attributes
namestring
What it holds, short: "Company", "Deal size", "Owner".
typestring
text (one line), long_text (notes), number, checkbox, select (one of its choices), multi_select (any of them), date (YYYY-MM-DD), url, email, phone, file (attachments), person (a member of the space), link (records of another table in this database). One of text, long_text, number, checkbox, select, multi_select, date, url, email, phone, file, person, link.
choicesstring[]
select, multi_select: the choices, in order. A value that is not one is added as a new choice.
formatstring
number: how it shows. percent takes 0.25 for 25%. One of plain, currency, percent.
currencystring
number with format currency: its code, default USD.
decimalsinteger
number: decimal places shown.
linkstring
link: the table its records point at (name or id).
remove_fieldsobject[]
Show child attributes
tablestringrequired
fieldstringrequired
move_fieldsobject[]
Show child attributes
tablestringrequired
fieldstringrequired
tointegerrequired

import_records

Fill a table from a range of one of the space's spreadsheets: the range's first row names the fields, each row under it is a record. A header that matches no field adds one (number when every value is a number, else text). Values are read as the sheet shows them; cleaned like add_records.

Parameters

item_idstringrequired
tablestringrequired
The table to fill (name or id).
sheetstringrequired
A spreadsheet in this space, by its item id.
rangestringrequired
"Tab!A1:F200" (no tab = the first): a header row and rows under it.

render_database

See a database as people do: a screenshot of one table's grid (the first by default), with a record's side panel open when record is given, and errors the page hit.

Parameters

item_idstringrequired
tablestring
Its name or id; default the first.
recordstring
A record id: shows its side panel.