Back to MCP Overview

Sites Tools

Tools for creating and managing site projects, pages, and components.

142 tools

Available Tools

site_listProjects

List all app builder projects. Returns array with id, name, description, linkedBaseId, page count, component count.

Input Schema

kindstring

'site' (default): sites only; 'app': internal apps; 'all': both

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_listProjects",
    "arguments": {
          "kind": "example"
    }
  }
}
site_getProject

Get a project with its pages, components, linkedBase, and triggers

Input Schema

idstringrequired

Project ID from listProjects

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_getProject",
    "arguments": {
          "id": "example"
    }
  }
}
site_getAccessOverview

Aggregated access-control snapshot for the central Access Control page.

Input Schema

projectIdstringrequired

Project ID from listProjects

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_getAccessOverview",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_createProject

Create a new app builder project

Input Schema

namestringrequired

Project name

descriptionstring

Optional project description

colorstring

Hex color code (default: #3B82F6)

brandKitany

Brand kit (colors/typography/tokens) to seed the project design system

projectTypestring

Project type: web or mobile app

bundleIdentifierstring

Mobile app bundle identifier (e.g. com.example.myapp)

appDisplayNamestring

Mobile app display name for App Store / Play Store

isAppboolean

Workspace app (Apps rail): built like a site, served by Serenities to the owner only at /app/<handle>/<slug>, no custom domain, not counted against the site limit. It counts against the plan's workspace-app limit: when the workspace is full the call is refused with a message and an upgrade link, so tell the person both.

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_createProject",
    "arguments": {
          "name": "example",
          "description": "example",
          "color": "example"
    }
  }
}
site_updateProject

Update project settings including branding, dependencies, marketplace, and mobile config. Returns { id, name } (plus needsRepublish and republishNote when a publish-time setting changed); call site_getProject to read the settings.

Input Schema

idstringrequired

Project ID from listProjects

namestring

New project name

descriptionstring

New description

colorstring

New hex color code

logostring

URL or path to logo image (recommended: 200x50px PNG or SVG)

faviconstring

URL or path to favicon image (recommended: 32x32px PNG or ICO)

showSerenitiesBrandingboolean

Show the "Built with Serenities AI" badge on the published site. Turning it OFF needs a paid plan, and publish forces it ON for a Free owner regardless, so a downgrade cannot keep it off. Baked into the bundle: the response carries needsRepublish: true because the live site only changes on the next publish.

showSerenitesBrandingboolean

DEPRECATED misspelling of showSerenitiesBranding — use that instead.

dependenciesobject

NPM packages to bundle. Example: {"framer-motion": "^10.0.0", "chart.js": "^4.4.0"}. Packages are installed via Bun and bundled by Vite for production. Tailwind CSS is included by default.

aiKnowledgestring

AI project knowledge - persistent instructions for AI including project goals, coding style, and constraints

brandKitobject

Brand kit - design tokens and identity (colors, typography, logo, voice, style) the AI applies when generating UI

marketplaceEnabledboolean

Enable marketplace listing for this app

marketplaceThumbnailstring

Thumbnail image URL or path for marketplace listing (recommended: 400x300px)

marketplaceCoverstring

Cover/banner image URL or path for marketplace detail page (recommended: 1200x400px)

marketplaceDescriptionstring

Extended description for marketplace listing

appDisplayNamestring

Mobile app display name for App Store / Play Store

bundleIdentifierstring

Mobile app bundle identifier (e.g. com.example.myapp)

appVersionstring

Mobile app version (e.g. 1.0.0)

buildNumberinteger

Mobile app build number

appIconstring

URL to app icon image (1024x1024 PNG)

pwaEnabledboolean

Make the published app an installable PWA (add-to-home-screen, full-screen, offline shell, auto-update). Default off.

splashScreenstring

URL to splash screen image (1284x2778 PNG)

orientationstring

Mobile app orientation lock

mobilePermissionsarray

Mobile permissions: camera, location, notifications, media-library, contacts, biometrics, file-system

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_updateProject",
    "arguments": {
          "id": "example",
          "name": "example",
          "description": "example"
    }
  }
}
site_setPageActive

Activate or deactivate a page. Slot rule: exactly ONE active page per URL path — activating a page automatically deactivates any sibling page holding the same path (e.g. switching which "/" home page variant is live). Params: projectId, pageId, active (boolean).

Input Schema

projectIdstringrequired

Project ID from listProjects

pageIdstringrequired
activebooleanrequired

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_setPageActive",
    "arguments": {
          "projectId": "example",
          "pageId": "example",
          "active": true
    }
  }
}
site_updateProjectAuth

Update project authentication settings

Input Schema

idstringrequired

Project ID

authEnabledboolean

Enable authentication for this app

authAllowSignupboolean

Allow new users to sign up

authRequireEmailboolean

Require email verification

authAllowSocialboolean

Allow social login (Google, GitHub)

authPathsobject

Custom auth paths object. Keys: login, signup, forgotPassword, resetPassword, verifyEmail, afterLogin, afterLogout, accessDenied, or any custom paths. Values: the URL path (e.g., "/signin", "/register")

authSessionHoursinteger

App-user session lifetime in hours (1..8760) — how long a login stays valid on a device. null = platform default (7 days). Applies to sessions created after the change.

authCustomFieldsarray

Custom signup form fields. MERGED by field name into the existing list (upsert): pass only the fields you want to add or change — omitted fields are preserved, not dropped. Pass null to clear ALL fields. To delete specific fields, use removeCustomFields.

removeCustomFieldsarray

Field names to remove from authCustomFields. Does not delete values already stored on user profiles, only stops the field being declared.

authMailAccountstring

Name of a connected mail account to send this site's auth email (verify, reset) through, instead of the shared platform sender. Their domain, their reputation — so custom auth templates become usable. null = use the platform sender.

authVerifyTemplateIdstring

Email template id to use for verification mail. Honoured ONLY while authMailAccount is set and resolvable; on the platform sender the built-in is always used. null = built-in.

authResetTemplateIdstring

Email template id to use for password-reset mail. Honoured ONLY while authMailAccount is set and resolvable. null = built-in.

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_updateProjectAuth",
    "arguments": {
          "id": "example",
          "authEnabled": true,
          "authAllowSignup": true
    }
  }
}
site_bundleDeps

Bundle npm dependencies for a project. Call this after adding/changing dependencies to ensure they are bundled and ready for preview.

Input Schema

idstringrequired

Project ID

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_bundleDeps",
    "arguments": {
          "id": "example"
    }
  }
}
site_updateSubdomain

Update the published subdomain for an app

Input Schema

idstringrequired

Project ID

subdomainstringrequired

New subdomain (without .serenitiesai.app)

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_updateSubdomain",
    "arguments": {
          "id": "example",
          "subdomain": "example"
    }
  }
}
site_listEnvVars

List environment variables for a project

Input Schema

projectIdstringrequired

Project ID

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_listEnvVars",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_createEnvVar

Create a new environment variable

Input Schema

projectIdstringrequired

Project ID

namestringrequired

Variable name (e.g., OPENAI_API_KEY)

valuestringrequired

Variable value

descriptionstring

Optional description

isSecretboolean

If true, value is masked in UI

allowedHostsarray

Hosts a VISITOR's serverFetch call may send this secret to, e.g. ["api.openai.com"] or ["*.example.com"]. Empty (the default) = visitors cannot use the secret at all; the owner's own calls are not limited. Just the host: no https://, path or port.

installScopeIdstring

