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 { callClickUpApi, clickupCommon } from '../../common';
import { clickupAuth } from '../../auth';
import { spaceOutputSchema } from '../../output-schemas';

export const getClickupSpace = createAction({
  auth: clickupAuth,
  name: 'get_space',
  classification: 'READ',
  description: 'Get one ClickUp space.',
  audience: 'human',
  aiMetadata: { description: 'Read-only: fetch the details of a single ClickUp space by its space ID. Use when you already know which space you want; to discover space IDs first, use the list-spaces action instead. Safe to call repeatedly.', idempotent: true },
  displayName: 'Get Space',
  props: {
    workspace_id: clickupCommon.workspace_id(),
    space_id: clickupCommon.space_id(),
  },
  outputSchema: spaceOutputSchema,
  async run(configValue) {
    const { space_id } = configValue.propsValue;
    const response = await callClickUpApi(
      HttpMethod.GET,
      `space/${space_id}`,
      getAccessTokenOrThrow(configValue.auth),
      {}
    );
    return response.body;
  },
});