Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

1.3 KB
Raw Blame
import { createAction } from '@activepieces/pieces-framework';
import { HttpMethod } from '@activepieces/pieces-common';
import { attioAuth } from '../auth';
import { attioApiCall } from '../common/client';
import { taskIdDropdown } from '../common/props';
import { deleteTaskOutputSchema } from '../output-schemas';

export const deleteTaskAction = createAction({
	auth: attioAuth,
	name: 'delete_task',
	outputSchema: deleteTaskOutputSchema,
	classification: 'DESTRUCTIVE',
	displayName: 'Delete Task',
	description: 'Permanently delete a task by its ID.',
	audience: 'human',
	aiMetadata: { description: 'Permanently deletes a task identified by its ID. Use this to remove a task you no longer need; the deletion cannot be undone. Effectively idempotent on end-state — once the task is gone, repeating the call has no further effect (though the second call may error on the missing task).', idempotent: true },
	props: {
		task_id: taskIdDropdown({
			displayName: 'Task',
			description: 'The task to delete.',
			required: true,
		}),
	},
	async run(context) {
		const { task_id } = context.propsValue;

		await attioApiCall({
			accessToken: context.auth.secret_text,
			method: HttpMethod.DELETE,
			resourceUri: `/tasks/${task_id}`,
		});

		return { success: true };
	},
});