KosmoKrator

social

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.

6 functions 5 read 1 write Bearer token auth

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

KeyEnv varTypeRequiredLabel
access_token MASTODON_ACCESS_TOKEN Secret secret yes Access Token
instance_url MASTODON_INSTANCE_URL URL url no Instance URL

Call Mastodon Headlessly

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

kosmo integrations:call mastodon.mastodon_list_statuses '{
  "timeline": "example_timeline",
  "limit": 1,
  "max_id": "example_max_id",
  "since_id": "example_since_id"
}' --json

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

kosmo integrations:mastodon mastodon_list_statuses '{
  "timeline": "example_timeline",
  "limit": 1,
  "max_id": "example_max_id",
  "since_id": "example_since_id"
}' --json

Agent Discovery Commands

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

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 Mastodon.

mastodon.mastodon_list_statuses

Read read

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.

Parameters
timeline, limit, max_id, since_id

Generic CLI call

kosmo integrations:call mastodon.mastodon_list_statuses '{"timeline":"example_timeline","limit":1,"max_id":"example_max_id","since_id":"example_since_id"}' --json

Provider shortcut

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

Read read

Retrieve a single Mastodon status (toot) by its ID. Returns the full post content, author details, and engagement metrics.

Parameters
id

Generic CLI call

kosmo integrations:call mastodon.mastodon_get_status '{"id":"example_id"}' --json

Provider shortcut

kosmo integrations:mastodon mastodon_get_status '{"id":"example_id"}' --json

mastodon.mastodon_create_status

Write write

Publish a new status (toot) on Mastodon. Supports content warnings, visibility controls (public, unlisted, private, direct), replies, and language settings.

Parameters
status, visibility, in_reply_to_id, spoiler_text, sensitive, language

Generic CLI call

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

Provider shortcut

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

Read read

List followers of a Mastodon account. Returns account profiles with display names, bios, and follower counts. Supports pagination.

Parameters
id, limit, max_id

Generic CLI call

kosmo integrations:call mastodon.mastodon_list_accounts '{"id":"example_id","limit":1,"max_id":"example_max_id"}' --json

Provider shortcut

kosmo integrations:mastodon mastodon_list_accounts '{"id":"example_id","limit":1,"max_id":"example_max_id"}' --json

mastodon.mastodon_get_account

Read read

Retrieve a Mastodon account profile by ID. Returns display name, bio, follower counts, and other profile details.

Parameters
id

Generic CLI call

kosmo integrations:call mastodon.mastodon_get_account '{"id":"example_id"}' --json

Provider shortcut

kosmo integrations:mastodon mastodon_get_account '{"id":"example_id"}' --json

mastodon.mastodon_get_current_user

Read read

Get the authenticated user's Mastodon profile. Returns display name, bio, follower/following counts, and other account details.

Parameters
none

Generic CLI call

kosmo integrations:call mastodon.mastodon_get_current_user '{}' --json

Provider shortcut

kosmo integrations:mastodon mastodon_get_current_user '{}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

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.

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

Retrieve a single Mastodon status (toot) by its ID. Returns the full post content, author details, and engagement metrics.

Operation
Read read
Schema command
kosmo integrations:schema mastodon.mastodon_get_status --json
ParameterTypeRequiredDescription
id string yes The ID of the status to retrieve.

mastodon.mastodon_create_status

Publish a new status (toot) on Mastodon. Supports content warnings, visibility controls (public, unlisted, private, direct), replies, and language settings.

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

List followers of a Mastodon account. Returns account profiles with display names, bios, and follower counts. Supports pagination.

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

Retrieve a Mastodon account profile by ID. Returns display name, bio, follower counts, and other profile details.

Operation
Read read
Schema command
kosmo integrations:schema mastodon.mastodon_get_account --json
ParameterTypeRequiredDescription
id string yes The account ID to retrieve.

mastodon.mastodon_get_current_user

Get the authenticated user's Mastodon profile. Returns display name, bio, follower/following counts, and other account details.

Operation
Read read
Schema command
kosmo integrations:schema mastodon.mastodon_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.