Actions Developer Guide

Input Payloads & Validation

How to define Action schemas, enforce constraints, and generate dynamic UI dropdowns.

Action Inputs

Actions often require parameters—such as an environment flag, a target hostname, or a specific database version. Rescile allows you to strictly define the required [[input]] schema directly within the action’s TOML file.

By declaring an input schema, Rescile automatically:

  1. Validates the JSON payload using jsonschema before the action even enters the queue.
  2. Generates the necessary User Interface (UI) form fields in the Managed Services Portal.
  3. Exposes the correct schema dynamically to AI Agents via the Model Context Protocol (MCP).

Basic Input Types

Inputs are declared as an array of [[input]] blocks.

name = "deploy_cache"

[[input]]
name = "dry_run"
description = "Simulate the deployment without making changes"
type = "boolean"
default = false

[[input]]
name = "cache_size_gb"
description = "Size of the cache volume in GB"
type = "number"
required = true

The supported type values are string, number, int, boolean, and bool.

You can constrain input to specific values to ensure users (or LLMs) don’t provide invalid parameters.

1. Static Enumerations (allowed_values)

If a parameter has a fixed set of acceptable values, provide an array of strings to allowed_values. The backend will enforce this constraint natively via the JSON Schema "enum" property, and the Frontend UI will automatically render a <select> dropdown.

[[input]]
name = "environment"
description = "Target deployment environment"
type = "string"
allowed_values = ["dev", "staging", "prod"]
default = "dev"
required = true

Instead of hardcoding values, you often want users to select from a list of resources that actually exist in your infrastructure right now.

You can use resource_link = "<resource_type>.<property>" to bind the input directly to your graph data.

[[input]]
name = "target_server"
description = "The server to apply the patch to"
type = "string"
resource_link = "linux_server.hostname"
required = true

How it works: When a user clicks “Run Action” in the UI, the portal parses the resource_link and fires a GraphQL query:

query { linux_server { hostname } }

It extracts the unique values and renders them as a dynamic dropdown. This guarantees the user selects a valid, active server.

Aliasing Support: If your module utilizes Resource Aliasing, the backend compiler resolves the aliases before serving the action to the UI. If "linux_server" is an alias for "aws_ec2_instance", the resource_link is safely translated in the background without breaking the UI query.

Accessing Inputs at Execution Time

When an action executes, the provided parameters are accessible within the runtime configuration blocks via the {{ input.<name> }} Tera template syntax.

[runtime]
engine = "nix"
exec = [
    ["sh", "-c", "echo Deploying to {{ input.environment }} on {{ input.target_server }}..."]
]