Compile-time macros of a prompt module (use OzMcp.Config.Prompt).
use OzMcp.Config.Prompt imports the root macro prompt/2 only.
The nested macros are not imported: they work only inside their
prompt block. A nested macro at the root of the module gives a
compile error (undefined function argument/2).
The macros generate list/0 of the prompt behaviour.
The module must define get/2. A module with the DSL cannot define
list/0.
The macros
| Macro | Block | Value | Wire field |
|---|---|---|---|
prompt "name" | root | non-empty string, unique in the module | name |
title | prompt | non-empty string | title |
description | prompt | non-empty string | description |
required_scopes | prompt | list of scope tokens | none (a 403 and a filtered prompts/list) |
argument "name" | prompt (repeatable) | name: non-empty string, unique in the prompt | one entry of arguments |
argument "name", opts | prompt (repeatable) | title: and description: are non-empty strings, required: is a boolean | arguments[].title, .description, .required |
icon | prompt (repeatable) | block | one entry of icons |
src | icon | https: URL, http: URL of a loopback host, or data: URI | icons[].src |
mime_type | icon | non-empty string | icons[].mimeType |
sizes | icon | list of "any" and "WxH" strings | icons[].sizes |
theme | icon | "light" or "dark" | icons[].theme |
meta key, value | prompt | key: string or atom, value: a JSON term | _meta.<key> |
The framework sends required on the wire only when it is true.
An option that is not title, description or required raises at
compile time. A wrong value, a macro outside its block, or a
property declared two times raises at compile time too. With
warn?: true (the default), a prompt with no title or no
description gives a compiler warning.
The guide Prompts shows an example of the DSL.