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 {
GetRandomPasswordCommand,
} from '@aws-sdk/client-secrets-manager';
import { awsSecretsManagerCombinedAuth } from '../common/auth';
import { resolveSecretsManagerClient } from '../common/client';
export const getARandomPassword = createAction({
auth: awsSecretsManagerCombinedAuth,
name: 'getARandomPassword',
classification: 'READ',
displayName: 'Generate Random Password',
description: 'Generates a random password using AWS Secrets Manager.',
audience: 'both',
aiMetadata: {
description:
'Generates a random password using the AWS Secrets Manager service, with optional length and character-set controls (exclude specific characters/numbers/punctuation/case, include spaces, require each included type). Use when a flow needs a freshly generated strong password; it does not store anything. Not idempotent — each call returns a different password.',
idempotent: false,
},
props: {
passwordLength: Property.Number({
displayName: 'Password Length',
description: 'The length of the password (default: 32)',
required: false,
}),
excludeCharacters: Property.ShortText({
displayName: 'Exclude Characters',
description: 'Characters to exclude from the password',
required: false,
}),
excludeNumbers: Property.Checkbox({
displayName: 'Exclude Numbers',
description: 'Exclude numbers from the password',
required: false,
}),
excludePunctuation: Property.Checkbox({
displayName: 'Exclude Punctuation',
description: 'Exclude punctuation from the password',
required: false,
}),
excludeUppercase: Property.Checkbox({
displayName: 'Exclude Uppercase',
description: 'Exclude uppercase letters from the password',
required: false,
}),
excludeLowercase: Property.Checkbox({
displayName: 'Exclude Lowercase',
description: 'Exclude lowercase letters from the password',
required: false,
}),
includeSpace: Property.Checkbox({
displayName: 'Include Space',
description: 'Include space character in the password',
required: false,
}),
requireEachIncludedType: Property.Checkbox({
displayName: 'Require Each Included Type',
description: 'Require at least one of each included character type',
required: false,
}),
},
async run({ auth, propsValue, server }) {
const client = await resolveSecretsManagerClient({ auth: auth.props, server });
try {
const command = new GetRandomPasswordCommand({
PasswordLength: propsValue.passwordLength,
ExcludeCharacters: propsValue.excludeCharacters,
ExcludeNumbers: propsValue.excludeNumbers,
ExcludePunctuation: propsValue.excludePunctuation,
ExcludeUppercase: propsValue.excludeUppercase,
ExcludeLowercase: propsValue.excludeLowercase,
IncludeSpace: propsValue.includeSpace,
RequireEachIncludedType: propsValue.requireEachIncludedType,
});
const response = await client.send(command);
return response;
} catch (error: any) {
throw new Error(
`Failed to generate random password: ${
error.message ?? 'Unknown error'
}`
);
}
},
});