Scope this variable to an installed plugin (listingId) — the plugin sees it, nothing else does.

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_createEnvVar",
    "arguments": {
          "projectId": "example",
          "name": "example",
          "value": "example"
    }
  }
}
site_updateEnvVar

Update an environment variable

Input Schema

idstringrequired

Environment variable ID

valuestring

New value (only if changing)

descriptionstring

New description

isSecretboolean

Update secret flag

allowedHostsarray

Hosts a VISITOR's serverFetch call may send this secret to, e.g. ["api.openai.com"] or ["*.example.com"]. Empty (the default) = visitors cannot use the secret at all; the owner's own calls are not limited. Just the host: no https://, path or port.

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_updateEnvVar",
    "arguments": {
          "id": "example",
          "value": "example",
          "description": "example"
    }
  }
}
site_deleteEnvVar

Delete an environment variable

Input Schema

idstringrequired

Environment variable ID to delete

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_deleteEnvVar",
    "arguments": {
          "id": "example"
    }
  }
}
site_updateCustomDomain

Update custom domain settings

Input Schema

idstringrequired

Project ID

customDomainstring

Custom domain (e.g., myapp.com)

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_updateCustomDomain",
    "arguments": {
          "id": "example",
          "customDomain": "example"
    }
  }
}
site_getAppUsers

Get users who signed up to this published app

Input Schema

projectIdstringrequired

Project ID

limitnumber
offsetnumber

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_getAppUsers",
    "arguments": {
          "projectId": "example",
          "limit": 0,
          "offset": 0
    }
  }
}
site_deleteAppUser

Delete a user from this published app

Input Schema

projectIdstringrequired

Project ID

userIdstringrequired

App user ID to delete

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_deleteAppUser",
    "arguments": {
          "projectId": "example",
          "userId": "example"
    }
  }
}
site_getEntitlements

List an app user's entitlements with live status — what paid access they hold right now

Input Schema

projectIdstringrequired

Project ID

appUserIdstringrequired

App user ID (from getAppUsers)

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_getEntitlements",
    "arguments": {
          "projectId": "example",
          "appUserId": "example"
    }
  }
}
site_grantEntitlement

Grant (or re-activate) paid access to an app user — e.g. a free month, a comp, or after an offline payment

Input Schema

projectIdstringrequired

Project ID

appUserIdstringrequired

App user ID

keystringrequired

Entitlement key, e.g. "member"

expiresAtstring

ISO date when access ends; omit for lifetime

graceUntilstring

ISO date grace period ends (access continues past expiry until then)

sourceobject

Audit context, e.g. { reason: "support comp" }

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_grantEntitlement",
    "arguments": {
          "projectId": "example",
          "appUserId": "example",
          "key": "example"
    }
  }
}
site_extendEntitlement

Extend an existing entitlement's expiry (renewal)

Input Schema

projectIdstringrequired

Project ID

appUserIdstringrequired

App user ID

keystringrequired

Entitlement key

expiresAtstringrequired

New ISO expiry date (required — use grantEntitlement for lifetime)

graceUntilstring

ISO date grace period ends

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_extendEntitlement",
    "arguments": {
          "projectId": "example",
          "appUserId": "example",
          "key": "example"
    }
  }
}
site_suspendEntitlement

Suspend an entitlement (e.g. missed installment) — access ends when any grace runs out

Input Schema

projectIdstringrequired

Project ID

appUserIdstringrequired

App user ID

keystringrequired

Entitlement key

graceUntilstring

ISO date until which access continues despite suspension (grace)

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_suspendEntitlement",
    "arguments": {
          "projectId": "example",
          "appUserId": "example",
          "key": "example"
    }
  }
}
site_revokeEntitlement

Revoke an entitlement immediately (refund/abuse) — access ends now, audit trail kept

Input Schema

projectIdstringrequired

Project ID

appUserIdstringrequired

App user ID

keystringrequired

Entitlement key

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_revokeEntitlement",
    "arguments": {
          "projectId": "example",
          "appUserId": "example",
          "key": "example"
    }
  }
}
site_listManualPayments

The manual-payment approval queue: members' offline payments awaiting the owner's verification

Input Schema

projectIdstringrequired

Project ID

statusstring

Filter — default "pending" (the approval queue)

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_listManualPayments",
    "arguments": {
          "projectId": "example",
          "status": "example"
    }
  }
}
site_approveManualPayment

Approve a member's manual payment — marks it succeeded and grants the offer's entitlement per its access terms

Input Schema

projectIdstringrequired

Project ID

paymentIdstringrequired

Manual payment id (from listManualPayments)

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_approveManualPayment",
    "arguments": {
          "projectId": "example",
          "paymentId": "example"
    }
  }
}
site_rejectManualPayment

Reject a member's manual payment claim (not received / wrong amount). No entitlement is granted

Input Schema

projectIdstringrequired

Project ID

paymentIdstringrequired

Manual payment id

reasonstring

Optional reason kept on the record

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_rejectManualPayment",
    "arguments": {
          "projectId": "example",
          "paymentId": "example",
          "reason": "example"
    }
  }
}
site_createAppUser

Manually create a user for this published app

Input Schema

projectIdstringrequired

Project ID

emailstringrequired

User email

namestring

User name

passwordstringrequired

User password (min 8 chars)

rolestring

Legacy user/admin enum (kept for backward compat during the role-migration).

roleIdsarray

New-format role assignments. Each ID must be an AppBuilderRole for this project. Granted atomically with user creation.

sendWelcomeEmailboolean

Send welcome email with credentials

customFieldsobject

Custom field values keyed by field ID

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_createAppUser",
    "arguments": {
          "projectId": "example",
          "email": "example",
          "name": "example"
    }
  }
}
site_resetAppUserPassword

Reset password for an app user

Input Schema

projectIdstringrequired

Project ID

userIdstringrequired

App user ID

newPasswordstringrequired

New password (min 8 chars)

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_resetAppUserPassword",
    "arguments": {
          "projectId": "example",
          "userId": "example",
          "newPassword": "example"
    }
  }
}
site_updateAppUserRole

LEGACY: set the platform-level user/admin classification. For has_role rules in access control, use assignRoleToAppUser / unassignRoleFromAppUser with roleIds from listProjectRoles.

Input Schema

projectIdstringrequired

Project ID

userIdstringrequired

App user ID

rolestringrequired

LEGACY platform-level classification (user|admin). Retained for backward compat during the role-migration window. For access-control roles, use assignRoleToAppUser with a roleId from listProjectRoles.

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_updateAppUserRole",
    "arguments": {
          "projectId": "example",
          "userId": "example",
          "role": "example"
    }
  }
}
site_updateAppUser

Update an app user record (name, email, role, banned status, custom fields)

Input Schema

projectIdstringrequired

Project ID

userIdstringrequired

App user ID

namestring

User name

emailstring

User email

rolestring

User role

isBannedboolean

Ban/unban user

customFieldsobject

Custom field values matching authCustomFields

profileDataobject

Alias of customFields — custom field values matching authCustomFields, merged into existing profileData

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_updateAppUser",
    "arguments": {
          "projectId": "example",
          "userId": "example",
          "name": "example"
    }
  }
}
site_listProjectRoles

List all role definitions for a project. Auto-seeds reserved + legacy roles.

Input Schema

projectIdstringrequired

Project ID

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_listProjectRoles",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_createProjectRole

Create a new role on a project.

Input Schema

projectIdstringrequired

Project ID

namestringrequired

Role name

colorstring

Hex color for UI badges

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_createProjectRole",
    "arguments": {
          "projectId": "example",
          "name": "example",
          "color": "example"
    }
  }
}
site_updateProjectRole

