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
| Name | Required | Description | Default |
|---|---|---|---|
| content_type_uid | Yes | Content type UID | |
| entry | Yes | Updated entry data | |
| entry_uid | Yes | Entry UID to update |
Implementation Reference
- src/index.ts:627-658 (handler)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, } } },
- src/index.ts:622-626 (schema)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, } } }, )