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 { zooAuth } from '../../auth'
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
export const convertMassAction = createAction({
name: 'convert_mass',
classification: 'READ',
displayName: 'Convert Mass',
description: 'Convert mass measurements between different units',
audience: 'both',
aiMetadata: { description: 'Convert a single mass/weight value between units such as kilograms, grams, milligrams, pounds, ounces, and metric tons. Use only for mass; other quantities have their own dedicated convert actions. Read-only calculation that returns the same result for the same inputs.', idempotent: true },
auth: zooAuth,
// category: 'Unit Conversion',
props: {
value: Property.Number({
displayName: 'Value',
required: true,
description: 'The mass value to convert',
}),
inputUnit: Property.StaticDropdown({
displayName: 'Input Unit',
required: true,
options: {
options: [
{ label: 'Kilograms', value: 'kg' },
{ label: 'Grams', value: 'g' },
{ label: 'Milligrams', value: 'mg' },
{ label: 'Pounds', value: 'lb' },
{ label: 'Ounces', value: 'oz' },
{ label: 'Metric Tons', value: 't' },
],
},
}),
outputUnit: Property.StaticDropdown({
displayName: 'Output Unit',
required: true,
options: {
options: [
{ label: 'Kilograms', value: 'kg' },
{ label: 'Grams', value: 'g' },
{ label: 'Milligrams', value: 'mg' },
{ label: 'Pounds', value: 'lb' },
{ label: 'Ounces', value: 'oz' },
{ label: 'Metric Tons', value: 't' },
],
},
}),
},
async run({ auth, propsValue }) {
const response = await httpClient.sendRequest({
method: HttpMethod.GET,
url: `https://api.zoo.dev/unit/conversion/mass/${propsValue.inputUnit}/${propsValue.outputUnit}`,
headers: {
Authorization: `Bearer ${auth.secret_text}`,
},
queryParams: {
value: propsValue.value.toString(),
},
});
return response.body;
},
});