KosmoKrator

productivity

GitBook Lua API for KosmoKrator Agents

Agent-facing Lua documentation and function reference for the GitBook KosmoKrator integration.

Lua Namespace

Agents call this integration through app.integrations.gitbook.*. Use lua_read_doc("integrations.gitbook") 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 GitBook workflow without starting an interactive agent session.

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.gitbook.list_organizations({}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("gitbook"))' --json
kosmo integrations:lua --eval 'print(docs.read("gitbook.list_organizations"))' --json

Workflow file

Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.

workflow.lua
local gitbook = app.integrations.gitbook
local result = gitbook.list_organizations({})

dump(result)
Run the workflow
kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json
Namespace note. integrations:lua exposes app.integrations.gitbook, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.gitbook.default.* or app.integrations.gitbook.work.* when you configured named credential accounts.

MCP-only Lua

If the script only needs configured MCP servers and does not need GitBook, use the narrower mcp:lua command.

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.

GitBook

Namespace: gitbook

Use this integration to inspect GitBook organizations, spaces, current content, pages, files, search results, and OpenAPI references.

Authentication

GitBook requires api_token. Create a personal access token in GitBook developer settings. The integration sends it as a Bearer token.

Tools

  • gitbook_list_organizations, gitbook_get_organization, gitbook_search_organization
  • gitbook_list_spaces, gitbook_get_space, gitbook_search_space
  • gitbook_get_space_content, gitbook_list_pages, gitbook_get_page, gitbook_get_page_by_path
  • gitbook_list_files, gitbook_get_file
  • gitbook_list_openapi_specs

Return Notes

Responses keep GitBook’s upstream JSON shape. Use format = "markdown" when you need page content that is easier for agents to quote, summarize, or diff.

Examples

local orgs = tools.gitbook_list_organizations({})

local spaces = tools.gitbook_list_spaces({
  organization_id = "org_abc",
  limit = 20
})

local results = tools.gitbook_search_space({
  space_id = "space_abc",
  query = "authentication",
  limit = 10
})

local page = tools.gitbook_get_page_by_path({
  space_id = "space_abc",
  page_path = "developers/api",
  format = "markdown"
})
Raw agent markdown
# GitBook

Namespace: `gitbook`

Use this integration to inspect GitBook organizations, spaces, current content,
pages, files, search results, and OpenAPI references.

## Authentication

GitBook requires `api_token`. Create a personal access token in GitBook
developer settings. The integration sends it as a Bearer token.

## Tools

- `gitbook_list_organizations`, `gitbook_get_organization`,
  `gitbook_search_organization`
- `gitbook_list_spaces`, `gitbook_get_space`, `gitbook_search_space`
- `gitbook_get_space_content`, `gitbook_list_pages`, `gitbook_get_page`,
  `gitbook_get_page_by_path`
- `gitbook_list_files`, `gitbook_get_file`
- `gitbook_list_openapi_specs`

## Return Notes

Responses keep GitBook's upstream JSON shape. Use `format = "markdown"` when
you need page content that is easier for agents to quote, summarize, or diff.

## Examples

```lua
local orgs = tools.gitbook_list_organizations({})

local spaces = tools.gitbook_list_spaces({
  organization_id = "org_abc",
  limit = 20
})

local results = tools.gitbook_search_space({
  space_id = "space_abc",
  query = "authentication",
  limit = 10
})

local page = tools.gitbook_get_page_by_path({
  space_id = "space_abc",
  page_path = "developers/api",
  format = "markdown"
})
```
Metadata-derived Lua example
local result = app.integrations.gitbook.list_organizations({})
print(result)

Functions

list_organizations Read

List organizations visible to the token.

Lua path
app.integrations.gitbook.list_organizations
Full name
gitbook.gitbook_list_organizations
ParameterTypeRequiredDescription
No parameters.
get_organization Read

Get one GitBook organization.

Lua path
app.integrations.gitbook.get_organization
Full name
gitbook.gitbook_get_organization
ParameterTypeRequiredDescription
No parameters.
search_organization Read

Search across an organization.

Lua path
app.integrations.gitbook.search_organization
Full name
gitbook.gitbook_search_organization
ParameterTypeRequiredDescription
No parameters.
list_spaces Read

List spaces in an organization.

Lua path
app.integrations.gitbook.list_spaces
Full name
gitbook.gitbook_list_spaces
ParameterTypeRequiredDescription
No parameters.
get_space Read

Get one GitBook space.

Lua path
app.integrations.gitbook.get_space
Full name
gitbook.gitbook_get_space
ParameterTypeRequiredDescription
No parameters.
search_space Read

Search content in a GitBook space.

Lua path
app.integrations.gitbook.search_space
Full name
gitbook.gitbook_search_space
ParameterTypeRequiredDescription
No parameters.
get_space_content Read

Get the current content revision for a space.

Lua path
app.integrations.gitbook.get_space_content
Full name
gitbook.gitbook_get_space_content
ParameterTypeRequiredDescription
No parameters.
list_pages Read

List pages in a space content revision.

Lua path
app.integrations.gitbook.list_pages
Full name
gitbook.gitbook_list_pages
ParameterTypeRequiredDescription
No parameters.
get_page Read

Get one page by ID.

Lua path
app.integrations.gitbook.get_page
Full name
gitbook.gitbook_get_page
ParameterTypeRequiredDescription
No parameters.
get_page_by_path Read

Get one page by path.

Lua path
app.integrations.gitbook.get_page_by_path
Full name
gitbook.gitbook_get_page_by_path
ParameterTypeRequiredDescription
No parameters.
list_files Read

List files in a space.

Lua path
app.integrations.gitbook.list_files
Full name
gitbook.gitbook_list_files
ParameterTypeRequiredDescription
No parameters.
get_file Read

Get one file by ID.

Lua path
app.integrations.gitbook.get_file
Full name
gitbook.gitbook_get_file
ParameterTypeRequiredDescription
No parameters.
list_openapi_specs Read

List OpenAPI specs in a space.

Lua path
app.integrations.gitbook.list_openapi_specs
Full name
gitbook.gitbook_list_openapi_specs
ParameterTypeRequiredDescription
No parameters.