Skip to main content
Glama

publish_entry

Publishes content entries to specified environments and locales in Contentstack, ensuring accurate content distribution across platforms and regions.

Instructions

Publishes an entry to a specified environment and locale.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
content_type_uidYesContent type UID
entry_uidYesEntry UID to publish
environmentYesEnvironment to publish to
localeNoLocale code (defaults to en-us)en-us

Implementation Reference

  • The handler function for the 'publish_entry' tool. It fetches the current entry to get its version, prepares a publish payload with the specified environment and locale, and sends a POST request to the Contentstack API's publish endpoint.
    async ({ content_type_uid, entry_uid, environment, locale }) => {
      try {
        // First get the entry to find its current version
        const entryResponse = await axios.get<EntryResponse>(
          `${API_BASE_URL}/content_types/${content_type_uid}/entries/${entry_uid}`,
          {
            headers: getHeaders(),
          },
        )
    
        const version = entryResponse.data.entry._version
    
        // Prepare publish payload
        const payload = {
          entry: {
            environments: [environment],
            locales: [locale],
          },
        }
    
        // Publish the entry
        const response = await axios.post(
          `${API_BASE_URL}/content_types/${content_type_uid}/entries/${entry_uid}/publish`,
          payload,
          { headers: getHeaders() },
        )
    
        return {
          content: [
            {
              type: 'text',
              text: `Entry "${entry_uid}" published successfully to environment "${environment}" in locale "${locale}".`,
            },
          ],
        }
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: handleError(error as ApiError),
            },
          ],
          isError: true,
        }
      }
    },
  • Zod schema defining the input parameters for the 'publish_entry' tool: content_type_uid, entry_uid, environment, and locale (with default 'en-us').
    {
      content_type_uid: z.string().describe('Content type UID'),
      entry_uid: z.string().describe('Entry UID to publish'),
      environment: z.string().describe('Environment to publish to'),
      locale: z.string().default('en-us').describe('Locale code (defaults to en-us)'),
    },
  • src/index.ts:1075-1130 (registration)
    Registration of the 'publish_entry' tool using server.tool(), including name, description, input schema, and handler function.
      'publish_entry',
      'Publishes an entry to a specified environment and locale.',
      {
        content_type_uid: z.string().describe('Content type UID'),
        entry_uid: z.string().describe('Entry UID to publish'),
        environment: z.string().describe('Environment to publish to'),
        locale: z.string().default('en-us').describe('Locale code (defaults to en-us)'),
      },
      async ({ content_type_uid, entry_uid, environment, locale }) => {
        try {
          // First get the entry to find its current version
          const entryResponse = await axios.get<EntryResponse>(
            `${API_BASE_URL}/content_types/${content_type_uid}/entries/${entry_uid}`,
            {
              headers: getHeaders(),
            },
          )
    
          const version = entryResponse.data.entry._version
    
          // Prepare publish payload
          const payload = {
            entry: {
              environments: [environment],
              locales: [locale],
            },
          }
    
          // Publish the entry
          const response = await axios.post(
            `${API_BASE_URL}/content_types/${content_type_uid}/entries/${entry_uid}/publish`,
            payload,
            { headers: getHeaders() },
          )
    
          return {
            content: [
              {
                type: 'text',
                text: `Entry "${entry_uid}" published successfully to environment "${environment}" in locale "${locale}".`,
              },
            ],
          }
        } catch (error) {
          return {
            content: [
              {
                type: 'text',
                text: handleError(error as ApiError),
              },
            ],
            isError: true,
          }
        }
      },
    )
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states the action ('Publishes') which implies a write/mutation operation, but doesn't disclose behavioral traits like whether publishing is reversible, requires specific permissions, affects entry status, or has side effects. The description is minimal and lacks operational context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's front-loaded with the core action and includes all essential elements (verb, resource, target). Every word earns its place without redundancy or fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete for a mutation tool. It doesn't explain what happens after publishing (e.g., entry availability, response format), error conditions, or dependencies. For a tool that likely changes system state, more context is needed beyond the basic action.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all parameters. The description adds no additional meaning beyond the schema—it doesn't explain parameter relationships, constraints, or usage examples. Baseline 3 is appropriate as the schema handles parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Publishes') and the resource ('an entry'), specifying the target ('to a specified environment and locale'). It distinguishes from sibling tools like 'unpublish_entry' by indicating the opposite action, but doesn't explicitly differentiate from other publishing-related tools if they existed.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., entry must exist), exclusions, or compare with sibling tools like 'create_entry' or 'update_entry' in a publishing workflow. Usage context is implied but not stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/darekrossman/contentstack-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server