fn org_get()
Get the caller's organization (id/name/state/domain). Read-only.
fn project_list()
List projects (factory: one `project` per project). Read-only.
fn app_list(projectId: string)
List applications in a project with their OIDC/API config (no secrets). Read-only.
| Argument | Type | Required | Description |
|---|
| projectId | string | yes | Project id to list applications for |
fn app_get(projectId: string, appId: string)
Get one application's full config (no secret). Read-only.
| Argument | Type | Required | Description |
|---|
| projectId | string | yes | |
| appId | string | yes | |
fn oidc_app_redirect_set(projectId: string, appId: string)
Add and/or remove redirect URIs on an OIDC app's allowlist via read-modify-
| Argument | Type | Required | Description |
|---|
| projectId | string | yes | Project id (from app_list / project_list) |
| appId | string | yes | Application id (from app_list) |
fn user_list(type?: enum)
List users, optionally filtered by type (factory: one `user` each). Read-only.
| Argument | Type | Required | Description |
|---|
| type? | enum | no | Filter by user type |
fn manager_audit()
List org managers (members) and their roles: who can administer this org. Read-only.
fn project_ensure(name: string)
Find-or-create a project by name. Idempotent.
| Argument | Type | Required | Description |
|---|
| name | string | yes | Project name (find-or-create by exact name) |
fn oidc_app_ensure(project: string, name: string, appType?: enum, authMethod?: enum, accessTokenType?: enum, devMode?: boolean)
Ensure an OIDC application: find-or-create by name within the project
| Argument | Type | Required | Description |
|---|
| project | string | yes | Project name (created if absent) or project id |
| name | string | yes | Application name (find-or-create within the project) |
| appType? | enum | no | |
| authMethod? | enum | no | OIDC client auth method. Use `none` for public PKCE (SPA/native). |
| accessTokenType? | enum | no | |
| devMode? | boolean | no | Relax redirect-URI checks (non-https/localhost). Test only. |
fn api_app_ensure(project: string, name: string, authMethod?: enum)
Find-or-create an API application (resource server / M2M) by name
| Argument | Type | Required | Description |
|---|
| project | string | yes | |
| name | string | yes | |
| authMethod? | enum | no | |
fn app_secret_rotate(projectId: string, appId: string, kind?: enum)
Regenerate an application's client secret. Reads the app first and
| Argument | Type | Required | Description |
|---|
| projectId | string | yes | |
| appId | string | yes | |
| kind? | enum | no | Optional check: the method refuses if the app is not of this kind |
fn machine_user_ensure(username: string, name: string, description?: string, accessTokenType?: enum)
Find-or-create a machine (service) user by username. Idempotent.
| Argument | Type | Required | Description |
|---|
| username | string | yes | Login name (find-or-create) |
| name | string | yes | Display name |
| description? | string | no | |
| accessTokenType? | enum | no | |
fn pat_create(user: string, expirationDate?: string)
Add a personal access token to a machine user. Returns the token once.
| Argument | Type | Required | Description |
|---|
| user | string | yes | Machine user id or username |
| expirationDate? | string | no | RFC3339 expiry, e.g. 2027-01-01T00:00:00Z (omit for none) |
fn pat_revoke(user: string, tokenId: string)
Revoke a PAT. Verify-first: confirms the tokenId belongs to the user before deleting.
| Argument | Type | Required | Description |
|---|
| user | string | yes | Machine user id or username |
| tokenId | string | yes | PAT id to revoke (verified to belong to the user first) |
fn machine_key_create(user: string, expirationDate?: string)
Add a JSON private key to a machine user. Returns the downloadable key JSON once.
| Argument | Type | Required | Description |
|---|
| user | string | yes | Machine user id or username |
| expirationDate? | string | no | |
fn machine_secret_generate(user: string)
Generate (rotate) a machine user's client secret. Returns the secret once.
| Argument | Type | Required | Description |
|---|
| user | string | yes | Machine user id or username |
fn app_set_state(projectId: string, appId: string, state: enum)
Deactivate or reactivate an application (reversible; verify-first; idempotent). No hard delete.
| Argument | Type | Required | Description |
|---|
| projectId | string | yes | |
| appId | string | yes | |
| state | enum | yes | |
fn user_set_state(userId: string, state: enum)
Deactivate or reactivate a user (reversible; verify-first; idempotent).
| Argument | Type | Required | Description |
|---|
| userId | string | yes | |
| state | enum | yes | |
fn role_list(projectId: string)
List a project's roles (factory: one `role` each). Read-only.
| Argument | Type | Required | Description |
|---|
| projectId | string | yes | Project id to list roles for |
fn role_ensure(project: string, key: string, displayName?: string, group?: string)
Find-or-create a project role by key; converge displayName/group. Idempotent.
| Argument | Type | Required | Description |
|---|
| project | string | yes | Project name (created if absent) or project id |
| key | string | yes | Role key (stable identifier; find-or-create) |
| displayName? | string | no | Human-readable role name |
| group? | string | no | Optional grouping label for the role |
fn role_remove(projectId: string, key: string)
Remove a project role (verify-first DELETE). Roles have no deactivate
| Argument | Type | Required | Description |
|---|
| projectId | string | yes | |
| key | string | yes | Role key to remove (verified to exist first) |
fn grant_list(user?: string, projectId?: string)
List user grants (which roles users hold on which projects), optionally
| Argument | Type | Required | Description |
|---|
| user? | string | no | Filter by user id or login name (omit for all users) |
| projectId? | string | no | Filter by project id (omit for all projects) |
fn grant_ensure(user: string, project: string)
Grant a user a set of roles on a project (find-or-create by user+project;
| Argument | Type | Required | Description |
|---|
| user | string | yes | User id or login name (e.g. alice@example.com) to grant roles to |
| project | string | yes | Project name or project id (the project must exist) |
fn grant_set_state(user: string, grantId: string, state: enum)
Deactivate or reactivate a user grant (reversible; verify-first; idempotent). No hard delete.
| Argument | Type | Required | Description |
|---|
| user | string | yes | User id or login name the grant belongs to |
| grantId | string | yes | Grant id (verified to belong to the user first) |
| state | enum | yes | |
fn project_authz_set(project: string, roleAssertion?: boolean, roleCheck?: boolean, hasProjectCheck?: boolean)
Set the authorization flags on an existing project (roleAssertion /
| Argument | Type | Required | Description |
|---|
| project | string | yes | Project name or project id |
| roleAssertion? | boolean | no | Assert project roles into tokens/userinfo (the flag that surfaces grants) |
| roleCheck? | boolean | no | Require a project role to authenticate |
| hasProjectCheck? | boolean | no | Require the user's org to have the project granted |
Resources
org(infinite)— An organization record
project(infinite)— A project record / ensure result
app(infinite)— An application record (config only; never a secret)
oidc-redirect-result(infinite)— Result of an oidc_app_redirect_set change
app-credential(infinite)— Result of creating/rotating an app (clientId + clientSecret once)
user(infinite)— A user record / ensure result
machine-credential(infinite)— Result of minting a machine credential (PAT / key / secret); secret once
manager(infinite)— An org manager (member) and their roles
role(infinite)— A project role (key/displayName/group)
grant(infinite)— A user grant: which roles a user holds on a project
state-result(infinite)— Result of a reversible deactivate/reactivate