Skip to main content
Glama

create_entry

Generate and add a new entry for a specific content type in Contentstack MCP, ensuring data aligns with predefined schema requirements.

Instructions

Creates a new entry for a specified content type.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
content_type_uidYesContent type UID
entryYesEntry data according to content type schema

Implementation Reference

  • The main handler function for the 'create_entry' tool. It constructs a POST request payload with the provided entry data and sends it to the Contentstack API endpoint `/content_types/{content_type_uid}/entries` to create a new entry. Returns success message with the new entry UID or error details.
      async ({ content_type_uid, entry }) => {
        try {
          const payload = { entry }
    
          const response = await axios.post(`${API_BASE_URL}/content_types/${content_type_uid}/entries`, payload, {
            headers: getHeaders(),
          })
    
          return {
            content: [
              {
                type: 'text',
                text: `Entry created successfully in content type "${content_type_uid}". Entry UID: ${response.data.entry.uid}`,
              },
            ],
          }
        } catch (error) {
          return {
            content: [
              {
                type: 'text',
                text: handleError(error as ApiError),
              },
            ],
            isError: true,
          }
        }
      },
    )
  • Zod schema defining the input parameters for the 'create_entry' tool: content_type_uid (string) and entry (passthrough object for flexible entry data matching the content type schema).
    {
      content_type_uid: z.string().describe('Content type UID'),
      entry: z.object({}).passthrough().describe('Entry data according to content type schema'),
    },
  • src/index.ts:581-616 (registration)
    Registers the 'create_entry' tool on the MCP server using server.tool(), including name, description, input schema, and handler function.
    server.tool(
      'create_entry',
      'Creates a new entry for a specified content type.',
      {
        content_type_uid: z.string().describe('Content type UID'),
        entry: z.object({}).passthrough().describe('Entry data according to content type schema'),
      },
      async ({ content_type_uid, entry }) => {
        try {
          const payload = { entry }
    
          const response = await axios.post(`${API_BASE_URL}/content_types/${content_type_uid}/entries`, payload, {
            headers: getHeaders(),
          })
    
          return {
            content: [
              {
                type: 'text',
                text: `Entry created successfully in content type "${content_type_uid}". Entry UID: ${response.data.entry.uid}`,
              },
            ],
          }
        } catch (error) {
          return {
            content: [
              {
                type: 'text',
                text: handleError(error as ApiError),
              },
            ],
            isError: true,
          }
        }
      },
    )

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