Scripts & Bindings
The tSM SpEL binding layer connects your scripts to the outside world: from reacting to live platform events to calling one script from another, publishing scripts as HTTP endpoints, or exposing them as AI-callable tools via MCP.
Binding types at a glance
| Binding type | Trigger | Typical use-case | Page |
|---|---|---|---|
| Events | Internal lifecycle event (order created, ticket closed, timer fired …) | Automate business logic whenever something happens in the platform | Event Bindings |
| Script-to-script | @script.myPackage.myScript(params) | Re-use a SpEL script from inside another script | Script-to-Script |
| REST | POST /scripts/package/my-script | Expose a script to external systems over HTTP | REST Bindings |
| MCP | AI agent tool call via Model Context Protocol | Expose a script as an AI-callable tool with typed inputs & outputs | MCP Bindings |
Common concepts
paramsFormCode and resultFormCode
Every binding type benefits from the script's parameter and result forms. A tSM Form is simultaneously a JSON Schema (data model) and a UI definition, so a single artefact covers:
- Validation — parameters are checked against the schema before execution.
- Documentation — field labels, descriptions, and constraints serve as living API docs.
- UI / AI contract — the SpEL Console, BPMN modeler, REST consumers, and MCP agents all leverage the same schema.
Transactions
All bindings interact with the tSM transaction model. Understanding when your script runs inside vs. outside a database transaction is critical:
- Synchronous event bindings run inside the triggering transaction.
- Async event bindings run after the transaction commits (read-only snapshot).
- Script-to-script calls share the caller's transaction.
- REST bindings each get their own transaction.
- MCP bindings each get their own transaction.
For details, see SpEL and Transactions and the Transactions overview.
Pages in this section
📄️ SpEL Scripts
Developing SpEL scripts in the tSM SpEL Console — editing, debugging, input/output forms, stacktraces, Kibana, and spreadsheets.
📄️ Event Bindings
Bind SpEL scripts to platform lifecycle events — entity created, updated, deleted.
📄️ Script-to-Script Bindings
Call one SpEL script from another using the @script.… syntax.
📄️ REST Bindings
Publish SpEL scripts as REST endpoints for external system integration.
📄️ MCP Bindings (Model Context Protocol)
Expose SpEL scripts as AI-callable tools via the Model Context Protocol (MCP).