social
Mastodon CLI for Shell Scripts
Use the Mastodon CLI for shell scripts with headless JSON commands, schema discovery, credentials, and permission controls.
6 functions 5 read 1 write Bearer token auth
Mastodon CLI for Shell Scripts
Call integration functions from shell scripts with stable JSON input and output.
Use shell scripts for small local automations that need one or more integration calls. The Mastodon CLI uses the same integration registry as the TUI, Lua runtime, and MCP gateway, but returns predictable command output for automation.
Command Shape
# Mastodon CLI for Shell Scripts
kosmokrator integrations:configure mastodon --set access_token="$MASTODON_ACCESS_TOKEN" --enable --read allow --write ask --json
kosmo integrations:call mastodon.mastodon_list_statuses '{"timeline":"example_timeline","limit":1,"max_id":"example_max_id","since_id":"example_since_id"}' --json Discovery Before Execution
Agents and scripts can inspect Mastodon docs and schemas 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 Useful Mastodon CLI Functions
| Function | Type | Parameters | Description |
|---|---|---|---|
mastodon.mastodon_list_statuses | Read | timeline, limit, max_id, since_id | 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. |
mastodon.mastodon_get_status | Read | id | Retrieve a single Mastodon status (toot) by its ID. Returns the full post content, author details, and engagement metrics. |
mastodon.mastodon_create_status | Write | status, visibility, in_reply_to_id, spoiler_text, sensitive, language | Publish a new status (toot) on Mastodon. Supports content warnings, visibility controls (public, unlisted, private, direct), replies, and language settings. |
mastodon.mastodon_list_accounts | Read | id, limit, max_id | List followers of a Mastodon account. Returns account profiles with display names, bios, and follower counts. Supports pagination. |
mastodon.mastodon_get_account | Read | id | Retrieve a Mastodon account profile by ID. Returns display name, bio, follower counts, and other profile details. |
mastodon.mastodon_get_current_user | Read | none | Get the authenticated user's Mastodon profile. Returns display name, bio, follower/following counts, and other account details. |
Automation Notes
- Use
--jsonfor machine-readable output. - Keep credentials out of argv by using environment variables or stored KosmoKrator configuration.
- Configure read/write policy before unattended runs; use
--forceonly for trusted automation. - Use the MCP gateway instead when the agent needs dynamic tool discovery inside a conversation.