Update a role on a project. The reserved app-super-admin role cannot be renamed.

Input Schema

roleIdstringrequired

Role ID from listProjectRoles

namestring

New role name

colorstring

New hex color (null clears)

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_updateProjectRole",
    "arguments": {
          "roleId": "example",
          "name": "example",
          "color": "example"
    }
  }
}
site_deleteProjectRole

Delete a role and all its assignments. The reserved app-super-admin role cannot be deleted.

Input Schema

roleIdstringrequired

Role ID to delete

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_deleteProjectRole",
    "arguments": {
          "roleId": "example"
    }
  }
}
site_listAccessPolicies

List reusable access policies for a project (at most 200). A policy past the size limits is listed without its condition (null), with its size and a note saying why.

Input Schema

projectIdstringrequired

Project ID

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_listAccessPolicies",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_createAccessPolicy

Create a reusable access policy. Reference it from a resource rule via { policy: <id> }. Limits (a save past them is refused with a message naming the policy): a policy is stored in at most 300,000 characters, and one single rule in it holds at most 256,000. A policy may use other policies at most 16 deep; a rule may reach at most 32 policies holding at most 4,000,000 characters together; written out in full they add at most 20,000 parts, 4,000,000 characters of values and 256 groups inside groups. A site holds at most 200 policies, at most 2,000,000 characters together.

Input Schema

projectIdstringrequired

Project ID

namestringrequired

Unique policy name

descriptionstring
colorstring
conditionanyrequired

The access Condition this policy represents (leaf, group, or legacy array).

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_createAccessPolicy",
    "arguments": {
          "projectId": "example",
          "name": "example",
          "description": "example"
    }
  }
}
site_updateAccessPolicy

Update a reusable access policy. Editing the condition updates every resource that references it. Limits (a save past them is refused with a message naming the policy): a policy is stored in at most 300,000 characters, and one single rule in it holds at most 256,000. A policy may use other policies at most 16 deep; a rule may reach at most 32 policies holding at most 4,000,000 characters together; written out in full they add at most 20,000 parts, 4,000,000 characters of values and 256 groups inside groups. A site holds at most 200 policies, at most 2,000,000 characters together.

Input Schema

policyIdstringrequired
namestring
descriptionstring
colorstring
conditionany

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_updateAccessPolicy",
    "arguments": {
          "policyId": "example",
          "name": "example",
          "description": "example"
    }
  }
}
site_deleteAccessPolicy

Delete a reusable access policy. Resources still referencing it will DENY (fail-closed) until updated.

Input Schema

policyIdstringrequired

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_deleteAccessPolicy",
    "arguments": {
          "policyId": "example"
    }
  }
}
site_assignRoleToAppUser

Grant a role to an app user. Idempotent.

Input Schema

userIdstringrequired

App user ID

roleIdstringrequired

Role ID

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_assignRoleToAppUser",
    "arguments": {
          "userId": "example",
          "roleId": "example"
    }
  }
}
site_unassignRoleFromAppUser

Remove a role from an app user. Idempotent.

Input Schema

userIdstringrequired

App user ID

roleIdstringrequired

Role ID

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_unassignRoleFromAppUser",
    "arguments": {
          "userId": "example",
          "roleId": "example"
    }
  }
}
site_getAppUserRoles

Get all roles assigned to an app user.

Input Schema

userIdstringrequired

App user ID

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_getAppUserRoles",
    "arguments": {
          "userId": "example"
    }
  }
}
site_migrateProjectToRoleSystem

Idempotent one-shot migration of legacy role data into the new AppBuilderRole model.

Input Schema

projectIdstringrequired

Project to migrate

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_migrateProjectToRoleSystem",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_getProjectDeleteInfo

Pre-delete impact summary — what deleting this project would remove (pages, components, app users, linked Base tables/rows). Param "id" is project ID. Read-only; call before deleteProject.

Input Schema

idstringrequired

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_getProjectDeleteInfo",
    "arguments": {
          "id": "example"
    }
  }
}
site_deleteProject

Delete a project, its linked Base, and all pages/components

Input Schema

idstringrequired

Project ID to delete

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_deleteProject",
    "arguments": {
          "id": "example"
    }
  }
}
site_createPage

Create a new page in a project. Set SEO title + description here for any public page so it ships indexable from day one — no follow-up updatePage call needed.

Input Schema

projectIdstringrequired

Project ID from listProjects

namestringrequired

Page name (e.g., "About", "Contact")

pathstringrequired

URL path (e.g., "/about", "/contact")

titlestring

SEO page title — 50-60 characters. Keyword-led, action-oriented. Example: "Pricing – Plans for Teams of Any Size". Leave empty for protected/auth pages and /404.

descriptionstring

SEO meta description — 150-160 characters. Action-oriented, includes value prop + key features. Example: "Compare Free, Pro, and Enterprise plans. Start free, upgrade for unlimited tasks, or pick Enterprise for SSO and SLA support."

isHomePageboolean

Set as the project home page (path "/"). Only one page can be home; setting this unsets any existing home.

isProtectedboolean

Require authentication to access. Use for dashboards, settings, user-only content. Skip SEO meta on protected pages.

contentstring

Page content (React component code). Pages without content are skipped by publish — set it here or via updatePage before publishing.

commitMessagestring

Git commit message describing what was created and why. Always provide a meaningful message.

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_createPage",
    "arguments": {
          "projectId": "example",
          "name": "example",
          "path": "example"
    }
  }
}
site_createComponent

Create a new component in a project

Input Schema

projectIdstringrequired

Project ID from listProjects

namestringrequired

Component name

descriptionstring

Optional component description

typestring

Component type: "custom", "layout", "ui", or "data"

contentstring

Component code (React/TSX). Set it here or via updateComponent — pages importing an empty component fail to build.

isGlobalboolean

Whether component is globally accessible

commitMessagestring

Git commit message describing what was created and why. Always provide a meaningful message.

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_createComponent",
    "arguments": {
          "projectId": "example",
          "name": "example",
          "description": "example"
    }
  }
}
site_listPages

List all pages in a project

Input Schema

projectIdstringrequired

Project ID from listProjects

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_listPages",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_getPage

Get page details including content

Input Schema

idstringrequired

Page ID from listPages

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_getPage",
    "arguments": {
          "id": "example"
    }
  }
}
site_readPage

Read page content with line numbers. Use offset/limit to read specific sections of large files. Each line is prefixed with EXACTLY 6 characters: a 4-wide right-aligned line number, an arrow, and ONE space (" 1→ "). Everything after that single space is file content, INCLUDING its leading indentation — keep that indentation when copying a line into the oldString of an edit.

Input Schema

idstringrequired

Page ID from listPages

offsetnumber

Line number to start from (1-indexed). If not specified, starts from line 1.

limitnumber

Number of lines to read. If not specified, reads entire file.

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_readPage",
    "arguments": {
          "id": "example",
          "offset": 0,
          "limit": 0
    }
  }
}
site_readComponent

Read component content with line numbers. Use offset/limit to read specific sections of large files. Each line is prefixed with EXACTLY 6 characters: a 4-wide right-aligned line number, an arrow, and ONE space (" 1→ "). Everything after that single space is file content, INCLUDING its leading indentation — keep that indentation when copying a line into the oldString of an edit.

Input Schema

idstringrequired

Component ID from listComponents

offsetnumber

Line number to start from (1-indexed)

limitnumber

Number of lines to read

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_readComponent",
    "arguments": {
          "id": "example",
          "offset": 0,
          "limit": 0
    }
  }
}
site_getPageAccessRules

