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.1 KB
Raw Blame
import { HttpMethod, getAccessTokenOrThrow } from '@activepieces/pieces-common';
import { clickupCommon, callClickUpApi } from '../../common';
import { clickupAuth } from '../../auth';
import { createAction } from '@activepieces/pieces-framework';
import { getSpacesOutputSchema } from '../../output-schemas';

export const getClickupSpaces = createAction({
  auth: clickupAuth,
  name: 'get_spaces',
  classification: 'SEARCH',
  description: 'List the spaces in a ClickUp workspace.',
  audience: 'human',
  aiMetadata: { description: 'Read-only: list all spaces in a ClickUp workspace (team). Use to discover available spaces and their IDs before drilling into a specific space, folder, or list. Safe to call repeatedly.', idempotent: true },
  displayName: 'Get Spaces',
  props: {
    team_id: clickupCommon.workspace_id(),
  },
  outputSchema: getSpacesOutputSchema,
  async run(configValue) {
    const { team_id } = configValue.propsValue;
    const response = await callClickUpApi(
      HttpMethod.GET,
      `team/${team_id}/space`,
      getAccessTokenOrThrow(configValue.auth),
      {}
    );

    return response.body;
  },
});