Add an app block
add_blockAdds an app block from Xodia's data kit to a page, the same way as the App group in Xodia's Add panel: the block's component (booking widget, my bookings, calendar, table view, search and filter, entry page, stats, chart, profile, edit profile, list, form, the sign-in set (one sign-in card: Google first when on, then a Password | Email me a code switch; methods picks the ways, default the site's own), comments, likes, checklist, board or an upload field) written into the file next to or inside the element whose opening tag starts on line, bound to the tables in bind (a table of the user's may have other field names: map them in bind), in the site's own colours and fonts, editable on the canvas. Read the file first and pick the element; for a block that makes its own tables, call make_block_tables first and pass its bind. For seats at an event (a booking widget on items that happen once), pass oneTime. Comments and likes hang on the entry around them (a DataList row, an entry page) or on entry or param. Blocks on any table name the table and map their slots in bind.table: a chart, label (also accepted as groupBy: what it groups by, a choice, text, date or yes/no field) and value (an optional number field it adds up; without it, it counts entries): { "table": { "table": "orders", "fields": { "label": "status", "value": "total" } } }; stats, value (an optional number field: without it, one card counts the entries; with it, also its total and average; each number becomes a you can edit after): { "table": { "table": "bookings", "fields": { "value": "people" } } }; a table view, the columns it shows, each column's word as the key and the table's field as the value (up to 8): { "table": { "table": "members", "fields": { "name": "full_name", "joined": "created_at", "plan": "plan" } } }; a search and filter, title (the field searched first) and the other fields it searches: { "table": { "table": "listings", "fields": { "title": "headline", "area": "neighbourhood" } } }, beside the list or table view it filters (filterBy). A board binds any table with a status field ({ "table": { "table": "projects", "fields": { "status": "stage", "title": "name" } } }) and takes columns. An upload goes only inside a form (DataForm): its line, position "inside", bind { "table": { "table": "<the form's table>", "fields": { "file": "" } } }, after make_block_tables with block "upload" set up the file storage. Only React files (.tsx, .jsx) on a site with the data kit (src/components/data). Saved at once like every edit. Afterwards read the file, wrap the block in the site's own section and container when it stands alone, and run run_check typecheck. When it answers add_unsupported, Xodia can't add blocks on this project yet: write the block yourself in the shape skill app-blocks gives.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"block": "<block>",
"file": "<file>",
"line": "<line>",
"position": "<position>",
"projectId": "<projectId>"
},
"name": "add_block"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bind | No | Which tables and fields the block uses. From make_block_tables as it answers; for a block on any table, { "table": { "table": "listings", "fields": { "title": "headline" } } } (slot name to the table's field; slots: calendar title, starts, ends; searchFilter title; entryPage title, image, text; stats value; chart label (group by, also accepted as groupBy) and value (a number to add up, else entries are counted), e.g. { "table": { "table": "bookings", "fields": { "label": "status" } } }; board status, title; list title, text, image, date; upload file); on a ready-made table from make_block_tables the slots are filled from its fields when left out; for a ready-made table under another name, { "bookings": { "table": "class_bookings" } }; for a table of the user's whose fields have other names, map each recipe field name to theirs, null for an optional field the table hasn't: { "services": { "table": "events", "fields": { "name": "title", "minutes": null } } }. Left out: the recipe's own names | |
| file | Yes | The page or section file to add it to, relative to the project root (src/pages/Book.tsx, src/components/sections/Bookings.tsx) | |
| line | Yes | The line where the element to place it next to (or inside) starts its opening tag, as read_file numbers lines | |
| block | Yes | The app block to add: "bookingWidget" (Booking widget), "myBookings" (My bookings), "calendar" (Calendar), "tableView" (Table view), "searchFilter" (Search and filter), "entryPage" (Entry page), "stats" (Stats), "chart" (Chart), "profile" (Profile), "editProfile" (Edit my profile), "list" (List and cards), "form" (Add or edit form), "signIn" (Sign-in set), "comments" (Comments), "likes" (Likes), "checklist" (Checklist), "board" (Board), "upload" (File upload) | |
| entry | No | comments and likes only: what the thread or like is under, as a page key ("about", "pricing") so each page has its own. Leave entry and param out inside a DataList row (each row's own id) or on an entry page (its route parameter) | |
| param | No | comments and likes only: on an entry page (/lessons/:id), the route parameter that names the entry (id, slug), instead of entry | |
| branch | No | Optional branch; default the branch the workspace has open | |
| sample | No | true: the block works on sample entries until a database is connected (Keep sample entries for now). Default false | |
| columns | No | board only: its columns left to right, each a status value as the table stores it and its words: [{ "value": "todo", "label": "To do" }]. Default To do, In progress, Done | |
| methods | No | signIn only: the ways the one sign-in card offers, any of google, email_code, password (Google first, then a Password | Email me a code switch). Default: the ways the site's sign-in has on (get_members), else a password and a code by email | |
| oneTime | No | bookingWidget only, for items that happen once (events): each item is booked on its own date and time, with no day or time picker. when: the items table's date or date-and-time field (default starts); param and match: on an entry page (/events/:slug), the route parameter and the field it matches ({ "param": "slug", "match": "slug" }) so only that item is offered. The items are bind.services or, without it, the events table. {} for the defaults | |
| position | Yes | Where the block goes: "before" or "after" that element, or "inside" it as its last child | |
| projectId | Yes | Project id from list_projects |