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 } from '@activepieces/pieces-framework';
import {
AuthenticationType,
httpClient,
HttpMethod,
} from '@activepieces/pieces-common';
import { straleAuth } from '../auth';
export const checkBalance = createAction({
name: 'check_balance',
auth: straleAuth,
displayName: 'Check Balance',
description:
'Returns the current wallet balance in EUR cents and formatted EUR. Use this before executing paid capabilities to verify sufficient funds. Requires an API key.',
audience: 'both',
aiMetadata: {
description:
'Look up the current Strale wallet balance (EUR cents plus a formatted EUR string). Use this to check available funds before running paid capabilities via Execute Capability. Read-only and idempotent; takes no input but requires an API key.',
idempotent: true,
},
props: {},
async run(context) {
const response = await httpClient.sendRequest({
url: 'https://api.strale.io/v1/wallet/balance',
method: HttpMethod.GET,
authentication: {
type: AuthenticationType.BEARER_TOKEN,
token: context.auth.secret_text,
},
});
const data = response.body as any;
return {
balance_cents: data.balance_cents,
balance_eur: `EUR ${(data.balance_cents / 100).toFixed(2)}`,
currency: data.currency,
};
},
});