thincms_create_tool
Create a new ThinCMS tool with custom HTML/JS, optional authentication, system prompt, and AI model configuration.
Instructions
Create a new Tool. html is the raw HTML/JS payload that renders inside a sandboxed iframe with a window.thinCMS runtime injected. Set authRequired to 'password' | 'google' | 'either' to gate access; 'none' makes the tool public. Set systemPrompt to prepend a persona to /ai/chat calls. For large HTML payloads (>10KB), use htmlFile with a local file path.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| html | No | Raw HTML/JS payload | |
| name | Yes | Tool name (required) | |
| slug | No | URL slug (auto-generated from name if omitted) | |
| siteId | No | Override the active site for this single call. Pass to target a specific tenant without mutating shared active-site state — the right pattern when running concurrent agent sessions managing different tenants. Must match a siteId from your THINCMS_SITES config (use thincms_list_sites to inspect). When omitted, the call uses the active site set by thincms_switch_site. | |
| status | No | Publish status (default: draft) | |
| aiModel | No | Override site AI model for this tool (e.g. claude-sonnet-4-6) | |
| enabled | No | Enabled (default: true) | |
| htmlFile | No | Local file path containing the HTML payload — use instead of html for large tools | |
| rateLimit | No | AI chat calls per end-user per hour (omit or null for unlimited) | |
| allowSignup | No | Whether the login screen offers self-signup (default: true) | |
| description | No | Short description shown in admin UI | |
| authRequired | No | Auth mode (default: none) | |
| systemPrompt | No | Default system prompt prepended to ai/chat calls | |
| confirmProductionWrite | No | Acknowledge that this call may write to a configured production site (THINCMS_PRODUCTION_SITE_IDS env var). Required for any POST/PUT/PATCH/DELETE against a production-listed site; ignored otherwise. The error message lists which site triggered the requirement and recommends thincms_snapshot before any production write. |