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 { HttpMethod } from '@activepieces/pieces-common';
import { youtrackAuth } from '../auth';
import { issueDropdown, youtrackApiCall } from '../common';
import { listAttachmentsActionOutputSchema } from '../output-schemas';
export const listAttachmentsAction = createAction({
auth: youtrackAuth,
name: 'list_attachments',
classification: 'SEARCH',
outputSchema: listAttachmentsActionOutputSchema,
displayName: 'List Attachments',
description: 'Lists all attachments on a specific issue with metadata (name, size, type).',
audience: 'both',
aiMetadata: { description: 'List the attachments on an issue, given its ID, with metadata (name, size, content type, author) capped by an optional limit. Use to discover attachment IDs before downloading or deleting them. Read-only and idempotent.', idempotent: true },
props: {
issue: issueDropdown,
limit: Property.Number({ displayName: 'Limit', description: 'Max attachments. Default 50.', required: false, defaultValue: 50 }),
},
async run(context) {
const { baseUrl, apiToken } = context.auth.props;
const limit = context.propsValue.limit ?? 50;
const response = await youtrackApiCall<Array<Record<string, unknown>>>({
baseUrl,
token: apiToken,
method: HttpMethod.GET,
path: '/issues/' + context.propsValue.issue + '/attachments',
queryParams: { fields: 'id,name,mimeType,size,author(name,login),created', '$top': String(limit) },
});
const data = response.body;
return (data || []).map((att) => ({
id: att['id'],
name: att['name'],
content_type: att['mimeType'] ?? null,
size_bytes: att['size'],
author_name: (att['author'] as Record<string, unknown>)?.['name'] ?? null,
author_login: (att['author'] as Record<string, unknown>)?.['login'] ?? null,
created: att['created'],
}));
},
});