Skip to main content
Glama

update_entry

Modify existing entries in Contentstack by specifying the content type UID, entry UID, and updated entry data using the update_entry function.

Instructions

Updates an existing entry identified by its UID and content type UID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
content_type_uidYesContent type UID
entryYesUpdated entry data
entry_uidYesEntry UID to update

Implementation Reference

  • The asynchronous handler function for the update_entry tool. It constructs a PUT request to the Contentstack API endpoint for updating an entry, using the provided content_type_uid, entry_uid, and entry data. Returns success message or error.
    async ({ content_type_uid, entry_uid, entry }) => {
      try {
        const payload = { entry }
    
        const response = await axios.put(
          `${API_BASE_URL}/content_types/${content_type_uid}/entries/${entry_uid}`,
          payload,
          {
            headers: getHeaders(),
          },
        )
    
        return {
          content: [
            {
              type: 'text',
              text: `Entry "${entry_uid}" updated successfully in content type "${content_type_uid}".`,
            },
          ],
        }
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: handleError(error as ApiError),
            },
          ],
          isError: true,
        }
      }
    },
  • Zod schema defining the input parameters for the update_entry tool: content_type_uid (string), entry_uid (string), and entry (passthrough object).
    {
      content_type_uid: z.string().describe('Content type UID'),
      entry_uid: z.string().describe('Entry UID to update'),
      entry: z.object({}).passthrough().describe('Updated entry data'),
    },
  • src/index.ts:619-659 (registration)
    Registers the 'update_entry' tool with the MCP server using server.tool(), providing name, description, input schema, and handler function.
    server.tool(
      'update_entry',
      'Updates an existing entry identified by its UID and content type UID.',
      {
        content_type_uid: z.string().describe('Content type UID'),
        entry_uid: z.string().describe('Entry UID to update'),
        entry: z.object({}).passthrough().describe('Updated entry data'),
      },
      async ({ content_type_uid, entry_uid, entry }) => {
        try {
          const payload = { entry }
    
          const response = await axios.put(
            `${API_BASE_URL}/content_types/${content_type_uid}/entries/${entry_uid}`,
            payload,
            {
              headers: getHeaders(),
            },
          )
    
          return {
            content: [
              {
                type: 'text',
                text: `Entry "${entry_uid}" updated successfully in content type "${content_type_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