Skip to content

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

1.2 KB
Raw Blame
import { createAction } from '@activepieces/pieces-framework';
import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
import { clickupCommon, callClickUpApi } from '../../common';
import { clickupAuth } from '../../auth';
import { getFoldersOutputSchema } from '../../output-schemas';

export const clickupGetFolders = createAction({
  auth: clickupAuth,
  name: 'clickup_get_folders',
  classification: 'SEARCH',
  description: 'List all folders in a ClickUp space',
  audience: 'ai',
  aiMetadata: {
    description:
      'Read-only: list every folder in a ClickUp space, returning their IDs and names. Use to discover folder IDs before acting on a folder or creating a list inside one. Safe to call repeatedly.',
    idempotent: true,
  },
  displayName: 'Get Folders',
  outputSchema: getFoldersOutputSchema,
  props: {
    workspace_id: clickupCommon.workspace_id(),
    space_id: clickupCommon.space_id(),
  },
  async run(configValue) {
    const { space_id } = configValue.propsValue;
    const response = await callClickUpApi(
      HttpMethod.GET,
      `space/${space_id}/folder`,
      getAccessTokenOrThrow(configValue.auth),
      {}
    );

    return response.body;
  },
});