Get the access rules JSON for a single page.

Input Schema

pageIdstringrequired

Page ID from listPages

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_getPageAccessRules",
    "arguments": {
          "pageId": "example"
    }
  }
}
site_setPageAccessRules

Set access rules on a page and sync legacy isProtected/requiredRole for Worker compatibility.

Input Schema

pageIdstringrequired

Page ID from listPages

accessRulesobjectrequired

Pages have a single read/view operation. `read` is a Condition: a rule, a legacy flat array (OR), or an { all | any | not } group with operators. `function` rules are NOT allowed (the edge guard cannot run them).

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_setPageAccessRules",
    "arguments": {
          "pageId": "example",
          "accessRules": {}
    }
  }
}
site_getBackendFunctionAccessRules

Get the access rules JSON for a single backend function.

Input Schema

functionIdstringrequired

Backend function ID from listBackendFunctions

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_getBackendFunctionAccessRules",
    "arguments": {
          "functionId": "example"
    }
  }
}
site_setBackendFunctionAccessRules

Set access rules on a backend function.

Input Schema

functionIdstringrequired

Backend function ID from listBackendFunctions

accessRulesobjectrequired

Backend functions have a single execute operation. `execute` is a Condition: a rule, a legacy flat array (OR), or an { all | any | not } group with operators and the custom `function` rule.

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_setBackendFunctionAccessRules",
    "arguments": {
          "functionId": "example",
          "accessRules": {}
    }
  }
}
site_getEmailAccessRules

Get who may send email from the published app (client-side email.send). Email is DENY-BY-DEFAULT for non-owners.

Input Schema

projectIdstringrequired

Project ID from listProjects

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_getEmailAccessRules",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_setEmailAccessRules

Set who may send email from the published app via the client-side email API. Server-side ctx.email.send() in backend functions is NOT affected (it runs as the project). Enforced at /api/email/send.

Input Schema

projectIdstringrequired

Project ID from listProjects

accessRulesobjectrequired

{ send: Condition } — same rule shapes as other resources (authenticated/has_role/user_property/policy refs or {all|any|not} groups). Empty/missing send = only the owner may send. NOTE: sending goes out under the owner's own sending identity — open it narrowly (e.g. a staff role), not { type: "public" }.

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_setEmailAccessRules",
    "arguments": {
          "projectId": "example",
          "accessRules": {}
    }
  }
}
site_verifyBuild

Fast whole-project verification: per-file syntax/export/undefined-JSX checks, unresolved component imports, npm imports missing from project dependencies, and non-PascalCase component names (breaks publish). Call AFTER finishing edits and fix every reported error BEFORE telling the user the work is done. Warnings are advisory. Static check — publish still runs the full bundler.

Input Schema

projectIdstringrequired

Project ID from listProjects

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_verifyBuild",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_updatePage

Update page properties and content

Input Schema

idstringrequired

Page ID from listPages

namestring

New page name

pathstring

New URL path

contentstring

Page content (React component code or JSON)

layoutstring

Layout template name

isHomePageboolean

Set as home page

sortOrdernumber

Sort order for navigation

titlestring

Page title for SEO

descriptionstring

Page description for SEO

isDraftboolean

Draft mode - page exists in builder but is not included when publishing

isProtectedboolean

Require authentication to access

requiredRolestring

Required role to access (null = any authenticated user)

redirectIfUnauthstring

Redirect path for unauthenticated users

commitMessagestring

Git commit message describing what changed and why. Always provide a meaningful message.

baseContentHashstring

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_updatePage",
    "arguments": {
          "id": "example",
          "name": "example",
          "path": "example"
    }
  }
}
site_editPage

Edit page content by replacing specific text. Exact-match only — a near-miss fails and the error shows the file's actual nearby text to copy. If oldString is not unique, provide more surrounding context or use replaceAll=true.

Input Schema

idstringrequired

Page ID from listPages

oldStringstringrequired

Exact text to find — matched byte-for-byte (whitespace and indentation included), NO fuzzy matching. Copy from readPage output with the 6-char line-number prefix (" 1→ ") removed and the line's own indentation KEPT, and do not add escaping the file does not contain (no \" or \n unless literally in the file). PREFER THE SMALLEST UNIQUE ANCHOR — one distinctive line beats a large block. Large multi-line blocks are the main cause of failed edits (measured: failures averaged 8.7 lines, successes 5.0). Must be unique unless using replaceAll.

newStringstringrequired

The replacement text (must be different from oldString)

replaceAllboolean

Replace all occurrences. If false (default), oldString must be unique in the file.

commitMessagestring

Git commit message describing what changed and why. Always provide a meaningful message.

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_editPage",
    "arguments": {
          "id": "example",
          "oldString": "example",
          "newString": "example"
    }
  }
}
site_searchPage

Search page content for specific text/patterns. Returns matching lines with context. More efficient than getPage for finding specific code.

Input Schema

idstringrequired

Page ID from listPages

patternstringrequired

Text or regex pattern to search for

contextLinesnumber

Number of lines to show before and after each match (default: 3)

maxMatchesnumber

Maximum number of matches to return (default: 5)

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_searchPage",
    "arguments": {
          "id": "example",
          "pattern": "example",
          "contextLines": 0
    }
  }
}
site_deletePage

Delete a page from the project

Input Schema

idstringrequired

Page ID to delete

commitMessagestring

Git commit message explaining why the page was deleted. Always provide a meaningful message.

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_deletePage",
    "arguments": {
          "id": "example",
          "commitMessage": "example"
    }
  }
}
site_createEmailTemplate

Create a new email template in a project

Input Schema

projectIdstringrequired

Project ID from listProjects

namestringrequired

Template display name (e.g., "Welcome Email")

slugstringrequired

Template slug used in email.send({ template: "slug" })

subjectstring

Default email subject line

descriptionstring

Template description

contentstring

Initial HTML content for the template

variablesarray

Template variables

commitMessagestring

Git commit message

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_createEmailTemplate",
    "arguments": {
          "projectId": "example",
          "name": "example",
          "slug": "example"
    }
  }
}
site_listEmailTemplates

List all email templates in a project

Input Schema

projectIdstringrequired

Project ID from listProjects

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_listEmailTemplates",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_getEmailTemplate

Get an email template with full content

Input Schema

idstringrequired

Email template ID

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_getEmailTemplate",
    "arguments": {
          "id": "example"
    }
  }
}
site_readEmailTemplate

Get email template content with line numbers for AI editing

Input Schema

idstringrequired

Email template ID

offsetinteger

1-indexed line to start from (for large templates)

limitinteger

Number of lines to return from offset

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_readEmailTemplate",
    "arguments": {
          "id": "example",
          "offset": {},
          "limit": {}
    }
  }
}
site_updateEmailTemplate

Update an email template

Input Schema

idstringrequired

Email template ID

namestring

Template display name

slugstring

Template slug

subjectstring

Default subject line

descriptionstring

Template description

contentstring

Full HTML email template content

variablesarray

Template variables with source metadata

commitMessagestring

Git commit message

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_updateEmailTemplate",
    "arguments": {
          "id": "example",
          "name": "example",
          "slug": "example"
    }
  }
}
site_editEmailTemplate

Replace specific text in an email template (string replacement)

Input Schema

idstringrequired

Email template ID

oldStringstringrequired

Exact string to find in the template content

newStringstringrequired

Replacement string

replaceAllboolean

Replace all occurrences

commitMessagestring

Git commit message

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_editEmailTemplate",
    "arguments": {
          "id": "example",
          "oldString": "example",
          "newString": "example"
    }
  }
}
site_searchEmailTemplate

