KosmoKrator

productivity

Contentful CLI for AI Agents

Use the Contentful CLI from KosmoKrator to call Contentful tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

Contentful CLI Setup

Contentful can be configured headlessly with `kosmokrator integrations:configure contentful`.

Install, configure, and verify
# 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 contentful --set access_token="$CONTENTFUL_ACCESS_TOKEN" --set space_id="$CONTENTFUL_SPACE_ID" --enable --read allow --write ask --json
kosmokrator integrations:doctor contentful --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.

KeyEnv varTypeRequiredLabel
access_token CONTENTFUL_ACCESS_TOKEN Secret secret yes Access Token
space_id CONTENTFUL_SPACE_ID Text text yes Space ID

Command Patterns

The generic command is stable across every integration. The provider shortcut is shorter for humans.

Generic CLI call
kosmo integrations:call contentful.contentful_list_content_types '{"limit":1}' --json
Provider shortcut
kosmo integrations:contentful contentful_list_content_types '{"limit":1}' --json

Discovery

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

Discovery commands
kosmo integrations:docs contentful --json
kosmo integrations:docs contentful.contentful_list_content_types --json
kosmo integrations:schema contentful.contentful_list_content_types --json
kosmo integrations:search "Contentful" --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.

contentful.contentful_list_content_types

List all content types defined in the connected Contentful space. Returns each content type's ID, name, description, and field count. Optionally limit the number of results.

Read read
Parameters
limit
Generic call
kosmo integrations:call contentful.contentful_list_content_types '{"limit":1}' --json
Shortcut
kosmo integrations:contentful contentful_list_content_types '{"limit":1}' --json

contentful.contentful_get_content_type

Get detailed information about a specific content type by its ID. Returns the content type name, description, display field, and full field definitions.

Read read
Parameters
content_type_id
Generic call
kosmo integrations:call contentful.contentful_get_content_type '{"content_type_id":"example_content_type_id"}' --json
Shortcut
kosmo integrations:contentful contentful_get_content_type '{"content_type_id":"example_content_type_id"}' --json

contentful.contentful_create_content_type

Create a new content type in Contentful with a name, display name, optional description, and field definitions. Fields are provided as a JSON array of objects with id, name, and type. Common field types: Symbol, Text, Integer, Number, Boolean, Date, Location, RichText, Array, Link.

Write write
Parameters
name, display_name, description, fields
Generic call
kosmo integrations:call contentful.contentful_create_content_type '{"name":"example_name","display_name":"example_display_name","description":"example_description","fields":"example_fields"}' --json
Shortcut
kosmo integrations:contentful contentful_create_content_type '{"name":"example_name","display_name":"example_display_name","description":"example_description","fields":"example_fields"}' --json

contentful.contentful_list_entries

List entries in the Contentful space. Optionally filter by content type, control pagination with limit and skip, order results, or search with a text query. Returns entry IDs, content types, and localized field values.

Read read
Parameters
content_type, limit, skip, order, query
Generic call
kosmo integrations:call contentful.contentful_list_entries '{"content_type":"example_content_type","limit":1,"skip":1,"order":"example_order","query":"example_query"}' --json
Shortcut
kosmo integrations:contentful contentful_list_entries '{"content_type":"example_content_type","limit":1,"skip":1,"order":"example_order","query":"example_query"}' --json

contentful.contentful_get_entry

Get detailed information about a specific entry by its ID. Returns all localized field values, content type, version, and timestamps.

Read read
Parameters
entry_id
Generic call
kosmo integrations:call contentful.contentful_get_entry '{"entry_id":"example_entry_id"}' --json
Shortcut
kosmo integrations:contentful contentful_get_entry '{"entry_id":"example_entry_id"}' --json

contentful.contentful_create_entry

Create a new entry in Contentful. Specify the content type ID and provide field values as a JSON object. Fields must be localized, e.g. {"title": {"en-US": "My Title"}}. The entry is created as a draft; use the publish tool to publish it.

Write write
Parameters
content_type_id, fields
Generic call
kosmo integrations:call contentful.contentful_create_entry '{"content_type_id":"example_content_type_id","fields":"example_fields"}' --json
Shortcut
kosmo integrations:contentful contentful_create_entry '{"content_type_id":"example_content_type_id","fields":"example_fields"}' --json

contentful.contentful_update_entry

Update an existing entry's field values. Requires the current version number for optimistic locking. Fields must be localized, e.g. {"title": {"en-US": "Updated Title"}}. The version is sent as the X-Contentful-Version header.

Write write
Parameters
entry_id, fields, version
Generic call
kosmo integrations:call contentful.contentful_update_entry '{"entry_id":"example_entry_id","fields":"example_fields","version":1}' --json
Shortcut
kosmo integrations:contentful contentful_update_entry '{"entry_id":"example_entry_id","fields":"example_fields","version":1}' --json

contentful.contentful_publish_entry

Publish a draft or updated entry. Requires the current version number for optimistic locking, sent as the X-Contentful-Version header. After publishing, the entry becomes publicly visible via the Content Delivery API.

Write write
Parameters
entry_id, version
Generic call
kosmo integrations:call contentful.contentful_publish_entry '{"entry_id":"example_entry_id","version":1}' --json
Shortcut
kosmo integrations:contentful contentful_publish_entry '{"entry_id":"example_entry_id","version":1}' --json

