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 { sageAccountingAuth } from '../auth';
import { sageAccountingClient } from '../client';
import { findStockItemActionOutputSchema } from '../output-schemas';
export const findStockItemAction = createAction({
auth: sageAccountingAuth,
name: 'find_stock_item',
classification: 'SEARCH',
displayName: 'Find Stock Item',
description: 'Searches for stock items in Sage Accounting by description or item code.',
audience: 'both',
aiMetadata: {
description:
'Search Sage Accounting stock items by description or item code (partial match). Returns zero or more matches. Read-only, safe to retry.',
idempotent: true,
},
outputSchema: findStockItemActionOutputSchema,
props: {
search: Property.ShortText({
displayName: 'Description or Item Code contains',
required: false,
}),
active: Property.Checkbox({ displayName: 'Active only', required: false }),
updatedOrCreatedSince: Property.DateTime({
displayName: 'Updated or Created Since',
description: 'Only return stock items changed since this date/time.',
required: false,
}),
maxResults: Property.Number({
displayName: 'Max results',
required: false,
defaultValue: 10,
display: 'stepper',
min: 1,
max: 200,
}),
},
async run(context) {
const { search, active, updatedOrCreatedSince, maxResults } = context.propsValue;
const { items } = await sageAccountingClient.list<Record<string, unknown>>({
accessToken: context.auth.access_token,
path: sageAccountingClient.paths.stockItems,
query: {
...(search ? { search } : {}),
...(active !== undefined ? { active: String(active) } : {}),
...(updatedOrCreatedSince ? { updated_or_created_since: updatedOrCreatedSince } : {}),
nested_attributes: 'all',
items_per_page: String(maxResults ?? 10),
},
});
return items;
},
});