data
Mastodon CLI for AI Agents
Use the Mastodon CLI from KosmoKrator to call Mastodon tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.Mastodon CLI Setup
Mastodon can be configured headlessly with `kosmokrator integrations:configure mastodon`.
# 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 mastodon --set access_token="$MASTODON_ACCESS_TOKEN" --enable --read allow --write ask --json
kosmokrator integrations:doctor mastodon --json
kosmokrator integrations:status --json Credentials
Authentication type: Bearer token bearer_token. Configure credentials once, then reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.
| Key | Env var | Type | Required | Label |
|---|---|---|---|---|
access_token | MASTODON_ACCESS_TOKEN | Secret secret | yes | Access Token |
instance_url | MASTODON_INSTANCE_URL | URL url | no | Instance URL |
Command Patterns
The generic command is stable across every integration. The provider shortcut is shorter for humans.
kosmo integrations:call mastodon.mastodon_list_statuses '{"timeline":"example_timeline","limit":1,"max_id":"example_max_id","since_id":"example_since_id"}' --json kosmo integrations:mastodon mastodon_list_statuses '{"timeline":"example_timeline","limit":1,"max_id":"example_max_id","since_id":"example_since_id"}' --json Discovery
These commands return structured output for coding agents that need to inspect capabilities before choosing a function.
kosmo integrations:docs mastodon --json
kosmo integrations:docs mastodon.mastodon_list_statuses --json
kosmo integrations:schema mastodon.mastodon_list_statuses --json
kosmo integrations:search "Mastodon" --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.
mastodon.mastodon_list_statuses
Browse statuses (toots) from a Mastodon timeline. Use "home" for your home feed, "public" for the federated timeline, or "local" for the local instance timeline. Supports pagination.
read - Parameters
- timeline, limit, max_id, since_id
kosmo integrations:call mastodon.mastodon_list_statuses '{"timeline":"example_timeline","limit":1,"max_id":"example_max_id","since_id":"example_since_id"}' --json kosmo integrations:mastodon mastodon_list_statuses '{"timeline":"example_timeline","limit":1,"max_id":"example_max_id","since_id":"example_since_id"}' --json mastodon.mastodon_get_status
Retrieve a single Mastodon status (toot) by its ID. Returns the full post content, author details, and engagement metrics.
read - Parameters
- id
kosmo integrations:call mastodon.mastodon_get_status '{"id":"example_id"}' --json kosmo integrations:mastodon mastodon_get_status '{"id":"example_id"}' --json mastodon.mastodon_create_status
Publish a new status (toot) on Mastodon. Supports content warnings, visibility controls (public, unlisted, private, direct), replies, and language settings.
write - Parameters
- status, visibility, in_reply_to_id, spoiler_text, sensitive, language
kosmo integrations:call mastodon.mastodon_create_status '{"status":"example_status","visibility":"example_visibility","in_reply_to_id":"example_in_reply_to_id","spoiler_text":"example_spoiler_text","sensitive":true,"language":"example_language"}' --json kosmo integrations:mastodon mastodon_create_status '{"status":"example_status","visibility":"example_visibility","in_reply_to_id":"example_in_reply_to_id","spoiler_text":"example_spoiler_text","sensitive":true,"language":"example_language"}' --json mastodon.mastodon_list_accounts
List followers of a Mastodon account. Returns account profiles with display names, bios, and follower counts. Supports pagination.
read - Parameters
- id, limit, max_id
kosmo integrations:call mastodon.mastodon_list_accounts '{"id":"example_id","limit":1,"max_id":"example_max_id"}' --json kosmo integrations:mastodon mastodon_list_accounts '{"id":"example_id","limit":1,"max_id":"example_max_id"}' --json mastodon.mastodon_get_account
Retrieve a Mastodon account profile by ID. Returns display name, bio, follower counts, and other profile details.
read - Parameters
- id
kosmo integrations:call mastodon.mastodon_get_account '{"id":"example_id"}' --json kosmo integrations:mastodon mastodon_get_account '{"id":"example_id"}' --json mastodon.mastodon_get_current_user
Get the authenticated user's Mastodon profile. Returns display name, bio, follower/following counts, and other account details.
read - Parameters
- none
kosmo integrations:call mastodon.mastodon_get_current_user '{}' --json kosmo integrations:mastodon mastodon_get_current_user '{}' --json mastodon.mastodon_api_get
Call any Mastodon GET API endpoint relative to the configured instance, such as /api/v1/notifications.
read - Parameters
- path, params
kosmo integrations:call mastodon.mastodon_api_get '{"path":"example_path","params":"example_params"}' --json kosmo integrations:mastodon mastodon_api_get '{"path":"example_path","params":"example_params"}' --json mastodon.mastodon_api_post
Call any Mastodon POST API endpoint relative to the configured instance.
write - Parameters
- path, body
kosmo integrations:call mastodon.mastodon_api_post '{"path":"example_path","body":"example_body"}' --json kosmo integrations:mastodon mastodon_api_post '{"path":"example_path","body":"example_body"}' --json mastodon.mastodon_api_put
Call any Mastodon PUT API endpoint relative to the configured instance.
write - Parameters
- path, body
kosmo integrations:call mastodon.mastodon_api_put '{"path":"example_path","body":"example_body"}' --json kosmo integrations:mastodon mastodon_api_put '{"path":"example_path","body":"example_body"}' --json mastodon.mastodon_api_delete
Call any Mastodon DELETE API endpoint relative to the configured instance.
write - Parameters
- path, body
kosmo integrations:call mastodon.mastodon_api_delete '{"path":"example_path","body":"example_body"}' --json kosmo integrations:mastodon mastodon_api_delete '{"path":"example_path","body":"example_body"}' --json Function Schemas
Use these parameter tables when building CLI payloads without calling integrations:schema first.
mastodon.mastodon_list_statuses 4 parameters
kosmo integrations:schema mastodon.mastodon_list_statuses --json | Parameter | Type | Required | Description |
|---|---|---|---|
timeline | string | no | Timeline to retrieve: "home" (default), "local", or "public". |
limit | integer | no | Maximum number of statuses to return (1–40, default: 20). |
max_id | string | no | Return results older than this status ID (for pagination). |
since_id | string | no | Return results newer than this status ID (for pagination). |
mastodon.mastodon_get_status 1 parameters
kosmo integrations:schema mastodon.mastodon_get_status --json | Parameter | Type | Required | Description |
|---|---|---|---|
id | string | yes | The ID of the status to retrieve. |
mastodon.mastodon_create_status 6 parameters
kosmo integrations:schema mastodon.mastodon_create_status --json | Parameter | Type | Required | Description |
|---|---|---|---|
status | string | yes | The text content of the status. |
visibility | string | no | Visibility: "public" (default), "unlisted", "private", or "direct". |
in_reply_to_id | string | no | ID of the status to reply to. |
spoiler_text | string | no | Content warning text (marks the status as sensitive). |
sensitive | boolean | no | Whether the status contains sensitive media. |
language | string | no | ISO 639-1 language code (e.g., "en", "nl", "fr"). |
mastodon.mastodon_list_accounts 3 parameters
kosmo integrations:schema mastodon.mastodon_list_accounts --json | Parameter | Type | Required | Description |
|---|---|---|---|
id | string | yes | The account ID whose followers to list. |
limit | integer | no | Maximum number of accounts to return (1–80, default: 40). |
max_id | string | no | Return results older than this account ID (for pagination). |
mastodon.mastodon_get_account 1 parameters
kosmo integrations:schema mastodon.mastodon_get_account --json | Parameter | Type | Required | Description |
|---|---|---|---|
id | string | yes | The account ID to retrieve. |
mastodon.mastodon_get_current_user 0 parameters
kosmo integrations:schema mastodon.mastodon_get_current_user --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
mastodon.mastodon_api_get 2 parameters
kosmo integrations:schema mastodon.mastodon_api_get --json | Parameter | Type | Required | Description |
|---|---|---|---|
path | string | yes | API path beginning with /api/. |
params | object | no | Query parameters. |
mastodon.mastodon_api_post 2 parameters
kosmo integrations:schema mastodon.mastodon_api_post --json | Parameter | Type | Required | Description |
|---|---|---|---|
path | string | yes | API path beginning with /api/. |
body | object | no | JSON request body. |
mastodon.mastodon_api_put 2 parameters
kosmo integrations:schema mastodon.mastodon_api_put --json | Parameter | Type | Required | Description |
|---|---|---|---|
path | string | yes | API path beginning with /api/. |
body | object | no | JSON request body. |
mastodon.mastodon_api_delete 2 parameters
kosmo integrations:schema mastodon.mastodon_api_delete --json | Parameter | Type | Required | Description |
|---|---|---|---|
path | string | yes | API path beginning with /api/. |
body | object | no | JSON request body. |
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.