KosmoKrator

communication

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.

8 functions 5 read 3 write API key auth

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 use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

KeyEnv varTypeRequiredLabel
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

Call Discourse Headlessly

Use the generic call form when another coding CLI or script needs a stable universal interface.

kosmo integrations:call discourse.discourse_list_topics '{
  "page": 1
}' --json

Use the provider shortcut form for shorter human-facing commands.

kosmo integrations:discourse discourse_list_topics '{
  "page": 1
}' --json

Agent Discovery Commands

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

All CLI Functions

Every function below can be called headlessly. The generic form is stable across all integrations; the provider shortcut is shorter but specific to Discourse.

discourse.discourse_list_topics

Read read

List the latest topics from the Discourse forum. Returns topic titles, categories, and activity metadata.

Parameters
page

Generic CLI call

kosmo integrations:call discourse.discourse_list_topics '{"page":1}' --json

Provider shortcut

kosmo integrations:discourse discourse_list_topics '{"page":1}' --json

discourse.discourse_get_topic

Read read

Get a single Discourse topic by ID, including its posts, author, and metadata.

Parameters
topic_id

Generic CLI call

kosmo integrations:call discourse.discourse_get_topic '{"topic_id":1}' --json

Provider shortcut

kosmo integrations:discourse discourse_get_topic '{"topic_id":1}' --json

discourse.discourse_create_topic

Write write

Create a new topic in a Discourse category. Requires a title, body content (Markdown), and category ID.

Parameters
title, raw, category, tags

Generic CLI call

kosmo integrations:call discourse.discourse_create_topic '{"title":"example_title","raw":"example_raw","category":1,"tags":"example_tags"}' --json

Provider shortcut

kosmo integrations:discourse discourse_create_topic '{"title":"example_title","raw":"example_raw","category":1,"tags":"example_tags"}' --json

discourse.discourse_update_topic

Write write

Update an existing Discourse topic's title or move it to a different category.

Parameters
topic_id, title, category

Generic CLI call

kosmo integrations:call discourse.discourse_update_topic '{"topic_id":1,"title":"example_title","category":1}' --json

Provider shortcut

kosmo integrations:discourse discourse_update_topic '{"topic_id":1,"title":"example_title","category":1}' --json

discourse.discourse_list_categories

Read read

List all categories on the Discourse forum. Returns category names, IDs, descriptions, and parent relationships.

Parameters
none

Generic CLI call

kosmo integrations:call discourse.discourse_list_categories '{}' --json

Provider shortcut

kosmo integrations:discourse discourse_list_categories '{}' --json

discourse.discourse_get_category

Read read

Get a single Discourse category by ID, including its recent topics and metadata.

Parameters
category_id

Generic CLI call

kosmo integrations:call discourse.discourse_get_category '{"category_id":1}' --json

Provider shortcut

kosmo integrations:discourse discourse_get_category '{"category_id":1}' --json

discourse.discourse_create_post

Write write

Reply to an existing Discourse topic with a new post. Provide the topic ID and body content in Markdown.

Parameters
topic_id, raw

Generic CLI call

kosmo integrations:call discourse.discourse_create_post '{"topic_id":1,"raw":"example_raw"}' --json

Provider shortcut

kosmo integrations:discourse discourse_create_post '{"topic_id":1,"raw":"example_raw"}' --json

discourse.discourse_get_current_user

Read read

Get the currently authenticated Discourse user profile. Useful for verifying API credentials and identifying the user context.

Parameters
none

Generic CLI call

kosmo integrations:call discourse.discourse_get_current_user '{}' --json

Provider shortcut

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

List the latest topics from the Discourse forum. Returns topic titles, categories, and activity metadata.

Operation
Read read
Schema command
kosmo integrations:schema discourse.discourse_list_topics --json
ParameterTypeRequiredDescription
page integer no Page number for pagination (default: 1).

discourse.discourse_get_topic

Get a single Discourse topic by ID, including its posts, author, and metadata.

Operation
Read read
Schema command
kosmo integrations:schema discourse.discourse_get_topic --json
ParameterTypeRequiredDescription
topic_id integer yes The ID of the topic to retrieve.

discourse.discourse_create_topic

Create a new topic in a Discourse category. Requires a title, body content (Markdown), and category ID.

Operation
Write write
Schema command
kosmo integrations:schema discourse.discourse_create_topic --json
ParameterTypeRequiredDescription
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

Update an existing Discourse topic's title or move it to a different category.

Operation
Write write
Schema command
kosmo integrations:schema discourse.discourse_update_topic --json
ParameterTypeRequiredDescription
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

List all categories on the Discourse forum. Returns category names, IDs, descriptions, and parent relationships.

Operation
Read read
Schema command
kosmo integrations:schema discourse.discourse_list_categories --json
ParameterTypeRequiredDescription
No parameters.

discourse.discourse_get_category

Get a single Discourse category by ID, including its recent topics and metadata.

Operation
Read read
Schema command
kosmo integrations:schema discourse.discourse_get_category --json
ParameterTypeRequiredDescription
category_id integer yes The ID of the category to retrieve.

discourse.discourse_create_post

Reply to an existing Discourse topic with a new post. Provide the topic ID and body content in Markdown.

Operation
Write write
Schema command
kosmo integrations:schema discourse.discourse_create_post --json
ParameterTypeRequiredDescription
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

Get the currently authenticated Discourse user profile. Useful for verifying API credentials and identifying the user context.

Operation
Read read
Schema command
kosmo integrations:schema discourse.discourse_get_current_user --json
ParameterTypeRequiredDescription
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.