productivity
Discourse CLI for AI Agents
Use the Discourse CLI from KosmoKrator to call Discourse tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.Discourse CLI Setup
Discourse can be configured headlessly with `kosmokrator integrations:configure discourse`.
# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash
# Configure and verify this integration.
kosmokrator integrations:configure discourse --set api_key="$DISCOURSE_API_KEY" --set api_username="$DISCOURSE_API_USERNAME" --set hostname="$DISCOURSE_HOSTNAME" --enable --read allow --write ask --json
kosmokrator integrations:doctor discourse --json
kosmokrator integrations:status --json Credentials
Authentication type: API key api_key. Configure credentials once, then reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.
| Key | Env var | Type | Required | Label |
|---|---|---|---|---|
api_key | DISCOURSE_API_KEY | Secret secret | yes | API Key |
api_username | DISCOURSE_API_USERNAME | Text string | yes | API Username |
hostname | DISCOURSE_HOSTNAME | Text string | yes | Hostname |
Command Patterns
The generic command is stable across every integration. The provider shortcut is shorter for humans.
kosmo integrations:call discourse.discourse_list_topics '{"page":1}' --json kosmo integrations:discourse discourse_list_topics '{"page":1}' --json Discovery
These commands return structured output for coding agents that need to inspect capabilities before choosing a function.
kosmo integrations:docs discourse --json
kosmo integrations:docs discourse.discourse_list_topics --json
kosmo integrations:schema discourse.discourse_list_topics --json
kosmo integrations:search "Discourse" --json
kosmo integrations:list --json Automation Contexts
The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.
CLI Functions
Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.
discourse.discourse_list_topics
List the latest topics from the Discourse forum. Returns topic titles, categories, and activity metadata.
read - Parameters
- page
kosmo integrations:call discourse.discourse_list_topics '{"page":1}' --json kosmo integrations:discourse discourse_list_topics '{"page":1}' --json discourse.discourse_get_topic
Get a single Discourse topic by ID, including its posts, author, and metadata.
read - Parameters
- topic_id
kosmo integrations:call discourse.discourse_get_topic '{"topic_id":1}' --json kosmo integrations:discourse discourse_get_topic '{"topic_id":1}' --json discourse.discourse_create_topic
Create a new topic in a Discourse category. Requires a title, body content (Markdown), and category ID.
write - Parameters
- title, raw, category, tags
kosmo integrations:call discourse.discourse_create_topic '{"title":"example_title","raw":"example_raw","category":1,"tags":"example_tags"}' --json kosmo integrations:discourse discourse_create_topic '{"title":"example_title","raw":"example_raw","category":1,"tags":"example_tags"}' --json discourse.discourse_update_topic
Update an existing Discourse topic's title or move it to a different category.
write - Parameters
- topic_id, title, category
kosmo integrations:call discourse.discourse_update_topic '{"topic_id":1,"title":"example_title","category":1}' --json kosmo integrations:discourse discourse_update_topic '{"topic_id":1,"title":"example_title","category":1}' --json discourse.discourse_list_categories
List all categories on the Discourse forum. Returns category names, IDs, descriptions, and parent relationships.
read - Parameters
- none
kosmo integrations:call discourse.discourse_list_categories '{}' --json kosmo integrations:discourse discourse_list_categories '{}' --json discourse.discourse_get_category
Get a single Discourse category by ID, including its recent topics and metadata.
read - Parameters
- category_id
kosmo integrations:call discourse.discourse_get_category '{"category_id":1}' --json kosmo integrations:discourse discourse_get_category '{"category_id":1}' --json discourse.discourse_create_post
Reply to an existing Discourse topic with a new post. Provide the topic ID and body content in Markdown.
write - Parameters
- topic_id, raw
kosmo integrations:call discourse.discourse_create_post '{"topic_id":1,"raw":"example_raw"}' --json kosmo integrations:discourse discourse_create_post '{"topic_id":1,"raw":"example_raw"}' --json discourse.discourse_get_current_user
Get the currently authenticated Discourse user profile. Useful for verifying API credentials and identifying the user context.
read - Parameters
- none
kosmo integrations:call discourse.discourse_get_current_user '{}' --json kosmo integrations:discourse discourse_get_current_user '{}' --json Function Schemas
Use these parameter tables when building CLI payloads without calling integrations:schema first.
discourse.discourse_list_topics 1 parameters
kosmo integrations:schema discourse.discourse_list_topics --json | Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number for pagination (default: 1). |
discourse.discourse_get_topic 1 parameters
kosmo integrations:schema discourse.discourse_get_topic --json | Parameter | Type | Required | Description |
|---|---|---|---|
topic_id | integer | yes | The ID of the topic to retrieve. |
discourse.discourse_create_topic 4 parameters
kosmo integrations:schema discourse.discourse_create_topic --json | Parameter | Type | Required | Description |
|---|---|---|---|
title | string | yes | The topic title. |
raw | string | yes | The body content in Markdown format. |
category | integer | yes | The category ID to post the topic in. |
tags | array | no | Optional tags for the topic (strings). |
discourse.discourse_update_topic 3 parameters
kosmo integrations:schema discourse.discourse_update_topic --json | Parameter | Type | Required | Description |
|---|---|---|---|
topic_id | integer | yes | The ID of the topic to update. |
title | string | no | The new title for the topic (optional). |
category | integer | no | The new category ID to move the topic to (optional). |
discourse.discourse_list_categories 0 parameters
kosmo integrations:schema discourse.discourse_list_categories --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
discourse.discourse_get_category 1 parameters
kosmo integrations:schema discourse.discourse_get_category --json | Parameter | Type | Required | Description |
|---|---|---|---|
category_id | integer | yes | The ID of the category to retrieve. |
discourse.discourse_create_post 2 parameters
kosmo integrations:schema discourse.discourse_create_post --json | Parameter | Type | Required | Description |
|---|---|---|---|
topic_id | integer | yes | The ID of the topic to reply to. |
raw | string | yes | The post body content in Markdown format. |
discourse.discourse_get_current_user 0 parameters
kosmo integrations:schema discourse.discourse_get_current_user --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
Permissions
Headless calls still follow the integration read/write permission policy. Configure read/write defaults with
integrations:configure. Add --force only for trusted automation that should bypass that policy.