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 { clockifyAuth } from '../../auth';
import { clockifyAiProps } from '../../common/ai-props';
import { clockifyApi } from '../../common/api';
import { userRolesOutputSchema } from '../../output-schemas';
export const addUserRoleAction = createAction({
auth: clockifyAuth,
name: 'clockify_add_user_role',
outputSchema: userRolesOutputSchema,
displayName: 'Add User Role',
description: 'Gives a user an admin or manager role.',
audience: 'ai',
classification: 'WRITE',
aiMetadata: {
description:
'Gives a workspace member the Workspace Admin, Team Manager or Project Manager role over an entity (see Entity ID). Workspace Admin grants full control of the workspace. Needs workspace admin. Returns the user roles after the change.',
idempotent: true,
},
props: {
workspaceId: clockifyAiProps.workspaceId({ required: true }),
userId: clockifyAiProps.userId({ required: true }),
role: Property.StaticDropdown({
displayName: 'Role',
required: true,
options: {
disabled: false,
options: [
{ label: 'Workspace Admin', value: 'WORKSPACE_ADMIN' },
{ label: 'Team Manager', value: 'TEAM_MANAGER' },
{ label: 'Project Manager', value: 'PROJECT_MANAGER' },
],
},
}),
entityId: Property.ShortText({
displayName: 'Entity ID',
description:
'What the role applies to. Workspace Admin: the workspace ID. Team Manager: the ID of the user (or user group) to manage. Project Manager: the project ID.',
required: true,
}),
entityIsUserGroup: Property.Checkbox({
displayName: 'Entity Is a User Group',
description:
'Team Manager only: set when Entity ID is a user group ID rather than a user ID. Default false.',
required: false,
}),
},
async run({ auth, propsValue }) {
return await clockifyApi.addUserRole({
auth,
workspaceId: propsValue.workspaceId,
userId: propsValue.userId,
role: propsValue.role,
entityId: propsValue.entityId,
sourceType: propsValue.entityIsUserGroup ? 'USER_GROUP' : undefined,
});
},
});