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 { HttpMethod } from '@activepieces/pieces-common';
import { createAction, Property } from '@activepieces/pieces-framework';
import { visibleAuth } from '../..';
import { visibleMakeRequest } from '../common';
export const createMetric = createAction({
name: 'create_metric',
displayName: 'Create Metric',
description: 'Create a new metric for a company.',
audience: 'both',
aiMetadata: {
description: 'Creates a new metric (a named, recurring data series with a reporting frequency and unit) for a Visible portfolio company. Use to register a KPI before reporting values against it. Requires the target company ID, a name, a frequency (daily, weekly, monthly, or quarterly), and a unit. Not idempotent: each call creates another metric even with identical inputs.',
idempotent: false,
},
auth: visibleAuth,
props: {
companyId: Property.ShortText({
displayName: 'Company ID',
required: true,
}),
name: Property.ShortText({
displayName: 'Name',
required: true,
}),
frequency: Property.StaticDropdown({
displayName: 'Frequency',
required: true,
options: {
options: [
{ label: 'Daily', value: 'daily' },
{ label: 'Weekly', value: 'weekly' },
{ label: 'Monthly', value: 'monthly' },
{ label: 'Quarterly', value: 'quarterly' },
],
},
}),
unit: Property.ShortText({
displayName: 'Unit',
required: true,
}),
},
async run({ auth, propsValue }) {
return await visibleMakeRequest({
accessToken: auth.secret_text,
method: HttpMethod.POST,
path: '/metrics',
body: {
metric: {
name: propsValue.name,
frequency: propsValue.frequency,
unit: propsValue.unit,
company_id: propsValue.companyId,
},
},
});
},
});