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 { jiraDataCenterAuth } from '../../auth';
import { jiraApiCall } from '../common';
import { AuthenticationType, httpClient, HttpMethod } from '@activepieces/pieces-common';
export const getIssueAttachmentAction = createAction({
auth: jiraDataCenterAuth,
name: 'get-issue-attachment',
classification: 'READ',
displayName: 'Get Issue Attachment',
description: 'Retrieves an attachment from an issue.',
audience: 'both',
aiMetadata: {
description:
'Downloads a single attachment from Jira Data Center/Server by its attachment ID, returning the attachment metadata and the file contents. Use when an agent already has an attachment ID (e.g. from reading an issue) and needs the actual file. Read-only and idempotent.',
idempotent: true,
},
props: {
attachmentId: Property.ShortText({
displayName: 'Attachment ID',
required: true,
}),
},
async run(context) {
const { attachmentId } = context.propsValue;
const attachmentResponse = await jiraApiCall<{ filename: string; content: string }>({
method: HttpMethod.GET,
resourceUri: `/attachment/${attachmentId}`,
auth: context.auth,
});
const { filename, content } = attachmentResponse;
const response = await httpClient.sendRequest({
url: content,
method: HttpMethod.GET,
authentication: {
type: AuthenticationType.BEARER_TOKEN,
token: context.auth.props.personalAccessToken,
},
responseType: 'arraybuffer',
followRedirects: true,
});
return {
...attachmentResponse,
file: await context.files.write({
fileName: filename,
data: Buffer.from(response.body),
}),
};
},
});