data
Prismic Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the Prismic KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.prismic.*.
Use lua_read_doc("integrations.prismic") inside KosmoKrator to discover the same reference at runtime.
Call Lua from the Headless CLI
Use kosmo integrations:lua when a shell script, CI job, cron job, or another coding CLI should run a deterministic
Prismic workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.prismic.list_documents({q = "example_q", pageSize = 1, page = 1, orderings = "example_orderings", lang = "example_lang", ref = "example_ref"}))' --json kosmo integrations:lua --eval 'print(docs.read("prismic"))' --json
kosmo integrations:lua --eval 'print(docs.read("prismic.list_documents"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local prismic = app.integrations.prismic
local result = prismic.list_documents({q = "example_q", pageSize = 1, page = 1, orderings = "example_orderings", lang = "example_lang", ref = "example_ref"})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.prismic, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.prismic.default.* or app.integrations.prismic.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need Prismic, use the narrower mcp:lua command.
# Use mcp:lua for MCP-only scripts; use integrations:lua for this integration namespace.
kosmo mcp:lua --eval 'dump(mcp.servers())' --json Agent-Facing Lua Docs
This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.
Prismic — Lua API Reference
list_documents
Search and list documents from the Prismic repository. Supports filtering with Prismic query predicates, pagination, ordering, and language selection.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
q | string | no | Prismic query predicate(s), e.g. [[:d = at(document.type, "blog_post")]] |
pageSize | integer | no | Number of documents per page (default: 20, max: 100) |
page | integer | no | Page number for pagination (default: 1) |
orderings | string | no | Ordering rules, e.g. [my.blog_post.date desc] |
lang | string | no | Language code to filter results (e.g., "en-us", "fr-fr"). Use "*" for all languages |
ref | string | no | The ref (release/draft) ID to query. Defaults to the master ref |
Query Predicates
Prismic queries use predicate syntax enclosed in [[ ]]. Multiple predicates can be combined:
| Predicate | Description |
|---|---|
at(path, value) | Exact match |
not(path, value) | Not equal |
any(path, values) | Match any value in array |
in(path, values) | Match any value in array (for document tags) |
fulltext(path, value) | Full-text search |
has(path) | Field has a value |
missing(path) | Field is empty |
similar(document_id, max_results) | Find similar documents |
Common paths: document.type, document.tags, document.id, my.{type}.{field}.
Example
local result = app.integrations.prismic.list_documents({
q = '[[:d = at(document.type, "blog_post")]]',
pageSize = 10,
page = 1,
orderings = '[my.blog_post.date desc]',
lang = 'en-us'
})
for _, doc in ipairs(result.results) do
print(doc.id, doc.type, doc.slugs[1])
end
get_document
Retrieve a single document from the Prismic repository by its unique document ID.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | yes | The unique document ID (e.g., "YjRHVhAAACEAnFqZ") |
ref | string | no | The ref (release/draft) ID to query. Defaults to the master ref |
lang | string | no | Language code to retrieve a specific translation |
Example
local doc = app.integrations.prismic.get_document({
id = 'YjRHVhAAACEAnFqZ'
})
print(doc.type, doc.data.title[1].text)
list_types
List all custom types defined in the Prismic repository. Returns type IDs and names that can be used for document queries.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Maximum number of types to return (default: 100) |
page | integer | no | Page number for pagination (default: 1) |
Example
local result = app.integrations.prismic.list_types({
limit = 50
})
for _, t in ipairs(result.types or {}) do
print(t.id, t.name)
end
get_tags
List all tags defined in the Prismic repository. Tags can be used to filter documents in search queries.
Parameters
This tool takes no parameters.
Example
local result = app.integrations.prismic.get_tags({})
for _, tag in ipairs(result.tags or {}) do
print(tag)
end
list_refs
List all refs (releases and drafts) for the Prismic repository. The master ref points to published content; other refs point to drafts or releases in progress.
Parameters
This tool takes no parameters.
Example
local result = app.integrations.prismic.list_refs({})
for _, ref in ipairs(result.refs or {}) do
print(ref.id, ref.ref, ref.label, ref.isMasterRef)
end
list_languages
List all languages configured in the Prismic repository. Returns language codes and names for querying content in specific locales.
Parameters
This tool takes no parameters.
Example
local result = app.integrations.prismic.list_languages({})
for _, lang in ipairs(result.languages or {}) do
print(lang.id, lang.name)
end
get_current_user
Verify the Prismic API connection is working by performing a minimal document search. Returns connection status and repository information.
Parameters
This tool takes no parameters.
Example
local result = app.integrations.prismic.get_current_user({})
print(result.status, result.total_results_size, result.message)Raw agent markdown
# Prismic — Lua API Reference
## list_documents
Search and list documents from the Prismic repository. Supports filtering with Prismic query predicates, pagination, ordering, and language selection.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `q` | string | no | Prismic query predicate(s), e.g. `[[:d = at(document.type, "blog_post")]]` |
| `pageSize` | integer | no | Number of documents per page (default: 20, max: 100) |
| `page` | integer | no | Page number for pagination (default: 1) |
| `orderings` | string | no | Ordering rules, e.g. `[my.blog_post.date desc]` |
| `lang` | string | no | Language code to filter results (e.g., `"en-us"`, `"fr-fr"`). Use `"*"` for all languages |
| `ref` | string | no | The ref (release/draft) ID to query. Defaults to the master ref |
### Query Predicates
Prismic queries use predicate syntax enclosed in `[[ ]]`. Multiple predicates can be combined:
| Predicate | Description |
|-----------|-------------|
| `at(path, value)` | Exact match |
| `not(path, value)` | Not equal |
| `any(path, values)` | Match any value in array |
| `in(path, values)` | Match any value in array (for document tags) |
| `fulltext(path, value)` | Full-text search |
| `has(path)` | Field has a value |
| `missing(path)` | Field is empty |
| `similar(document_id, max_results)` | Find similar documents |
Common paths: `document.type`, `document.tags`, `document.id`, `my.{type}.{field}`.
### Example
```lua
local result = app.integrations.prismic.list_documents({
q = '[[:d = at(document.type, "blog_post")]]',
pageSize = 10,
page = 1,
orderings = '[my.blog_post.date desc]',
lang = 'en-us'
})
for _, doc in ipairs(result.results) do
print(doc.id, doc.type, doc.slugs[1])
end
```
---
## get_document
Retrieve a single document from the Prismic repository by its unique document ID.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | string | yes | The unique document ID (e.g., `"YjRHVhAAACEAnFqZ"`) |
| `ref` | string | no | The ref (release/draft) ID to query. Defaults to the master ref |
| `lang` | string | no | Language code to retrieve a specific translation |
### Example
```lua
local doc = app.integrations.prismic.get_document({
id = 'YjRHVhAAACEAnFqZ'
})
print(doc.type, doc.data.title[1].text)
```
---
## list_types
List all custom types defined in the Prismic repository. Returns type IDs and names that can be used for document queries.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Maximum number of types to return (default: 100) |
| `page` | integer | no | Page number for pagination (default: 1) |
### Example
```lua
local result = app.integrations.prismic.list_types({
limit = 50
})
for _, t in ipairs(result.types or {}) do
print(t.id, t.name)
end
```
---
## get_tags
List all tags defined in the Prismic repository. Tags can be used to filter documents in search queries.
### Parameters
This tool takes no parameters.
### Example
```lua
local result = app.integrations.prismic.get_tags({})
for _, tag in ipairs(result.tags or {}) do
print(tag)
end
```
---
## list_refs
List all refs (releases and drafts) for the Prismic repository. The master ref points to published content; other refs point to drafts or releases in progress.
### Parameters
This tool takes no parameters.
### Example
```lua
local result = app.integrations.prismic.list_refs({})
for _, ref in ipairs(result.refs or {}) do
print(ref.id, ref.ref, ref.label, ref.isMasterRef)
end
```
---
## list_languages
List all languages configured in the Prismic repository. Returns language codes and names for querying content in specific locales.
### Parameters
This tool takes no parameters.
### Example
```lua
local result = app.integrations.prismic.list_languages({})
for _, lang in ipairs(result.languages or {}) do
print(lang.id, lang.name)
end
```
---
## get_current_user
Verify the Prismic API connection is working by performing a minimal document search. Returns connection status and repository information.
### Parameters
This tool takes no parameters.
### Example
```lua
local result = app.integrations.prismic.get_current_user({})
print(result.status, result.total_results_size, result.message)
``` local result = app.integrations.prismic.list_documents({q = "example_q", pageSize = 1, page = 1, orderings = "example_orderings", lang = "example_lang", ref = "example_ref"})
print(result) Functions
list_documents Read
Search and list documents from the Prismic repository. Supports filtering with Prismic query predicates, pagination, ordering, and language selection.
- Lua path
app.integrations.prismic.list_documents- Full name
prismic.prismic_list_documents
| Parameter | Type | Required | Description |
|---|---|---|---|
q | string | no | Prismic query predicate(s), e.g. '[[:d = at(document.type, "blog_post")]]'. Multiple predicates can be combined. |
pageSize | integer | no | Number of documents per page (default: 20, max: 100). |
page | integer | no | Page number for pagination (default: 1). |
orderings | string | no | Ordering rules, e.g. "[my.blog_post.date desc]". |
lang | string | no | Language code to filter results (e.g., "en-us", "fr-fr"). Use "*" for all languages. |
ref | string | no | The ref (release/draft) ID to query. Defaults to the master ref. |
get_document Read
Retrieve a single document from the Prismic repository by its unique document ID.
- Lua path
app.integrations.prismic.get_document- Full name
prismic.prismic_get_document
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | yes | The unique document ID (e.g., "YjRHVhAAACEAnFqZ"). |
ref | string | no | The ref (release/draft) ID to query. Defaults to the master ref. |
lang | string | no | Language code to retrieve a specific translation (e.g., "en-us", "fr-fr"). |
list_types Read
List all custom types defined in the Prismic repository. Returns type IDs and names that can be used for document queries.
- Lua path
app.integrations.prismic.list_types- Full name
prismic.prismic_list_types
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Maximum number of types to return (default: 100). |
page | integer | no | Page number for pagination (default: 1). |
get_tags Read
List all tags defined in the Prismic repository. Tags can be used to filter documents in search queries.
- Lua path
app.integrations.prismic.get_tags- Full name
prismic.prismic_get_tags
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
list_refs Read
List all refs (releases and drafts) for the Prismic repository. The master ref points to the published content; other refs point to drafts or releases in progress.
- Lua path
app.integrations.prismic.list_refs- Full name
prismic.prismic_list_refs
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
list_languages Read
List all languages configured in the Prismic repository. Returns language codes and names that can be used for querying content in specific locales.
- Lua path
app.integrations.prismic.list_languages- Full name
prismic.prismic_list_languages
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
health_check Read
Verify the Prismic API connection is working by performing a minimal document search. Returns connection status and repository information.
- Lua path
app.integrations.prismic.health_check- Full name
prismic.prismic_get_current_user
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||