contentful.contentful_unpublish_entry

Unpublish a published entry, reverting it to draft status. Requires the current version number for optimistic locking, sent as the X-Contentful-Version header. The entry will no longer be visible via the Content Delivery API.

Write write
Parameters
entry_id, version
Generic call
kosmo integrations:call contentful.contentful_unpublish_entry '{"entry_id":"example_entry_id","version":1}' --json
Shortcut
kosmo integrations:contentful contentful_unpublish_entry '{"entry_id":"example_entry_id","version":1}' --json

contentful.contentful_delete_entry

Permanently delete an entry from the Contentful space. The entry must be unpublished before it can be deleted. This action is irreversible.

Write write
Parameters
entry_id
Generic call
kosmo integrations:call contentful.contentful_delete_entry '{"entry_id":"example_entry_id"}' --json
Shortcut
kosmo integrations:contentful contentful_delete_entry '{"entry_id":"example_entry_id"}' --json

contentful.contentful_list_assets

List assets (images, files, videos) in the Contentful space. Supports pagination with limit and skip parameters. Returns asset IDs, titles, file details, and URLs.

Read read
Parameters
limit, skip
Generic call
kosmo integrations:call contentful.contentful_list_assets '{"limit":1,"skip":1}' --json
Shortcut
kosmo integrations:contentful contentful_list_assets '{"limit":1,"skip":1}' --json

contentful.contentful_get_space

Get details about the connected Contentful space, including name, locales, organization, and space type.

Read read
Parameters
none
Generic call
kosmo integrations:call contentful.contentful_get_space '{}' --json
Shortcut
kosmo integrations:contentful contentful_get_space '{}' --json

Function Schemas

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

contentful.contentful_list_content_types 1 parameters
Schema command
kosmo integrations:schema contentful.contentful_list_content_types --json
ParameterTypeRequiredDescription
limit integer no Maximum number of content types to return (default 100).
contentful.contentful_get_content_type 1 parameters
Schema command
kosmo integrations:schema contentful.contentful_get_content_type --json
ParameterTypeRequiredDescription
content_type_id string yes The ID of the content type to retrieve.
contentful.contentful_create_content_type 4 parameters
Schema command
kosmo integrations:schema contentful.contentful_create_content_type --json
ParameterTypeRequiredDescription
name string yes Internal name of the content type (e.g. "blogPost").
display_name string yes Human-readable display name (e.g. "Blog Post").
description string no Description of the content type.
fields string yes JSON array of field definitions. Each field needs id, name, and type. Example: [{"id":"title","name":"Title","type":"Symbol"}].
contentful.contentful_list_entries 5 parameters
Schema command
kosmo integrations:schema contentful.contentful_list_entries --json
ParameterTypeRequiredDescription
content_type string no Filter entries by content type ID.
limit integer no Maximum number of entries to return (default 100, max 1000).
skip integer no Number of entries to skip for pagination.
order string no Order entries by field. Prefix with "-" for descending. E.g. "sys.createdAt" or "-sys.updatedAt".
query string no Full-text search query to filter entries.
contentful.contentful_get_entry 1 parameters
Schema command
kosmo integrations:schema contentful.contentful_get_entry --json
ParameterTypeRequiredDescription
entry_id string yes The ID of the entry to retrieve.
contentful.contentful_create_entry 2 parameters
Schema command
kosmo integrations:schema contentful.contentful_create_entry --json
ParameterTypeRequiredDescription
content_type_id string yes The content type ID for the new entry.
fields string yes JSON object of localized field values. E.g. {"title": {"en-US": "Hello"}, "body": {"en-US": "World"}}.
contentful.contentful_update_entry 3 parameters
Schema command
kosmo integrations:schema contentful.contentful_update_entry --json
ParameterTypeRequiredDescription
entry_id string yes The ID of the entry to update.
fields string yes JSON object of localized field values to update. E.g. {"title": {"en-US": "New Title"}}.
version integer yes Current version of the entry (required for optimistic locking). Get this from the entry's sys.version.
contentful.contentful_publish_entry 2 parameters
Schema command
kosmo integrations:schema contentful.contentful_publish_entry --json
ParameterTypeRequiredDescription
entry_id string yes The ID of the entry to publish.
version integer yes Current version of the entry (required for optimistic locking).
contentful.contentful_unpublish_entry 2 parameters
Schema command
kosmo integrations:schema contentful.contentful_unpublish_entry --json
ParameterTypeRequiredDescription
entry_id string yes The ID of the entry to unpublish.
version integer yes Current version of the entry (required for optimistic locking).
contentful.contentful_delete_entry 1 parameters
Schema command
kosmo integrations:schema contentful.contentful_delete_entry --json
ParameterTypeRequiredDescription
entry_id string yes The ID of the entry to delete.
contentful.contentful_list_assets 2 parameters
Schema command
kosmo integrations:schema contentful.contentful_list_assets --json
ParameterTypeRequiredDescription
limit integer no Maximum number of assets to return (default 100).
skip integer no Number of assets to skip for pagination.
contentful.contentful_get_space 0 parameters
Schema command
kosmo integrations:schema contentful.contentful_get_space --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.