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

876 B
Raw Blame
import { createAction } from '@activepieces/pieces-framework';
import { metabaseAiProps } from '../../ai-props';
import { metabaseApi } from '../../api';
import { metabaseAuth } from '../../auth';
import { metabaseGetSegmentOutputSchema } from '../../output-schemas';

export const getSegmentAction = createAction({
  auth: metabaseAuth,
  name: 'metabase_get_segment',
  outputSchema: metabaseGetSegmentOutputSchema,
  displayName: 'Get Segment',
  description: 'Get a segment by ID.',
  audience: 'ai',
  classification: 'READ',
  aiMetadata: {
    description: 'Returns one segment with its filter definition and table.',
    idempotent: true,
  },
  props: {
    segmentId: metabaseAiProps.segmentId({ required: true }),
  },
  async run({ auth, propsValue }) {
    return await metabaseApi.getSegment({
      auth,
      segmentId: propsValue.segmentId,
    });
  },
});