@centrali-io/centrali-mcp 7.0.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -29
- package/dist/index.js +0 -2
- package/dist/tools/alerts.js +4 -2
- package/dist/tools/describe.js +12 -856
- package/package.json +2 -2
- package/src/index.ts +0 -2
- package/src/tools/alerts.ts +4 -2
- package/src/tools/describe.ts +12 -1009
- package/dist/tools/pages.d.ts +0 -3
- package/dist/tools/pages.js +0 -512
- package/src/tools/pages.ts +0 -615
package/dist/tools/describe.js
CHANGED
|
@@ -28,7 +28,7 @@ function registerDescribeTools(server) {
|
|
|
28
28
|
type: "text",
|
|
29
29
|
text: JSON.stringify({
|
|
30
30
|
platform: "Centrali",
|
|
31
|
-
description: "Centrali is a low-code backend platform. You define data collections, write compute functions, build orchestration workflows
|
|
31
|
+
description: "Centrali is a low-code backend platform. You define data collections, write compute functions, and build orchestration workflows — all through APIs.",
|
|
32
32
|
domains: {
|
|
33
33
|
collections: {
|
|
34
34
|
summary: "Data schemas. Define the shape of your data — fields, types, constraints, references.",
|
|
@@ -152,31 +152,6 @@ function registerDescribeTools(server) {
|
|
|
152
152
|
"reject_validation_suggestion",
|
|
153
153
|
],
|
|
154
154
|
},
|
|
155
|
-
pages: {
|
|
156
|
-
summary: "UI page builder. Create list views, detail views, forms, and dashboards backed by collection data. Supports publishing, versioning, access control, and theming.",
|
|
157
|
-
describeWith: "describe_pages",
|
|
158
|
-
tools: [
|
|
159
|
-
"list_pages",
|
|
160
|
-
"get_page",
|
|
161
|
-
"create_page",
|
|
162
|
-
"update_page",
|
|
163
|
-
"delete_page",
|
|
164
|
-
"save_page_draft",
|
|
165
|
-
"get_page_draft",
|
|
166
|
-
"list_page_versions",
|
|
167
|
-
"validate_page",
|
|
168
|
-
"publish_page",
|
|
169
|
-
"unpublish_page",
|
|
170
|
-
"set_page_access_policy",
|
|
171
|
-
"get_page_theme",
|
|
172
|
-
"set_page_theme",
|
|
173
|
-
"get_navigation",
|
|
174
|
-
"set_navigation",
|
|
175
|
-
"delete_navigation",
|
|
176
|
-
"generate_starter_pages",
|
|
177
|
-
"accept_page_proposal",
|
|
178
|
-
],
|
|
179
|
-
},
|
|
180
155
|
auth_providers: {
|
|
181
156
|
summary: "External identity provider configuration for BYOT (Bring Your Own Token). Connect Clerk, Auth0, Okta, Keycloak, or any OIDC provider so your app's users can authenticate with their existing IdP and Centrali handles authorization via claim-based policies.",
|
|
182
157
|
describeWith: "describe_auth_providers",
|
|
@@ -265,11 +240,10 @@ function registerDescribeTools(server) {
|
|
|
265
240
|
aliases: {
|
|
266
241
|
recordSlug: "Used across all tools — the collection's URL-safe identifier (e.g., 'orders').",
|
|
267
242
|
collections: "Used by search_records. Same value as recordSlug. Accepts a string or array of strings.",
|
|
268
|
-
collectionIds: "Used by generate_starter_pages. This is the collection UUID (not the slug). Get it from list_collections → id field.",
|
|
269
243
|
},
|
|
270
|
-
rule: "When a tool asks for recordSlug or collections — use the collection's slug (e.g., 'orders').
|
|
244
|
+
rule: "When a tool asks for recordSlug or collections — use the collection's slug (e.g., 'orders').",
|
|
271
245
|
},
|
|
272
|
-
workflow: "Typical workflow: 1) Define collections → 2) Create records → 3) Write compute functions → 4) Wire orchestrations
|
|
246
|
+
workflow: "Typical workflow: 1) Define collections → 2) Create records → 3) Write compute functions → 4) Wire orchestrations. When building an app, also: 5) Create a service account → 6) Grant least-privilege permissions via remediation → 7) Create publishable keys for the frontend.",
|
|
273
247
|
app_credential_setup: {
|
|
274
248
|
description: "When building an app that uses Centrali, you need credentials. The flow depends on whether the code runs server-side or client-side.",
|
|
275
249
|
backend: {
|
|
@@ -303,7 +277,6 @@ function registerDescribeTools(server) {
|
|
|
303
277
|
"Triggers": { sdk: true, mcp: true, console: true },
|
|
304
278
|
"Smart queries": { sdk: true, mcp: true, console: true },
|
|
305
279
|
"Orchestrations": { sdk: true, mcp: true, console: true },
|
|
306
|
-
"Pages": { sdk: "partial", mcp: true, console: true },
|
|
307
280
|
"Realtime subscriptions (SSE)": { sdk: true, mcp: false, console: false, note: "SDK-only — use client.realtime.subscribe() in app code" },
|
|
308
281
|
"Validation scans": { sdk: true, mcp: true, console: true },
|
|
309
282
|
"Anomaly insights": { sdk: true, mcp: true, console: true },
|
|
@@ -614,7 +587,7 @@ function registerDescribeTools(server) {
|
|
|
614
587
|
type: "text",
|
|
615
588
|
text: JSON.stringify({
|
|
616
589
|
domain: "Records",
|
|
617
|
-
description: "Records are rows of data stored in collections. All custom field values live under the 'data' namespace. The query_records tool accepts a canonical QueryDefinition body; the underlying engine (POST /records/query) is shared with the SDK, console,
|
|
590
|
+
description: "Records are rows of data stored in collections. All custom field values live under the 'data' namespace. The query_records tool accepts a canonical QueryDefinition body; the underlying engine (POST /records/query) is shared with the SDK, console, and compute.",
|
|
618
591
|
record_shape: {
|
|
619
592
|
id: "UUID — auto-generated",
|
|
620
593
|
collectionId: "UUID — the collection this record belongs to",
|
|
@@ -960,10 +933,6 @@ function registerDescribeTools(server) {
|
|
|
960
933
|
triggerParams: "Static params from trigger.triggerMetadata.params",
|
|
961
934
|
executionParams: "{ payload } — the payload passed to invoke_trigger",
|
|
962
935
|
},
|
|
963
|
-
"pages-action": {
|
|
964
|
-
triggerParams: "{ input, token } — from page action invocation",
|
|
965
|
-
executionParams: "{} — empty",
|
|
966
|
-
},
|
|
967
936
|
"orchestration-step": {
|
|
968
937
|
triggerParams: "Merged: orchestration input + previous step outputs + decrypted encrypted params",
|
|
969
938
|
executionParams: "Not used — all input arrives via triggerParams for orchestration steps",
|
|
@@ -972,8 +941,11 @@ function registerDescribeTools(server) {
|
|
|
972
941
|
},
|
|
973
942
|
sandbox_api: {
|
|
974
943
|
description: "Functions receive an `api` object with built-in utilities.",
|
|
975
|
-
records: "api.queryRecords, api.fetchRecord, api.createRecord, api.updateRecord, api.deleteRecord, api.
|
|
976
|
-
|
|
944
|
+
records: "api.queryRecords, api.aggregateRecords, api.fetchRecord, api.fetchRecordByUniqueField, api.createRecord, api.upsertRecord, api.updateRecord, api.deleteRecord, api.incrementField, api.decrementField, api.compareSecret",
|
|
945
|
+
records_many: "api.batchCreateRecords, api.batchUpdateRecords, api.batchDeleteRecords, api.bulkCreateRecords, api.bulkUpdateRecords, api.bulkDeleteRecords — up to 1,000 records each. bulk* aggregates events; batch* does not.",
|
|
946
|
+
http: "api.httpGet(url, config?), api.httpPost(url, data?, config?), api.httpPut(url, data?, config?), api.httpDelete(url, config?). config is { headers, timeout }; each returns { status, statusText, headers, data }. There is NO api.httpRequest and NO api.httpFetch — this field named both until 2026-08-15 and neither has ever existed.",
|
|
947
|
+
http_allowlist: "Outbound HTTP is deny-by-default: a function reaches nothing external until the workspace allow-lists the domain. Wildcards use the *.example.com form and match subdomains only, not the apex. Private/internal addresses are blocked outright (SSRF protection).",
|
|
948
|
+
cannot: "A compute function CANNOT start an orchestration (no api method exists; orchestrationRunId/orchestrationStepId are inbound context, set when the function is already a step) and CANNOT send an outbound webhook (delivery is driven by subscriptions reacting to record events). To start an orchestration from a webhook, point the sender at the orchestration service's own HMAC-verified endpoint: POST /ws/{ws}/webhooks/{path}.",
|
|
977
949
|
files: "api.storeFile, api.storeAsCSV, api.storeAsJSON",
|
|
978
950
|
crypto: {
|
|
979
951
|
"api.crypto.sha256(data)": "SHA256 hash → base64 string",
|
|
@@ -981,7 +953,7 @@ function registerDescribeTools(server) {
|
|
|
981
953
|
"api.crypto.rsaSign(privateKeyPem, data, algorithm?)": "RSA signature → base64url string. algorithm: 'RS256' (default), 'RS384', 'RS512'",
|
|
982
954
|
"api.crypto.signJwt(privateKeyPem, payload, options?)": "Build + sign a JWT → 'header.payload.signature'. options: { algorithm, expiresIn (seconds), issuer }",
|
|
983
955
|
},
|
|
984
|
-
utilities: "api.uuid, api.formatDate, api.
|
|
956
|
+
utilities: "api.uuid, api.formatDate, api.renderTemplate, api.log, api.logError, api.toCSV, api.toJSON. Namespaced: api.lodash.{chunk,flatten,uniq,merge}, api.math.{evaluate,round,sum,mean,median,std,...}, api.base64.{encode,decode}. NOTE: api.chunk, api.merge and api.evaluate are NOT top-level — they live under api.lodash / api.math and were mislisted here until 2026-08-15.",
|
|
985
957
|
},
|
|
986
958
|
secrets: {
|
|
987
959
|
description: "Set encrypted params directly on any trigger's triggerMetadata.params. Shape at create/update: { paramName: { value: 'plaintext', encrypt: true } }. Stored AES-256-GCM at rest, decrypted at execution time, arrive in triggerParams[paramName] as plaintext.",
|
|
@@ -1177,7 +1149,7 @@ function registerDescribeTools(server) {
|
|
|
1177
1149
|
optional_params: ["savedQueryId"],
|
|
1178
1150
|
},
|
|
1179
1151
|
get_alert: {
|
|
1180
|
-
description: "Get an alert by ID, including its bound 'variables'
|
|
1152
|
+
description: "Get an alert by ID, including its bound 'variables', evaluation history ('lastEvaluatedAt', 'lastTriggeredAt', 'lastRowCount'), and health ('consecutiveFailures', 'lastError', 'lastErrorAt').",
|
|
1181
1153
|
required_params: ["alertId"],
|
|
1182
1154
|
},
|
|
1183
1155
|
create_alert: {
|
|
@@ -1205,7 +1177,7 @@ function registerDescribeTools(server) {
|
|
|
1205
1177
|
schedule: "'cronExpression' is a 5-field cron expression interpreted in 'timezone' (IANA name, default 'UTC'). Notifications are throttled to 1 per recipient per 15 minutes per alert, so a sub-15-minute cron evaluates more often than it can notify.",
|
|
1206
1178
|
recipients: "'recipients' is an explicit list — [{ type: 'user', id: '<userId>' }] — not a subscription list. No MCP tool enumerates workspace users, so ask the user for IDs instead of constructing them.",
|
|
1207
1179
|
variable_binding: "Bind the saved query's parameters via 'variables'. The server requires EVERY declaration the query body references that has no 'default', regardless of 'required' — stricter than execute_saved_query. An unbound reference is accepted at execute time and left in the body verbatim, so the alert would filter on the literal '${name}', match nothing, and never fire, with no error anywhere. Authoring is the last point where that's noticeable, so it fails there with a 400 naming each offending variable.",
|
|
1208
|
-
diagnosing: "For 'it never fired':
|
|
1180
|
+
diagnosing: "For 'it never fired': check 'consecutiveFailures' first — non-zero means the saved query is erroring and the alert cannot fire, with 'lastError' carrying the sanitized reason (commonest cause: a collection or field renamed out from under the query). It resets on the first successful run, so 0 rules that class out. With 'consecutiveFailures' at 0, a null/stale 'lastEvaluatedAt' means the alert is disabled or was never scheduled; a current 'lastEvaluatedAt' with null 'lastTriggeredAt' means the query runs fine and the condition isn't matching — compare the alert's 'variables' against the saved query's declarations.",
|
|
1209
1181
|
},
|
|
1210
1182
|
tips: [
|
|
1211
1183
|
"Use list_saved_queries to discover available queries (optionally filter by collection slug); each row's 'variables' field tells you what to pass",
|
|
@@ -1677,822 +1649,6 @@ function registerDescribeTools(server) {
|
|
|
1677
1649
|
],
|
|
1678
1650
|
});
|
|
1679
1651
|
}));
|
|
1680
|
-
// ── Pages ──────────────────────────────────────────────────────────
|
|
1681
|
-
(0, _register_js_1.registerTool)(server, "describe_pages", "Get the schema reference for Centrali pages. Explains page types, the definition structure, sections, blocks, and the publish lifecycle.", {}, () => __awaiter(this, void 0, void 0, function* () {
|
|
1682
|
-
return ({
|
|
1683
|
-
content: [
|
|
1684
|
-
{
|
|
1685
|
-
type: "text",
|
|
1686
|
-
text: JSON.stringify({
|
|
1687
|
-
domain: "Pages",
|
|
1688
|
-
description: "Pages are pre-built UI views that surface data from collections. Each page has a type, a versioned definition (describing layout and data binding), and a publish lifecycle.",
|
|
1689
|
-
page_types: {
|
|
1690
|
-
list: {
|
|
1691
|
-
description: "Data table view — shows multiple records with columns, sorting, filtering, and pagination.",
|
|
1692
|
-
typical_sections: ["content"],
|
|
1693
|
-
typical_blocks: ["data-table"],
|
|
1694
|
-
validation_requirement: "List pages must have at least one block with configured columns (in presentation.columns or block.columns) to pass publishing validation.",
|
|
1695
|
-
use_when: "You need to browse, search, or manage a set of records",
|
|
1696
|
-
},
|
|
1697
|
-
detail: {
|
|
1698
|
-
description: "Single-record view — shows all fields of one record with optional related data and actions.",
|
|
1699
|
-
typical_sections: ["hero", "content", "supporting"],
|
|
1700
|
-
typical_blocks: [
|
|
1701
|
-
"field-display",
|
|
1702
|
-
"related-list",
|
|
1703
|
-
"activity-feed",
|
|
1704
|
-
"markdown",
|
|
1705
|
-
],
|
|
1706
|
-
use_when: "You need to display a single record's full details (e.g., customer profile)",
|
|
1707
|
-
},
|
|
1708
|
-
form: {
|
|
1709
|
-
description: "Data entry form — lets users create or update records with validation and submission actions.",
|
|
1710
|
-
typical_sections: ["content", "actions"],
|
|
1711
|
-
typical_blocks: ["field-group", "markdown", "static-html"],
|
|
1712
|
-
IMPORTANT: "Use 'field-group' blockType with a 'fields' array. Do NOT use individual field block types (text-input, select, etc.) — the runtime only renders fields from field-group's fields array.",
|
|
1713
|
-
use_when: "You need users to input or edit data",
|
|
1714
|
-
},
|
|
1715
|
-
dashboard: {
|
|
1716
|
-
description: "Metrics and analytics view — shows KPIs, charts, tables, and activity feeds for data overview.",
|
|
1717
|
-
typical_sections: ["metrics", "content", "supporting"],
|
|
1718
|
-
typical_blocks: [
|
|
1719
|
-
"stat-group",
|
|
1720
|
-
"metric-card",
|
|
1721
|
-
"chart",
|
|
1722
|
-
"data-table",
|
|
1723
|
-
"activity-feed",
|
|
1724
|
-
"progress-indicator",
|
|
1725
|
-
"kanban",
|
|
1726
|
-
"calendar",
|
|
1727
|
-
"filter-bar",
|
|
1728
|
-
],
|
|
1729
|
-
use_when: "You need an overview with KPIs, trends, and visual summaries",
|
|
1730
|
-
},
|
|
1731
|
-
},
|
|
1732
|
-
describeDefinitionWith: "describe_page_definition",
|
|
1733
|
-
describeBlocksWith: "describe_page_blocks",
|
|
1734
|
-
describeActionsWith: "describe_page_actions",
|
|
1735
|
-
lifecycle: {
|
|
1736
|
-
"1_create": "create_page — creates the page record with name, slug, and type",
|
|
1737
|
-
"2_draft": "save_page_draft — saves or updates the page definition (layout, blocks, data bindings)",
|
|
1738
|
-
"3_validate": "validate_page — checks the draft for errors before publishing",
|
|
1739
|
-
"4_publish": "publish_page — makes the page accessible at its runtime URL",
|
|
1740
|
-
"5_iterate": "Repeat steps 2-4 to update. Each publish creates a new version.",
|
|
1741
|
-
unpublish: "unpublish_page — removes the page from its runtime URL (keeps the definition)",
|
|
1742
|
-
important_behavior: {
|
|
1743
|
-
description: "Publishing does NOT consume or delete the draft. After publishing, the page has BOTH an activePublication (the live version) and a currentDraft (a new working draft for future edits). This is intentional — it allows iterating on changes without affecting the live page.",
|
|
1744
|
-
example: "After publishing version 1, get_page shows: activePublication.versionNumber=1 (live) and currentDraft.versionNumber=2 (editable). The draft is not stale — it's the starting point for the next publish cycle.",
|
|
1745
|
-
agent_tip: "Do not treat the draft as an error or leftover. The normal state of a published page is: one active publication + one working draft. Edit the draft, validate, publish again to create version 3, etc.",
|
|
1746
|
-
},
|
|
1747
|
-
eventual_consistency_note: "After save_page_draft or set_navigation, there may be a brief delay before the data is visible via get_page_draft or get_navigation. If you get a 'not found' immediately after writing, wait 1-2 seconds and retry.",
|
|
1748
|
-
},
|
|
1749
|
-
access_modes: {
|
|
1750
|
-
public: "Anyone can view — no authentication required",
|
|
1751
|
-
authenticated: "Only logged-in users can view — redirects to login if not authenticated",
|
|
1752
|
-
"role-gated": "Only users with specific roles can view — returns 403 for unauthorized users",
|
|
1753
|
-
},
|
|
1754
|
-
describeNavigationWith: "describe_navigation",
|
|
1755
|
-
tips: [
|
|
1756
|
-
"Call describe_page_definition to learn the full definition schema before using save_page_draft",
|
|
1757
|
-
"Call describe_page_blocks to see all available block types and their configs",
|
|
1758
|
-
"Call describe_navigation to learn the navigation config schema before using set_navigation",
|
|
1759
|
-
"Use generate_starter_pages to auto-generate page proposals from your collections",
|
|
1760
|
-
"Always validate_page before publish_page — publishing will reject if there are errors",
|
|
1761
|
-
"Set access policy with set_page_access_policy before publishing if you need auth",
|
|
1762
|
-
"Use variable bindings on data sources to scope data dynamically — bind to URL params, auth context, record context, or static defaults",
|
|
1763
|
-
"For list→detail navigation: set useQueryParams:true on navigate-to-page actions, then bind the detail page's data source variables to { source: 'url', param: 'id' }. Use config.paramMapping to rename fields if source and target use different names (e.g., { requestId: 'id' })",
|
|
1764
|
-
"For user-scoped views (e.g., My Approvals): bind a variable to { source: 'auth', field: 'userId' } and use a smart query with '${assigneeId}'",
|
|
1765
|
-
],
|
|
1766
|
-
multi_page_pattern: {
|
|
1767
|
-
description: "How to build a list→detail app with scoped related data",
|
|
1768
|
-
steps: [
|
|
1769
|
-
"1. Create a smart query with '${variables}' for the detail page's related data (e.g., filter by '${requestId}')",
|
|
1770
|
-
"2. Create a list page with a data-table block and a navigate-to-page action: set config.useQueryParams:true, paramConfig: { source:'row', mode:'selected', selectedFields:['id'] }",
|
|
1771
|
-
"3. Create a detail page with: (a) a record-card block with mode:'single' and variables: { id: { source:'url', param:'id' } }, (b) a related-list block with dataSource type:'query', ref:smartQueryId, variables: { requestId: { source:'url', param:'id' } }",
|
|
1772
|
-
"4. Publish both pages. Clicking a row on the list navigates to /ws/detail-slug?id=rowId, and the detail page scopes all blocks to that ID.",
|
|
1773
|
-
],
|
|
1774
|
-
},
|
|
1775
|
-
}, null, 2),
|
|
1776
|
-
},
|
|
1777
|
-
],
|
|
1778
|
-
});
|
|
1779
|
-
}));
|
|
1780
|
-
// ── Page Definition Schema ─────────────────────────────────────────
|
|
1781
|
-
(0, _register_js_1.registerTool)(server, "describe_page_definition", "Get the full schema for a page definition — the JSON structure passed to save_page_draft. Explains sections, blocks, data sources, and how they compose together.", {}, () => __awaiter(this, void 0, void 0, function* () {
|
|
1782
|
-
return ({
|
|
1783
|
-
content: [
|
|
1784
|
-
{
|
|
1785
|
-
type: "text",
|
|
1786
|
-
text: JSON.stringify({
|
|
1787
|
-
domain: "Page Definition",
|
|
1788
|
-
description: "A page definition is a JSON object that describes the page layout. It contains sections, and each section contains blocks. Blocks are the actual UI components (tables, charts, forms, etc.).",
|
|
1789
|
-
definition_shape: {
|
|
1790
|
-
sections: "PageSection[] — ordered array of sections that make up the page",
|
|
1791
|
-
theme: {
|
|
1792
|
-
inherit: "boolean — if true, inherits the workspace theme. Usually set to true.",
|
|
1793
|
-
},
|
|
1794
|
-
},
|
|
1795
|
-
draft_vs_publish: {
|
|
1796
|
-
description: "Drafts are lenient — most fields are optional and will default. Publishing validates strictly. Always provide the fields below to avoid 400 errors.",
|
|
1797
|
-
always_required_even_in_drafts: [
|
|
1798
|
-
"sections[*].id — MUST be a valid UUID",
|
|
1799
|
-
"sections[*].blocks — array (can be empty)",
|
|
1800
|
-
"blocks[*].id — MUST be a valid UUID",
|
|
1801
|
-
],
|
|
1802
|
-
required_for_publish: [
|
|
1803
|
-
"sections[*].kind — enum (see section_kinds)",
|
|
1804
|
-
"sections[*].title — non-empty string",
|
|
1805
|
-
"sections[*].layout — enum (see section_layouts)",
|
|
1806
|
-
"blocks[*].blockType — non-empty string",
|
|
1807
|
-
"theme.inherit — boolean",
|
|
1808
|
-
],
|
|
1809
|
-
},
|
|
1810
|
-
section_shape: {
|
|
1811
|
-
id: "string — MUST be a valid UUID (e.g., crypto.randomUUID()). Non-UUID strings will cause 400 errors.",
|
|
1812
|
-
kind: "'content' | 'metrics' | 'exceptions' | 'actions' | 'hero' | 'supporting' — optional in drafts, required for publish",
|
|
1813
|
-
title: "string — section heading displayed to users. Optional in drafts, required (non-empty) for publish.",
|
|
1814
|
-
layout: "'single-column' | 'two-column' | 'metric-strip' | 'stack' — optional in drafts, required for publish",
|
|
1815
|
-
blocks: "PageBlock[] — array of blocks in this section (required, can be empty)",
|
|
1816
|
-
},
|
|
1817
|
-
section_kinds: {
|
|
1818
|
-
hero: "Top of page — typically a title/summary or key metric. Use for detail pages.",
|
|
1819
|
-
metrics: "KPI strip — typically metric-card or stat-group blocks in metric-strip layout",
|
|
1820
|
-
content: "Main content area — data tables, charts, forms. The workhorse section.",
|
|
1821
|
-
supporting: "Secondary content — related data, activity feeds, supplementary info",
|
|
1822
|
-
actions: "Action buttons or form submission areas. Often at the bottom of form pages.",
|
|
1823
|
-
exceptions: "Error/warning display area — for anomaly or validation results",
|
|
1824
|
-
},
|
|
1825
|
-
section_layouts: {
|
|
1826
|
-
"single-column": "Full-width blocks stacked vertically",
|
|
1827
|
-
"two-column": "Blocks arranged in two columns side by side",
|
|
1828
|
-
"metric-strip": "Horizontal strip of small blocks (ideal for stat-group, metric-card)",
|
|
1829
|
-
stack: "Compact vertical stack",
|
|
1830
|
-
},
|
|
1831
|
-
block_shape: {
|
|
1832
|
-
id: "string — MUST be a valid UUID. Non-UUID strings will cause 400 errors.",
|
|
1833
|
-
blockType: "string — the type of UI component (see describe_page_blocks for all types). Optional in drafts, required (non-empty) for publish.",
|
|
1834
|
-
dataSource: "DataSource | null — where this block gets its data (see below)",
|
|
1835
|
-
presentation: "BlockPresentation | null — display options (density, columns, chart type, emphasis rules)",
|
|
1836
|
-
actions: "BlockAction[] | null — interactive actions (buttons, row clicks, form submissions). See describe_page_actions.",
|
|
1837
|
-
narrative: "BlockNarrative | null — contextual copy (primary question, framing text, comparison)",
|
|
1838
|
-
filterableColumns: "string[] | null — which columns users can filter on (for data-table blocks)",
|
|
1839
|
-
},
|
|
1840
|
-
data_source_shape: {
|
|
1841
|
-
type: "'structure' | 'query' — 'structure' fetches collection records directly, 'query' executes a smart query with '${variable}' substitution",
|
|
1842
|
-
ref: "string — the collection ID (for structure) or smart query ID (for query) — UUID",
|
|
1843
|
-
mode: "'list' | 'single' | 'aggregate' — optional. 'single' fetches one record (detail pages), 'list' fetches paginated records, 'aggregate' computes metrics",
|
|
1844
|
-
recordSlug: "string | undefined — the collection's record slug for direct resolution (avoids an extra lookup). Recommended for structure type.",
|
|
1845
|
-
config: {
|
|
1846
|
-
description: "Optional query configuration",
|
|
1847
|
-
filter: "object | null — same filter syntax as query_records",
|
|
1848
|
-
sort: "SortConfig[] | null — array of { field, direction: 'asc' | 'desc' }",
|
|
1849
|
-
page: "number | null — for pagination",
|
|
1850
|
-
pageSize: "number | null — records per page",
|
|
1851
|
-
},
|
|
1852
|
-
variables: {
|
|
1853
|
-
description: "Optional variable bindings map. Each key is a variable name, each value declares the runtime source.",
|
|
1854
|
-
example: "{ requestId: { source: 'url', param: 'id' }, status: { source: 'static', value: 'active' } }",
|
|
1855
|
-
sources: {
|
|
1856
|
-
url: "{ source: 'url', param: 'paramName' } — reads from URL query params (e.g., ?id=abc)",
|
|
1857
|
-
auth: "{ source: 'auth', field: 'userId' | 'email' | 'name' } — from the logged-in user",
|
|
1858
|
-
record: "{ source: 'record', field: 'fieldName' } — from the page's primary record (detail pages only)",
|
|
1859
|
-
static: "{ source: 'static', value: 'literalValue' } — a hardcoded default",
|
|
1860
|
-
},
|
|
1861
|
-
behavior: {
|
|
1862
|
-
query_type: "For type:'query' — resolved variables substitute into smart query '${placeholders}' before execution",
|
|
1863
|
-
structure_type: "For type:'structure' — resolved variables become equality filters on the collection. IMPORTANT: the variable name 'id' is special — it matches the system record UUID (used for single-record fetch by ID). ALL OTHER variable names filter against user data fields and are automatically prefixed with 'data.' (e.g., variable 'requestId' filters on data.requestId in the JSONB column). System columns like createdAt, updatedAt, status do NOT get the data. prefix.",
|
|
1864
|
-
unresolved: "If any variable cannot be resolved, the block returns an empty result with a variableError message — NEVER unfiltered data",
|
|
1865
|
-
detail_page_pattern: "For a detail page: use variables: { id: { source: 'url', param: 'id' } } on the primary record-card block to fetch by system ID. For related-list blocks, use the actual data field name (e.g., variables: { requestId: { source: 'url', param: 'id' } }) — this filters related records where data.requestId matches the URL param. The 'id' variable fetches a record BY its UUID; other variable names filter records WHERE a field equals the value.",
|
|
1866
|
-
reference_fields: "Reference fields (foreign keys between collections) store the target record's system UUID. To filter a related list by a reference field, bind the variable to the parent record's system ID (from URL param), not a custom field value. Example: approval_steps has a data.requestId field that stores the governance_request's UUID.",
|
|
1867
|
-
},
|
|
1868
|
-
precedence: "url > record > auth > static (highest to lowest priority)",
|
|
1869
|
-
},
|
|
1870
|
-
aggregation: {
|
|
1871
|
-
description: "For metric/chart blocks. Defines computations over the data.",
|
|
1872
|
-
operations: "Record<string, { count?: '*', sum?: 'fieldName', avg?: 'fieldName', min?: 'fieldName', max?: 'fieldName' }>",
|
|
1873
|
-
groupBy: "string[] | null — fields to group by",
|
|
1874
|
-
},
|
|
1875
|
-
},
|
|
1876
|
-
narrative_shape: {
|
|
1877
|
-
primaryQuestion: "string — the business question this block answers (e.g., 'How are sales trending?')",
|
|
1878
|
-
framingCopy: "string — contextual description shown above/below the block",
|
|
1879
|
-
comparison: "{ type: 'previous-period' | 'target' | 'baseline', value: number } — for metrics comparison",
|
|
1880
|
-
nextActionLabel: "string — label for a suggested next action (e.g., 'View all orders')",
|
|
1881
|
-
},
|
|
1882
|
-
IMPORTANT_all_ids_must_be_uuids: "Section IDs and block IDs MUST be valid UUIDs (e.g., 'a1b2c3d4-e5f6-7890-abcd-ef1234567890'). Using slugs like 'main-content' will cause a 400 error.",
|
|
1883
|
-
example_list_page_definition: {
|
|
1884
|
-
sections: [
|
|
1885
|
-
{
|
|
1886
|
-
id: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
|
|
1887
|
-
kind: "content",
|
|
1888
|
-
title: "All Customers",
|
|
1889
|
-
layout: "single-column",
|
|
1890
|
-
blocks: [
|
|
1891
|
-
{
|
|
1892
|
-
id: "d290f1ee-6c54-4b01-90e6-d701748f0851",
|
|
1893
|
-
blockType: "data-table",
|
|
1894
|
-
dataSource: {
|
|
1895
|
-
type: "structure",
|
|
1896
|
-
ref: "<collection-uuid>",
|
|
1897
|
-
recordSlug: "customers",
|
|
1898
|
-
},
|
|
1899
|
-
columns: [
|
|
1900
|
-
{ key: "name", label: "Name", filterable: true, sortable: true },
|
|
1901
|
-
{ key: "email", label: "Email", sortable: true },
|
|
1902
|
-
{ key: "status", label: "Status", filterable: true, sortable: true },
|
|
1903
|
-
{ key: "createdAt", label: "Created", sortable: true },
|
|
1904
|
-
],
|
|
1905
|
-
},
|
|
1906
|
-
],
|
|
1907
|
-
},
|
|
1908
|
-
],
|
|
1909
|
-
theme: { inherit: true },
|
|
1910
|
-
},
|
|
1911
|
-
example_dashboard_definition: {
|
|
1912
|
-
sections: [
|
|
1913
|
-
{
|
|
1914
|
-
id: "c73bcdcc-2669-4bf6-81d3-e4ae73fb11fd",
|
|
1915
|
-
kind: "metrics",
|
|
1916
|
-
title: "Key Metrics",
|
|
1917
|
-
layout: "metric-strip",
|
|
1918
|
-
blocks: [
|
|
1919
|
-
{
|
|
1920
|
-
id: "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
|
|
1921
|
-
blockType: "metric-card",
|
|
1922
|
-
dataSource: {
|
|
1923
|
-
type: "structure",
|
|
1924
|
-
ref: "<orders-collection-uuid>",
|
|
1925
|
-
mode: "aggregate",
|
|
1926
|
-
config: {},
|
|
1927
|
-
aggregation: {
|
|
1928
|
-
operations: { totalOrders: { count: "*" } },
|
|
1929
|
-
},
|
|
1930
|
-
},
|
|
1931
|
-
narrative: {
|
|
1932
|
-
primaryQuestion: "How many orders do we have?",
|
|
1933
|
-
},
|
|
1934
|
-
},
|
|
1935
|
-
{
|
|
1936
|
-
id: "1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed",
|
|
1937
|
-
blockType: "metric-card",
|
|
1938
|
-
dataSource: {
|
|
1939
|
-
type: "structure",
|
|
1940
|
-
ref: "<orders-collection-uuid>",
|
|
1941
|
-
mode: "aggregate",
|
|
1942
|
-
config: {},
|
|
1943
|
-
aggregation: {
|
|
1944
|
-
operations: {
|
|
1945
|
-
revenue: { sum: "totalAmount" },
|
|
1946
|
-
},
|
|
1947
|
-
},
|
|
1948
|
-
},
|
|
1949
|
-
narrative: {
|
|
1950
|
-
primaryQuestion: "What is our total revenue?",
|
|
1951
|
-
},
|
|
1952
|
-
},
|
|
1953
|
-
],
|
|
1954
|
-
},
|
|
1955
|
-
{
|
|
1956
|
-
id: "6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b",
|
|
1957
|
-
kind: "content",
|
|
1958
|
-
title: "Trends",
|
|
1959
|
-
layout: "two-column",
|
|
1960
|
-
blocks: [
|
|
1961
|
-
{
|
|
1962
|
-
id: "3fa85f64-5717-4562-b3fc-2c963f66afa6",
|
|
1963
|
-
blockType: "chart",
|
|
1964
|
-
dataSource: {
|
|
1965
|
-
type: "structure",
|
|
1966
|
-
ref: "<orders-collection-uuid>",
|
|
1967
|
-
mode: "aggregate",
|
|
1968
|
-
config: {},
|
|
1969
|
-
aggregation: {
|
|
1970
|
-
operations: { count: { count: "*" } },
|
|
1971
|
-
groupBy: ["status"],
|
|
1972
|
-
},
|
|
1973
|
-
},
|
|
1974
|
-
presentation: { chartType: "pie" },
|
|
1975
|
-
},
|
|
1976
|
-
],
|
|
1977
|
-
},
|
|
1978
|
-
],
|
|
1979
|
-
theme: { inherit: true },
|
|
1980
|
-
},
|
|
1981
|
-
}, null, 2),
|
|
1982
|
-
},
|
|
1983
|
-
],
|
|
1984
|
-
});
|
|
1985
|
-
}));
|
|
1986
|
-
// ── Page Block Types ───────────────────────────────────────────────
|
|
1987
|
-
(0, _register_js_1.registerTool)(server, "describe_page_blocks", "Get all available page block types and their configuration shapes. Each block type has specific data source requirements and presentation options.", {}, () => __awaiter(this, void 0, void 0, function* () {
|
|
1988
|
-
return ({
|
|
1989
|
-
content: [
|
|
1990
|
-
{
|
|
1991
|
-
type: "text",
|
|
1992
|
-
text: JSON.stringify({
|
|
1993
|
-
domain: "Page Block Types",
|
|
1994
|
-
description: "Blocks are the UI components inside page sections. Each blockType has its own configuration requirements.",
|
|
1995
|
-
IMPORTANT_config_convention: "Block-type-specific config uses named properties on the block object (e.g., block.kanbanConfig, block.chartConfig), NOT a generic 'config' key. This is critical — using 'config' instead of the named property will silently fail.",
|
|
1996
|
-
block_types: {
|
|
1997
|
-
"data-table": {
|
|
1998
|
-
description: "Tabular data display with columns, sorting, filtering, and pagination. The primary block for list and dashboard pages.",
|
|
1999
|
-
dataSource: "Required — type: 'structure'. Add recordSlug for direct resolution.",
|
|
2000
|
-
columns: "{ key: string, label: string, filterable?: boolean, sortable?: boolean }[] — column definitions on the block object. Used by both the publish validator and the runtime renderer.",
|
|
2001
|
-
example: {
|
|
2002
|
-
id: "<uuid>",
|
|
2003
|
-
blockType: "data-table",
|
|
2004
|
-
dataSource: { type: "structure", ref: "<collection-uuid>", recordSlug: "my-records" },
|
|
2005
|
-
columns: [
|
|
2006
|
-
{ key: "name", label: "Name", filterable: true, sortable: true },
|
|
2007
|
-
{ key: "status", label: "Status", filterable: true, sortable: true },
|
|
2008
|
-
{ key: "createdAt", label: "Created", sortable: true },
|
|
2009
|
-
],
|
|
2010
|
-
},
|
|
2011
|
-
},
|
|
2012
|
-
"metric-card": {
|
|
2013
|
-
description: "Single KPI metric display — shows a number with label, optional trend, and thresholds.",
|
|
2014
|
-
dataSource: "Required — type: 'structure', mode: 'aggregate' with aggregation.operations in the dataSource",
|
|
2015
|
-
label: "string — display label for the metric, placed directly on the block object",
|
|
2016
|
-
metricConfig: {
|
|
2017
|
-
format: "'number' | 'currency' | 'percentage' — value formatting (optional)",
|
|
2018
|
-
thresholds: "{ green?: [min, max], amber?: [min, max], red?: [min, max] } — color-code the value (optional)",
|
|
2019
|
-
},
|
|
2020
|
-
example: {
|
|
2021
|
-
id: "<uuid>",
|
|
2022
|
-
blockType: "metric-card",
|
|
2023
|
-
label: "Pending Requests",
|
|
2024
|
-
dataSource: {
|
|
2025
|
-
ref: "<collection-uuid>",
|
|
2026
|
-
type: "structure",
|
|
2027
|
-
mode: "aggregate",
|
|
2028
|
-
recordSlug: "governance_requests",
|
|
2029
|
-
config: { filters: { "data.status": "pending_approval" } },
|
|
2030
|
-
aggregation: { operations: { count: { count: "*" } } },
|
|
2031
|
-
},
|
|
2032
|
-
},
|
|
2033
|
-
},
|
|
2034
|
-
"stat-group": {
|
|
2035
|
-
description: "Group of 2-5 related metrics displayed side by side. More compact than individual metric-cards.",
|
|
2036
|
-
dataSource: "Not set at block level — each item has its own dataSource",
|
|
2037
|
-
statGroupConfig: {
|
|
2038
|
-
items: "StatGroupItem[] — array of { id, label, dataSource, aggregation, valueField, format, trend }",
|
|
2039
|
-
},
|
|
2040
|
-
},
|
|
2041
|
-
chart: {
|
|
2042
|
-
description: "Data visualization — bar, line, or pie chart.",
|
|
2043
|
-
dataSource: "Required — type: 'structure' with aggregation and groupBy in the dataSource",
|
|
2044
|
-
chartConfig: {
|
|
2045
|
-
chartType: "'bar' | 'line' | 'pie'",
|
|
2046
|
-
categoryField: "string — field for x-axis / categories",
|
|
2047
|
-
valueField: "string — field for y-axis / values",
|
|
2048
|
-
groupByField: "string | null — optional field for series grouping",
|
|
2049
|
-
colors: "string[] | null — custom color palette",
|
|
2050
|
-
showLegend: "boolean (default: true)",
|
|
2051
|
-
},
|
|
2052
|
-
},
|
|
2053
|
-
"field-group": {
|
|
2054
|
-
description: "Group of editable form fields. THE block type for form pages. Contains a 'fields' array directly on the block (not under config).",
|
|
2055
|
-
dataSource: "Optional — set with recordSlug to scope. For edit forms, include recordSlug to pre-populate.",
|
|
2056
|
-
fields: "FormFieldDef[] — array of field definitions directly on the block object",
|
|
2057
|
-
field_shape: {
|
|
2058
|
-
key: "string — maps to the record's data field name",
|
|
2059
|
-
label: "string — display label (unused for hidden fields)",
|
|
2060
|
-
type: "'text' | 'number' | 'email' | 'date' | 'boolean' | 'select' | 'textarea' | 'hidden'",
|
|
2061
|
-
required: "boolean (default: false) — ignored for hidden fields",
|
|
2062
|
-
placeholder: "string | null",
|
|
2063
|
-
defaultValue: "string | number | boolean | { source: 'auth' | 'system', field: string } — static value or derived default. For hidden fields, this is the value injected at submit time. For visible fields, this pre-populates the input. Derived sources: auth.userId, auth.email, auth.name (from logged-in user's JWT), system.now (server timestamp), system.uuid (random UUID). Derived defaults are resolved server-side.",
|
|
2064
|
-
resolveErrorMessage: "string | null — custom error message shown when a derived defaultValue cannot be resolved (e.g. user not signed in). Defaults to 'This form requires you to be signed in' for auth source.",
|
|
2065
|
-
options: "For 'select' type: { label: string, value: string }[] — inline static options",
|
|
2066
|
-
optionSource: "For 'select' type (alternative): { type: 'static' | 'dynamic', staticOptions?: [{label, value}], dynamicRef?: 'collection-uuid', labelField?, valueField? }",
|
|
2067
|
-
},
|
|
2068
|
-
HIDDEN_FIELDS: "Fields with type 'hidden' are NOT rendered to end users but their defaultValue is included in the form submission payload. Use for auto-populated values like status, provider, userId, timestamps. Static defaults are injected directly; derived defaults (auth/system) are resolved securely on the server.",
|
|
2069
|
-
allowed_actions: ["create-record", "update-record", "invoke-trigger"],
|
|
2070
|
-
default_activation: "form-submit",
|
|
2071
|
-
param_source: "form",
|
|
2072
|
-
},
|
|
2073
|
-
"field-display": {
|
|
2074
|
-
description: "Read-only display of record fields with labels. THE block type for detail pages. Contains a 'fields' array directly on the block.",
|
|
2075
|
-
dataSource: "Required — type: 'structure'",
|
|
2076
|
-
fields: "{ key: string, label: string }[] — fields to display from the record",
|
|
2077
|
-
allowed_actions: ["invoke-trigger", "navigate-to-page"],
|
|
2078
|
-
default_activation: "button",
|
|
2079
|
-
param_source: "record",
|
|
2080
|
-
},
|
|
2081
|
-
"activity-feed": {
|
|
2082
|
-
description: "Chronological list of recent items/events, showing title, description, and timestamp.",
|
|
2083
|
-
dataSource: "Required — type: 'structure'",
|
|
2084
|
-
feedConfig: {
|
|
2085
|
-
titleField: "string — field to use as item title",
|
|
2086
|
-
descriptionField: "string | null — field for item description",
|
|
2087
|
-
timestampField: "string — field for item timestamp",
|
|
2088
|
-
iconField: "string | null — field for item icon",
|
|
2089
|
-
maxItems: "number (default: 10)",
|
|
2090
|
-
},
|
|
2091
|
-
},
|
|
2092
|
-
"progress-indicator": {
|
|
2093
|
-
description: "Visual progress display — bar, ring, or badge. Shows completion toward a target.",
|
|
2094
|
-
dataSource: "Optional — can use static value or aggregate from data",
|
|
2095
|
-
progressConfig: {
|
|
2096
|
-
mode: "'bar' | 'ring' | 'badge'",
|
|
2097
|
-
label: "string",
|
|
2098
|
-
value: "number | null — static value (if no dataSource)",
|
|
2099
|
-
valueField: "string | null — field to aggregate (if using dataSource)",
|
|
2100
|
-
target: "number — the 100% target value",
|
|
2101
|
-
thresholds: "{ green?: [min, max], amber?: [min, max], red?: [min, max] }",
|
|
2102
|
-
},
|
|
2103
|
-
},
|
|
2104
|
-
kanban: {
|
|
2105
|
-
description: "Kanban board — drag-and-drop cards grouped by a status/category field.",
|
|
2106
|
-
dataSource: "Required — type: 'structure'",
|
|
2107
|
-
kanbanConfig: {
|
|
2108
|
-
groupByField: "string — field to group cards by (e.g., 'status')",
|
|
2109
|
-
columnOrder: "string[] | null — explicit column order (e.g., ['todo', 'in-progress', 'done'])",
|
|
2110
|
-
cardTitleField: "string — field for card title",
|
|
2111
|
-
cardSubtitleField: "string | null — field for card subtitle",
|
|
2112
|
-
cardBadgeField: "string | null — field for a badge/tag on the card",
|
|
2113
|
-
},
|
|
2114
|
-
},
|
|
2115
|
-
calendar: {
|
|
2116
|
-
description: "Calendar view — displays records as events on a month/week/day calendar.",
|
|
2117
|
-
dataSource: "Required — type: 'structure'",
|
|
2118
|
-
calendarConfig: {
|
|
2119
|
-
dateField: "string — field for event start date",
|
|
2120
|
-
endDateField: "string | null — field for event end date (for multi-day events)",
|
|
2121
|
-
titleField: "string — field for event title",
|
|
2122
|
-
colorField: "string | null — field to determine event color",
|
|
2123
|
-
defaultView: "'month' | 'week' | 'day' (default: 'month')",
|
|
2124
|
-
},
|
|
2125
|
-
},
|
|
2126
|
-
"filter-bar": {
|
|
2127
|
-
description: "Global filter bar for dashboards — provides date range pickers and dropdown filters that control other blocks on the page.",
|
|
2128
|
-
dataSource: "Not required",
|
|
2129
|
-
filterBarConfig: {
|
|
2130
|
-
dateField: "string | null — field to filter by date range",
|
|
2131
|
-
datePresets: "('today' | '7d' | '30d' | '90d' | 'custom')[] — available date range presets",
|
|
2132
|
-
dropdownFilters: "{ field: string, label: string }[] — dropdown filter options",
|
|
2133
|
-
},
|
|
2134
|
-
},
|
|
2135
|
-
"related-list": {
|
|
2136
|
-
description: "Displays related records from another collection. Similar to data-table but used in detail pages to show linked data.",
|
|
2137
|
-
dataSource: "Required — type: 'structure'",
|
|
2138
|
-
columns: "{ key: string, label: string }[] — column definitions on the block object",
|
|
2139
|
-
allowed_actions: ["navigate-to-page", "invoke-trigger"],
|
|
2140
|
-
default_activation: "row-click",
|
|
2141
|
-
param_source: "row",
|
|
2142
|
-
},
|
|
2143
|
-
form: {
|
|
2144
|
-
description: "DEPRECATED — use 'field-group' blockType instead. The runtime does not handle 'form' as a blockType.",
|
|
2145
|
-
IMPORTANT: "Do NOT use this. Use field-group with a fields array.",
|
|
2146
|
-
},
|
|
2147
|
-
"detail-fields": {
|
|
2148
|
-
description: "DEPRECATED — use 'field-display' blockType instead. The runtime does not handle 'detail-fields'.",
|
|
2149
|
-
IMPORTANT: "Do NOT use this. Use field-display with a fields array.",
|
|
2150
|
-
},
|
|
2151
|
-
markdown: {
|
|
2152
|
-
description: "Static markdown content block. Renders markdown text on the page. Must have non-empty content to pass publishing validation.",
|
|
2153
|
-
dataSource: "Not required",
|
|
2154
|
-
requires: "content property (string) — the markdown text",
|
|
2155
|
-
category: "content-block",
|
|
2156
|
-
},
|
|
2157
|
-
"static-html": {
|
|
2158
|
-
description: "Static HTML content block. Renders raw HTML on the page. Must have non-empty content to pass publishing validation.",
|
|
2159
|
-
dataSource: "Not required",
|
|
2160
|
-
requires: "content property (string) — the HTML markup",
|
|
2161
|
-
category: "content-block",
|
|
2162
|
-
},
|
|
2163
|
-
"data-html": {
|
|
2164
|
-
description: "Data-bound HTML block. Write HTML templates with {{fieldName}} placeholders that resolve against a data source. Supports two modes: LIST mode (default) renders the template ONCE PER RECORD — perfect for card grids, custom list layouts, or any repeating template. SINGLE mode renders the template once for a single record (detail pages). Records are auto-flattened so {{firstName}} works directly — no need for {{data.firstName}}. Output is sanitized via DOMPurify. No JavaScript allowed.",
|
|
2165
|
-
dataSource: "Required — type: 'structure' or 'query'. Data is resolved server-side and injected into the template.",
|
|
2166
|
-
requires: "content property (string) — HTML template with {{field}} placeholders. Must have non-empty content to pass publishing validation.",
|
|
2167
|
-
template_syntax: "{{fieldName}} for top-level fields, {{data.status}} for nested. Unresolved placeholders render as empty string.",
|
|
2168
|
-
modes: {
|
|
2169
|
-
list: "Default. Template repeats for EACH record. Write a single card/row template and it renders N times for N records. Example: a styled customer card template produces a grid of cards.",
|
|
2170
|
-
single: "Template renders once for ONE record. Use with mode:'single' and a variable binding like { id: { source: 'url', param: 'id' } } to fetch a specific record.",
|
|
2171
|
-
},
|
|
2172
|
-
example_list_mode: {
|
|
2173
|
-
blockType: "data-html",
|
|
2174
|
-
dataSource: { type: "structure", ref: "<collection-uuid>", recordSlug: "customers", config: { sort: [{ field: "createdAt", direction: "desc" }], limit: 20 } },
|
|
2175
|
-
content: "<div style='display:inline-block; width:280px; margin:8px; padding:16px; border:1px solid #e5e7eb; border-radius:8px; vertical-align:top;'><h3>{{firstName}} {{lastName}}</h3><p style='color:#6b7280;'>{{email}}</p></div>",
|
|
2176
|
-
},
|
|
2177
|
-
example_single_mode: {
|
|
2178
|
-
blockType: "data-html",
|
|
2179
|
-
dataSource: { type: "structure", ref: "<collection-uuid>", mode: "single", config: {}, variables: { id: { source: "url", param: "id" } } },
|
|
2180
|
-
content: "<div style='padding:16px; border:1px solid #e5e7eb; border-radius:8px;'><h2>{{firstName}} {{lastName}}</h2><p>{{email}}</p><p>Company: {{company}}</p></div>",
|
|
2181
|
-
},
|
|
2182
|
-
IMPORTANT: "No iteration syntax needed for lists. Just write a single template — the runtime repeats it automatically for each record. Records are auto-flattened: use {{fieldName}} directly, not {{data.fieldName}}.",
|
|
2183
|
-
category: "data-block",
|
|
2184
|
-
},
|
|
2185
|
-
"image": {
|
|
2186
|
-
description: "Image block. Displays an image from a URL with responsive sizing, lazy loading, optional caption, alignment, and link-on-click.",
|
|
2187
|
-
dataSource: "Not required",
|
|
2188
|
-
requires: "src property (string) — the image URL. Optional: alt, caption, alignment (left|center|right), maxWidth, linkUrl.",
|
|
2189
|
-
category: "media-block",
|
|
2190
|
-
},
|
|
2191
|
-
"video": {
|
|
2192
|
-
description: "Video block. Embeds YouTube/Vimeo videos via iframe or direct MP4/WebM via native <video>. Auto-detects provider from URL.",
|
|
2193
|
-
dataSource: "Not required",
|
|
2194
|
-
requires: "src property (string) — video URL (YouTube, Vimeo, or direct). Optional: autoplay (boolean, muted only), loop, controls (default true), poster, caption.",
|
|
2195
|
-
category: "media-block",
|
|
2196
|
-
},
|
|
2197
|
-
"modal": {
|
|
2198
|
-
description: "Declarative modal block. Invisible by default — renders as an overlay when triggered by an 'open-modal' action. Content can be static HTML, markdown, or data-bound HTML. Supports actions (buttons) inside the modal for confirm/cancel flows. Uses Radix Dialog.",
|
|
2199
|
-
dataSource: "Optional — only needed if contentType is 'data-html'",
|
|
2200
|
-
requires: "content property (string), contentType ('html' | 'markdown' | 'data-html', default 'html'). Optional: title, modalSize ('sm' | 'md' | 'lg' | 'fullscreen', default 'md').",
|
|
2201
|
-
actions: "Optional actions array — renders as buttons at the bottom of the modal. Supports close-modal (close the modal), invoke-trigger, navigate-to-page, start-orchestration, open-modal (open another modal). Use close-modal with targetRef set to this modal's own ID for a 'Cancel' button.",
|
|
2202
|
-
trigger: "Add an 'open-modal' action on another block with targetRef set to this modal block's ID. The modal opens when the action fires.",
|
|
2203
|
-
category: "interactive-block",
|
|
2204
|
-
example_confirm_modal: {
|
|
2205
|
-
blockType: "modal",
|
|
2206
|
-
title: "Confirm Delete",
|
|
2207
|
-
modalSize: "sm",
|
|
2208
|
-
contentType: "html",
|
|
2209
|
-
content: "<p>Are you sure you want to delete this item? This action cannot be undone.</p>",
|
|
2210
|
-
actions: [
|
|
2211
|
-
{ id: "cancel", type: "close-modal", label: "Cancel", targetRef: "THIS_MODAL_ID", presentation: { color: "neutral" } },
|
|
2212
|
-
{ id: "confirm", type: "invoke-trigger", label: "Delete", targetRef: "TRIGGER_ID", presentation: { color: "destructive" } },
|
|
2213
|
-
],
|
|
2214
|
-
},
|
|
2215
|
-
},
|
|
2216
|
-
},
|
|
2217
|
-
block_categories: {
|
|
2218
|
-
"data-block": "Blocks that display data from collections (data-table, chart, metric-card, stat-group, field-display, related-list, activity-feed, kanban, calendar, progress-indicator, data-html)",
|
|
2219
|
-
"form-block": "Use 'field-group' blockType with a 'fields' array for form pages. Do NOT use individual field block types (text-input, select, etc.) — the runtime renders field types from the field-group's fields array.",
|
|
2220
|
-
"content-block": "Static content blocks (markdown, static-html). Must have non-empty 'content' property.",
|
|
2221
|
-
"media-block": "Media blocks (image, video). Require a 'src' URL property.",
|
|
2222
|
-
"layout-block": "Blocks that control page-level behavior (filter-bar)",
|
|
2223
|
-
},
|
|
2224
|
-
action_mappings: {
|
|
2225
|
-
description: "Not all action types are valid on all block types. The publish validator warns when an action type is not recommended for a block type.",
|
|
2226
|
-
per_block_type: {
|
|
2227
|
-
"data-table": {
|
|
2228
|
-
allowed_actions: ["navigate-to-page", "invoke-trigger"],
|
|
2229
|
-
default_activation: "row-click",
|
|
2230
|
-
param_source: "row",
|
|
2231
|
-
},
|
|
2232
|
-
"related-list": {
|
|
2233
|
-
allowed_actions: ["navigate-to-page", "invoke-trigger"],
|
|
2234
|
-
default_activation: "row-click",
|
|
2235
|
-
param_source: "row",
|
|
2236
|
-
},
|
|
2237
|
-
"field-display": {
|
|
2238
|
-
allowed_actions: ["invoke-trigger", "navigate-to-page"],
|
|
2239
|
-
default_activation: "button",
|
|
2240
|
-
param_source: "record",
|
|
2241
|
-
},
|
|
2242
|
-
"field-group": {
|
|
2243
|
-
allowed_actions: [
|
|
2244
|
-
"create-record",
|
|
2245
|
-
"update-record",
|
|
2246
|
-
"invoke-trigger",
|
|
2247
|
-
],
|
|
2248
|
-
default_activation: "form-submit",
|
|
2249
|
-
param_source: "form",
|
|
2250
|
-
},
|
|
2251
|
-
actions: {
|
|
2252
|
-
allowed_actions: [
|
|
2253
|
-
"invoke-trigger",
|
|
2254
|
-
"navigate-to-page",
|
|
2255
|
-
"start-orchestration",
|
|
2256
|
-
"enqueue-job",
|
|
2257
|
-
],
|
|
2258
|
-
default_activation: "button",
|
|
2259
|
-
param_source: "none",
|
|
2260
|
-
},
|
|
2261
|
-
},
|
|
2262
|
-
},
|
|
2263
|
-
}, null, 2),
|
|
2264
|
-
},
|
|
2265
|
-
],
|
|
2266
|
-
});
|
|
2267
|
-
}));
|
|
2268
|
-
// ── Page Actions ───────────────────────────────────────────────────
|
|
2269
|
-
(0, _register_js_1.registerTool)(server, "describe_page_actions", "Get all available page action types and their configuration shapes. Actions define interactive behaviors on blocks (button clicks, row clicks, form submissions).", {}, () => __awaiter(this, void 0, void 0, function* () {
|
|
2270
|
-
return ({
|
|
2271
|
-
content: [
|
|
2272
|
-
{
|
|
2273
|
-
type: "text",
|
|
2274
|
-
text: JSON.stringify({
|
|
2275
|
-
domain: "Page Actions",
|
|
2276
|
-
description: "Actions define what happens when a user interacts with a block — clicking a row, pressing a button, or submitting a form.",
|
|
2277
|
-
action_shape: {
|
|
2278
|
-
id: "string — unique ID for the action (use a UUID)",
|
|
2279
|
-
type: "ActionType — what the action does (see action_types below)",
|
|
2280
|
-
label: "string — button/link text (e.g., 'View Details', 'Create Order')",
|
|
2281
|
-
targetRef: "string — reference to the target resource (page slug, structure ID, orchestration ID, etc.)",
|
|
2282
|
-
config: "object | null — action-type-specific configuration",
|
|
2283
|
-
confirmationRequired: "boolean — if true, shows a confirmation dialog before executing",
|
|
2284
|
-
activation: "'row-click' | 'button' | 'form-submit' — how the action is triggered",
|
|
2285
|
-
paramConfig: {
|
|
2286
|
-
source: "'row' | 'record' | 'form' | 'none' — where to get parameters",
|
|
2287
|
-
mode: "'all' | 'selected' — pass all fields or only selected ones",
|
|
2288
|
-
selectedFields: "string[] | null — specific fields to pass (when mode is 'selected')",
|
|
2289
|
-
},
|
|
2290
|
-
presentation: {
|
|
2291
|
-
display: "'button' | 'icon' | 'icon-button'",
|
|
2292
|
-
icon: "string | null — icon name",
|
|
2293
|
-
color: "'primary' | 'secondary' | 'destructive' | 'neutral'",
|
|
2294
|
-
},
|
|
2295
|
-
postSubmit: {
|
|
2296
|
-
behavior: "'message' | 'navigate'",
|
|
2297
|
-
message: "string | null — success message to show (when behavior is 'message')",
|
|
2298
|
-
targetPageSlug: "string | null — page to navigate to (when behavior is 'navigate')",
|
|
2299
|
-
},
|
|
2300
|
-
executionMode: "'fire-and-forget' | 'fire-and-poll' — whether to wait for completion",
|
|
2301
|
-
},
|
|
2302
|
-
action_types: {
|
|
2303
|
-
"navigate-to-page": {
|
|
2304
|
-
description: "Navigate to another page. Use for detail-view links and list-to-detail navigation.",
|
|
2305
|
-
targetRef: "Page slug to navigate to",
|
|
2306
|
-
typical_activation: "row-click",
|
|
2307
|
-
paramConfig: "Use source: 'row', mode: 'selected', selectedFields: ['id'] to pass the record ID to the detail page",
|
|
2308
|
-
paramMapping: "Optional config.paramMapping: { sourceField: 'targetParam' } to rename fields in the URL. E.g., { requestId: 'id' } passes ?id=<value> instead of ?requestId=<value>. Only applies when useQueryParams is true.",
|
|
2309
|
-
example: {
|
|
2310
|
-
id: "view-detail",
|
|
2311
|
-
type: "navigate-to-page",
|
|
2312
|
-
label: "View Details",
|
|
2313
|
-
targetRef: "customer-detail",
|
|
2314
|
-
activation: "row-click",
|
|
2315
|
-
config: { useQueryParams: true, paramMapping: { requestId: "id" } },
|
|
2316
|
-
paramConfig: {
|
|
2317
|
-
source: "row",
|
|
2318
|
-
mode: "selected",
|
|
2319
|
-
selectedFields: ["requestId"],
|
|
2320
|
-
},
|
|
2321
|
-
},
|
|
2322
|
-
},
|
|
2323
|
-
"create-record": {
|
|
2324
|
-
description: "Create a new record in a collection. Typically used with form blocks.",
|
|
2325
|
-
targetRef: "Collection ID (UUID) to create the record in",
|
|
2326
|
-
typical_activation: "form-submit",
|
|
2327
|
-
paramConfig: "Use source: 'form', mode: 'all'",
|
|
2328
|
-
postSubmit: "Usually { behavior: 'message', message: 'Record created successfully' } or { behavior: 'navigate', targetPageSlug: 'list-page' }",
|
|
2329
|
-
},
|
|
2330
|
-
"update-record": {
|
|
2331
|
-
description: "Update an existing record. Used with form blocks pre-populated with record data.",
|
|
2332
|
-
targetRef: "Collection ID (UUID)",
|
|
2333
|
-
typical_activation: "form-submit",
|
|
2334
|
-
paramConfig: "Use source: 'form', mode: 'all'",
|
|
2335
|
-
},
|
|
2336
|
-
"invoke-trigger": {
|
|
2337
|
-
description: "Invoke an on-demand compute trigger. Use for server-side actions like sending emails, running calculations, etc.",
|
|
2338
|
-
targetRef: "Trigger ID (UUID)",
|
|
2339
|
-
typical_activation: "button",
|
|
2340
|
-
paramConfig: "Use source: 'row' to pass the current record as payload, or source: 'none' for no payload",
|
|
2341
|
-
confirmationRequired: "Recommended: true for destructive or costly operations",
|
|
2342
|
-
executionMode: "'fire-and-forget' for async, 'fire-and-poll' to show loading state",
|
|
2343
|
-
},
|
|
2344
|
-
"start-orchestration": {
|
|
2345
|
-
description: "Start an orchestration workflow run. Use for multi-step processes.",
|
|
2346
|
-
targetRef: "Orchestration ID (prefixed xid, e.g. orch_...)",
|
|
2347
|
-
typical_activation: "button",
|
|
2348
|
-
executionMode: "'fire-and-poll' recommended — orchestrations are long-running",
|
|
2349
|
-
},
|
|
2350
|
-
"enqueue-job": {
|
|
2351
|
-
description: "Enqueue a background job. Use for bulk operations or long-running tasks.",
|
|
2352
|
-
targetRef: "Job type identifier",
|
|
2353
|
-
typical_activation: "button",
|
|
2354
|
-
executionMode: "'fire-and-forget'",
|
|
2355
|
-
},
|
|
2356
|
-
"open-modal": {
|
|
2357
|
-
description: "Open a modal block. Client-side only — no backend call. The modal block must be defined on the same page with blockType 'modal'.",
|
|
2358
|
-
targetRef: "The modal block's ID (UUID) — must match a block with blockType 'modal' on this page.",
|
|
2359
|
-
typical_activation: "button",
|
|
2360
|
-
},
|
|
2361
|
-
"close-modal": {
|
|
2362
|
-
description: "Close an open modal. Client-side only.",
|
|
2363
|
-
targetRef: "The modal block's ID (UUID) to close.",
|
|
2364
|
-
typical_activation: "button",
|
|
2365
|
-
},
|
|
2366
|
-
},
|
|
2367
|
-
tips: [
|
|
2368
|
-
"Every action needs an 'id' — use UUIDs for uniqueness",
|
|
2369
|
-
"Use 'navigate-to-page' with activation 'row-click' for list-to-detail navigation",
|
|
2370
|
-
"Form pages typically have one action with activation 'form-submit' and type 'create-record' or 'update-record'",
|
|
2371
|
-
"Set confirmationRequired: true for destructive actions (delete, bulk update)",
|
|
2372
|
-
"Use postSubmit to control what happens after a form submission",
|
|
2373
|
-
"Actions on data-table blocks often use paramConfig with source: 'row' to pass the clicked record's data",
|
|
2374
|
-
],
|
|
2375
|
-
}, null, 2),
|
|
2376
|
-
},
|
|
2377
|
-
],
|
|
2378
|
-
});
|
|
2379
|
-
}));
|
|
2380
|
-
// ── Navigation ─────────────────────────────────────────────────────
|
|
2381
|
-
(0, _register_js_1.registerTool)(server, "describe_navigation", "Get the full schema for the workspace navigation configuration. Explains how to construct the sidebar/nav shell that wraps published pages — item types, grouping, branding, and limits.", {}, () => __awaiter(this, void 0, void 0, function* () {
|
|
2382
|
-
return ({
|
|
2383
|
-
content: [
|
|
2384
|
-
{
|
|
2385
|
-
type: "text",
|
|
2386
|
-
text: JSON.stringify({
|
|
2387
|
-
domain: "Navigation",
|
|
2388
|
-
description: "The navigation configuration controls the sidebar/nav shell that wraps published pages. When enabled, all pages in the workspace share a common sidebar with branding, grouped links, and external links. When disabled or deleted, pages render standalone.",
|
|
2389
|
-
tools: {
|
|
2390
|
-
get_navigation: "Returns the current config enriched with page metadata (name, slug, isPublished for each page item)",
|
|
2391
|
-
set_navigation: "Create or update the config. Pass the full config object (not a partial — it replaces the existing config).",
|
|
2392
|
-
delete_navigation: "Remove the config entirely. Pages revert to standalone rendering.",
|
|
2393
|
-
},
|
|
2394
|
-
config_shape: {
|
|
2395
|
-
enabled: "boolean — master toggle. If false, the nav shell is hidden even if items exist.",
|
|
2396
|
-
branding: {
|
|
2397
|
-
logoUrl: "string | undefined — URL to the workspace logo displayed at the top of the sidebar. Must be a valid URL or empty string.",
|
|
2398
|
-
displayName: "string | undefined — workspace display name shown in the sidebar header. Max 100 characters.",
|
|
2399
|
-
},
|
|
2400
|
-
items: "NavEntry[] — ordered array of navigation items (max 50). Each entry is one of three types: 'group', 'page', or 'external-link'.",
|
|
2401
|
-
},
|
|
2402
|
-
item_types: {
|
|
2403
|
-
page: {
|
|
2404
|
-
description: "Links to a published page in the workspace. The sidebar displays the page's name and slug automatically (resolved from pageId).",
|
|
2405
|
-
shape: {
|
|
2406
|
-
type: "'page' (literal)",
|
|
2407
|
-
id: "string (UUID) — unique ID for this nav item",
|
|
2408
|
-
pageId: "string (UUID) — the page ID to link to. Must reference an existing page.",
|
|
2409
|
-
icon: "string | undefined — icon name (max 50 chars). Optional.",
|
|
2410
|
-
},
|
|
2411
|
-
note: "GET response enriches page items with name, slug, and isPublished fields. When setting, you only need type, id, and pageId.",
|
|
2412
|
-
},
|
|
2413
|
-
group: {
|
|
2414
|
-
description: "A collapsible group that contains page items and/or external links. Use to organize nav items by category.",
|
|
2415
|
-
shape: {
|
|
2416
|
-
type: "'group' (literal)",
|
|
2417
|
-
id: "string (UUID) — unique ID for this group",
|
|
2418
|
-
label: "string — group heading displayed in the sidebar. 1-50 characters.",
|
|
2419
|
-
children: "(NavPageItem | NavExternalLink)[] — ordered array of child items (max 20). Cannot contain nested groups.",
|
|
2420
|
-
},
|
|
2421
|
-
},
|
|
2422
|
-
"external-link": {
|
|
2423
|
-
description: "Links to an external URL. Opens in a new tab. Use for documentation, support links, or other external resources.",
|
|
2424
|
-
shape: {
|
|
2425
|
-
type: "'external-link' (literal)",
|
|
2426
|
-
id: "string (UUID) — unique ID for this nav item",
|
|
2427
|
-
label: "string — link text displayed in the sidebar. 1-50 characters.",
|
|
2428
|
-
url: "string — the external URL. Must be a valid URL.",
|
|
2429
|
-
icon: "string | undefined — icon name (max 50 chars). Optional.",
|
|
2430
|
-
},
|
|
2431
|
-
},
|
|
2432
|
-
},
|
|
2433
|
-
limits: {
|
|
2434
|
-
max_top_level_items: 50,
|
|
2435
|
-
max_children_per_group: 20,
|
|
2436
|
-
max_label_length: 50,
|
|
2437
|
-
max_display_name_length: 100,
|
|
2438
|
-
nesting: "Groups cannot be nested — children must be 'page' or 'external-link' items only.",
|
|
2439
|
-
},
|
|
2440
|
-
example: {
|
|
2441
|
-
config: {
|
|
2442
|
-
enabled: true,
|
|
2443
|
-
branding: {
|
|
2444
|
-
displayName: "Acme Corp",
|
|
2445
|
-
logoUrl: "https://acme.com/logo.png",
|
|
2446
|
-
},
|
|
2447
|
-
items: [
|
|
2448
|
-
{
|
|
2449
|
-
type: "page",
|
|
2450
|
-
id: "nav-dashboard",
|
|
2451
|
-
pageId: "<dashboard-page-uuid>",
|
|
2452
|
-
icon: "LayoutDashboard",
|
|
2453
|
-
},
|
|
2454
|
-
{
|
|
2455
|
-
type: "group",
|
|
2456
|
-
id: "nav-data",
|
|
2457
|
-
label: "Data Management",
|
|
2458
|
-
children: [
|
|
2459
|
-
{
|
|
2460
|
-
type: "page",
|
|
2461
|
-
id: "nav-customers",
|
|
2462
|
-
pageId: "<customers-page-uuid>",
|
|
2463
|
-
icon: "Users",
|
|
2464
|
-
},
|
|
2465
|
-
{
|
|
2466
|
-
type: "page",
|
|
2467
|
-
id: "nav-orders",
|
|
2468
|
-
pageId: "<orders-page-uuid>",
|
|
2469
|
-
icon: "ShoppingCart",
|
|
2470
|
-
},
|
|
2471
|
-
],
|
|
2472
|
-
},
|
|
2473
|
-
{
|
|
2474
|
-
type: "external-link",
|
|
2475
|
-
id: "nav-docs",
|
|
2476
|
-
label: "Documentation",
|
|
2477
|
-
url: "https://docs.acme.com",
|
|
2478
|
-
icon: "BookOpen",
|
|
2479
|
-
},
|
|
2480
|
-
],
|
|
2481
|
-
},
|
|
2482
|
-
},
|
|
2483
|
-
tips: [
|
|
2484
|
-
"Use UUIDs for all 'id' fields — they must be unique across the config",
|
|
2485
|
-
"Page items only need 'type', 'id', and 'pageId' — name and slug are resolved automatically from the page",
|
|
2486
|
-
"Groups cannot be nested — keep the hierarchy to one level deep",
|
|
2487
|
-
"set_navigation replaces the entire config — always send the full config, not a partial update",
|
|
2488
|
-
"Pages don't need to be published to appear in the nav config, but unpublished pages will show as disabled in the sidebar",
|
|
2489
|
-
"The showInNavShell field on a page (via update_page) controls whether the page appears in auto-generated nav suggestions",
|
|
2490
|
-
],
|
|
2491
|
-
}, null, 2),
|
|
2492
|
-
},
|
|
2493
|
-
],
|
|
2494
|
-
});
|
|
2495
|
-
}));
|
|
2496
1652
|
// ── Auth Providers (BYOT) ──────────────────────────────────────────
|
|
2497
1653
|
(0, _register_js_1.registerTool)(server, "describe_auth_providers", "Get the full reference for configuring external auth providers (BYOT — Bring Your Own Token). Explains how to connect Clerk, Auth0, Okta, or any OIDC provider so your app's users authenticate with their existing IdP while Centrali handles authorization.", {}, () => __awaiter(this, void 0, void 0, function* () {
|
|
2498
1654
|
return ({
|