Search for text in an email template

Input Schema

idstringrequired

Email template ID

patternstringrequired

Search pattern (plain text or regex)

contextLinesinteger

Lines of context before/after each match (default 3)

maxMatchesinteger

Maximum matches to return (default 5)

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_searchEmailTemplate",
    "arguments": {
          "id": "example",
          "pattern": "example",
          "contextLines": {}
    }
  }
}
site_deleteEmailTemplate

Delete an email template

Input Schema

idstringrequired

Email template ID

commitMessagestring

Git commit message

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_deleteEmailTemplate",
    "arguments": {
          "id": "example",
          "commitMessage": "example"
    }
  }
}
site_getEmailUsage

Sign-in and receipt email used/limit for this month. Email the owner writes goes from their OWN mailbox and is not counted here — there is no platform quota on it.

Input Schema

projectIdstringrequired

Project ID

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_getEmailUsage",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_listComponents

List all components in a project

Input Schema

projectIdstringrequired

Project ID from listProjects

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_listComponents",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_getComponent

Get component details including content

Input Schema

idstringrequired

Component ID from listComponents

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_getComponent",
    "arguments": {
          "id": "example"
    }
  }
}
site_updateComponent

Update component properties and code

Input Schema

idstringrequired

Component ID from listComponents

namestring

New component name

descriptionstring

Component description

contentstring

Component code (React/TSX)

typestring

Component type

isGlobalboolean

Whether globally accessible

commitMessagestring

Git commit message describing what changed and why. Always provide a meaningful message.

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_updateComponent",
    "arguments": {
          "id": "example",
          "name": "example",
          "description": "example"
    }
  }
}
site_editComponent

Edit component content by replacing specific text. Exact-match only — a near-miss fails and the error shows the file's actual nearby text to copy. If oldString is not unique, provide more context or use replaceAll=true.

Input Schema

idstringrequired

Component ID from listComponents

oldStringstringrequired

Exact text to find — matched byte-for-byte (whitespace and indentation included), NO fuzzy matching. Copy from readComponent output with the 6-char line-number prefix (" 1→ ") removed and the line's own indentation KEPT, and do not add escaping the file does not contain (no \" or \n unless literally in the file). PREFER THE SMALLEST UNIQUE ANCHOR — one distinctive line beats a large block. Large multi-line blocks are the main cause of failed edits (measured: failures averaged 8.7 lines, successes 5.0). Must be unique unless using replaceAll.

newStringstringrequired

The replacement text (must be different from oldString)

replaceAllboolean

Replace all occurrences. If false (default), oldString must be unique.

commitMessagestring

Git commit message describing what changed and why. Always provide a meaningful message.

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_editComponent",
    "arguments": {
          "id": "example",
          "oldString": "example",
          "newString": "example"
    }
  }
}
site_searchComponent

Search component content for specific text/patterns. Returns matching lines with context.

Input Schema

idstringrequired

Component ID from listComponents

patternstringrequired

Text or regex pattern to search for

contextLinesnumber

Lines to show before/after match

maxMatchesnumber

Maximum matches to return

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_searchComponent",
    "arguments": {
          "id": "example",
          "pattern": "example",
          "contextLines": 0
    }
  }
}
site_deleteComponent

Delete a component from the project

Input Schema

idstringrequired

Component ID to delete

commitMessagestring

Git commit message explaining why the component was deleted. Always provide a meaningful message.

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_deleteComponent",
    "arguments": {
          "id": "example",
          "commitMessage": "example"
    }
  }
}
site_listSnapshots

List built-in version-history checkpoints for a project (paginated)

Input Schema

projectIdstringrequired
limitinteger
cursorstring

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_listSnapshots",
    "arguments": {
          "projectId": "example",
          "limit": {},
          "cursor": "example"
    }
  }
}
site_getSnapshotContent

Resolve a checkpoint's page/component content for preview

Input Schema

projectIdstringrequired
snapshotIdstringrequired

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_getSnapshotContent",
    "arguments": {
          "projectId": "example",
          "snapshotId": "example"
    }
  }
}
site_restoreSnapshot

Restore the project to a previous version. Reversible — captures the current state first.

Input Schema

projectIdstringrequired
snapshotIdstringrequired

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_restoreSnapshot",
    "arguments": {
          "projectId": "example",
          "snapshotId": "example"
    }
  }
}
site_revertSnapshotChange

Undo only the change a version/message made, keeping later changes (skips files later edited).

Input Schema

projectIdstringrequired
snapshotIdstringrequired

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_revertSnapshotChange",
    "arguments": {
          "projectId": "example",
          "snapshotId": "example"
    }
  }
}
site_listOffers

List ALL offers (active + inactive) with full terms.

Input Schema

projectIdstringrequired

Project ID from listProjects

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_listOffers",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_createOffer

Create a PRODUCT (a sellable thing: membership tier, course, pass, download). Buying it grants its entitlement; gate pages/tables/channels with has_entitlement rules. Tiers = multiple products with different entitlementKeys.

Input Schema

projectIdstringrequired

Project ID from listProjects

keystringrequired

Stable id used by pages: payments.checkout(key). Lowercase, e.g. "pro"

namestringrequired

Display name, e.g. "Pro Membership"

descriptionstring
amountintegerrequired

Price in MINOR units (1900 = $19.00). 0 = free (trial offers)

currencystring

ISO code, default usd

paymentTermany

How it is paid. Default one_time. recurring {every:1,interval:"month"} = monthly; {every:3,interval:"month"} = quarterly; trialDays = free trial before the first charge (card checkout)

accessTermany

How long access lasts. Default lifetime. while_subscribed pairs with recurring payment

entitlementKeystring

Entitlement granted on payment (default = the product key). Gate content with { type: "has_entitlement", key }

imageUrlstring

Product image URL shown on pricing/product cards

featuresarray

Selling-point bullets, e.g. ["All courses", "Weekly live calls", "Private lounge"]

isActiveboolean

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_createOffer",
    "arguments": {
          "projectId": "example",
          "key": "example",
          "name": "example"
    }
  }
}
site_updateOffer

Update an offer. Term changes affect FUTURE purchases only — existing members keep what they bought (grandfathering).

Input Schema

projectIdstringrequired
keystringrequired

Offer key from listOffers

namestring
descriptionstring
amountinteger
currencystring
paymentTermany
accessTermany
entitlementKeystring
imageUrlstring
featuresarray
isActiveboolean

false = stop selling (existing entitlements unaffected)

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_updateOffer",
    "arguments": {
          "projectId": "example",
          "key": "example",
          "name": "example"
    }
  }
}
site_deleteOffer

Delete an offer permanently. Prefer updateOffer isActive:false — deletion breaks pages referencing the key. Existing entitlements are never touched.

Input Schema

projectIdstringrequired
keystringrequired

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_deleteOffer",
    "arguments": {
          "projectId": "example",
          "key": "example"
    }
  }
}
site_listCoupons

List discount coupons with redemption counts

Input Schema

projectIdstringrequired

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_listCoupons",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_createCoupon

Create a discount coupon. Multiple coupons can be active at once. Redemptions count only on PAID checkouts. The redeemed code lands in the entitlement source — usable for affiliate attribution.

Input Schema

projectIdstringrequired
codestringrequired

The code members type (stored UPPERCASE), e.g. LAUNCH20

percentOffinteger

Percent discount 1-100 (use EITHER this or amountOff)

amountOffinteger

Fixed discount in MINOR units (500 = $5 off)

