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 { jiraCloudAuth } from '../../auth';
import { HttpMethod } from '@activepieces/pieces-common';
import { sendJiraRequest } from '../common';
import FormData from 'form-data';
import { getProjectIdDropdown, getIssueIdDropdown } from '../common/props';
import { legacyAttachmentListOutputSchema } from '../output-schemas';
export const addAttachmentToIssueAction = createAction({
auth: jiraCloudAuth,
name: 'add_issue_attachment',
classification: 'WRITE',
displayName: 'Add Attachment to Issue',
description: 'Adds an attachment to an issue.',
audience: 'human',
aiMetadata: {
description:
'Upload a file as an attachment on an existing Jira issue, identified by project and issue. Use when a file (image, log, document) needs to be stored on the issue itself rather than referenced in a comment. Not idempotent: re-running uploads a duplicate copy of the same file.',
idempotent: false,
},
outputSchema: legacyAttachmentListOutputSchema,
props: {
projectId: getProjectIdDropdown(),
issueId: getIssueIdDropdown({ refreshers: ['projectId'] }),
attachment: Property.File({
displayName: 'File',
required: true,
}),
},
propertyGroups: [
{
key: 'issue',
display: 'section',
label: 'Issue',
icon: 'inbox',
props: ['projectId', 'issueId'],
},
{
key: 'attachment',
display: 'section',
label: 'Attachment',
icon: 'paperclip',
props: ['attachment'],
},
],
async run(context) {
const { issueId, attachment } = context.propsValue;
const formData = new FormData();
const fileBuffer = Buffer.from(attachment.base64, 'base64');
formData.append('file', fileBuffer, attachment.filename);
const response = await sendJiraRequest({
method: HttpMethod.POST,
url: `issue/${issueId}/attachments`,
auth: context.auth,
headers: {
'X-Atlassian-Token': 'no-check',
...formData.getHeaders(),
},
body: formData,
});
return response.body;
},
});