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
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
import { createAction, Property } from '@activepieces/pieces-framework';
import OpenAI from 'openai';
import { openaiAuth } from '../auth';
import { deleteFileActionOutputSchema } from '../output-schemas';
export const deleteFile = createAction({
audience: 'both',
auth: openaiAuth,
name: 'delete_file',
classification: 'DESTRUCTIVE',
displayName: 'Delete File',
description: 'Delete a file you uploaded to OpenAI.',
aiMetadata: { description: 'Permanently removes one file from the connected OpenAI account, identified by the OpenAI file id returned by upload_file (it starts with file-). Use it to clean up assistant, vision, batch, or fine-tune uploads that are no longer needed; find_file resolves a filename to that id first. Deleting converges on the same end state so it counts as idempotent, but a repeat call for an id that is already gone fails with a not-found error.', idempotent: true },
props: {
fileId: Property.ShortText({
displayName: 'File ID',
description: 'Starts with file-. Upload, List and Find File return it.',
placeholder: 'e.g. file-abc123',
required: true,
}),
},
outputSchema: deleteFileActionOutputSchema,
async run(context) {
const openai = new OpenAI({ apiKey: context.auth.secret_text });
const { fileId } = context.propsValue;
const response = await openai.files.del(fileId);
return response;
},
});