offerKeysarray

Restrict to these offer keys (omit = all offers)

maxRedemptionsinteger

Total successful uses allowed (omit = unlimited)

expiresAtstring

ISO date after which the code stops working

isActiveboolean

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_createCoupon",
    "arguments": {
          "projectId": "example",
          "code": "example",
          "percentOff": {}
    }
  }
}
site_updateCoupon

Update a coupon (isActive:false kills it instantly; past redemptions unaffected).

Input Schema

projectIdstringrequired
codestringrequired

Coupon code from listCoupons

percentOffinteger
amountOffinteger
offerKeysarray
maxRedemptionsinteger
expiresAtstring
isActiveboolean

false = disable the code immediately

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_updateCoupon",
    "arguments": {
          "projectId": "example",
          "code": "example",
          "percentOff": {}
    }
  }
}
site_deleteCoupon

Delete a coupon permanently.

Input Schema

projectIdstringrequired
codestringrequired

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_deleteCoupon",
    "arguments": {
          "projectId": "example",
          "code": "example"
    }
  }
}
site_listCampaigns

List email campaigns with status + send stats

Input Schema

projectIdstringrequired

Project ID from listProjects

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_listCampaigns",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_createCampaign

Create a DRAFT email campaign. The audience is dynamic: an access-rule condition evaluated against live member data at send time.

Input Schema

projectIdstringrequired

Project ID from listProjects

namestringrequired

Internal name, e.g. "July newsletter"

subjectstringrequired
htmlstringrequired

Email body HTML (an unsubscribe footer is added automatically)

textstring
audienceRulesany

Access Control condition selecting recipients — SAME schema as page/table rules. Examples: [{"type":"has_entitlement","key":"pro"}] = paying Pro members; [{"type":"has_role","roleId":"..."}]; omit = ALL members.

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_createCampaign",
    "arguments": {
          "projectId": "example",
          "name": "example",
          "subject": "example"
    }
  }
}
site_updateCampaign

Update a DRAFT campaign (sent/sending campaigns are immutable).

Input Schema

projectIdstringrequired
idstringrequired

Campaign ID from listCampaigns

namestring
subjectstring
htmlstring
textstring
audienceRulesany

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_updateCampaign",
    "arguments": {
          "projectId": "example",
          "id": "example",
          "name": "example"
    }
  }
}
site_deleteCampaign

Delete a campaign (any status; stops future batches).

Input Schema

projectIdstringrequired
idstringrequired

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_deleteCampaign",
    "arguments": {
          "projectId": "example",
          "id": "example"
    }
  }
}
site_previewCampaignAudience

Resolve the campaign audience NOW: recipient count, sample and suppressed count. Always preview before sendCampaign.

Input Schema

projectIdstringrequired
idstringrequired

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_previewCampaignAudience",
    "arguments": {
          "projectId": "example",
          "id": "example"
    }
  }
}
site_sendCampaign

Send a draft campaign to its resolved audience. Goes out through the owner's own connected mailbox — no platform quota applies; the ceiling is that mailbox's own hourly limit.

Input Schema

projectIdstringrequired
idstringrequired

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_sendCampaign",
    "arguments": {
          "projectId": "example",
          "id": "example"
    }
  }
}
site_listSuppressions

List unsubscribed/suppressed email addresses (marketing only)

Input Schema

projectIdstringrequired

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_listSuppressions",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_removeSuppression

Remove an address from the suppression list (only when the person explicitly re-opted-in).

Input Schema

projectIdstringrequired
emailstringrequired

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_removeSuppression",
    "arguments": {
          "projectId": "example",
          "email": "example"
    }
  }
}
site_getChannelAccessRules

List realtime channel access rules (pattern -> rules). Channels with no matching pattern allow any signed-in member.

Input Schema

projectIdstringrequired

Project ID from listProjects

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_getChannelAccessRules",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_setChannelAccessRules

Set access rules for a realtime channel pattern (upserts by pattern). Same rule engine as every other resource.

Input Schema

projectIdstringrequired

Project ID from listProjects

patternstringrequired

Channel pattern: exact ("announcements"), wildcard ("chat:*"), or dynamic with {self} = subscriber id ("support:{self}", "user:{self}:*")

accessRulesobjectrequired

Channels have a single `subscribe` operation. Same Condition schema as pages/tables/files: rules, flat arrays (OR), { all | any | not } groups. Example: { subscribe: [{ type: "has_entitlement", key: "pro" }] }

descriptionstring
sortOrderinteger

First matching pattern wins (ascending)

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_setChannelAccessRules",
    "arguments": {
          "projectId": "example",
          "pattern": "example",
          "accessRules": {}
    }
  }
}
site_deleteChannelAccessRules

Remove access rules for a channel pattern.

Input Schema

projectIdstringrequired

Project ID from listProjects

patternstringrequired

Channel pattern to remove rules for (channel reverts to the any-member default)

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_deleteChannelAccessRules",
    "arguments": {
          "projectId": "example",
          "pattern": "example"
    }
  }
}
site_setRealtimeGuestAccess

Enable/disable anonymous guest realtime sessions (support-widget chat for non-logged-in visitors).

Input Schema

projectIdstringrequired

Project ID from listProjects

enabledbooleanrequired

Allow anonymous visitors to open guest realtime sessions (scoped to their own guest:{id}:* channels)

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_setRealtimeGuestAccess",
    "arguments": {
          "projectId": "example",
          "enabled": true
    }
  }
}
site_listSchedules

List scheduled backend-function runs (crons) for a project. A schedule created before the plan gate can still read isActive:true while never firing — `blocked` says so.

Input Schema

projectIdstringrequired

Project ID from listProjects

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_listSchedules",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_createSchedule

Schedule a backend function to run on a cron — drip, digests, reminders, sweeps

Input Schema

projectIdstringrequired

Project ID from listProjects

functionNamestringrequired

Backend function to run (name from listBackendFunctions)

cronExpressionstringrequired

Cron expression, e.g. "0 9 * * 1" = Mondays 9am

timezonestring

IANA timezone (default UTC)

namestring

Display name, e.g. "Weekly digest"

paramsobject

Extra params passed to the function

isActiveboolean

Start enabled (default true)

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_createSchedule",
    "arguments": {
          "projectId": "example",
          "functionName": "example",
          "cronExpression": "example"
    }
  }
}
site_updateSchedule

Update a schedule (fields omitted stay unchanged); isActive toggles it

Input Schema

projectIdstringrequired

Project ID from listProjects

idstringrequired

Schedule ID from listSchedules

functionNamestring
cronExpressionstring
timezonestring
namestring
paramsobject
isActiveboolean

Enable/disable the schedule

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_updateSchedule",
    "arguments": {
          "projectId": "example",
          "id": "example",
          "functionName": "example"
    }
  }
}
site_deleteSchedule

Delete a schedule permanently (stop recurring runs)

Input Schema

projectIdstringrequired

Project ID from listProjects

idstringrequired

Schedule ID from listSchedules

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_deleteSchedule",
    "arguments": {
          "projectId": "example",
          "id": "example"
    }
  }
}
site_getPublishStatus

Live progress of an IN-FLIGHT publish. Param: projectId. Returns { stage, label, pct, updatedAt } or null when no publish is running. Poll this after calling publish to report progress; for "is the app live" use getProject (isPublished/publishedUrl) instead.

Input Schema

projectIdstringrequired

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_getPublishStatus",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_publish

Publish an app to production. Builds all pages and deploys for serving.

Input Schema

idstringrequired

Project ID to publish

releaseVersionstring

