update_activity_state
Modify the state of an Adobe Target activity by specifying the tenant identifier and desired new state. Utilize the MCP server for streamlined API interactions.
Instructions
Update the state of an activity in Adobe Target.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| state | Yes | The new state to set for the activity. | |
| tenant | Yes | The tenant identifier. |
Implementation Reference
- The core handler function `executeFunction` that performs the HTTP PUT request to the Adobe Target API to update the activity state.const executeFunction = async ({ tenant, state }) => { const baseUrl = 'https://mc.adobe.io'; const apiKey = process.env.ADOBE_API_KEY; const token = process.env.ADOBE_API_KEY; try { // Construct the URL for the request const url = `${baseUrl}/${tenant}/target/activities/ab/168816/state`; // Set up headers for the request const headers = { 'Authorization': `Bearer ${token}`, 'X-Api-Key': apiKey, 'Content-Type': 'application/vnd.adobe.target.v1+json' }; // Set up the body of the request const body = JSON.stringify({ state }); // Perform the fetch request const response = await fetch(url, { method: 'PUT', headers, body }); // Check if the response was successful if (!response.ok) { const errorData = await response.json(); throw new Error(errorData); } // Parse and return the response data const data = await response.json(); return data; } catch (error) { console.error('Error updating activity state:', error); return { error: 'An error occurred while updating the activity state.' }; } };
- The tool definition object `apiTool` including the schema (parameters), description, and reference to the handler function.const apiTool = { function: executeFunction, definition: { type: 'function', function: { name: 'update_activity_state', description: 'Update the state of an activity in Adobe Target.', parameters: { type: 'object', properties: { tenant: { type: 'string', description: 'The tenant identifier.' }, state: { type: 'string', description: 'The new state to set for the activity.' } }, required: ['tenant', 'state'] } } } };
- tools/paths.js:1-5 (registration)The `toolPaths` export listing the path to this tool's file, used by `discoverTools()` for dynamic loading and registration in the MCP server.export const toolPaths = [ 'adobe/adobe-target-admin-ap-is/update-activity-state.js', 'adobe/adobe-target-admin-ap-is/update-activity-priority.js', 'adobe/adobe-target-admin-ap-is/update-activity-schedule.js' ];