KosmoKrator

cms

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.

12 functions 6 read 6 write Bearer token auth

Contentful CLI Setup

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

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

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

Call Contentful Headlessly

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

kosmo integrations:call contentful.contentful_list_content_types '{
  "limit": 1
}' --json

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

kosmo integrations:contentful contentful_list_content_types '{
  "limit": 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 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

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

contentful.contentful_list_content_types

Read read

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.

Parameters
limit

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

contentful.contentful_get_content_type

Read read

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

Parameters
content_type_id

Generic CLI call

kosmo integrations:call contentful.contentful_get_content_type '{"content_type_id":"example_content_type_id"}' --json

Provider shortcut

kosmo integrations:contentful contentful_get_content_type '{"content_type_id":"example_content_type_id"}' --json

contentful.contentful_create_content_type

Write write

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.

Parameters
name, display_name, description, fields

Generic CLI call

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

Provider 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

Read read

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.

Parameters
content_type, limit, skip, order, query

Generic CLI call

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

Provider 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

Read read

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

Parameters
entry_id

Generic CLI call

kosmo integrations:call contentful.contentful_get_entry '{"entry_id":"example_entry_id"}' --json

Provider shortcut

kosmo integrations:contentful contentful_get_entry '{"entry_id":"example_entry_id"}' --json

contentful.contentful_create_entry

Write write

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.

Parameters
content_type_id, fields

Generic CLI call

kosmo integrations:call contentful.contentful_create_entry '{"content_type_id":"example_content_type_id","fields":"example_fields"}' --json

Provider shortcut

kosmo integrations:contentful contentful_create_entry '{"content_type_id":"example_content_type_id","fields":"example_fields"}' --json

contentful.contentful_update_entry

Write write

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.

Parameters
entry_id, fields, version

Generic CLI call

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

Provider shortcut

kosmo integrations:contentful contentful_update_entry '{"entry_id":"example_entry_id","fields":"example_fields","version":1}' --json

contentful.contentful_publish_entry

Write write

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.

Parameters
entry_id, version

Generic CLI call

kosmo integrations:call contentful.contentful_publish_entry '{"entry_id":"example_entry_id","version":1}' --json

Provider shortcut

kosmo integrations:contentful contentful_publish_entry '{"entry_id":"example_entry_id","version":1}' --json

contentful.contentful_unpublish_entry

Write write

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.

Parameters
entry_id, version

Generic CLI call

kosmo integrations:call contentful.contentful_unpublish_entry '{"entry_id":"example_entry_id","version":1}' --json

Provider shortcut

kosmo integrations:contentful contentful_unpublish_entry '{"entry_id":"example_entry_id","version":1}' --json

contentful.contentful_delete_entry

Write write

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

Parameters
entry_id

Generic CLI call

kosmo integrations:call contentful.contentful_delete_entry '{"entry_id":"example_entry_id"}' --json

Provider shortcut

kosmo integrations:contentful contentful_delete_entry '{"entry_id":"example_entry_id"}' --json

contentful.contentful_list_assets

Read read

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

Parameters
limit, skip

Generic CLI call

kosmo integrations:call contentful.contentful_list_assets '{"limit":1,"skip":1}' --json

Provider shortcut

kosmo integrations:contentful contentful_list_assets '{"limit":1,"skip":1}' --json

contentful.contentful_get_space

Read read

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

Parameters
none

Generic CLI call

kosmo integrations:call contentful.contentful_get_space '{}' --json

Provider 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

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.

Operation
Read read
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

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

Operation
Read read
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

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.

Operation
Write write
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

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.

Operation
Read read
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

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

Operation
Read read
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

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.

Operation
Write write
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

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.

Operation
Write write
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

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.

Operation
Write write
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

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.

Operation
Write write
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

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

Operation
Write write
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

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

Operation
Read read
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

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

Operation
Read read
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.