Cut an immutable release instead of updating the live copy: the build lands under apps/{id}/releases/{version} and the project itself is left untouched (docs/apps-platform-plan.md §4.10)

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_publish",
    "arguments": {
          "id": "example",
          "releaseVersion": "example"
    }
  }
}
site_unpublish

Unpublish an app (marks as unpublished but keeps deployed files)

Input Schema

idstringrequired

Project ID to unpublish

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_unpublish",
    "arguments": {
          "id": "example"
    }
  }
}
site_getCustomDomainStatus

Get custom domain verification status and DNS instructions

Input Schema

idstringrequired

Project ID

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_getCustomDomainStatus",
    "arguments": {
          "id": "example"
    }
  }
}
site_verifyCustomDomain

Verify custom domain ownership via DNS TXT record lookup

Input Schema

idstringrequired

Project ID

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_verifyCustomDomain",
    "arguments": {
          "id": "example"
    }
  }
}
site_getCodeGuide

Get docs for a SPECIFIC App Builder topic. Pass the topic you need (payments, auth, email, sdk, …). The SDK basics are already in your system prompt, so call this only when you need depth on a specific area — and pass a topic, not "all" (which returns just an index).

Input Schema

topicstring

Pick the SPECIFIC topic you need (e.g. "payments", "auth", "email", "sdk", "styling"). "all" returns only a short index of topics, NOT full docs — request a specific topic for details. Topics: "sdk", "globals", "hooks", "navigation", "libraries", "styling", "components", "examples", "errors", "mcp", "access", "auth", "payments", "saas", "functions", "email".

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_getCodeGuide",
    "arguments": {
          "topic": "example"
    }
  }
}
site_removeCustomDomain

Remove custom domain from a project

Input Schema

idstringrequired

Project ID

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_removeCustomDomain",
    "arguments": {
          "id": "example"
    }
  }
}
site_getStripeConnection

Get Stripe connection status for a project

Input Schema

projectIdstringrequired

Project ID

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_getStripeConnection",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_registerStripeWebhook

Auto-register the Stripe webhook endpoint using the stored secret key

Input Schema

projectIdstringrequired

Project ID

modestringrequired

Which mode to register the webhook for

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_registerStripeWebhook",
    "arguments": {
          "projectId": "example",
          "mode": "example"
    }
  }
}
site_toggleStripeMode

Switch between test and live Stripe mode

Input Schema

projectIdstringrequired

Project ID

modestringrequired

Mode to switch to

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_toggleStripeMode",
    "arguments": {
          "projectId": "example",
          "mode": "example"
    }
  }
}
site_syncStripeProducts

Sync products and prices from Stripe account

Input Schema

projectIdstringrequired

Project ID

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_syncStripeProducts",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_listStripeProducts

List synced Stripe products

Input Schema

projectIdstringrequired

Project ID

modestring

Filter by mode (default: current mode)

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_listStripeProducts",
    "arguments": {
          "projectId": "example",
          "mode": "example"
    }
  }
}
site_createStripeProduct

Create a new product with price in Stripe

Input Schema

projectIdstringrequired

Project ID

namestringrequired

Product name

descriptionstring

Product description

amountintegerrequired

Price amount in cents (e.g., 999 = $9.99)

currencystring

Currency code (default: usd)

intervalstring

Billing interval for subscriptions

intervalCountinteger

Number of intervals between billings

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_createStripeProduct",
    "arguments": {
          "projectId": "example",
          "name": "example",
          "description": "example"
    }
  }
}
site_getGitConnection

Get Git connection status. Param "projectId". Returns: connected, repoOwner, repoName, branch, lastCommitSha, AI permission flags.

Input Schema

projectIdstringrequired

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_getGitConnection",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_connectGitHub

Connect a GitHub repository. Params: projectId (required), repoOwner (GitHub username or org), repoName (repo name), OR createNew (true) with newRepoName to create a new repo.

Input Schema

projectIdstringrequired
repoOwnerstring
repoNamestring
createNewboolean
newRepoNamestring

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_connectGitHub",
    "arguments": {
          "projectId": "example",
          "repoOwner": "example",
          "repoName": "example"
    }
  }
}
site_disconnectGitHub

Disconnect GitHub from project. Param "projectId". Clears all Git settings and token.

Input Schema

projectIdstringrequired

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_disconnectGitHub",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_updateGitPermissions

Update AI Git permissions. Params: projectId (required), plus any of: - allowAiCommit: boolean - Allow AI to commit changes - allowAiPull: boolean - Allow AI to pull from remote - allowAiPush: boolean - Allow AI to push to remote - allowAiCreateBranch: boolean - Allow AI to create branches/repos

Input Schema

projectIdstringrequired
allowAiCommitboolean
allowAiPullboolean
allowAiPushboolean
allowAiCreateBranchboolean

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_updateGitPermissions",
    "arguments": {
          "projectId": "example",
          "allowAiCommit": true,
          "allowAiPull": true
    }
  }
}
site_listGitHubRepos

List user GitHub repos for selection. Param "projectId". Returns array of {fullName, name, owner, private, defaultBranch}.

Input Schema

projectIdstringrequired

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_listGitHubRepos",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_gitPull

Pull latest changes from GitHub remote

Input Schema

projectIdstringrequired

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_gitPull",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_gitPush

Push commits to GitHub remote

Input Schema

projectIdstringrequired

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_gitPush",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_gitCommit

Create a new commit with current source files

Input Schema

projectIdstringrequired
messagestringrequired

Commit message

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_gitCommit",
    "arguments": {
          "projectId": "example",
          "message": "example"
    }
  }
}
site_gitCreateBranch

Create a new branch from current HEAD

Input Schema

projectIdstringrequired
namestringrequired

New branch name

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_gitCreateBranch",
    "arguments": {
          "projectId": "example",
          "name": "example"
    }
  }
}
site_gitSwitchBranch

Switch to an existing branch

Input Schema

projectIdstringrequired
namestringrequired

Branch name to switch to

discardLocalChangesboolean

Switch even though pages have edits that were never committed. Those edits are PERMANENTLY LOST. Default false — the switch aborts and names the affected pages instead.

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_gitSwitchBranch",
    "arguments": {
          "projectId": "example",
          "name": "example",
          "discardLocalChanges": true
    }
  }
}
site_gitMerge

Merge one branch into another

Input Schema

projectIdstringrequired
fromstringrequired

Source branch to merge from

tostringrequired

Target branch to merge into

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_gitMerge",
    "arguments": {
          "projectId": "example",
          "from": "example",
          "to": "example"
    }
  }
}
site_gitListCommits

Get commit history

Input Schema

projectIdstringrequired
limitnumber

Maximum number of commits to return

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_gitListCommits",
    "arguments": {
          "projectId": "example",
          "limit": 0
    }
  }
}
site_gitRollback

Restore project to a previous commit

Input Schema

projectIdstringrequired
shastringrequired

Commit SHA to rollback to

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_gitRollback",
    "arguments": {
          "projectId": "example",
          "sha": "example"
    }
  }
}
site_gitStatus

Get current Git status

Input Schema

projectIdstringrequired

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_gitStatus",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_gitCreateRepo

Create a new GitHub repository

Input Schema

projectIdstringrequired
namestringrequired

Repository name

isPrivateboolean

Whether the repo should be private

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_gitCreateRepo",
    "arguments": {
          "projectId": "example",
          "name": "example",
          "isPrivate": true
    }
  }
}
site_gitListBranches

List all branches in the repository

Input Schema

projectIdstringrequired

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_gitListBranches",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_serverProxy

