update_activity_state
Modify the status of an Adobe Target activity by specifying a tenant and new state to control campaign execution.
Instructions
Update the state of an activity in Adobe Target.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tenant | Yes | The tenant identifier. | |
| state | Yes | The new state to set for the activity. |
Implementation Reference
- Handler function that executes the tool: sends PUT request to Adobe Target API to update activity state for a given tenant.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.' }; } };
- Tool definition including schema for input parameters (tenant, state), description, and reference to 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'] } } } };
- lib/tools.js:7-16 (registration)Dynamic tool discovery and registration: imports apiTool from each tool file listed in toolPaths and collects them into an array of tools.export async function discoverTools() { const toolPromises = toolPaths.map(async (file) => { const module = await import(`../tools/${file}`); return { ...module.apiTool, path: file, }; }); return Promise.all(toolPromises); }
- mcpServer.js:102-104 (registration)Loads the discovered tools in the MCP server main entry point.const tools = await discoverTools(); console.log("🧰 Tools discovered:", tools.map(t => t.definition?.function?.name));
- tools/paths.js:1-5 (helper)Lists paths to all tool implementation files, used by discoverTools.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' ];