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.4 KB
Raw Blame
import { createAction, Property } from '@activepieces/pieces-framework';
import { assertNotNullOrUndefined } from '@activepieces/pieces-framework';
import { todoistLabelsClient } from '../common/client/labels-client';
import { todoistAuth } from '../..';
import { getLabelActionOutputSchema } from '../output-schemas';

export const todoistGetLabelAction = createAction({
  auth: todoistAuth,
  name: 'todoist_get_label',
  classification: 'READ',
  displayName: 'Get Label',
  description: 'Gets a single personal label by ID in Todoist.',
  audience: 'ai',
  aiMetadata: {
    description:
      'Fetches a single personal Todoist label by label_id (full record: name, color, order, favorite). Use when you already have the ID and want its current state; to discover IDs from names list everything with List Labels or filter with Search Labels. Read-only and idempotent.',
    idempotent: true,
  },
  outputSchema: getLabelActionOutputSchema,
  props: {
    label_id: Property.ShortText({
      displayName: 'Label ID',
      description: 'The ID of the personal label to fetch. Obtain it via List Labels or Search Labels.',
      required: true,
    }),
  },
  async run({ auth, propsValue }) {
    const token = auth.access_token;
    const { label_id } = propsValue;

    assertNotNullOrUndefined(token, 'token');
    assertNotNullOrUndefined(label_id, 'label_id');
    return await todoistLabelsClient.get({ token, label_id });
  },
});