Make an HTTP request through server-side proxy with env var placeholder resolution.

Input Schema

projectIdstringrequired
urlstringrequired
methodstring
headersobject
bodyany
timeoutnumber

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_serverProxy",
    "arguments": {
          "projectId": "example",
          "url": "example",
          "method": "example"
    }
  }
}
site_setServerProxyAccessRules

Set access rules for server proxy on a project. Controls who can use serverFetch in published apps. No rules = deny (only app owner). Set execute rules to allow app users.

Input Schema

projectIdstringrequired
accessRulesobjectrequired

Access rules with a single execute operation. `execute` is a Condition: a rule, a legacy flat array (OR), or an { all | any | not } group with operators and the custom `function` rule.

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_setServerProxyAccessRules",
    "arguments": {
          "projectId": "example",
          "accessRules": {}
    }
  }
}
site_getServerProxyAccessRules

Get the current server proxy access rules for a project.

Input Schema

projectIdstringrequired

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_getServerProxyAccessRules",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_listBackendFunctions

List all backend functions for a project — includes BOTH code functions AND data functions (kind: "data" vs "code" in each row). Params: projectId (required). Returns array with id, name, kind, description, code, definition, accessRules, timeout, isActive.

Input Schema

projectIdstringrequired

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_listBackendFunctions",
    "arguments": {
          "projectId": "example"
    }
  }
}
site_getBackendFunction

Get a single backend function. Params: projectId (required), functionId (required). Returns full function with code.

Input Schema

projectIdstringrequired
functionIdstringrequired

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_getBackendFunction",
    "arguments": {
          "projectId": "example",
          "functionId": "example"
    }
  }
}
site_createDataFunction

Create a DATA function: a named declarative data operation — no code, no sandbox, entity-call speed. Callable from pages (as the member) AND headlessly by automations/agents (as system). Prefer these over backend functions for plain create/read/update/delete.

Input Schema

projectIdstringrequired
namestringrequired

Function name pages/automations call, e.g. "addContact"

descriptionstring
definitionobjectrequired

One owner-locked declarative operation on one table. Callers can only fill the declared placeholders — they cannot change the table, operation, or widen filters.

runAsstring

member (default) = caller's own row permissions. service = full data access (the declarative ctx.service): only the Owner or an Admin turns it on, by hand in the dashboard — leave it out; if the function needs it (a public form writing a protected table), create it without and tell the person to turn on "Full data access" for it in the dashboard.

accessRulesobject

Who may call it. REQUIRED in practice — no rules = nobody can execute (secure by default). Public contact form: { execute: [{ type: "public" }] }.

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_createDataFunction",
    "arguments": {
          "projectId": "example",
          "name": "example",
          "description": "example"
    }
  }
}
site_updateDataFunction

Update a data function (definition is re-validated; kind cannot change here — recreate to convert).

Input Schema

projectIdstringrequired
functionIdstringrequired

Function id from listBackendFunctions

descriptionstring
definitionobject

One owner-locked declarative operation on one table. Callers can only fill the declared placeholders — they cannot change the table, operation, or widen filters.

runAsstring
accessRulesobject
seenVersionstring

The function's version the dashboard showed (getBackendFunction): full data access is given only to that version.

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_updateDataFunction",
    "arguments": {
          "projectId": "example",
          "functionId": "example",
          "description": "example"
    }
  }
}
site_createBackendFunction

Create a server-side backend function (sandboxed JS with the ctx API) for secrets, elevated data access, external APIs, or heavy logic. For plain create/read/update/delete of table rows prefer createDataFunction. Read getCodeGuide topic "functions" first for the ctx API, patterns, and a worked example.

Input Schema

projectIdstringrequired

Project ID from listProjects

namestringrequired

Function name pages call via functions.invoke("name", params)

descriptionstring

What the function does (shown in the Config panel)

codestring

Sandboxed JS. Write plain statements using `params` (caller input) and `ctx` (tables/service.tables/fetch/files/email/env/user) directly — the code runs as a function body. `export default async (params, ctx) => { ... }` is also accepted. Call getCodeGuide topic "functions" for the full ctx API and examples BEFORE writing code.

accessRulesobject

Who may call it from the published app: { execute: [...] }. No rules = nobody can execute (secure by default).

timeoutnumber

Execution timeout in ms (default 30000, max 300000 = 5 min). Covers a cold start plus the run, so warm timings are not the budget. Extend ONLY for slow work like LLM calls or big imports — long agentic jobs should be turn-based, not one long execution.

maxRetriesinteger

Retries when run by an automation on failure. 0 = run once (default). Set > 0 ONLY if this function is idempotent (safe to re-run).

toolSpecobject

Structured MCP-tool schema authored WITH the code (one artifact): { inputSchema, outputSchema?, returns?, sideEffects?, kind? } as JSON Schema. For an exposed function (an action the owner's agents can run) set kind: read | write | destructive. A function with a schema is marked as an MCP tool (its interface is shown + AI-readable); omit it for a plain internal helper.

exposedboolean

true = a public METHOD of this site (catalog-listed, connectable). false (default) = internal helper.

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_createBackendFunction",
    "arguments": {
          "projectId": "example",
          "name": "example",
          "description": "example"
    }
  }
}
site_updateBackendFunction

Update a backend function. Only provided fields are updated. A function with Full data access (the "service" power) is changed only by the Owner or an Admin in the dashboard (its code, access rules, exposed, isActive): tell the person what to change instead. Params: projectId (required), functionId (required), name, description, code, accessRules, timeout (1000-300000), isActive (boolean), maxRetries (0 = run once (default); > 0 only if idempotent — used when an automation runs it), toolSpec (structured MCP-tool schema { inputSchema, outputSchema?, returns?, sideEffects? } — update it TOGETHER with the code so they stay in sync; pass null to remove the schema).

Input Schema

projectIdstringrequired
functionIdstringrequired
namestring
descriptionstring
codestring
accessRulesobject
timeoutnumber
maxRetriesinteger

Retries when run by an automation on failure. 0 = run once. Set > 0 only if idempotent.

isActiveboolean
toolSpecobject

Structured MCP-tool schema { inputSchema, outputSchema?, returns?, sideEffects?, kind? } authored WITH the code. Pass null to remove the schema (function becomes a plain internal helper).

exposedboolean

true = the owner's automations & AI (account functions, connectors) may call this function as a site method — UI label: "Automations & AI can use this function". false = private to this site's own pages.

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_updateBackendFunction",
    "arguments": {
          "projectId": "example",
          "functionId": "example",
          "name": "example"
    }
  }
}
site_deleteBackendFunction

Delete a backend function OR data function permanently (both live in the same registry — check kind from listBackendFunctions). Params: projectId (required), functionId (required).

Input Schema

projectIdstringrequired
functionIdstringrequired

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_deleteBackendFunction",
    "arguments": {
          "projectId": "example",
          "functionId": "example"
    }
  }
}
site_invokeBackendFunction

Execute/invoke a backend function and return the result. Use this to test functions after creating them. Params: - projectId: Project ID (required) - functionName: The function name (required, NOT the function ID) - params: Optional object of key-value parameters to pass to the function Returns: { success: true, data: <function return value>, executionTime: <ms> } or throws error with the function's error message. Example: invokeBackendFunction({ projectId: "abc", functionName: "getTaskStats", params: {} })

Input Schema

projectIdstringrequired
functionNamestringrequired
paramsobject

Example Call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "site_invokeBackendFunction",
    "arguments": {
          "projectId": "example",
          "functionName": "example",
          "params": {}
    }
  }
}