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

feat(metabase): add AI actions and output schemas (#16814)

Kishan Parmar2031119a8295
diff --git a/bun.lock b/bun.lock
index 12b9bac22f2..d848a8cd55e 100644
--- a/bun.lock
+++ b/bun.lock
@@ -5839,7 +5839,7 @@
},
"packages/pieces/community/metabase": {
"name": "@activepieces/piece-metabase",
- "version": "0.3.1",
+ "version": "0.4.0",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
diff --git a/packages/pieces/community/metabase/package.json b/packages/pieces/community/metabase/package.json
index 7a81fe84194..3243269688e 100644
--- a/packages/pieces/community/metabase/package.json
+++ b/packages/pieces/community/metabase/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-metabase",
- "version": "0.3.1",
+ "version": "0.4.0",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"dependencies": {
diff --git a/packages/pieces/community/metabase/src/index.ts b/packages/pieces/community/metabase/src/index.ts
index 40fb8c6eaa2..b61e99c2060 100644
--- a/packages/pieces/community/metabase/src/index.ts
+++ b/packages/pieces/community/metabase/src/index.ts
@@ -1,81 +1,24 @@
-import {
- createPiece,
- PieceAuth,
- Property,
-} from '@activepieces/pieces-framework';
+import { createPiece } from '@activepieces/pieces-framework';
import { getQuestion } from './lib/actions/get-question';
import { getQuestionPngPreview } from './lib/actions/get-png-rendering';
import { getDashboardQuestions } from './lib/actions/get-dashboard';
-import { queryMetabaseApi } from './lib/common';
import {
createCustomApiCallAction,
- HttpMethod,
is_chromium_installed,
} from '@activepieces/pieces-common';
import { getGraphQuestion } from './lib/actions/get-graph-question';
import { embedQuestion } from './lib/actions/embed-question';
-import { AppConnectionType } from '@activepieces/pieces-framework';
-
-const baseProps = {
- baseUrl: Property.ShortText({
- displayName: 'Metabase API base URL',
- required: true,
- }),
- apiKey: PieceAuth.SecretText({
- displayName: 'API key',
- description:
- 'Generate one on your Metabase instance (settings -> authentication -> API keys)',
- required: true,
- }),
-};
-
-const authProps = is_chromium_installed()
- ? {
- ...baseProps,
- embeddingKey: Property.ShortText({
- displayName: 'Embedding key',
- description:
- 'Needed if you want to generate a graph of a question (settings -> embedding -> static embedding).',
- required: false,
- }),
- }
- : baseProps;
-
-export const metabaseAuth = PieceAuth.CustomAuth({
- description: 'Metabase authentication requires a baseUrl and a password.',
- required: true,
- props: authProps,
+import { metabaseAuth } from './lib/auth';
+import { metabaseAiActions } from './lib/actions/ai';
- validate: async ({ auth }) => {
- try {
- await queryMetabaseApi(
- {
- endpoint: 'login-history/current',
- method: HttpMethod.GET,
- },
- {
- type: AppConnectionType.CUSTOM_AUTH,
- props: auth,
- }
- );
- return {
- valid: true,
- };
- } catch (e) {
- return {
- valid: false,
- error: 'Invalid API Key or base URL',
- };
- }
- },
-});
+export { metabaseAuth };
export const metabase = createPiece({
displayName: 'Metabase',
description: 'The simplest way to ask questions and learn from data',
auth: metabaseAuth,
- minimumSupportedRelease: '0.30.0',
+ minimumSupportedRelease: '0.88.2',
logoUrl: 'https://cdn.activepieces.com/pieces/metabase.png',
authors: ['AdamSelene', 'abuaboud', 'valentin-mourtialon', 'Kevinyu-alan'],
actions: [
@@ -84,6 +27,7 @@ export const metabase = createPiece({
getDashboardQuestions,
embedQuestion,
...(is_chromium_installed() ? [getGraphQuestion] : []),
+ ...metabaseAiActions,
createCustomApiCallAction({
auth: metabaseAuth,
baseUrl: (auth) =>
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/add-group-member.ts b/packages/pieces/community/metabase/src/lib/actions/ai/add-group-member.ts
new file mode 100644
index 00000000000..59980b42bcf
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/add-group-member.ts
@@ -0,0 +1,30 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseAddGroupMemberOutputSchema } from '../../output-schemas';
+
+export const addGroupMemberAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_add_group_member',
+ outputSchema: metabaseAddGroupMemberOutputSchema,
+ displayName: 'Add Group Member',
+ description: 'Add a user to a permission group.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ "Adds a user to a permission group and returns the group's memberships. Needs an admin key; fails if the user is already a member.",
+ idempotent: false,
+ },
+ props: {
+ groupId: metabaseAiProps.groupId({ required: true }),
+ userId: metabaseAiProps.userId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.addGroupMember({
+ auth,
+ body: { group_id: propsValue.groupId, user_id: propsValue.userId },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/check-database-health.ts b/packages/pieces/community/metabase/src/lib/actions/ai/check-database-health.ts
new file mode 100644
index 00000000000..9b9eabcf5c7
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/check-database-health.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseMoveCardsOutputSchema } from '../../output-schemas';
+
+export const checkDatabaseHealthAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_check_database_health',
+ outputSchema: metabaseMoveCardsOutputSchema,
+ displayName: 'Check Database Health',
+ description: 'Check that Metabase can connect to a database.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ "Tests Metabase's connection to a database and returns its status; an unreachable database returns an error status.",
+ idempotent: true,
+ },
+ props: {
+ databaseId: metabaseAiProps.databaseId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.checkDatabaseHealth({
+ auth,
+ databaseId: propsValue.databaseId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/convert-query-to-native.ts b/packages/pieces/community/metabase/src/lib/actions/ai/convert-query-to-native.ts
new file mode 100644
index 00000000000..1be169418b9
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/convert-query-to-native.ts
@@ -0,0 +1,34 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseConvertQueryToNativeOutputSchema } from '../../output-schemas';
+
+export const convertQueryToNativeAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_convert_query_to_native',
+ outputSchema: metabaseConvertQueryToNativeOutputSchema,
+ displayName: 'Convert Query to Native',
+ description: 'Get the SQL that a query-builder query compiles to.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Returns the native SQL (or database query) that a query-builder (MBQL) query compiles to, without running it.',
+ idempotent: true,
+ },
+ props: {
+ datasetQuery: Property.Json({
+ displayName: 'Dataset Query',
+ description:
+ 'An MBQL query, e.g. {"database": 1, "type": "query", "query": {"source-table": 2, "limit": 10}}. Get it from a card\'s `dataset_query` (Get Card).',
+ required: true,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.convertQueryToNative({
+ auth,
+ datasetQuery: propsValue.datasetQuery,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/copy-card.ts b/packages/pieces/community/metabase/src/lib/actions/ai/copy-card.ts
new file mode 100644
index 00000000000..8f430660bf2
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/copy-card.ts
@@ -0,0 +1,27 @@
+import { createAction } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseCopyCardOutputSchema } from '../../output-schemas';
+
+export const copyCardAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_copy_card',
+ outputSchema: metabaseCopyCardOutputSchema,
+ displayName: 'Copy Card',
+ description: 'Duplicate a saved question.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Creates a copy of a question (card) in the same collection and returns the new card. Each call creates another copy.',
+ idempotent: false,
+ },
+ props: {
+ cardId: metabaseAiProps.cardId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.copyCard({ auth, cardId: propsValue.cardId });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/copy-dashboard.ts b/packages/pieces/community/metabase/src/lib/actions/ai/copy-dashboard.ts
new file mode 100644
index 00000000000..a68890e5f5a
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/copy-dashboard.ts
@@ -0,0 +1,56 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseCopyDashboardOutputSchema } from '../../output-schemas';
+
+export const copyDashboardAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_copy_dashboard',
+ outputSchema: metabaseCopyDashboardOutputSchema,
+ displayName: 'Copy Dashboard',
+ description: 'Duplicate a dashboard.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Creates a copy of a dashboard and returns it. A deep copy also duplicates its questions; a shallow copy reuses them. Each call creates another copy.',
+ idempotent: false,
+ },
+ props: {
+ dashboardId: metabaseAiProps.dashboardId({ required: true }),
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'Name of the copy. Empty = the original name.',
+ required: false,
+ }),
+ description: Property.LongText({
+ displayName: 'Description',
+ required: false,
+ }),
+ collectionId: metabaseAiProps.collectionId({
+ required: false,
+ description:
+ 'Collection for the copy, from List Collections. Empty = the root collection.',
+ }),
+ isDeepCopy: Property.Checkbox({
+ displayName: 'Deep Copy',
+ description: 'Also duplicate the questions on the dashboard.',
+ required: false,
+ defaultValue: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.copyDashboard({
+ auth,
+ dashboardId: propsValue.dashboardId,
+ body: {
+ name: propsValue.name,
+ description: propsValue.description,
+ collection_id: propsValue.collectionId,
+ is_deep_copy: propsValue.isDeepCopy ?? false,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/create-action.ts b/packages/pieces/community/metabase/src/lib/actions/ai/create-action.ts
new file mode 100644
index 00000000000..fd1296a10b5
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/create-action.ts
@@ -0,0 +1,93 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseCreateActionOutputSchema } from '../../output-schemas';
+
+export const createActionAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_create_action',
+ outputSchema: metabaseCreateActionOutputSchema,
+ displayName: 'Create Action',
+ description: 'Create a Metabase action on a model.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ "Creates a Metabase action on a model: a SQL write query, or a basic create/update/delete row action. Needs actions enabled on the model's database. Each call creates a new action.",
+ idempotent: false,
+ },
+ props: {
+ name: Property.ShortText({
+ displayName: 'Name',
+ required: true,
+ }),
+ modelId: metabaseAiProps.cardId({
+ required: true,
+ displayName: 'Model ID',
+ description:
+ 'The model (a card of type model) the action belongs to, from List Cards.',
+ }),
+ type: Property.StaticDropdown({
+ displayName: 'Type',
+ description: 'SQL query, or a basic row action generated from the model.',
+ required: true,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'SQL query', value: 'query' },
+ { label: 'Basic row action', value: 'implicit' },
+ ],
+ },
+ }),
+ databaseId: metabaseAiProps.databaseId({
+ required: false,
+ description:
+ 'For SQL actions: the database to run against, from List Databases.',
+ }),
+ datasetQuery: Property.Json({
+ displayName: 'Dataset Query',
+ description:
+ 'For SQL actions: {"database": 1, "type": "native", "native": {"query": "UPDATE orders SET status = {{status}} WHERE id = {{id}}", "template-tags": {}}}.',
+ required: false,
+ }),
+ kind: Property.StaticDropdown({
+ displayName: 'Row Action',
+ description: 'For basic row actions: which operation.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Create row', value: 'row/create' },
+ { label: 'Update row', value: 'row/update' },
+ { label: 'Delete row', value: 'row/delete' },
+ ],
+ },
+ }),
+ parameters: Property.Json({
+ displayName: 'Parameters',
+ description:
+ 'For SQL actions: the parameter list, e.g. [{"id": "status", "type": "string/=", "target": ["variable", ["template-tag", "status"]]}].',
+ required: false,
+ }),
+ description: Property.LongText({
+ displayName: 'Description',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.createAction({
+ auth,
+ body: {
+ name: propsValue.name,
+ model_id: propsValue.modelId,
+ type: propsValue.type,
+ database_id: propsValue.databaseId,
+ dataset_query: propsValue.datasetQuery,
+ kind: propsValue.kind,
+ parameters: propsValue.parameters,
+ description: propsValue.description,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/create-alert.ts b/packages/pieces/community/metabase/src/lib/actions/ai/create-alert.ts
new file mode 100644
index 00000000000..837f7d5ed84
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/create-alert.ts
@@ -0,0 +1,114 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseCreateAlertOutputSchema } from '../../output-schemas';
+
+export const createAlertAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_create_alert',
+ outputSchema: metabaseCreateAlertOutputSchema,
+ displayName: 'Create Alert',
+ description: 'Create an email alert on a saved question.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Creates an email alert on a question (card) that runs on a cron schedule and emails Metabase users and/or external addresses when the condition is met. Each call creates a new alert.',
+ idempotent: false,
+ },
+ props: {
+ cardId: metabaseAiProps.cardId({ required: true }),
+ cronSchedule: Property.ShortText({
+ displayName: 'Cron Schedule',
+ description:
+ 'Quartz cron expression (seconds first), e.g. "0 0 9 * * ?" for every day at 09:00.',
+ required: true,
+ }),
+ sendCondition: Property.StaticDropdown({
+ displayName: 'Send When',
+ description:
+ 'When the alert fires. Goal conditions need a goal line on the chart.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'The question has results', value: 'has_result' },
+ { label: 'Results go above the goal', value: 'goal_above' },
+ { label: 'Results go below the goal', value: 'goal_below' },
+ ],
+ },
+ }),
+ sendOnce: Property.Checkbox({
+ displayName: 'Send Once',
+ description: 'Stop the alert after it fires the first time.',
+ required: false,
+ defaultValue: false,
+ }),
+ recipientUserIds: Property.Array({
+ displayName: 'Recipient User IDs',
+ description: 'Numeric IDs of Metabase users to email, from List Users.',
+ required: false,
+ }),
+ recipientEmails: Property.Array({
+ displayName: 'Recipient Emails',
+ description: 'External email addresses to send to.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const recipientUserIds = propsValue.recipientUserIds ?? [];
+ if (
+ !recipientUserIds.every(
+ (id): id is number => typeof id === 'number' && Number.isInteger(id)
+ )
+ ) {
+ throw new Error('Recipient User IDs must be a list of numeric IDs.');
+ }
+ const recipientEmails = propsValue.recipientEmails ?? [];
+ if (
+ !recipientEmails.every(
+ (value): value is string => typeof value === 'string' && value !== ''
+ )
+ ) {
+ throw new Error('Recipient Emails must be a list of non-empty strings.');
+ }
+ if (recipientUserIds.length + recipientEmails.length === 0) {
+ throw new Error(
+ 'Set at least one recipient in Recipient User IDs or Recipient Emails.'
+ );
+ }
+ return await metabaseApi.createAlert({
+ auth,
+ body: {
+ payload_type: 'notification/card',
+ payload: {
+ card_id: propsValue.cardId,
+ send_condition: propsValue.sendCondition ?? 'has_result',
+ send_once: propsValue.sendOnce ?? false,
+ },
+ subscriptions: [
+ {
+ type: 'notification-subscription/cron',
+ cron_schedule: propsValue.cronSchedule,
+ },
+ ],
+ handlers: [
+ {
+ channel_type: 'channel/email',
+ recipients: [
+ ...recipientUserIds.map((userId) => ({
+ type: 'notification-recipient/user',
+ user_id: userId,
+ })),
+ ...recipientEmails.map((email) => ({
+ type: 'notification-recipient/raw-value',
+ details: { value: email },
+ })),
+ ],
+ },
+ ],
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/create-bookmark.ts b/packages/pieces/community/metabase/src/lib/actions/ai/create-bookmark.ts
new file mode 100644
index 00000000000..841cf464b19
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/create-bookmark.ts
@@ -0,0 +1,47 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseCreateBookmarkOutputSchema } from '../../output-schemas';
+
+export const createBookmarkAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_create_bookmark',
+ outputSchema: metabaseCreateBookmarkOutputSchema,
+ displayName: 'Create Bookmark',
+ description: 'Bookmark a question, dashboard, collection or document.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ "Bookmarks an item for the connection's user. Fails if it is already bookmarked.",
+ idempotent: false,
+ },
+ props: {
+ model: Property.StaticDropdown({
+ displayName: 'Item Type',
+ required: true,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Question', value: 'card' },
+ { label: 'Dashboard', value: 'dashboard' },
+ { label: 'Collection', value: 'collection' },
+ { label: 'Document', value: 'document' },
+ ],
+ },
+ }),
+ itemId: Property.Number({
+ displayName: 'Item ID',
+ description:
+ 'Numeric ID of the item, from Search or the matching List action.',
+ required: true,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.createBookmark({
+ auth,
+ model: propsValue.model,
+ itemId: propsValue.itemId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/create-card-public-link.ts b/packages/pieces/community/metabase/src/lib/actions/ai/create-card-public-link.ts
new file mode 100644
index 00000000000..4733427a92a
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/create-card-public-link.ts
@@ -0,0 +1,30 @@
+import { createAction } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseCreateCardPublicLinkOutputSchema } from '../../output-schemas';
+
+export const createCardPublicLinkAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_create_card_public_link',
+ outputSchema: metabaseCreateCardPublicLinkOutputSchema,
+ displayName: 'Create Card Public Link',
+ description: 'Create a public, no-login link to a saved question.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Makes a question (card) viewable by anyone with the link and returns its public UUID; the link is {base URL}/public/question/{uuid}. Returns the existing UUID if the card is already shared. Needs an admin key and public sharing enabled.',
+ idempotent: true,
+ },
+ props: {
+ cardId: metabaseAiProps.cardId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.createCardPublicLink({
+ auth,
+ cardId: propsValue.cardId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/create-card.ts b/packages/pieces/community/metabase/src/lib/actions/ai/create-card.ts
new file mode 100644
index 00000000000..6e30b37c5ac
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/create-card.ts
@@ -0,0 +1,89 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseCreateCardOutputSchema } from '../../output-schemas';
+
+export const createCardAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_create_card',
+ outputSchema: metabaseCreateCardOutputSchema,
+ displayName: 'Create Card',
+ description: 'Create a saved question, model or metric.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Saves a new question (card), model or metric from a query definition. For SQL pass a native query; get database IDs from List Databases. Each call creates a new card.',
+ idempotent: false,
+ },
+ props: {
+ name: Property.ShortText({
+ displayName: 'Name',
+ required: true,
+ }),
+ datasetQuery: Property.Json({
+ displayName: 'Dataset Query',
+ description:
+ 'The query. SQL example: {"database": 1, "type": "native", "native": {"query": "SELECT * FROM orders LIMIT 10"}}. MBQL example: {"database": 1, "type": "query", "query": {"source-table": 2}}.',
+ required: true,
+ }),
+ display: Property.ShortText({
+ displayName: 'Display',
+ description:
+ 'Visualization type, e.g. table, bar, line, pie, scalar. Empty = table.',
+ required: false,
+ }),
+ parameters: Property.Json({
+ displayName: 'Parameters',
+ description:
+ 'Filter widgets for the SQL template tags, as a list. Needed before Run Card Query can filter by slug. Example for a {{category}} field-filter tag: [{"id": "<tag id>", "slug": "category", "name": "Category", "type": "string/=", "target": ["dimension", ["template-tag", "category"]]}]. Empty = none.',
+ required: false,
+ }),
+ visualizationSettings: Property.Json({
+ displayName: 'Visualization Settings',
+ description: 'Visualization settings object. Empty = defaults.',
+ required: false,
+ }),
+ description: Property.LongText({
+ displayName: 'Description',
+ required: false,
+ }),
+ collectionId: metabaseAiProps.collectionId({ required: false }),
+ dashboardId: metabaseAiProps.dashboardId({
+ required: false,
+ description:
+ 'Save the question inside this dashboard instead of a collection. Get it from List Dashboards.',
+ }),
+ type: Property.StaticDropdown({
+ displayName: 'Type',
+ description: 'Question, model or metric. Empty = question.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Question', value: 'question' },
+ { label: 'Model', value: 'model' },
+ { label: 'Metric', value: 'metric' },
+ ],
+ },
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.createCard({
+ auth,
+ body: {
+ name: propsValue.name,
+ dataset_query: propsValue.datasetQuery,
+ display: propsValue.display ?? 'table',
+ visualization_settings: propsValue.visualizationSettings ?? {},
+ parameters: propsValue.parameters,
+ description: propsValue.description,
+ collection_id: propsValue.collectionId,
+ dashboard_id: propsValue.dashboardId,
+ type: propsValue.type,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/create-collection.ts b/packages/pieces/community/metabase/src/lib/actions/ai/create-collection.ts
new file mode 100644
index 00000000000..36f60d2c776
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/create-collection.ts
@@ -0,0 +1,47 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseCreateCollectionOutputSchema } from '../../output-schemas';
+
+export const createCollectionAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_create_collection',
+ outputSchema: metabaseCreateCollectionOutputSchema,
+ displayName: 'Create Collection',
+ description: 'Create a collection.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Creates a collection (folder), optionally inside another one. Each call creates a new collection, even with the same name.',
+ idempotent: false,
+ },
+ props: {
+ name: Property.ShortText({
+ displayName: 'Name',
+ required: true,
+ }),
+ description: Property.LongText({
+ displayName: 'Description',
+ required: false,
+ }),
+ parentId: metabaseAiProps.collectionId({
+ required: false,
+ displayName: 'Parent Collection ID',
+ description:
+ 'Create it inside this collection, from List Collections. Empty = the root collection.',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.createCollection({
+ auth,
+ body: {
+ name: propsValue.name,
+ description: propsValue.description,
+ parent_id: propsValue.parentId,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/create-dashboard-public-link.ts b/packages/pieces/community/metabase/src/lib/actions/ai/create-dashboard-public-link.ts
new file mode 100644
index 00000000000..5b08e874b3c
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/create-dashboard-public-link.ts
@@ -0,0 +1,30 @@
+import { createAction } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseCreateCardPublicLinkOutputSchema } from '../../output-schemas';
+
+export const createDashboardPublicLinkAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_create_dashboard_public_link',
+ outputSchema: metabaseCreateCardPublicLinkOutputSchema,
+ displayName: 'Create Dashboard Public Link',
+ description: 'Create a public, no-login link to a dashboard.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Makes a dashboard viewable by anyone with the link and returns its public UUID; the link is {base URL}/public/dashboard/{uuid}. Returns the existing UUID if already shared. Needs an admin key and public sharing enabled.',
+ idempotent: true,
+ },
+ props: {
+ dashboardId: metabaseAiProps.dashboardId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.createDashboardPublicLink({
+ auth,
+ dashboardId: propsValue.dashboardId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/create-dashboard-subscription.ts b/packages/pieces/community/metabase/src/lib/actions/ai/create-dashboard-subscription.ts
new file mode 100644
index 00000000000..7ece237c324
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/create-dashboard-subscription.ts
@@ -0,0 +1,163 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseCreateDashboardSubscriptionOutputSchema } from '../../output-schemas';
+
+export const createDashboardSubscriptionAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_create_dashboard_subscription',
+ outputSchema: metabaseCreateDashboardSubscriptionOutputSchema,
+ displayName: 'Create Dashboard Subscription',
+ description: 'Email a dashboard on a schedule.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Creates an email subscription that sends every card of a dashboard on a schedule to Metabase users and/or external addresses. Each call creates a new subscription.',
+ idempotent: false,
+ },
+ props: {
+ dashboardId: metabaseAiProps.dashboardId({ required: true }),
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'Subscription name. Empty = the dashboard name.',
+ required: false,
+ }),
+ scheduleType: Property.StaticDropdown({
+ displayName: 'Frequency',
+ required: true,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Hourly', value: 'hourly' },
+ { label: 'Daily', value: 'daily' },
+ { label: 'Weekly', value: 'weekly' },
+ { label: 'Monthly', value: 'monthly' },
+ ],
+ },
+ }),
+ scheduleHour: Property.Number({
+ displayName: 'Hour',
+ description:
+ 'Hour of day (0-23, instance time zone) for daily, weekly and monthly. Defaults to 8.',
+ required: false,
+ }),
+ scheduleDay: Property.StaticDropdown({
+ displayName: 'Day',
+ description:
+ 'Day of the week for weekly, or with "first"/"last" for monthly.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Monday', value: 'mon' },
+ { label: 'Tuesday', value: 'tue' },
+ { label: 'Wednesday', value: 'wed' },
+ { label: 'Thursday', value: 'thu' },
+ { label: 'Friday', value: 'fri' },
+ { label: 'Saturday', value: 'sat' },
+ { label: 'Sunday', value: 'sun' },
+ ],
+ },
+ }),
+ scheduleFrame: Property.StaticDropdown({
+ displayName: 'Monthly On',
+ description:
+ 'For monthly: the first, middle or last day (or weekday with Day) of the month.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'First', value: 'first' },
+ { label: 'Middle', value: 'mid' },
+ { label: 'Last', value: 'last' },
+ ],
+ },
+ }),
+ skipIfEmpty: Property.Checkbox({
+ displayName: 'Skip If Empty',
+ description: 'Do not send when every card has no results.',
+ required: false,
+ defaultValue: false,
+ }),
+ recipientUserIds: Property.Array({
+ displayName: 'Recipient User IDs',
+ description: 'Numeric IDs of Metabase users to email, from List Users.',
+ required: false,
+ }),
+ recipientEmails: Property.Array({
+ displayName: 'Recipient Emails',
+ description: 'External email addresses to send to.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const recipientUserIds = propsValue.recipientUserIds ?? [];
+ if (
+ !recipientUserIds.every(
+ (id): id is number => typeof id === 'number' && Number.isInteger(id)
+ )
+ ) {
+ throw new Error('Recipient User IDs must be a list of numeric IDs.');
+ }
+ const recipientEmails = propsValue.recipientEmails ?? [];
+ if (
+ !recipientEmails.every(
+ (value): value is string => typeof value === 'string' && value !== ''
+ )
+ ) {
+ throw new Error('Recipient Emails must be a list of non-empty strings.');
+ }
+ if (recipientUserIds.length + recipientEmails.length === 0) {
+ throw new Error(
+ 'Set at least one recipient in Recipient User IDs or Recipient Emails.'
+ );
+ }
+ const dashboard = await metabaseApi.getDashboard({
+ auth,
+ dashboardId: propsValue.dashboardId,
+ });
+ const cards = (dashboard.dashcards ?? []).flatMap((dashcard) =>
+ dashcard.card_id
+ ? [
+ {
+ id: dashcard.card_id,
+ dashboard_card_id: dashcard.id,
+ include_csv: false,
+ include_xls: false,
+ },
+ ]
+ : []
+ );
+ if (cards.length === 0) {
+ throw new Error('The dashboard has no question cards to send.');
+ }
+ return await metabaseApi.createDashboardSubscription({
+ auth,
+ body: {
+ name: propsValue.name ?? dashboard.name,
+ dashboard_id: propsValue.dashboardId,
+ cards,
+ skip_if_empty: propsValue.skipIfEmpty ?? false,
+ channels: [
+ {
+ channel_type: 'email',
+ enabled: true,
+ schedule_type: propsValue.scheduleType,
+ schedule_hour:
+ propsValue.scheduleType === 'hourly'
+ ? null
+ : propsValue.scheduleHour ?? 8,
+ schedule_day: propsValue.scheduleDay ?? null,
+ schedule_frame: propsValue.scheduleFrame ?? null,
+ recipients: [
+ ...recipientUserIds.map((id) => ({ id })),
+ ...recipientEmails.map((email) => ({ email })),
+ ],
+ },
+ ],
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/create-dashboard.ts b/packages/pieces/community/metabase/src/lib/actions/ai/create-dashboard.ts
new file mode 100644
index 00000000000..8d5ce635875
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/create-dashboard.ts
@@ -0,0 +1,49 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseCreateDashboardOutputSchema } from '../../output-schemas';
+
+export const createDashboardAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_create_dashboard',
+ outputSchema: metabaseCreateDashboardOutputSchema,
+ displayName: 'Create Dashboard',
+ description: 'Create an empty dashboard.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Creates a new, empty dashboard in a collection. Add cards afterwards with Update Dashboard (dashcards). Each call creates a new dashboard.',
+ idempotent: false,
+ },
+ props: {
+ name: Property.ShortText({
+ displayName: 'Name',
+ required: true,
+ }),
+ description: Property.LongText({
+ displayName: 'Description',
+ required: false,
+ }),
+ collectionId: metabaseAiProps.collectionId({ required: false }),
+ parameters: Property.Json({
+ displayName: 'Parameters',
+ description:
+ 'Dashboard filters, as an array: [{"id": "a1b2c3d4", "name": "Category", "slug": "category", "type": "string/="}]. Empty = no filters.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.createDashboard({
+ auth,
+ body: {
+ name: propsValue.name,
+ description: propsValue.description,
+ collection_id: propsValue.collectionId,
+ parameters: propsValue.parameters,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/create-document.ts b/packages/pieces/community/metabase/src/lib/actions/ai/create-document.ts
new file mode 100644
index 00000000000..7d78d47796e
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/create-document.ts
@@ -0,0 +1,65 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseCreateDocumentOutputSchema } from '../../output-schemas';
+
+export const createDocumentAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_create_document',
+ outputSchema: metabaseCreateDocumentOutputSchema,
+ displayName: 'Create Document',
+ description: 'Create a document.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Creates a document (rich-text report) in a collection from plain text or ProseMirror JSON. Each call creates a new document.',
+ idempotent: false,
+ },
+ props: {
+ name: Property.ShortText({
+ displayName: 'Name',
+ required: true,
+ }),
+ text: Property.LongText({
+ displayName: 'Text',
+ description:
+ 'Plain-text content; blank lines separate paragraphs. Set this or Content, not both.',
+ required: false,
+ }),
+ content: Property.Json({
+ displayName: 'Content',
+ description:
+ 'Rich content as a ProseMirror document, e.g. {"type": "doc", "content": [{"type": "paragraph", "content": [{"type": "text", "text": "Hello"}]}]}. Set this or Text, not both.',
+ required: false,
+ }),
+ collectionId: metabaseAiProps.collectionId({ required: false }),
+ },
+ async run({ auth, propsValue }) {
+ if (propsValue.text !== undefined && propsValue.content !== undefined) {
+ throw new Error('Set either Text or Content, not both.');
+ }
+ const document =
+ propsValue.text === undefined
+ ? propsValue.content
+ : {
+ type: 'doc',
+ content: propsValue.text.split(/\n\s*\n/).map((paragraph) => ({
+ type: 'paragraph',
+ content: [{ type: 'text', text: paragraph }],
+ })),
+ };
+ if (document === undefined) {
+ throw new Error('Set Text or Content.');
+ }
+ return await metabaseApi.createDocument({
+ auth,
+ body: {
+ name: propsValue.name,
+ document,
+ collection_id: propsValue.collectionId,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/create-glossary-entry.ts b/packages/pieces/community/metabase/src/lib/actions/ai/create-glossary-entry.ts
new file mode 100644
index 00000000000..6aa1090d7ce
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/create-glossary-entry.ts
@@ -0,0 +1,35 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseCreateGlossaryEntryOutputSchema } from '../../output-schemas';
+
+export const createGlossaryEntryAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_create_glossary_entry',
+ outputSchema: metabaseCreateGlossaryEntryOutputSchema,
+ displayName: 'Create Glossary Entry',
+ description: 'Add a term to the business glossary.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Adds a term and its definition to the business glossary. Each call creates a new entry.',
+ idempotent: false,
+ },
+ props: {
+ term: Property.ShortText({
+ displayName: 'Term',
+ required: true,
+ }),
+ definition: Property.LongText({
+ displayName: 'Definition',
+ required: true,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.createGlossaryEntry({
+ auth,
+ body: { term: propsValue.term, definition: propsValue.definition },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/create-group.ts b/packages/pieces/community/metabase/src/lib/actions/ai/create-group.ts
new file mode 100644
index 00000000000..e710f4b8e9d
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/create-group.ts
@@ -0,0 +1,31 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseCreateGroupOutputSchema } from '../../output-schemas';
+
+export const createGroupAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_create_group',
+ outputSchema: metabaseCreateGroupOutputSchema,
+ displayName: 'Create Group',
+ description: 'Create a permission group.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Creates a permission group. Fails if a group with the same name exists. Needs an admin key.',
+ idempotent: false,
+ },
+ props: {
+ name: Property.ShortText({
+ displayName: 'Name',
+ required: true,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.createGroup({
+ auth,
+ body: { name: propsValue.name },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/create-segment.ts b/packages/pieces/community/metabase/src/lib/actions/ai/create-segment.ts
new file mode 100644
index 00000000000..85822df70c9
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/create-segment.ts
@@ -0,0 +1,45 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseGetSegmentOutputSchema } from '../../output-schemas';
+
+export const createSegmentAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_create_segment',
+ outputSchema: metabaseGetSegmentOutputSchema,
+ displayName: 'Create Segment',
+ description: 'Create a segment (named filter) on a table.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Creates a segment: a named filter on a table that users can reuse. Needs an admin key. Each call creates a new segment.',
+ idempotent: false,
+ },
+ props: {
+ name: Property.ShortText({
+ displayName: 'Name',
+ required: true,
+ }),
+ definition: Property.Json({
+ displayName: 'Definition',
+ description:
+ 'The filter as a full MBQL query on one table, e.g. {"database": 1, "type": "query", "query": {"source-table": 2, "filter": ["=", ["field", 13, null], "Gizmo"]}}. Get table and field ids from Get Table Metadata.',
+ required: true,
+ }),
+ description: Property.LongText({
+ displayName: 'Description',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.createSegment({
+ auth,
+ body: {
+ name: propsValue.name,
+ definition: propsValue.definition,
+ description: propsValue.description,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/create-snippet.ts b/packages/pieces/community/metabase/src/lib/actions/ai/create-snippet.ts
new file mode 100644
index 00000000000..39ff7053c0e
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/create-snippet.ts
@@ -0,0 +1,45 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseCreateSnippetOutputSchema } from '../../output-schemas';
+
+export const createSnippetAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_create_snippet',
+ outputSchema: metabaseCreateSnippetOutputSchema,
+ displayName: 'Create Snippet',
+ description: 'Create a reusable SQL snippet.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Creates a reusable SQL snippet that SQL questions can include as {{snippet: Name}}. Names must be unique; a duplicate name fails.',
+ idempotent: false,
+ },
+ props: {
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'Unique snippet name, used as {{snippet: Name}} in SQL.',
+ required: true,
+ }),
+ content: Property.LongText({
+ displayName: 'SQL',
+ description: 'The SQL fragment.',
+ required: true,
+ }),
+ description: Property.LongText({
+ displayName: 'Description',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.createSnippet({
+ auth,
+ body: {
+ name: propsValue.name,
+ content: propsValue.content,
+ description: propsValue.description,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/create-timeline-event.ts b/packages/pieces/community/metabase/src/lib/actions/ai/create-timeline-event.ts
new file mode 100644
index 00000000000..5502559704f
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/create-timeline-event.ts
@@ -0,0 +1,79 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseCreateTimelineEventOutputSchema } from '../../output-schemas';
+
+export const createTimelineEventAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_create_timeline_event',
+ outputSchema: metabaseCreateTimelineEventOutputSchema,
+ displayName: 'Create Timeline Event',
+ description: 'Add an event to a timeline.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Adds an event (e.g. a launch or outage) to a timeline so it shows on time-series charts. Each call creates a new event.',
+ idempotent: false,
+ },
+ props: {
+ timelineId: metabaseAiProps.timelineId({ required: true }),
+ name: Property.ShortText({
+ displayName: 'Name',
+ required: true,
+ }),
+ timestamp: Property.DateTime({
+ displayName: 'Timestamp',
+ description:
+ 'When the event happened, ISO 8601, e.g. 2026-05-01T09:00:00Z.',
+ required: true,
+ }),
+ timezone: Property.ShortText({
+ displayName: 'Time Zone',
+ description:
+ 'IANA time zone of the timestamp, e.g. Europe/Berlin. Defaults to UTC.',
+ required: false,
+ }),
+ timeMatters: Property.Checkbox({
+ displayName: 'Time Matters',
+ description: 'Show the time of day, not just the date.',
+ required: false,
+ defaultValue: false,
+ }),
+ description: Property.LongText({
+ displayName: 'Description',
+ required: false,
+ }),
+ icon: Property.StaticDropdown({
+ displayName: 'Icon',
+ description: 'Icon shown on charts. Empty = default.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Star', value: 'star' },
+ { label: 'Cake', value: 'cake' },
+ { label: 'Mail', value: 'mail' },
+ { label: 'Warning', value: 'warning' },
+ { label: 'Bell', value: 'bell' },
+ { label: 'Cloud', value: 'cloud' },
+ ],
+ },
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.createTimelineEvent({
+ auth,
+ body: {
+ timeline_id: propsValue.timelineId,
+ name: propsValue.name,
+ timestamp: propsValue.timestamp,
+ timezone: propsValue.timezone ?? 'UTC',
+ time_matters: propsValue.timeMatters ?? false,
+ description: propsValue.description,
+ icon: propsValue.icon,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/create-timeline.ts b/packages/pieces/community/metabase/src/lib/actions/ai/create-timeline.ts
new file mode 100644
index 00000000000..fb561efdbbb
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/create-timeline.ts
@@ -0,0 +1,58 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseCreateTimelineOutputSchema } from '../../output-schemas';
+
+export const createTimelineAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_create_timeline',
+ outputSchema: metabaseCreateTimelineOutputSchema,
+ displayName: 'Create Timeline',
+ description: 'Create an event timeline in a collection.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Creates an event timeline in a collection; add events with Create Timeline Event. Each call creates a new timeline.',
+ idempotent: false,
+ },
+ props: {
+ name: Property.ShortText({
+ displayName: 'Name',
+ required: true,
+ }),
+ description: Property.LongText({
+ displayName: 'Description',
+ required: false,
+ }),
+ collectionId: metabaseAiProps.collectionId({ required: false }),
+ icon: Property.StaticDropdown({
+ displayName: 'Icon',
+ description: 'Icon shown on charts. Empty = default.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Star', value: 'star' },
+ { label: 'Cake', value: 'cake' },
+ { label: 'Mail', value: 'mail' },
+ { label: 'Warning', value: 'warning' },
+ { label: 'Bell', value: 'bell' },
+ { label: 'Cloud', value: 'cloud' },
+ ],
+ },
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.createTimeline({
+ auth,
+ body: {
+ name: propsValue.name,
+ description: propsValue.description,
+ collection_id: propsValue.collectionId,
+ icon: propsValue.icon,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/create-user.ts b/packages/pieces/community/metabase/src/lib/actions/ai/create-user.ts
new file mode 100644
index 00000000000..465126fdcc7
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/create-user.ts
@@ -0,0 +1,68 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseCreateUserOutputSchema } from '../../output-schemas';
+
+export const createUserAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_create_user',
+ outputSchema: metabaseCreateUserOutputSchema,
+ displayName: 'Create User',
+ description: 'Invite a new user.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Creates a user and emails them an invite (when email is configured), optionally adding them to groups. Needs an admin key; fails if the email already exists.',
+ idempotent: false,
+ },
+ props: {
+ email: Property.ShortText({
+ displayName: 'Email',
+ required: true,
+ }),
+ firstName: Property.ShortText({
+ displayName: 'First Name',
+ required: false,
+ }),
+ lastName: Property.ShortText({
+ displayName: 'Last Name',
+ required: false,
+ }),
+ groupIds: Property.Array({
+ displayName: 'Group IDs',
+ description:
+ 'Numeric IDs of groups to add the user to, from List Groups. Empty = default group only.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const groupIds = propsValue.groupIds ?? [];
+ if (
+ !groupIds.every(
+ (id): id is number => typeof id === 'number' && Number.isInteger(id)
+ )
+ ) {
+ throw new Error('Group IDs must be a list of numeric IDs.');
+ }
+ const allUsersGroupIds =
+ groupIds.length > 0
+ ? (await metabaseApi.listGroups({ auth }))
+ .filter((group) => group.magic_group_type === 'all-internal-users')
+ .map((group) => group.id)
+ : [];
+ const memberships = [...new Set([...allUsersGroupIds, ...groupIds])];
+ return await metabaseApi.createUser({
+ auth,
+ body: {
+ email: propsValue.email,
+ first_name: propsValue.firstName,
+ last_name: propsValue.lastName,
+ user_group_memberships:
+ memberships.length > 0
+ ? memberships.map((id) => ({ id }))
+ : undefined,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/deactivate-user.ts b/packages/pieces/community/metabase/src/lib/actions/ai/deactivate-user.ts
new file mode 100644
index 00000000000..9dd027ae5b3
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/deactivate-user.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseDeactivateUserOutputSchema } from '../../output-schemas';
+
+export const deactivateUserAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_deactivate_user',
+ outputSchema: metabaseDeactivateUserOutputSchema,
+ displayName: 'Deactivate User',
+ description: 'Deactivate a user.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description:
+ 'Deactivates a user so they can no longer log in; their content stays. Reverse it with Reactivate User. Needs an admin key.',
+ idempotent: true,
+ },
+ props: {
+ userId: metabaseAiProps.userId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.deactivateUser({
+ auth,
+ userId: propsValue.userId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/delete-action.ts b/packages/pieces/community/metabase/src/lib/actions/ai/delete-action.ts
new file mode 100644
index 00000000000..bfc56173100
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/delete-action.ts
@@ -0,0 +1,30 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseDeleteActionOutputSchema } from '../../output-schemas';
+
+export const deleteActionAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_delete_action',
+ outputSchema: metabaseDeleteActionOutputSchema,
+ displayName: 'Delete Action',
+ description: 'Permanently delete a Metabase action.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description:
+ 'Permanently deletes a Metabase action. To hide it instead (recoverable), use Update Action with Archived = Yes.',
+ idempotent: false,
+ },
+ props: {
+ actionId: metabaseAiProps.actionId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ await metabaseApi.deleteAction({
+ auth,
+ actionId: propsValue.actionId,
+ });
+ return { deleted: true, actionId: propsValue.actionId };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/delete-bookmark.ts b/packages/pieces/community/metabase/src/lib/actions/ai/delete-bookmark.ts
new file mode 100644
index 00000000000..0f166ab8a56
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/delete-bookmark.ts
@@ -0,0 +1,52 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseDeleteBookmarkOutputSchema } from '../../output-schemas';
+
+export const deleteBookmarkAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_delete_bookmark',
+ outputSchema: metabaseDeleteBookmarkOutputSchema,
+ displayName: 'Delete Bookmark',
+ description: 'Remove a bookmark.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ "Removes the connection user's bookmark from an item; the item itself is untouched.",
+ idempotent: true,
+ },
+ props: {
+ model: Property.StaticDropdown({
+ displayName: 'Item Type',
+ required: true,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Question', value: 'card' },
+ { label: 'Dashboard', value: 'dashboard' },
+ { label: 'Collection', value: 'collection' },
+ { label: 'Document', value: 'document' },
+ ],
+ },
+ }),
+ itemId: Property.Number({
+ displayName: 'Item ID',
+ description:
+ 'Numeric ID of the item, from Search or the matching List action.',
+ required: true,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ await metabaseApi.deleteBookmark({
+ auth,
+ model: propsValue.model,
+ itemId: propsValue.itemId,
+ });
+ return {
+ deleted: true,
+ model: propsValue.model,
+ itemId: propsValue.itemId,
+ };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/delete-card-public-link.ts b/packages/pieces/community/metabase/src/lib/actions/ai/delete-card-public-link.ts
new file mode 100644
index 00000000000..c87f579ca02
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/delete-card-public-link.ts
@@ -0,0 +1,28 @@
+import { createAction } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseDeleteCardOutputSchema } from '../../output-schemas';
+
+export const deleteCardPublicLinkAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_delete_card_public_link',
+ outputSchema: metabaseDeleteCardOutputSchema,
+ displayName: 'Delete Card Public Link',
+ description: 'Turn off the public link of a saved question.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description:
+ "Disables a question's public link so it no longer opens without login. A new link from Create Card Public Link gets a different UUID. Needs an admin key.",
+ idempotent: false,
+ },
+ props: {
+ cardId: metabaseAiProps.cardId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ await metabaseApi.deleteCardPublicLink({ auth, cardId: propsValue.cardId });
+ return { deleted: true, cardId: propsValue.cardId };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/delete-card.ts b/packages/pieces/community/metabase/src/lib/actions/ai/delete-card.ts
new file mode 100644
index 00000000000..ae09197645b
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/delete-card.ts
@@ -0,0 +1,28 @@
+import { createAction } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseDeleteCardOutputSchema } from '../../output-schemas';
+
+export const deleteCardAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_delete_card',
+ outputSchema: metabaseDeleteCardOutputSchema,
+ displayName: 'Delete Card',
+ description: 'Permanently delete a saved question, model or metric.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description:
+ 'Permanently deletes a question (card); this cannot be undone. To move it to the trash instead (recoverable), use Update Card with Archived = Yes.',
+ idempotent: false,
+ },
+ props: {
+ cardId: metabaseAiProps.cardId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ await metabaseApi.deleteCard({ auth, cardId: propsValue.cardId });
+ return { deleted: true, cardId: propsValue.cardId };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/delete-collection.ts b/packages/pieces/community/metabase/src/lib/actions/ai/delete-collection.ts
new file mode 100644
index 00000000000..7b8b5e8da49
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/delete-collection.ts
@@ -0,0 +1,35 @@
+import { createAction } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseDeleteCollectionOutputSchema } from '../../output-schemas';
+
+export const deleteCollectionAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_delete_collection',
+ outputSchema: metabaseDeleteCollectionOutputSchema,
+ displayName: 'Delete Collection',
+ description: 'Permanently delete a trashed collection.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description:
+ 'Permanently deletes a collection that is already in the trash (archive it first with Update Collection); this cannot be undone.',
+ idempotent: false,
+ },
+ props: {
+ collectionId: metabaseAiProps.collectionId({
+ required: true,
+ description:
+ 'Numeric ID of a trashed collection, from List Collections with Archived = Yes.',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ await metabaseApi.deleteCollection({
+ auth,
+ collectionId: propsValue.collectionId,
+ });
+ return { deleted: true, collectionId: propsValue.collectionId };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/delete-dashboard-public-link.ts b/packages/pieces/community/metabase/src/lib/actions/ai/delete-dashboard-public-link.ts
new file mode 100644
index 00000000000..a0a2ab80cf7
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/delete-dashboard-public-link.ts
@@ -0,0 +1,31 @@
+import { createAction } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseDeleteDashboardOutputSchema } from '../../output-schemas';
+
+export const deleteDashboardPublicLinkAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_delete_dashboard_public_link',
+ outputSchema: metabaseDeleteDashboardOutputSchema,
+ displayName: 'Delete Dashboard Public Link',
+ description: 'Turn off the public link of a dashboard.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description:
+ "Disables a dashboard's public link so it no longer opens without login. A new link from Create Dashboard Public Link gets a different UUID. Needs an admin key.",
+ idempotent: false,
+ },
+ props: {
+ dashboardId: metabaseAiProps.dashboardId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ await metabaseApi.deleteDashboardPublicLink({
+ auth,
+ dashboardId: propsValue.dashboardId,
+ });
+ return { deleted: true, dashboardId: propsValue.dashboardId };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/delete-dashboard.ts b/packages/pieces/community/metabase/src/lib/actions/ai/delete-dashboard.ts
new file mode 100644
index 00000000000..9d9888e175e
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/delete-dashboard.ts
@@ -0,0 +1,31 @@
+import { createAction } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseDeleteDashboardOutputSchema } from '../../output-schemas';
+
+export const deleteDashboardAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_delete_dashboard',
+ outputSchema: metabaseDeleteDashboardOutputSchema,
+ displayName: 'Delete Dashboard',
+ description: 'Permanently delete a dashboard.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description:
+ 'Permanently deletes a dashboard; this cannot be undone. To move it to the trash instead (recoverable), use Update Dashboard with Archived = Yes.',
+ idempotent: false,
+ },
+ props: {
+ dashboardId: metabaseAiProps.dashboardId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ await metabaseApi.deleteDashboard({
+ auth,
+ dashboardId: propsValue.dashboardId,
+ });
+ return { deleted: true, dashboardId: propsValue.dashboardId };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/delete-document.ts b/packages/pieces/community/metabase/src/lib/actions/ai/delete-document.ts
new file mode 100644
index 00000000000..24a78e120c1
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/delete-document.ts
@@ -0,0 +1,35 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseDeleteDocumentOutputSchema } from '../../output-schemas';
+
+export const deleteDocumentAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_delete_document',
+ outputSchema: metabaseDeleteDocumentOutputSchema,
+ displayName: 'Delete Document',
+ description: 'Permanently delete a document.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description:
+ 'Permanently deletes a document (it is moved to the trash first, as Metabase requires). To only move it to the trash (recoverable), use Update Document with Archived = Yes.',
+ idempotent: false,
+ },
+ props: {
+ documentId: metabaseAiProps.documentId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ await metabaseApi.updateDocument({
+ auth,
+ documentId: propsValue.documentId,
+ body: { archived: true },
+ });
+ await metabaseApi.deleteDocument({
+ auth,
+ documentId: propsValue.documentId,
+ });
+ return { deleted: true, documentId: propsValue.documentId };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/delete-glossary-entry.ts b/packages/pieces/community/metabase/src/lib/actions/ai/delete-glossary-entry.ts
new file mode 100644
index 00000000000..9eed7a2fbb3
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/delete-glossary-entry.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseDeleteGlossaryEntryOutputSchema } from '../../output-schemas';
+
+export const deleteGlossaryEntryAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_delete_glossary_entry',
+ outputSchema: metabaseDeleteGlossaryEntryOutputSchema,
+ displayName: 'Delete Glossary Entry',
+ description: 'Delete a glossary term.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description: 'Permanently deletes a glossary entry.',
+ idempotent: false,
+ },
+ props: {
+ glossaryId: metabaseAiProps.glossaryId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ await metabaseApi.deleteGlossaryEntry({
+ auth,
+ glossaryId: propsValue.glossaryId,
+ });
+ return { deleted: true, glossaryId: propsValue.glossaryId };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/delete-group.ts b/packages/pieces/community/metabase/src/lib/actions/ai/delete-group.ts
new file mode 100644
index 00000000000..71a1f787ae5
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/delete-group.ts
@@ -0,0 +1,30 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseDeleteGroupOutputSchema } from '../../output-schemas';
+
+export const deleteGroupAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_delete_group',
+ outputSchema: metabaseDeleteGroupOutputSchema,
+ displayName: 'Delete Group',
+ description: 'Delete a permission group.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description:
+ 'Permanently deletes a permission group and its memberships; members lose the access it granted. Needs an admin key.',
+ idempotent: false,
+ },
+ props: {
+ groupId: metabaseAiProps.groupId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ await metabaseApi.deleteGroup({
+ auth,
+ groupId: propsValue.groupId,
+ });
+ return { deleted: true, groupId: propsValue.groupId };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/delete-segment.ts b/packages/pieces/community/metabase/src/lib/actions/ai/delete-segment.ts
new file mode 100644
index 00000000000..56bc5070079
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/delete-segment.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseDeleteSegmentOutputSchema } from '../../output-schemas';
+
+export const deleteSegmentAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_delete_segment',
+ outputSchema: metabaseDeleteSegmentOutputSchema,
+ displayName: 'Delete Segment',
+ description: 'Delete a segment.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description:
+ 'Retires a segment, with a revision message kept in its history. Metabase archives rather than erases it: Get Segment still returns it with archived = true, and it no longer appears in List Segments or the query builder. Needs an admin key.',
+ idempotent: false,
+ },
+ props: {
+ segmentId: metabaseAiProps.segmentId({ required: true }),
+ revisionMessage: Property.ShortText({
+ displayName: 'Revision Message',
+ description:
+ 'Why the change was made, kept in the history. Required by Metabase.',
+ required: true,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ await metabaseApi.deleteSegment({
+ auth,
+ segmentId: propsValue.segmentId,
+ revisionMessage: propsValue.revisionMessage,
+ });
+ return { deleted: true, segmentId: propsValue.segmentId };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/delete-timeline-event.ts b/packages/pieces/community/metabase/src/lib/actions/ai/delete-timeline-event.ts
new file mode 100644
index 00000000000..79130b993c1
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/delete-timeline-event.ts
@@ -0,0 +1,30 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseDeleteTimelineEventOutputSchema } from '../../output-schemas';
+
+export const deleteTimelineEventAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_delete_timeline_event',
+ outputSchema: metabaseDeleteTimelineEventOutputSchema,
+ displayName: 'Delete Timeline Event',
+ description: 'Permanently delete a timeline event.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description:
+ 'Permanently deletes a timeline event. To hide it instead (recoverable), use Update Timeline Event with Archived = Yes.',
+ idempotent: false,
+ },
+ props: {
+ eventId: metabaseAiProps.timelineEventId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ await metabaseApi.deleteTimelineEvent({
+ auth,
+ eventId: propsValue.eventId,
+ });
+ return { deleted: true, eventId: propsValue.eventId };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/delete-timeline.ts b/packages/pieces/community/metabase/src/lib/actions/ai/delete-timeline.ts
new file mode 100644
index 00000000000..d7b26a47ae8
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/delete-timeline.ts
@@ -0,0 +1,30 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseDeleteTimelineOutputSchema } from '../../output-schemas';
+
+export const deleteTimelineAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_delete_timeline',
+ outputSchema: metabaseDeleteTimelineOutputSchema,
+ displayName: 'Delete Timeline',
+ description: 'Permanently delete a timeline and its events.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description:
+ 'Permanently deletes a timeline and all its events. To hide it instead (recoverable), use Update Timeline with Archived = Yes.',
+ idempotent: false,
+ },
+ props: {
+ timelineId: metabaseAiProps.timelineId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ await metabaseApi.deleteTimeline({
+ auth,
+ timelineId: propsValue.timelineId,
+ });
+ return { deleted: true, timelineId: propsValue.timelineId };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/discard-database-field-values.ts b/packages/pieces/community/metabase/src/lib/actions/ai/discard-database-field-values.ts
new file mode 100644
index 00000000000..40f70c4d646
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/discard-database-field-values.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseMoveCardsOutputSchema } from '../../output-schemas';
+
+export const discardDatabaseFieldValuesAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_discard_database_field_values',
+ outputSchema: metabaseMoveCardsOutputSchema,
+ displayName: 'Discard Database Field Values',
+ description: 'Discard cached filter values for a database.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Deletes the distinct values Metabase cached for filter dropdowns across a database; they are rebuilt on the next scan. Needs an admin key.',
+ idempotent: true,
+ },
+ props: {
+ databaseId: metabaseAiProps.databaseId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.discardDatabaseFieldValues({
+ auth,
+ databaseId: propsValue.databaseId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/discard-field-values.ts b/packages/pieces/community/metabase/src/lib/actions/ai/discard-field-values.ts
new file mode 100644
index 00000000000..b1708bbf6a0
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/discard-field-values.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseMoveCardsOutputSchema } from '../../output-schemas';
+
+export const discardFieldValuesAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_discard_field_values',
+ outputSchema: metabaseMoveCardsOutputSchema,
+ displayName: 'Discard Field Values',
+ description: 'Discard the cached values of one field.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ "Deletes the distinct values Metabase cached for one field's filter dropdown; they are rebuilt on the next scan. Needs an admin key.",
+ idempotent: true,
+ },
+ props: {
+ fieldId: metabaseAiProps.fieldId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.discardFieldValues({
+ auth,
+ fieldId: propsValue.fieldId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/discard-table-field-values.ts b/packages/pieces/community/metabase/src/lib/actions/ai/discard-table-field-values.ts
new file mode 100644
index 00000000000..56d9f1118ba
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/discard-table-field-values.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseMoveCardsOutputSchema } from '../../output-schemas';
+
+export const discardTableFieldValuesAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_discard_table_field_values',
+ outputSchema: metabaseMoveCardsOutputSchema,
+ displayName: 'Discard Table Field Values',
+ description: 'Discard cached filter values for a table.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ "Deletes the distinct values Metabase cached for the table's filter dropdowns; they are rebuilt on the next scan. Needs an admin key.",
+ idempotent: true,
+ },
+ props: {
+ tableId: metabaseAiProps.tableId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.discardTableFieldValues({
+ auth,
+ tableId: propsValue.tableId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/execute-action.ts b/packages/pieces/community/metabase/src/lib/actions/ai/execute-action.ts
new file mode 100644
index 00000000000..bbafd3d8976
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/execute-action.ts
@@ -0,0 +1,36 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseExecuteActionOutputSchema } from '../../output-schemas';
+
+export const executeActionAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_execute_action',
+ outputSchema: metabaseExecuteActionOutputSchema,
+ displayName: 'Execute Action',
+ description: 'Run a Metabase action (writes to the database).',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Runs a Metabase action, which writes to the connected database (insert, update or delete rows, or custom SQL). Parameter ids come from Get Action. Each call runs the write again.',
+ idempotent: false,
+ },
+ props: {
+ actionId: metabaseAiProps.actionId({ required: true }),
+ parameters: Property.Object({
+ displayName: 'Parameters',
+ description:
+ 'Values keyed by parameter id from Get Action, e.g. {"id": 42, "status": "shipped"}.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.executeAction({
+ auth,
+ actionId: propsValue.actionId,
+ body: { parameters: propsValue.parameters ?? {} },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/get-action.ts b/packages/pieces/community/metabase/src/lib/actions/ai/get-action.ts
new file mode 100644
index 00000000000..6cd9edce689
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/get-action.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseGetActionOutputSchema } from '../../output-schemas';
+
+export const getActionAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_get_action',
+ outputSchema: metabaseGetActionOutputSchema,
+ displayName: 'Get Action',
+ description: 'Get a Metabase action by ID.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Returns one Metabase action with its type, query and parameters (the parameter ids Execute Action expects).',
+ idempotent: true,
+ },
+ props: {
+ actionId: metabaseAiProps.actionId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.getAction({
+ auth,
+ actionId: propsValue.actionId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/get-alert.ts b/packages/pieces/community/metabase/src/lib/actions/ai/get-alert.ts
new file mode 100644
index 00000000000..c1dbf798efc
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/get-alert.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseGetAlertOutputSchema } from '../../output-schemas';
+
+export const getAlertAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_get_alert',
+ outputSchema: metabaseGetAlertOutputSchema,
+ displayName: 'Get Alert',
+ description: 'Get a question alert by ID.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Returns one alert with its question, condition, schedule, channels and recipients.',
+ idempotent: true,
+ },
+ props: {
+ alertId: metabaseAiProps.alertId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.getAlert({
+ auth,
+ alertId: propsValue.alertId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/get-card-query-metadata.ts b/packages/pieces/community/metabase/src/lib/actions/ai/get-card-query-metadata.ts
new file mode 100644
index 00000000000..bcce9ed0a00
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/get-card-query-metadata.ts
@@ -0,0 +1,30 @@
+import { createAction } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseGetCardQueryMetadataOutputSchema } from '../../output-schemas';
+
+export const getCardQueryMetadataAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_get_card_query_metadata',
+ outputSchema: metabaseGetCardQueryMetadataOutputSchema,
+ displayName: 'Get Card Query Metadata',
+ description: 'Get the tables, fields and databases a saved question uses.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Returns the databases, tables and fields (with types) behind a question (card). Use it to learn column names and IDs before editing the query or building filters.',
+ idempotent: true,
+ },
+ props: {
+ cardId: metabaseAiProps.cardId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.getCardQueryMetadata({
+ auth,
+ cardId: propsValue.cardId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/get-card.ts b/packages/pieces/community/metabase/src/lib/actions/ai/get-card.ts
new file mode 100644
index 00000000000..027fec3621a
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/get-card.ts
@@ -0,0 +1,27 @@
+import { createAction } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseGetCardOutputSchema } from '../../output-schemas';
+
+export const getCardAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_get_card',
+ outputSchema: metabaseGetCardOutputSchema,
+ displayName: 'Get Card',
+ description: 'Get a saved question, model or metric by ID.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Returns one saved question (card), model or metric with its query definition, visualization, collection and filter parameters. Use Run Card Query to get its result rows.',
+ idempotent: true,
+ },
+ props: {
+ cardId: metabaseAiProps.cardId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.getCard({ auth, cardId: propsValue.cardId });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/get-collection-tree.ts b/packages/pieces/community/metabase/src/lib/actions/ai/get-collection-tree.ts
new file mode 100644
index 00000000000..8964a339832
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/get-collection-tree.ts
@@ -0,0 +1,35 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseGetCollectionTreeOutputSchema } from '../../output-schemas';
+
+export const getCollectionTreeAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_get_collection_tree',
+ outputSchema: metabaseGetCollectionTreeOutputSchema,
+ displayName: 'Get Collection Tree',
+ description: 'Get the nested hierarchy of collections.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Returns every collection as a nested tree (each with its children), to resolve a path like "Marketing / Reports" to a collection id.',
+ idempotent: true,
+ },
+ props: {
+ excludeArchived: Property.Checkbox({
+ displayName: 'Exclude Archived',
+ description: 'Leave out trashed collections.',
+ required: false,
+ defaultValue: true,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const collections = await metabaseApi.getCollectionTree({
+ auth,
+ excludeArchived: propsValue.excludeArchived ?? true,
+ });
+ return { collections, count: collections.length };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/get-collection.ts b/packages/pieces/community/metabase/src/lib/actions/ai/get-collection.ts
new file mode 100644
index 00000000000..e385406cc4d
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/get-collection.ts
@@ -0,0 +1,30 @@
+import { createAction } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseGetCollectionOutputSchema } from '../../output-schemas';
+
+export const getCollectionAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_get_collection',
+ outputSchema: metabaseGetCollectionOutputSchema,
+ displayName: 'Get Collection',
+ description: 'Get a collection by ID, or the root collection.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Returns one collection (name, location, permissions); leave Collection ID empty for the root collection ("Our analytics").',
+ idempotent: true,
+ },
+ props: {
+ collectionId: metabaseAiProps.collectionId({ required: false }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.getCollection({
+ auth,
+ collectionId: propsValue.collectionId ?? 'root',
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/get-current-user.ts b/packages/pieces/community/metabase/src/lib/actions/ai/get-current-user.ts
new file mode 100644
index 00000000000..91525669885
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/get-current-user.ts
@@ -0,0 +1,23 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseGetCurrentUserOutputSchema } from '../../output-schemas';
+
+export const getCurrentUserAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_get_current_user',
+ outputSchema: metabaseGetCurrentUserOutputSchema,
+ displayName: 'Get Current User',
+ description: 'Get the user behind the connection.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Returns the Metabase user the API key acts as, including id, email, admin status and group memberships.',
+ idempotent: true,
+ },
+ props: {},
+ async run({ auth }) {
+ return await metabaseApi.getCurrentUser({ auth });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/get-dashboard-subscription.ts b/packages/pieces/community/metabase/src/lib/actions/ai/get-dashboard-subscription.ts
new file mode 100644
index 00000000000..b4121c8da78
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/get-dashboard-subscription.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseGetDashboardSubscriptionOutputSchema } from '../../output-schemas';
+
+export const getDashboardSubscriptionAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_get_dashboard_subscription',
+ outputSchema: metabaseGetDashboardSubscriptionOutputSchema,
+ displayName: 'Get Dashboard Subscription',
+ description: 'Get a dashboard subscription by ID.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Returns one dashboard subscription with its cards, channels, schedule and recipients.',
+ idempotent: true,
+ },
+ props: {
+ subscriptionId: metabaseAiProps.subscriptionId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.getDashboardSubscription({
+ auth,
+ subscriptionId: propsValue.subscriptionId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/get-dashboard.ts b/packages/pieces/community/metabase/src/lib/actions/ai/get-dashboard.ts
new file mode 100644
index 00000000000..77b95734b38
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/get-dashboard.ts
@@ -0,0 +1,30 @@
+import { createAction } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseGetDashboardOutputSchema } from '../../output-schemas';
+
+export const getDashboardAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_get_dashboard',
+ outputSchema: metabaseGetDashboardOutputSchema,
+ displayName: 'Get Dashboard',
+ description: 'Get a dashboard with its cards, tabs and filters.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Returns one dashboard with its dashcards (each with its own id and card_id), tabs and filter parameters. Use the dashcard ids with Run Dashboard Card Query.',
+ idempotent: true,
+ },
+ props: {
+ dashboardId: metabaseAiProps.dashboardId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.getDashboard({
+ auth,
+ dashboardId: propsValue.dashboardId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/get-database-metadata.ts b/packages/pieces/community/metabase/src/lib/actions/ai/get-database-metadata.ts
new file mode 100644
index 00000000000..8b239001840
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/get-database-metadata.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseGetDatabaseMetadataOutputSchema } from '../../output-schemas';
+
+export const getDatabaseMetadataAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_get_database_metadata',
+ outputSchema: metabaseGetDatabaseMetadataOutputSchema,
+ displayName: 'Get Database Metadata',
+ description: 'Get every table and field of a database.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Returns a database with all of its tables and their fields (names, types, ids) in one call. Large for big warehouses; use List Schema Tables or Get Table Metadata to narrow down.',
+ idempotent: true,
+ },
+ props: {
+ databaseId: metabaseAiProps.databaseId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.getDatabaseMetadata({
+ auth,
+ databaseId: propsValue.databaseId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/get-database.ts b/packages/pieces/community/metabase/src/lib/actions/ai/get-database.ts
new file mode 100644
index 00000000000..ec7496aa333
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/get-database.ts
@@ -0,0 +1,43 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseGetDatabaseOutputSchema } from '../../output-schemas';
+
+export const getDatabaseAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_get_database',
+ outputSchema: metabaseGetDatabaseOutputSchema,
+ displayName: 'Get Database',
+ description: 'Get a connected database by ID.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Returns one connected database (engine, settings, sync status), optionally with its tables and their fields.',
+ idempotent: true,
+ },
+ props: {
+ databaseId: metabaseAiProps.databaseId({ required: true }),
+ include: Property.StaticDropdown({
+ displayName: 'Include',
+ description:
+ 'Also return tables, or tables with their fields. Empty = database only.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Tables', value: 'tables' },
+ { label: 'Tables and fields', value: 'tables.fields' },
+ ],
+ },
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.getDatabase({
+ auth,
+ databaseId: propsValue.databaseId,
+ include: propsValue.include,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/get-document.ts b/packages/pieces/community/metabase/src/lib/actions/ai/get-document.ts
new file mode 100644
index 00000000000..a4cf97a3e48
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/get-document.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseCreateDocumentOutputSchema } from '../../output-schemas';
+
+export const getDocumentAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_get_document',
+ outputSchema: metabaseCreateDocumentOutputSchema,
+ displayName: 'Get Document',
+ description: 'Get a document with its content.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Returns one document with its rich-text content (ProseMirror JSON) and the cards it embeds.',
+ idempotent: true,
+ },
+ props: {
+ documentId: metabaseAiProps.documentId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.getDocument({
+ auth,
+ documentId: propsValue.documentId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/get-field-summary.ts b/packages/pieces/community/metabase/src/lib/actions/ai/get-field-summary.ts
new file mode 100644
index 00000000000..4ec3cfa38cb
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/get-field-summary.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseGetFieldSummaryOutputSchema } from '../../output-schemas';
+
+export const getFieldSummaryAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_get_field_summary',
+ outputSchema: metabaseGetFieldSummaryOutputSchema,
+ displayName: 'Get Field Summary',
+ description: 'Get the row count and distinct-value count of a field.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Returns quick statistics for a field: its row count and number of distinct values.',
+ idempotent: true,
+ },
+ props: {
+ fieldId: metabaseAiProps.fieldId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.getFieldSummary({
+ auth,
+ fieldId: propsValue.fieldId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/get-field.ts b/packages/pieces/community/metabase/src/lib/actions/ai/get-field.ts
new file mode 100644
index 00000000000..466e7739fb6
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/get-field.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseGetFieldOutputSchema } from '../../output-schemas';
+
+export const getFieldAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_get_field',
+ outputSchema: metabaseGetFieldOutputSchema,
+ displayName: 'Get Field',
+ description: 'Get a field (column) by ID.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ "Returns one field's metadata: name, display name, base and semantic type, visibility, foreign-key target and table.",
+ idempotent: true,
+ },
+ props: {
+ fieldId: metabaseAiProps.fieldId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.getField({
+ auth,
+ fieldId: propsValue.fieldId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/get-group.ts b/packages/pieces/community/metabase/src/lib/actions/ai/get-group.ts
new file mode 100644
index 00000000000..41dd1e345bb
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/get-group.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseGetGroupOutputSchema } from '../../output-schemas';
+
+export const getGroupAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_get_group',
+ outputSchema: metabaseGetGroupOutputSchema,
+ displayName: 'Get Group',
+ description: 'Get a permission group with its members.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Returns a permission group with its members; each member carries the membership_id that Remove Group Member needs. Needs an admin key.',
+ idempotent: true,
+ },
+ props: {
+ groupId: metabaseAiProps.groupId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.getGroup({
+ auth,
+ groupId: propsValue.groupId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/get-segment.ts b/packages/pieces/community/metabase/src/lib/actions/ai/get-segment.ts
new file mode 100644
index 00000000000..785ca535184
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/get-segment.ts
@@ -0,0 +1,28 @@
+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,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/get-snippet.ts b/packages/pieces/community/metabase/src/lib/actions/ai/get-snippet.ts
new file mode 100644
index 00000000000..7ac8832c9c3
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/get-snippet.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseUpdateSnippetOutputSchema } from '../../output-schemas';
+
+export const getSnippetAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_get_snippet',
+ outputSchema: metabaseUpdateSnippetOutputSchema,
+ displayName: 'Get Snippet',
+ description: 'Get a SQL snippet by ID.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Returns one SQL snippet with its name, content and collection.',
+ idempotent: true,
+ },
+ props: {
+ snippetId: metabaseAiProps.snippetId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.getSnippet({
+ auth,
+ snippetId: propsValue.snippetId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/get-table-data.ts b/packages/pieces/community/metabase/src/lib/actions/ai/get-table-data.ts
new file mode 100644
index 00000000000..2c6c4311613
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/get-table-data.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseGetTableDataOutputSchema } from '../../output-schemas';
+
+export const getTableDataAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_get_table_data',
+ outputSchema: metabaseGetTableDataOutputSchema,
+ displayName: 'Get Table Data',
+ description: 'Get rows from a table.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Returns rows and columns from a table without writing a query. Metabase caps the rows returned; use Run Query with a LIMIT for precise control.',
+ idempotent: true,
+ },
+ props: {
+ tableId: metabaseAiProps.tableId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.getTableData({
+ auth,
+ tableId: propsValue.tableId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/get-table-metadata.ts b/packages/pieces/community/metabase/src/lib/actions/ai/get-table-metadata.ts
new file mode 100644
index 00000000000..671972e845d
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/get-table-metadata.ts
@@ -0,0 +1,43 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseGetTableMetadataOutputSchema } from '../../output-schemas';
+
+export const getTableMetadataAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_get_table_metadata',
+ outputSchema: metabaseGetTableMetadataOutputSchema,
+ displayName: 'Get Table Metadata',
+ description: 'Get a table with its fields.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Returns a table with its fields (ids, names, types, semantic types, foreign keys). Use it to find field ids and column names before querying.',
+ idempotent: true,
+ },
+ props: {
+ tableId: metabaseAiProps.tableId({ required: true }),
+ includeHiddenFields: Property.Checkbox({
+ displayName: 'Include Hidden Fields',
+ description: 'Also return fields hidden in the data model.',
+ required: false,
+ defaultValue: false,
+ }),
+ includeSensitiveFields: Property.Checkbox({
+ displayName: 'Include Sensitive Fields',
+ description: 'Also return fields marked sensitive.',
+ required: false,
+ defaultValue: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.getTableMetadata({
+ auth,
+ tableId: propsValue.tableId,
+ includeHiddenFields: propsValue.includeHiddenFields ?? false,
+ includeSensitiveFields: propsValue.includeSensitiveFields ?? false,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/get-table.ts b/packages/pieces/community/metabase/src/lib/actions/ai/get-table.ts
new file mode 100644
index 00000000000..94ee0dba3e5
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/get-table.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseGetTableOutputSchema } from '../../output-schemas';
+
+export const getTableAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_get_table',
+ outputSchema: metabaseGetTableOutputSchema,
+ displayName: 'Get Table',
+ description: 'Get a table by ID.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ "Returns one table's settings (display name, description, visibility, schema, database). Use Get Table Metadata for its fields.",
+ idempotent: true,
+ },
+ props: {
+ tableId: metabaseAiProps.tableId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.getTable({
+ auth,
+ tableId: propsValue.tableId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/get-timeline-event.ts b/packages/pieces/community/metabase/src/lib/actions/ai/get-timeline-event.ts
new file mode 100644
index 00000000000..d86daac05c3
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/get-timeline-event.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseCreateTimelineEventOutputSchema } from '../../output-schemas';
+
+export const getTimelineEventAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_get_timeline_event',
+ outputSchema: metabaseCreateTimelineEventOutputSchema,
+ displayName: 'Get Timeline Event',
+ description: 'Get a timeline event by ID.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Returns one timeline event with its name, timestamp, time zone and timeline.',
+ idempotent: true,
+ },
+ props: {
+ eventId: metabaseAiProps.timelineEventId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.getTimelineEvent({
+ auth,
+ eventId: propsValue.eventId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/get-timeline.ts b/packages/pieces/community/metabase/src/lib/actions/ai/get-timeline.ts
new file mode 100644
index 00000000000..a31b5cd48dc
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/get-timeline.ts
@@ -0,0 +1,43 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseGetTimelineOutputSchema } from '../../output-schemas';
+
+export const getTimelineAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_get_timeline',
+ outputSchema: metabaseGetTimelineOutputSchema,
+ displayName: 'Get Timeline',
+ description: 'Get a timeline, optionally with its events.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Returns one timeline, optionally with its events (each with an id for the event actions).',
+ idempotent: true,
+ },
+ props: {
+ timelineId: metabaseAiProps.timelineId({ required: true }),
+ includeEvents: Property.Checkbox({
+ displayName: 'Include Events',
+ description: "Also return each timeline's events.",
+ required: false,
+ defaultValue: false,
+ }),
+ archived: Property.Checkbox({
+ displayName: 'Archived',
+ description: 'Return archived items instead of active ones.',
+ required: false,
+ defaultValue: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.getTimeline({
+ auth,
+ timelineId: propsValue.timelineId,
+ include: propsValue.includeEvents ? 'events' : undefined,
+ archived: propsValue.archived ?? false,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/get-user.ts b/packages/pieces/community/metabase/src/lib/actions/ai/get-user.ts
new file mode 100644
index 00000000000..c0ce3b8f314
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/get-user.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseGetUserOutputSchema } from '../../output-schemas';
+
+export const getUserAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_get_user',
+ outputSchema: metabaseGetUserOutputSchema,
+ displayName: 'Get User',
+ description: 'Get a user by ID.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description:
+ 'Returns one user with email, name, admin status and group memberships. Reading another user needs an admin key.',
+ idempotent: true,
+ },
+ props: {
+ userId: metabaseAiProps.userId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.getUser({
+ auth,
+ userId: propsValue.userId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/index.ts b/packages/pieces/community/metabase/src/lib/actions/ai/index.ts
new file mode 100644
index 00000000000..0e42ad2520d
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/index.ts
@@ -0,0 +1,255 @@
+import { addGroupMemberAction } from './add-group-member';
+import { checkDatabaseHealthAction } from './check-database-health';
+import { convertQueryToNativeAction } from './convert-query-to-native';
+import { copyCardAction } from './copy-card';
+import { copyDashboardAction } from './copy-dashboard';
+import { createActionAction } from './create-action';
+import { createAlertAction } from './create-alert';
+import { createBookmarkAction } from './create-bookmark';
+import { createCardPublicLinkAction } from './create-card-public-link';
+import { createCardAction } from './create-card';
+import { createCollectionAction } from './create-collection';
+import { createDashboardPublicLinkAction } from './create-dashboard-public-link';
+import { createDashboardSubscriptionAction } from './create-dashboard-subscription';
+import { createDashboardAction } from './create-dashboard';
+import { createDocumentAction } from './create-document';
+import { createGlossaryEntryAction } from './create-glossary-entry';
+import { createGroupAction } from './create-group';
+import { createSegmentAction } from './create-segment';
+import { createSnippetAction } from './create-snippet';
+import { createTimelineEventAction } from './create-timeline-event';
+import { createTimelineAction } from './create-timeline';
+import { createUserAction } from './create-user';
+import { deactivateUserAction } from './deactivate-user';
+import { deleteActionAction } from './delete-action';
+import { deleteBookmarkAction } from './delete-bookmark';
+import { deleteCardPublicLinkAction } from './delete-card-public-link';
+import { deleteCardAction } from './delete-card';
+import { deleteCollectionAction } from './delete-collection';
+import { deleteDashboardPublicLinkAction } from './delete-dashboard-public-link';
+import { deleteDashboardAction } from './delete-dashboard';
+import { deleteDocumentAction } from './delete-document';
+import { deleteGlossaryEntryAction } from './delete-glossary-entry';
+import { deleteGroupAction } from './delete-group';
+import { deleteSegmentAction } from './delete-segment';
+import { deleteTimelineEventAction } from './delete-timeline-event';
+import { deleteTimelineAction } from './delete-timeline';
+import { discardDatabaseFieldValuesAction } from './discard-database-field-values';
+import { discardFieldValuesAction } from './discard-field-values';
+import { discardTableFieldValuesAction } from './discard-table-field-values';
+import { executeActionAction } from './execute-action';
+import { getActionAction } from './get-action';
+import { getAlertAction } from './get-alert';
+import { getCardQueryMetadataAction } from './get-card-query-metadata';
+import { getCardAction } from './get-card';
+import { getCollectionTreeAction } from './get-collection-tree';
+import { getCollectionAction } from './get-collection';
+import { getCurrentUserAction } from './get-current-user';
+import { getDashboardSubscriptionAction } from './get-dashboard-subscription';
+import { getDashboardAction } from './get-dashboard';
+import { getDatabaseMetadataAction } from './get-database-metadata';
+import { getDatabaseAction } from './get-database';
+import { getDocumentAction } from './get-document';
+import { getFieldSummaryAction } from './get-field-summary';
+import { getFieldAction } from './get-field';
+import { getGroupAction } from './get-group';
+import { getSegmentAction } from './get-segment';
+import { getSnippetAction } from './get-snippet';
+import { getTableDataAction } from './get-table-data';
+import { getTableMetadataAction } from './get-table-metadata';
+import { getTableAction } from './get-table';
+import { getTimelineEventAction } from './get-timeline-event';
+import { getTimelineAction } from './get-timeline';
+import { getUserAction } from './get-user';
+import { listActionsAction } from './list-actions';
+import { listAlertsAction } from './list-alerts';
+import { listBookmarksAction } from './list-bookmarks';
+import { listCardDashboardsAction } from './list-card-dashboards';
+import { listCardParameterValuesAction } from './list-card-parameter-values';
+import { listCardsAction } from './list-cards';
+import { listCollectionItemsAction } from './list-collection-items';
+import { listCollectionTimelinesAction } from './list-collection-timelines';
+import { listCollectionsAction } from './list-collections';
+import { listDashboardParameterValuesAction } from './list-dashboard-parameter-values';
+import { listDashboardSubscriptionsAction } from './list-dashboard-subscriptions';
+import { listDashboardsAction } from './list-dashboards';
+import { listDatabaseFieldsAction } from './list-database-fields';
+import { listDatabaseSchemasAction } from './list-database-schemas';
+import { listDatabasesAction } from './list-databases';
+import { listDocumentsAction } from './list-documents';
+import { listFieldValuesAction } from './list-field-values';
+import { listGlossaryEntriesAction } from './list-glossary-entries';
+import { listGroupsAction } from './list-groups';
+import { listPopularItemsAction } from './list-popular-items';
+import { listRecentViewsAction } from './list-recent-views';
+import { listRevisionsAction } from './list-revisions';
+import { listSchemaTablesAction } from './list-schema-tables';
+import { listSegmentsAction } from './list-segments';
+import { listSnippetsAction } from './list-snippets';
+import { listTableForeignKeysAction } from './list-table-foreign-keys';
+import { listTablesAction } from './list-tables';
+import { listTimelinesAction } from './list-timelines';
+import { listUsersAction } from './list-users';
+import { moveCardsAction } from './move-cards';
+import { reactivateUserAction } from './reactivate-user';
+import { removeGroupMemberAction } from './remove-group-member';
+import { rescanDatabaseFieldValuesAction } from './rescan-database-field-values';
+import { rescanFieldValuesAction } from './rescan-field-values';
+import { rescanTableFieldValuesAction } from './rescan-table-field-values';
+import { revertRevisionAction } from './revert-revision';
+import { runCardQueryAction } from './run-card-query';
+import { runDashboardCardQueryAction } from './run-dashboard-card-query';
+import { runQueryAction } from './run-query';
+import { searchCardParameterValuesAction } from './search-card-parameter-values';
+import { searchDashboardParameterValuesAction } from './search-dashboard-parameter-values';
+import { searchFieldValuesAction } from './search-field-values';
+import { searchAction } from './search';
+import { sendAlertAction } from './send-alert';
+import { syncDatabaseSchemaAction } from './sync-database-schema';
+import { syncTableSchemaAction } from './sync-table-schema';
+import { updateActionAction } from './update-action';
+import { updateAlertAction } from './update-alert';
+import { updateCardAction } from './update-card';
+import { updateCollectionAction } from './update-collection';
+import { updateDashboardSubscriptionAction } from './update-dashboard-subscription';
+import { updateDashboardAction } from './update-dashboard';
+import { updateDatabaseAction } from './update-database';
+import { updateDocumentAction } from './update-document';
+import { updateFieldValuesAction } from './update-field-values';
+import { updateFieldAction } from './update-field';
+import { updateGlossaryEntryAction } from './update-glossary-entry';
+import { updateSegmentAction } from './update-segment';
+import { updateSnippetAction } from './update-snippet';
+import { updateTableAction } from './update-table';
+import { updateTimelineEventAction } from './update-timeline-event';
+import { updateTimelineAction } from './update-timeline';
+import { updateUserAction } from './update-user';
+
+export const metabaseAiActions = [
+ addGroupMemberAction,
+ checkDatabaseHealthAction,
+ convertQueryToNativeAction,
+ copyCardAction,
+ copyDashboardAction,
+ createActionAction,
+ createAlertAction,
+ createBookmarkAction,
+ createCardPublicLinkAction,
+ createCardAction,
+ createCollectionAction,
+ createDashboardPublicLinkAction,
+ createDashboardSubscriptionAction,
+ createDashboardAction,
+ createDocumentAction,
+ createGlossaryEntryAction,
+ createGroupAction,
+ createSegmentAction,
+ createSnippetAction,
+ createTimelineEventAction,
+ createTimelineAction,
+ createUserAction,
+ deactivateUserAction,
+ deleteActionAction,
+ deleteBookmarkAction,
+ deleteCardPublicLinkAction,
+ deleteCardAction,
+ deleteCollectionAction,
+ deleteDashboardPublicLinkAction,
+ deleteDashboardAction,
+ deleteDocumentAction,
+ deleteGlossaryEntryAction,
+ deleteGroupAction,
+ deleteSegmentAction,
+ deleteTimelineEventAction,
+ deleteTimelineAction,
+ discardDatabaseFieldValuesAction,
+ discardFieldValuesAction,
+ discardTableFieldValuesAction,
+ executeActionAction,
+ getActionAction,
+ getAlertAction,
+ getCardQueryMetadataAction,
+ getCardAction,
+ getCollectionTreeAction,
+ getCollectionAction,
+ getCurrentUserAction,
+ getDashboardSubscriptionAction,
+ getDashboardAction,
+ getDatabaseMetadataAction,
+ getDatabaseAction,
+ getDocumentAction,
+ getFieldSummaryAction,
+ getFieldAction,
+ getGroupAction,
+ getSegmentAction,
+ getSnippetAction,
+ getTableDataAction,
+ getTableMetadataAction,
+ getTableAction,
+ getTimelineEventAction,
+ getTimelineAction,
+ getUserAction,
+ listActionsAction,
+ listAlertsAction,
+ listBookmarksAction,
+ listCardDashboardsAction,
+ listCardParameterValuesAction,
+ listCardsAction,
+ listCollectionItemsAction,
+ listCollectionTimelinesAction,
+ listCollectionsAction,
+ listDashboardParameterValuesAction,
+ listDashboardSubscriptionsAction,
+ listDashboardsAction,
+ listDatabaseFieldsAction,
+ listDatabaseSchemasAction,
+ listDatabasesAction,
+ listDocumentsAction,
+ listFieldValuesAction,
+ listGlossaryEntriesAction,
+ listGroupsAction,
+ listPopularItemsAction,
+ listRecentViewsAction,
+ listRevisionsAction,
+ listSchemaTablesAction,
+ listSegmentsAction,
+ listSnippetsAction,
+ listTableForeignKeysAction,
+ listTablesAction,
+ listTimelinesAction,
+ listUsersAction,
+ moveCardsAction,
+ reactivateUserAction,
+ removeGroupMemberAction,
+ rescanDatabaseFieldValuesAction,
+ rescanFieldValuesAction,
+ rescanTableFieldValuesAction,
+ revertRevisionAction,
+ runCardQueryAction,
+ runDashboardCardQueryAction,
+ runQueryAction,
+ searchCardParameterValuesAction,
+ searchDashboardParameterValuesAction,
+ searchFieldValuesAction,
+ searchAction,
+ sendAlertAction,
+ syncDatabaseSchemaAction,
+ syncTableSchemaAction,
+ updateActionAction,
+ updateAlertAction,
+ updateCardAction,
+ updateCollectionAction,
+ updateDashboardSubscriptionAction,
+ updateDashboardAction,
+ updateDatabaseAction,
+ updateDocumentAction,
+ updateFieldValuesAction,
+ updateFieldAction,
+ updateGlossaryEntryAction,
+ updateSegmentAction,
+ updateSnippetAction,
+ updateTableAction,
+ updateTimelineEventAction,
+ updateTimelineAction,
+ updateUserAction,
+];
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-actions.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-actions.ts
new file mode 100644
index 00000000000..7afcb1570bb
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-actions.ts
@@ -0,0 +1,35 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseListActionsOutputSchema } from '../../output-schemas';
+
+export const listActionsAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_actions',
+ outputSchema: metabaseListActionsOutputSchema,
+ displayName: 'List Actions',
+ description: 'List Metabase actions.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Lists Metabase actions (saved write operations on a model, run with Execute Action), optionally for one model.',
+ idempotent: true,
+ },
+ props: {
+ modelId: metabaseAiProps.cardId({
+ required: false,
+ displayName: 'Model ID',
+ description:
+ 'Only actions of this model (a card of type model), from List Cards. Empty = all.',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const actions = await metabaseApi.listActions({
+ auth,
+ modelId: propsValue.modelId,
+ });
+ return { actions, count: actions.length };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-alerts.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-alerts.ts
new file mode 100644
index 00000000000..bdd5f8f7984
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-alerts.ts
@@ -0,0 +1,49 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseListAlertsOutputSchema } from '../../output-schemas';
+
+export const listAlertsAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_alerts',
+ outputSchema: metabaseListAlertsOutputSchema,
+ displayName: 'List Alerts',
+ description: 'List question alerts.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Lists alerts on questions (cards), optionally for one card or creator, with their schedule, condition and recipients. Dashboard subscriptions are listed by List Dashboard Subscriptions.',
+ idempotent: true,
+ },
+ props: {
+ cardId: metabaseAiProps.cardId({
+ required: false,
+ description:
+ 'Only alerts on this question, from List Cards. Empty = all.',
+ }),
+ creatorId: metabaseAiProps.userId({
+ required: false,
+ displayName: 'Creator ID',
+ description:
+ 'Only alerts created by this user, from List Users. Empty = all.',
+ }),
+ includeInactive: Property.Checkbox({
+ displayName: 'Include Inactive',
+ description: 'Also return archived (inactive) alerts.',
+ required: false,
+ defaultValue: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const alerts = await metabaseApi.listAlerts({
+ auth,
+ payloadType: 'notification/card',
+ cardId: propsValue.cardId,
+ creatorId: propsValue.creatorId,
+ includeInactive: propsValue.includeInactive ?? false,
+ });
+ return { alerts, count: alerts.length };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-bookmarks.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-bookmarks.ts
new file mode 100644
index 00000000000..40445f9abe0
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-bookmarks.ts
@@ -0,0 +1,26 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseListBookmarksOutputSchema } from '../../output-schemas';
+
+export const listBookmarksAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_bookmarks',
+ outputSchema: metabaseListBookmarksOutputSchema,
+ displayName: 'List Bookmarks',
+ description: "List the connection user's bookmarks.",
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ "Lists the items the connection's user has bookmarked (questions, dashboards, collections, documents).",
+ idempotent: true,
+ },
+ props: {},
+ async run({ auth }) {
+ const bookmarks = await metabaseApi.listBookmarks({
+ auth,
+ });
+ return { bookmarks, count: bookmarks.length };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-card-dashboards.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-card-dashboards.ts
new file mode 100644
index 00000000000..a3a46dfc395
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-card-dashboards.ts
@@ -0,0 +1,31 @@
+import { createAction } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseListCardDashboardsOutputSchema } from '../../output-schemas';
+
+export const listCardDashboardsAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_card_dashboards',
+ outputSchema: metabaseListCardDashboardsOutputSchema,
+ displayName: 'List Card Dashboards',
+ description: 'List the dashboards that use a saved question.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Lists the dashboards a question (card) appears on. Use before changing or deleting a card to see what it affects.',
+ idempotent: true,
+ },
+ props: {
+ cardId: metabaseAiProps.cardId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ const dashboards = await metabaseApi.listCardDashboards({
+ auth,
+ cardId: propsValue.cardId,
+ });
+ return { dashboards, count: dashboards.length };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-card-parameter-values.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-card-parameter-values.ts
new file mode 100644
index 00000000000..3ac8b3863f2
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-card-parameter-values.ts
@@ -0,0 +1,32 @@
+import { createAction } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseSearchCardParameterValuesOutputSchema } from '../../output-schemas';
+
+export const listCardParameterValuesAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_card_parameter_values',
+ outputSchema: metabaseSearchCardParameterValuesOutputSchema,
+ displayName: 'List Card Parameter Values',
+ description: "List the allowed values of a saved question's filter.",
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ "Returns the values a question's filter offers, so you can pass a valid value to Run Card Query. Use Search Card Parameter Values when the list is long.",
+ idempotent: true,
+ },
+ props: {
+ cardId: metabaseAiProps.cardId({ required: true }),
+ parameterId: metabaseAiProps.parameterId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.listCardParameterValues({
+ auth,
+ cardId: propsValue.cardId,
+ parameterId: propsValue.parameterId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-cards.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-cards.ts
new file mode 100644
index 00000000000..87310e3f829
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-cards.ts
@@ -0,0 +1,51 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseListCardsOutputSchema } from '../../output-schemas';
+
+export const listCardsAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_cards',
+ outputSchema: metabaseListCardsOutputSchema,
+ displayName: 'List Cards',
+ description: 'List saved questions, models and metrics.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Lists every saved question (card), model and metric the connection can see, optionally narrowed by a filter. Metabase returns the whole list in one call, so prefer Search to find a card by name in a large instance.',
+ idempotent: true,
+ },
+ props: {
+ filter: Property.StaticDropdown({
+ displayName: 'Filter',
+ description: 'Which cards to return. Empty = all non-archived cards.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'All', value: 'all' },
+ { label: 'Created by me', value: 'mine' },
+ { label: 'Bookmarked', value: 'bookmarked' },
+ { label: 'Archived', value: 'archived' },
+ { label: 'Using a model', value: 'using_model' },
+ ],
+ },
+ }),
+ modelId: Property.Number({
+ displayName: 'Model ID',
+ description:
+ 'With filter "Using a model": the model card ID whose dependent questions to return.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const cards = await metabaseApi.listCards({
+ auth,
+ filter: propsValue.filter,
+ modelId: propsValue.modelId,
+ });
+ return { cards, count: cards.length };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-collection-items.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-collection-items.ts
new file mode 100644
index 00000000000..0541cfa919d
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-collection-items.ts
@@ -0,0 +1,72 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseListCollectionItemsOutputSchema } from '../../output-schemas';
+
+export const listCollectionItemsAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_collection_items',
+ outputSchema: metabaseListCollectionItemsOutputSchema,
+ displayName: 'List Collection Items',
+ description:
+ 'List the questions, dashboards and sub-collections inside a collection.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Lists what is inside a collection (questions, models, dashboards, sub-collections, snippets), one page at a time; leave Collection ID empty for the root. Use Offset with the returned total to page.',
+ idempotent: true,
+ },
+ props: {
+ collectionId: metabaseAiProps.collectionId({ required: false }),
+ models: Property.StaticDropdown({
+ displayName: 'Item Type',
+ description: 'Only return this type of item. Empty = all types.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Question', value: 'card' },
+ { label: 'Model', value: 'dataset' },
+ { label: 'Metric', value: 'metric' },
+ { label: 'Dashboard', value: 'dashboard' },
+ { label: 'Collection', value: 'collection' },
+ { label: 'Snippet', value: 'snippet' },
+ { label: 'Timeline', value: 'timeline' },
+ ],
+ },
+ }),
+ archived: metabaseAiProps.yesNo({
+ displayName: 'Archived',
+ description: 'Yes = only trashed items. Empty = active items.',
+ required: false,
+ }),
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'Maximum number of items to return. Defaults to 50.',
+ required: false,
+ defaultValue: 50,
+ }),
+ offset: Property.Number({
+ displayName: 'Offset',
+ description: 'Number of items to skip, for the next page. Defaults to 0.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const limit = propsValue.limit ?? 50;
+ if (limit < 1) {
+ throw new Error('Limit must be at least 1.');
+ }
+ return await metabaseApi.listCollectionItems({
+ auth,
+ collectionId: propsValue.collectionId ?? 'root',
+ models: propsValue.models,
+ archived: propsValue.archived,
+ limit,
+ offset: propsValue.offset,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-collection-timelines.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-collection-timelines.ts
new file mode 100644
index 00000000000..34b07d3df85
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-collection-timelines.ts
@@ -0,0 +1,44 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseListCollectionTimelinesOutputSchema } from '../../output-schemas';
+
+export const listCollectionTimelinesAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_collection_timelines',
+ outputSchema: metabaseListCollectionTimelinesOutputSchema,
+ displayName: 'List Collection Timelines',
+ description: 'List the timelines of one collection.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Lists the timelines in one collection (empty Collection ID = the root collection), optionally with their events.',
+ idempotent: true,
+ },
+ props: {
+ collectionId: metabaseAiProps.collectionId({ required: false }),
+ includeEvents: Property.Checkbox({
+ displayName: 'Include Events',
+ description: "Also return each timeline's events.",
+ required: false,
+ defaultValue: false,
+ }),
+ archived: Property.Checkbox({
+ displayName: 'Archived',
+ description: 'Return archived items instead of active ones.',
+ required: false,
+ defaultValue: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const timelines = await metabaseApi.listCollectionTimelines({
+ auth,
+ collectionId: propsValue.collectionId ?? 'root',
+ include: propsValue.includeEvents ? 'events' : undefined,
+ archived: propsValue.archived ?? false,
+ });
+ return { timelines, count: timelines.length };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-collections.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-collections.ts
new file mode 100644
index 00000000000..9b5ad042591
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-collections.ts
@@ -0,0 +1,42 @@
+import { createAction } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseListCollectionsOutputSchema } from '../../output-schemas';
+
+export const listCollectionsAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_collections',
+ outputSchema: metabaseListCollectionsOutputSchema,
+ displayName: 'List Collections',
+ description: 'List collections.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Lists the collections (folders) the connection can see, with their ids and locations. Use Get Collection Tree for the nested hierarchy, or List Collection Items for what is inside one.',
+ idempotent: true,
+ },
+ props: {
+ archived: metabaseAiProps.yesNo({
+ displayName: 'Archived',
+ description:
+ 'Yes = only trashed collections, No = only active ones. Empty = active ones.',
+ required: false,
+ }),
+ personalOnly: metabaseAiProps.yesNo({
+ displayName: 'Personal Only',
+ description: 'Yes = only personal collections. Empty = all.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const collections = await metabaseApi.listCollections({
+ auth,
+ archived: propsValue.archived,
+ personalOnly: propsValue.personalOnly,
+ });
+ return { collections, count: collections.length };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-dashboard-parameter-values.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-dashboard-parameter-values.ts
new file mode 100644
index 00000000000..65b3f296fa0
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-dashboard-parameter-values.ts
@@ -0,0 +1,32 @@
+import { createAction } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseSearchCardParameterValuesOutputSchema } from '../../output-schemas';
+
+export const listDashboardParameterValuesAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_dashboard_parameter_values',
+ outputSchema: metabaseSearchCardParameterValuesOutputSchema,
+ displayName: 'List Dashboard Parameter Values',
+ description: 'List the allowed values of a dashboard filter.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Returns the values a dashboard filter offers, so you can pass a valid value to Run Dashboard Card Query. Use Search Dashboard Parameter Values when the list is long.',
+ idempotent: true,
+ },
+ props: {
+ dashboardId: metabaseAiProps.dashboardId({ required: true }),
+ parameterId: metabaseAiProps.parameterId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.listDashboardParameterValues({
+ auth,
+ dashboardId: propsValue.dashboardId,
+ parameterId: propsValue.parameterId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-dashboard-subscriptions.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-dashboard-subscriptions.ts
new file mode 100644
index 00000000000..d2046d00611
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-dashboard-subscriptions.ts
@@ -0,0 +1,40 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseListDashboardSubscriptionsOutputSchema } from '../../output-schemas';
+
+export const listDashboardSubscriptionsAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_dashboard_subscriptions',
+ outputSchema: metabaseListDashboardSubscriptionsOutputSchema,
+ displayName: 'List Dashboard Subscriptions',
+ description: 'List dashboard subscriptions.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Lists scheduled dashboard subscriptions (emails or Slack messages of a dashboard), optionally for one dashboard, with their schedule and recipients.',
+ idempotent: true,
+ },
+ props: {
+ dashboardId: metabaseAiProps.dashboardId({
+ required: false,
+ description:
+ 'Only subscriptions of this dashboard, from List Dashboards. Empty = all.',
+ }),
+ archived: metabaseAiProps.yesNo({
+ displayName: 'Archived',
+ description: 'Yes = only archived subscriptions. Empty = active ones.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const subscriptions = await metabaseApi.listDashboardSubscriptions({
+ auth,
+ dashboardId: propsValue.dashboardId,
+ archived: propsValue.archived,
+ });
+ return { subscriptions, count: subscriptions.length };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-dashboards.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-dashboards.ts
new file mode 100644
index 00000000000..f5175f8b947
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-dashboards.ts
@@ -0,0 +1,43 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseListDashboardsOutputSchema } from '../../output-schemas';
+
+export const listDashboardsAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_dashboards',
+ outputSchema: metabaseListDashboardsOutputSchema,
+ displayName: 'List Dashboards',
+ description: 'List dashboards.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Lists the dashboards the connection can see, optionally only your own or archived ones. Metabase returns the whole list in one call; use Search to find a dashboard by name.',
+ idempotent: true,
+ },
+ props: {
+ filter: Property.StaticDropdown({
+ displayName: 'Filter',
+ description:
+ 'Which dashboards to return. Empty = all non-archived dashboards.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'All', value: 'all' },
+ { label: 'Created by me', value: 'mine' },
+ { label: 'Archived', value: 'archived' },
+ ],
+ },
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const dashboards = await metabaseApi.listDashboards({
+ auth,
+ filter: propsValue.filter,
+ });
+ return { dashboards, count: dashboards.length };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-database-fields.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-database-fields.ts
new file mode 100644
index 00000000000..a3d4e904e14
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-database-fields.ts
@@ -0,0 +1,30 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseListDatabaseFieldsOutputSchema } from '../../output-schemas';
+
+export const listDatabaseFieldsAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_database_fields',
+ outputSchema: metabaseListDatabaseFieldsOutputSchema,
+ displayName: 'List Database Fields',
+ description: 'List every field of a database.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Lists every field (column) of a connected database with its id, table and type. Field ids feed the field actions.',
+ idempotent: true,
+ },
+ props: {
+ databaseId: metabaseAiProps.databaseId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ const fields = await metabaseApi.listDatabaseFields({
+ auth,
+ databaseId: propsValue.databaseId,
+ });
+ return { fields, count: fields.length };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-database-schemas.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-database-schemas.ts
new file mode 100644
index 00000000000..8504c03ecea
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-database-schemas.ts
@@ -0,0 +1,30 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseListDatabaseSchemasOutputSchema } from '../../output-schemas';
+
+export const listDatabaseSchemasAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_database_schemas',
+ outputSchema: metabaseListDatabaseSchemasOutputSchema,
+ displayName: 'List Database Schemas',
+ description: 'List the schemas of a database.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Lists the schema names in a connected database. Pass one to List Schema Tables.',
+ idempotent: true,
+ },
+ props: {
+ databaseId: metabaseAiProps.databaseId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ const schemas = await metabaseApi.listDatabaseSchemas({
+ auth,
+ databaseId: propsValue.databaseId,
+ });
+ return { schemas, count: schemas.length };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-databases.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-databases.ts
new file mode 100644
index 00000000000..e20202ed798
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-databases.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseListDatabasesOutputSchema } from '../../output-schemas';
+
+export const listDatabasesAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_databases',
+ outputSchema: metabaseListDatabasesOutputSchema,
+ displayName: 'List Databases',
+ description: 'List the connected databases.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ "Lists the data warehouses connected to Metabase with their ids and engines; optionally include each one's tables. Database ids feed Run Query, Create Card and the table actions.",
+ idempotent: true,
+ },
+ props: {
+ include: Property.StaticDropdown({
+ displayName: 'Include',
+ description:
+ "Also return each database's tables. Empty = databases only.",
+ required: false,
+ options: {
+ disabled: false,
+ options: [{ label: 'Tables', value: 'tables' }],
+ },
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.listDatabases({
+ auth,
+ include: propsValue.include,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-documents.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-documents.ts
new file mode 100644
index 00000000000..06ea0d66419
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-documents.ts
@@ -0,0 +1,25 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseListDocumentsOutputSchema } from '../../output-schemas';
+
+export const listDocumentsAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_documents',
+ outputSchema: metabaseListDocumentsOutputSchema,
+ displayName: 'List Documents',
+ description: 'List documents.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Lists Metabase documents (rich-text reports that can embed questions) with their ids and collections.',
+ idempotent: true,
+ },
+ props: {},
+ async run({ auth }) {
+ return await metabaseApi.listDocuments({
+ auth,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-field-values.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-field-values.ts
new file mode 100644
index 00000000000..e291ce75e13
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-field-values.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseListFieldValuesOutputSchema } from '../../output-schemas';
+
+export const listFieldValuesAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_field_values',
+ outputSchema: metabaseListFieldValuesOutputSchema,
+ displayName: 'List Field Values',
+ description: 'List the distinct values of a field.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Returns the distinct values Metabase cached for a field (used by filter dropdowns), with display remappings. Empty when the field is not set to list values.',
+ idempotent: true,
+ },
+ props: {
+ fieldId: metabaseAiProps.fieldId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.listFieldValues({
+ auth,
+ fieldId: propsValue.fieldId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-glossary-entries.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-glossary-entries.ts
new file mode 100644
index 00000000000..77b9becc7f7
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-glossary-entries.ts
@@ -0,0 +1,25 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseListGlossaryEntriesOutputSchema } from '../../output-schemas';
+
+export const listGlossaryEntriesAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_glossary_entries',
+ outputSchema: metabaseListGlossaryEntriesOutputSchema,
+ displayName: 'List Glossary Entries',
+ description: 'List business glossary terms.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Lists the business glossary: terms and their definitions, with ids.',
+ idempotent: true,
+ },
+ props: {},
+ async run({ auth }) {
+ return await metabaseApi.listGlossaryEntries({
+ auth,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-groups.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-groups.ts
new file mode 100644
index 00000000000..fec6ea1b7da
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-groups.ts
@@ -0,0 +1,26 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseListGroupsOutputSchema } from '../../output-schemas';
+
+export const listGroupsAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_groups',
+ outputSchema: metabaseListGroupsOutputSchema,
+ displayName: 'List Groups',
+ description: 'List permission groups.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Lists permission groups with their ids and member counts. Needs an admin key.',
+ idempotent: true,
+ },
+ props: {},
+ async run({ auth }) {
+ const groups = await metabaseApi.listGroups({
+ auth,
+ });
+ return { groups, count: groups.length };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-popular-items.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-popular-items.ts
new file mode 100644
index 00000000000..4cd1d599cac
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-popular-items.ts
@@ -0,0 +1,23 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseListPopularItemsOutputSchema } from '../../output-schemas';
+
+export const listPopularItemsAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_popular_items',
+ outputSchema: metabaseListPopularItemsOutputSchema,
+ displayName: 'List Popular Items',
+ description: 'List the most-viewed items.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Lists the most popular questions, dashboards and collections in the instance by recent views.',
+ idempotent: true,
+ },
+ props: {},
+ async run({ auth }) {
+ return await metabaseApi.listPopularItems({ auth });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-recent-views.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-recent-views.ts
new file mode 100644
index 00000000000..9b3fb6be71e
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-recent-views.ts
@@ -0,0 +1,23 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseListRecentViewsOutputSchema } from '../../output-schemas';
+
+export const listRecentViewsAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_recent_views',
+ outputSchema: metabaseListRecentViewsOutputSchema,
+ displayName: 'List Recent Views',
+ description: 'List items the connection user viewed recently.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ "Lists the items the connection's user viewed recently, newest first.",
+ idempotent: true,
+ },
+ props: {},
+ async run({ auth }) {
+ return await metabaseApi.listRecentViews({ auth, context: 'views' });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-revisions.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-revisions.ts
new file mode 100644
index 00000000000..109c00ad78e
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-revisions.ts
@@ -0,0 +1,47 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseListRevisionsOutputSchema } from '../../output-schemas';
+
+export const listRevisionsAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_revisions',
+ outputSchema: metabaseListRevisionsOutputSchema,
+ displayName: 'List Revisions',
+ description: 'List the change history of an item.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Lists the revision history of a question, dashboard, document or segment: who changed what and when, with revision ids for Revert Revision.',
+ idempotent: true,
+ },
+ props: {
+ entity: Property.StaticDropdown({
+ displayName: 'Item Type',
+ required: true,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Question', value: 'card' },
+ { label: 'Dashboard', value: 'dashboard' },
+ { label: 'Document', value: 'document' },
+ { label: 'Segment', value: 'segment' },
+ ],
+ },
+ }),
+ entityId: Property.Number({
+ displayName: 'Item ID',
+ description: 'Numeric ID of the item.',
+ required: true,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const revisions = await metabaseApi.listRevisions({
+ auth,
+ entity: propsValue.entity,
+ entityId: propsValue.entityId,
+ });
+ return { revisions, count: revisions.length };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-schema-tables.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-schema-tables.ts
new file mode 100644
index 00000000000..7fd277234d0
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-schema-tables.ts
@@ -0,0 +1,36 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseListSchemaTablesOutputSchema } from '../../output-schemas';
+
+export const listSchemaTablesAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_schema_tables',
+ outputSchema: metabaseListSchemaTablesOutputSchema,
+ displayName: 'List Schema Tables',
+ description: 'List the tables in one schema of a database.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Lists the tables in one schema of a connected database, with their ids. Get schema names from List Database Schemas.',
+ idempotent: true,
+ },
+ props: {
+ databaseId: metabaseAiProps.databaseId({ required: true }),
+ schema: Property.ShortText({
+ displayName: 'Schema',
+ description: 'Schema name, e.g. "public", from List Database Schemas.',
+ required: true,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const tables = await metabaseApi.listSchemaTables({
+ auth,
+ databaseId: propsValue.databaseId,
+ schema: encodeURIComponent(propsValue.schema),
+ });
+ return { tables, count: tables.length };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-segments.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-segments.ts
new file mode 100644
index 00000000000..52143c3149d
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-segments.ts
@@ -0,0 +1,26 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseListSegmentsOutputSchema } from '../../output-schemas';
+
+export const listSegmentsAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_segments',
+ outputSchema: metabaseListSegmentsOutputSchema,
+ displayName: 'List Segments',
+ description: 'List saved segments (named filters).',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Lists segments: named, reusable filter definitions on a table, with their ids and table ids.',
+ idempotent: true,
+ },
+ props: {},
+ async run({ auth }) {
+ const segments = await metabaseApi.listSegments({
+ auth,
+ });
+ return { segments, count: segments.length };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-snippets.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-snippets.ts
new file mode 100644
index 00000000000..b6925007453
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-snippets.ts
@@ -0,0 +1,34 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseListSnippetsOutputSchema } from '../../output-schemas';
+
+export const listSnippetsAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_snippets',
+ outputSchema: metabaseListSnippetsOutputSchema,
+ displayName: 'List Snippets',
+ description: 'List reusable SQL snippets.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Lists reusable SQL snippets (referenced in SQL as {{snippet: Name}}) with their ids and content.',
+ idempotent: true,
+ },
+ props: {
+ archived: Property.Checkbox({
+ displayName: 'Archived',
+ description: 'Return archived snippets instead of active ones.',
+ required: false,
+ defaultValue: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const snippets = await metabaseApi.listSnippets({
+ auth,
+ archived: propsValue.archived ?? false,
+ });
+ return { snippets, count: snippets.length };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-table-foreign-keys.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-table-foreign-keys.ts
new file mode 100644
index 00000000000..779be9e4989
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-table-foreign-keys.ts
@@ -0,0 +1,30 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseListTableForeignKeysOutputSchema } from '../../output-schemas';
+
+export const listTableForeignKeysAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_table_foreign_keys',
+ outputSchema: metabaseListTableForeignKeysOutputSchema,
+ displayName: 'List Table Foreign Keys',
+ description: 'List the foreign keys that point to a table.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Lists the foreign keys in other tables that reference this table, with origin and destination field ids, to plan joins.',
+ idempotent: true,
+ },
+ props: {
+ tableId: metabaseAiProps.tableId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ const foreignKeys = await metabaseApi.listTableForeignKeys({
+ auth,
+ tableId: propsValue.tableId,
+ });
+ return { foreignKeys, count: foreignKeys.length };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-tables.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-tables.ts
new file mode 100644
index 00000000000..b11eeee2c27
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-tables.ts
@@ -0,0 +1,34 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseListTablesOutputSchema } from '../../output-schemas';
+
+export const listTablesAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_tables',
+ outputSchema: metabaseListTablesOutputSchema,
+ displayName: 'List Tables',
+ description: 'List tables across all connected databases.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Lists the tables Metabase knows about across all databases, with ids, schemas and database ids, optionally matching a name. Metabase returns the whole list in one call; use List Schema Tables to narrow by schema.',
+ idempotent: true,
+ },
+ props: {
+ term: Property.ShortText({
+ displayName: 'Name Contains',
+ description:
+ 'Only tables whose name matches this text. Empty = all tables.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const tables = await metabaseApi.listTables({
+ auth,
+ term: propsValue.term,
+ });
+ return { tables, count: tables.length };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-timelines.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-timelines.ts
new file mode 100644
index 00000000000..7d4e176d1f9
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-timelines.ts
@@ -0,0 +1,41 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseListTimelinesOutputSchema } from '../../output-schemas';
+
+export const listTimelinesAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_timelines',
+ outputSchema: metabaseListTimelinesOutputSchema,
+ displayName: 'List Timelines',
+ description: 'List event timelines.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Lists event timelines (the annotations shown on time-series charts), optionally with their events.',
+ idempotent: true,
+ },
+ props: {
+ includeEvents: Property.Checkbox({
+ displayName: 'Include Events',
+ description: "Also return each timeline's events.",
+ required: false,
+ defaultValue: false,
+ }),
+ archived: Property.Checkbox({
+ displayName: 'Archived',
+ description: 'Return archived items instead of active ones.',
+ required: false,
+ defaultValue: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const timelines = await metabaseApi.listTimelines({
+ auth,
+ include: propsValue.includeEvents ? 'events' : undefined,
+ archived: propsValue.archived ?? false,
+ });
+ return { timelines, count: timelines.length };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/list-users.ts b/packages/pieces/community/metabase/src/lib/actions/ai/list-users.ts
new file mode 100644
index 00000000000..d41dfb288fe
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/list-users.ts
@@ -0,0 +1,63 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseListUsersOutputSchema } from '../../output-schemas';
+
+export const listUsersAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_list_users',
+ outputSchema: metabaseListUsersOutputSchema,
+ displayName: 'List Users',
+ description: 'List Metabase users.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Lists users with their ids, emails and status, one page at a time, optionally matching a name or email or limited to one group. Needs an admin key to see other users.',
+ idempotent: true,
+ },
+ props: {
+ query: Property.ShortText({
+ displayName: 'Search Text',
+ description: 'Match against name or email. Empty = all users.',
+ required: false,
+ }),
+ groupId: metabaseAiProps.groupId({
+ required: false,
+ description:
+ 'Only members of this group, from List Groups. Empty = all groups.',
+ }),
+ includeDeactivated: Property.Checkbox({
+ displayName: 'Include Deactivated',
+ description: 'Also return deactivated users.',
+ required: false,
+ defaultValue: false,
+ }),
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'Maximum number of items to return. Defaults to 50.',
+ required: false,
+ defaultValue: 50,
+ }),
+ offset: Property.Number({
+ displayName: 'Offset',
+ description: 'Number of items to skip, for the next page. Defaults to 0.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const limit = propsValue.limit ?? 50;
+ if (limit < 1) {
+ throw new Error('Limit must be at least 1.');
+ }
+ return await metabaseApi.listUsers({
+ auth,
+ query: propsValue.query,
+ groupId: propsValue.groupId,
+ includeDeactivated: propsValue.includeDeactivated ?? false,
+ limit,
+ offset: propsValue.offset,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/move-cards.ts b/packages/pieces/community/metabase/src/lib/actions/ai/move-cards.ts
new file mode 100644
index 00000000000..5820ca93f51
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/move-cards.ts
@@ -0,0 +1,60 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseMoveCardsOutputSchema } from '../../output-schemas';
+
+export const moveCardsAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_move_cards',
+ outputSchema: metabaseMoveCardsOutputSchema,
+ displayName: 'Move Cards',
+ description: 'Move several saved questions to a collection or dashboard.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Moves one or more questions (cards) into a collection, or into a dashboard, in one call. Set exactly one of Collection ID or Dashboard ID. Re-running converges on the same placement.',
+ idempotent: true,
+ },
+ props: {
+ cardIds: Property.Array({
+ displayName: 'Card IDs',
+ description:
+ 'Numeric IDs of the cards to move, from List Cards or Search.',
+ required: true,
+ }),
+ collectionId: metabaseAiProps.collectionId({
+ required: false,
+ description: 'Target collection ID, from List Collections.',
+ }),
+ dashboardId: metabaseAiProps.dashboardId({
+ required: false,
+ description: 'Target dashboard ID, from List Dashboards.',
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const cardIds = propsValue.cardIds;
+ if (
+ cardIds.length === 0 ||
+ !cardIds.every(
+ (id): id is number => typeof id === 'number' && Number.isInteger(id)
+ )
+ ) {
+ throw new Error('Card IDs must be a non-empty list of numeric card IDs.');
+ }
+ if (
+ (propsValue.collectionId === undefined) ===
+ (propsValue.dashboardId === undefined)
+ ) {
+ throw new Error('Set exactly one of Collection ID or Dashboard ID.');
+ }
+ return await metabaseApi.moveCards({
+ auth,
+ cardIds,
+ collectionId: propsValue.collectionId,
+ dashboardId: propsValue.dashboardId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/reactivate-user.ts b/packages/pieces/community/metabase/src/lib/actions/ai/reactivate-user.ts
new file mode 100644
index 00000000000..31f4432c986
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/reactivate-user.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseReactivateUserOutputSchema } from '../../output-schemas';
+
+export const reactivateUserAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_reactivate_user',
+ outputSchema: metabaseReactivateUserOutputSchema,
+ displayName: 'Reactivate User',
+ description: 'Reactivate a deactivated user.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ "Restores a deactivated user's access. Fails if the user is already active. Needs an admin key.",
+ idempotent: false,
+ },
+ props: {
+ userId: metabaseAiProps.userId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.reactivateUser({
+ auth,
+ userId: propsValue.userId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/remove-group-member.ts b/packages/pieces/community/metabase/src/lib/actions/ai/remove-group-member.ts
new file mode 100644
index 00000000000..3b1ca2da762
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/remove-group-member.ts
@@ -0,0 +1,34 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseRemoveGroupMemberOutputSchema } from '../../output-schemas';
+
+export const removeGroupMemberAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_remove_group_member',
+ outputSchema: metabaseRemoveGroupMemberOutputSchema,
+ displayName: 'Remove Group Member',
+ description: 'Remove a user from a permission group.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description:
+ 'Removes one group membership. Takes the membership id (from the members of Get Group), not the user id. Needs an admin key.',
+ idempotent: false,
+ },
+ props: {
+ membershipId: Property.Number({
+ displayName: 'Membership ID',
+ description:
+ 'The membership_id of the member in Get Group, not the user id.',
+ required: true,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ await metabaseApi.removeGroupMember({
+ auth,
+ membershipId: propsValue.membershipId,
+ });
+ return { removed: true, membershipId: propsValue.membershipId };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/rescan-database-field-values.ts b/packages/pieces/community/metabase/src/lib/actions/ai/rescan-database-field-values.ts
new file mode 100644
index 00000000000..eaa6a3046f2
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/rescan-database-field-values.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseMoveCardsOutputSchema } from '../../output-schemas';
+
+export const rescanDatabaseFieldValuesAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_rescan_database_field_values',
+ outputSchema: metabaseMoveCardsOutputSchema,
+ displayName: 'Rescan Database Field Values',
+ description: 'Start a rescan of filter values for a database.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Starts a background rescan of the distinct values Metabase caches for filter dropdowns across a database; returns before it finishes. Needs an admin key.',
+ idempotent: true,
+ },
+ props: {
+ databaseId: metabaseAiProps.databaseId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.rescanDatabaseFieldValues({
+ auth,
+ databaseId: propsValue.databaseId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/rescan-field-values.ts b/packages/pieces/community/metabase/src/lib/actions/ai/rescan-field-values.ts
new file mode 100644
index 00000000000..0cf8f0d468b
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/rescan-field-values.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseMoveCardsOutputSchema } from '../../output-schemas';
+
+export const rescanFieldValuesAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_rescan_field_values',
+ outputSchema: metabaseMoveCardsOutputSchema,
+ displayName: 'Rescan Field Values',
+ description: 'Rescan the distinct values of one field.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ "Rescans the distinct values Metabase caches for one field's filter dropdown. Needs an admin key.",
+ idempotent: true,
+ },
+ props: {
+ fieldId: metabaseAiProps.fieldId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.rescanFieldValues({
+ auth,
+ fieldId: propsValue.fieldId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/rescan-table-field-values.ts b/packages/pieces/community/metabase/src/lib/actions/ai/rescan-table-field-values.ts
new file mode 100644
index 00000000000..b2001431d4f
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/rescan-table-field-values.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseMoveCardsOutputSchema } from '../../output-schemas';
+
+export const rescanTableFieldValuesAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_rescan_table_field_values',
+ outputSchema: metabaseMoveCardsOutputSchema,
+ displayName: 'Rescan Table Field Values',
+ description: 'Start a rescan of filter values for a table.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ "Starts a background rescan of the distinct values Metabase caches for the table's filter dropdowns; returns before it finishes. Needs an admin key.",
+ idempotent: true,
+ },
+ props: {
+ tableId: metabaseAiProps.tableId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.rescanTableFieldValues({
+ auth,
+ tableId: propsValue.tableId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/revert-revision.ts b/packages/pieces/community/metabase/src/lib/actions/ai/revert-revision.ts
new file mode 100644
index 00000000000..421294a431d
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/revert-revision.ts
@@ -0,0 +1,54 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseRevertRevisionOutputSchema } from '../../output-schemas';
+
+export const revertRevisionAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_revert_revision',
+ outputSchema: metabaseRevertRevisionOutputSchema,
+ displayName: 'Revert Revision',
+ description: 'Restore an item to an earlier revision.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Restores a question, dashboard, document or segment to an earlier revision from List Revisions. The revert is itself recorded as a new revision.',
+ idempotent: true,
+ },
+ props: {
+ entity: Property.StaticDropdown({
+ displayName: 'Item Type',
+ required: true,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Question', value: 'card' },
+ { label: 'Dashboard', value: 'dashboard' },
+ { label: 'Document', value: 'document' },
+ { label: 'Segment', value: 'segment' },
+ ],
+ },
+ }),
+ entityId: Property.Number({
+ displayName: 'Item ID',
+ description: 'Numeric ID of the item.',
+ required: true,
+ }),
+ revisionId: Property.Number({
+ displayName: 'Revision ID',
+ description: 'The revision to restore, from List Revisions.',
+ required: true,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.revertRevision({
+ auth,
+ body: {
+ entity: propsValue.entity,
+ id: propsValue.entityId,
+ revision_id: propsValue.revisionId,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/run-card-query.ts b/packages/pieces/community/metabase/src/lib/actions/ai/run-card-query.ts
new file mode 100644
index 00000000000..91de1311355
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/run-card-query.ts
@@ -0,0 +1,71 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseRunCardQueryOutputSchema } from '../../output-schemas';
+
+export const runCardQueryAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_run_card_query',
+ outputSchema: metabaseRunCardQueryOutputSchema,
+ displayName: 'Run Card Query',
+ description: 'Run a saved question and return its result rows.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Runs a saved question (card) and returns its rows and columns. Filters are passed by parameter slug, from the `parameters` of Get Card; an unknown slug fails the call. Read-only.',
+ idempotent: true,
+ },
+ props: {
+ cardId: metabaseAiProps.cardId({ required: true }),
+ parameters: Property.Object({
+ displayName: 'Parameters',
+ description:
+ 'Filter values keyed by parameter slug, e.g. {"category": "Gizmo"}. Empty = no filters.',
+ required: false,
+ }),
+ ignoreCache: Property.Checkbox({
+ displayName: 'Ignore Cache',
+ description: 'Re-run the query instead of returning a cached result.',
+ required: false,
+ defaultValue: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const values = propsValue.parameters ?? {};
+ const slugs = Object.keys(values);
+ const cardParameters =
+ slugs.length > 0
+ ? (await metabaseApi.getCard({ auth, cardId: propsValue.cardId }))
+ .parameters ?? []
+ : [];
+ const unknownSlugs = slugs.filter(
+ (slug) => !cardParameters.some((param) => param.slug === slug)
+ );
+ if (unknownSlugs.length > 0) {
+ throw new Error(
+ `Unknown parameter slug(s): ${unknownSlugs.join(
+ ', '
+ )}. This card accepts: ${
+ cardParameters.map((param) => param.slug).join(', ') ||
+ 'no parameters'
+ }.`
+ );
+ }
+ return await metabaseApi.runCardQuery({
+ auth,
+ cardId: propsValue.cardId,
+ ignoreCache: propsValue.ignoreCache ?? false,
+ parameters: cardParameters
+ .filter((param) => slugs.includes(param.slug))
+ .map((param) => ({
+ id: param.id,
+ type: param.type,
+ target: param.target,
+ value: values[param.slug],
+ })),
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/run-dashboard-card-query.ts b/packages/pieces/community/metabase/src/lib/actions/ai/run-dashboard-card-query.ts
new file mode 100644
index 00000000000..54747144c46
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/run-dashboard-card-query.ts
@@ -0,0 +1,79 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseRunDashboardCardQueryOutputSchema } from '../../output-schemas';
+
+export const runDashboardCardQueryAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_run_dashboard_card_query',
+ outputSchema: metabaseRunDashboardCardQueryOutputSchema,
+ displayName: 'Run Dashboard Card Query',
+ description: "Run one card on a dashboard with the dashboard's filters.",
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Runs one card as it appears on a dashboard and returns its rows, applying dashboard filter values by slug (from the `parameters` of Get Dashboard); an unknown slug fails the call. Get the dashcard id and card id from Get Dashboard. Read-only.',
+ idempotent: true,
+ },
+ props: {
+ dashboardId: metabaseAiProps.dashboardId({ required: true }),
+ dashcardId: Property.Number({
+ displayName: 'Dashcard ID',
+ description:
+ "The `id` of the card's entry in `dashcards` from Get Dashboard (not the card id).",
+ required: true,
+ }),
+ cardId: metabaseAiProps.cardId({
+ required: true,
+ description: 'The `card_id` of the same dashcard, from Get Dashboard.',
+ }),
+ parameters: Property.Object({
+ displayName: 'Parameters',
+ description:
+ 'Dashboard filter values keyed by parameter slug, e.g. {"category": "Gizmo"}. Empty = no filters.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const values = propsValue.parameters ?? {};
+ const slugs = Object.keys(values);
+ const dashboardParameters =
+ slugs.length > 0
+ ? (
+ await metabaseApi.getDashboard({
+ auth,
+ dashboardId: propsValue.dashboardId,
+ })
+ ).parameters ?? []
+ : [];
+ const unknownSlugs = slugs.filter(
+ (slug) => !dashboardParameters.some((param) => param.slug === slug)
+ );
+ if (unknownSlugs.length > 0) {
+ throw new Error(
+ `Unknown parameter slug(s): ${unknownSlugs.join(
+ ', '
+ )}. This dashboard accepts: ${
+ dashboardParameters.map((param) => param.slug).join(', ') ||
+ 'no parameters'
+ }.`
+ );
+ }
+ return await metabaseApi.runDashboardCardQuery({
+ auth,
+ dashboardId: propsValue.dashboardId,
+ dashcardId: propsValue.dashcardId,
+ cardId: propsValue.cardId,
+ parameters: dashboardParameters
+ .filter((param) => slugs.includes(param.slug))
+ .map((param) => ({
+ id: param.id,
+ type: param.type,
+ value: values[param.slug],
+ })),
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/run-query.ts b/packages/pieces/community/metabase/src/lib/actions/ai/run-query.ts
new file mode 100644
index 00000000000..04e0a085dab
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/run-query.ts
@@ -0,0 +1,34 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseRunQueryOutputSchema } from '../../output-schemas';
+
+export const runQueryAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_run_query',
+ outputSchema: metabaseRunQueryOutputSchema,
+ displayName: 'Run Query',
+ description: 'Run an ad-hoc SQL or query-builder query.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Runs a query without saving it and returns rows and columns. For SQL use a native query; get database ids from List Databases. SQL can write to the database, and repeating a call repeats the write. Results are capped by Metabase (2,000 rows by default).',
+ idempotent: false,
+ },
+ props: {
+ datasetQuery: Property.Json({
+ displayName: 'Dataset Query',
+ description:
+ 'SQL example: {"database": 1, "type": "native", "native": {"query": "SELECT * FROM orders LIMIT 10"}}. MBQL example: {"database": 1, "type": "query", "query": {"source-table": 2, "limit": 10}}.',
+ required: true,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.runQuery({
+ auth,
+ datasetQuery: propsValue.datasetQuery,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/search-card-parameter-values.ts b/packages/pieces/community/metabase/src/lib/actions/ai/search-card-parameter-values.ts
new file mode 100644
index 00000000000..02c3f3b6209
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/search-card-parameter-values.ts
@@ -0,0 +1,38 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseSearchCardParameterValuesOutputSchema } from '../../output-schemas';
+
+export const searchCardParameterValuesAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_search_card_parameter_values',
+ outputSchema: metabaseSearchCardParameterValuesOutputSchema,
+ displayName: 'Search Card Parameter Values',
+ description: "Search the allowed values of a saved question's filter.",
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ "Returns a question's filter values that match a search text. Use it instead of List Card Parameter Values when the filter has many values.",
+ idempotent: true,
+ },
+ props: {
+ cardId: metabaseAiProps.cardId({ required: true }),
+ parameterId: metabaseAiProps.parameterId({ required: true }),
+ query: Property.ShortText({
+ displayName: 'Search Text',
+ description: 'Text to match against the filter values.',
+ required: true,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.searchCardParameterValues({
+ auth,
+ cardId: propsValue.cardId,
+ parameterId: propsValue.parameterId,
+ query: propsValue.query,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/search-dashboard-parameter-values.ts b/packages/pieces/community/metabase/src/lib/actions/ai/search-dashboard-parameter-values.ts
new file mode 100644
index 00000000000..d93ed82fe28
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/search-dashboard-parameter-values.ts
@@ -0,0 +1,38 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseSearchCardParameterValuesOutputSchema } from '../../output-schemas';
+
+export const searchDashboardParameterValuesAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_search_dashboard_parameter_values',
+ outputSchema: metabaseSearchCardParameterValuesOutputSchema,
+ displayName: 'Search Dashboard Parameter Values',
+ description: 'Search the allowed values of a dashboard filter.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ "Returns a dashboard filter's values that match a search text. Use it instead of List Dashboard Parameter Values when the filter has many values.",
+ idempotent: true,
+ },
+ props: {
+ dashboardId: metabaseAiProps.dashboardId({ required: true }),
+ parameterId: metabaseAiProps.parameterId({ required: true }),
+ query: Property.ShortText({
+ displayName: 'Search Text',
+ description: 'Text to match against the filter values.',
+ required: true,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.searchDashboardParameterValues({
+ auth,
+ dashboardId: propsValue.dashboardId,
+ parameterId: propsValue.parameterId,
+ query: propsValue.query,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/search-field-values.ts b/packages/pieces/community/metabase/src/lib/actions/ai/search-field-values.ts
new file mode 100644
index 00000000000..51a6ca00c9d
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/search-field-values.ts
@@ -0,0 +1,42 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseSearchFieldValuesOutputSchema } from '../../output-schemas';
+
+export const searchFieldValuesAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_search_field_values',
+ outputSchema: metabaseSearchFieldValuesOutputSchema,
+ displayName: 'Search Field Values',
+ description: 'Search the values of a field.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Returns values of a field that match a search text, e.g. to find a customer name for a filter. Optionally search a different field (such as a name column) linked to it.',
+ idempotent: true,
+ },
+ props: {
+ fieldId: metabaseAiProps.fieldId({ required: true }),
+ value: Property.ShortText({
+ displayName: 'Search Text',
+ description: 'Text to match.',
+ required: true,
+ }),
+ searchFieldId: Property.Number({
+ displayName: 'Search Field ID',
+ description:
+ 'Field whose values are matched, e.g. a name column linked to an ID field. Empty = the same field.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.searchFieldValues({
+ auth,
+ fieldId: propsValue.fieldId,
+ searchFieldId: propsValue.searchFieldId ?? propsValue.fieldId,
+ value: propsValue.value,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/search.ts b/packages/pieces/community/metabase/src/lib/actions/ai/search.ts
new file mode 100644
index 00000000000..c26fc80c73d
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/search.ts
@@ -0,0 +1,85 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseSearchOutputSchema } from '../../output-schemas';
+
+export const searchAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_search',
+ outputSchema: metabaseSearchOutputSchema,
+ displayName: 'Search',
+ description: 'Search questions, dashboards, collections, tables and more.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description:
+ 'Full-text search across Metabase items, returning ids, types and locations, one page at a time. Use it to find a card, dashboard, collection or table id by name.',
+ idempotent: true,
+ },
+ props: {
+ q: Property.ShortText({
+ displayName: 'Search Text',
+ description:
+ 'Text to search for. Empty = all items (filter by type instead).',
+ required: false,
+ }),
+ models: Property.StaticDropdown({
+ displayName: 'Item Type',
+ description: 'Only return this type of item. Empty = all types.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Question', value: 'card' },
+ { label: 'Model', value: 'dataset' },
+ { label: 'Metric', value: 'metric' },
+ { label: 'Dashboard', value: 'dashboard' },
+ { label: 'Collection', value: 'collection' },
+ { label: 'Table', value: 'table' },
+ { label: 'Database', value: 'database' },
+ { label: 'Segment', value: 'segment' },
+ { label: 'Action', value: 'action' },
+ { label: 'Document', value: 'document' },
+ ],
+ },
+ }),
+ collectionId: metabaseAiProps.collectionId({
+ required: false,
+ description:
+ 'Only search inside this collection, from List Collections. Empty = everywhere.',
+ }),
+ archived: metabaseAiProps.yesNo({
+ displayName: 'Archived',
+ description: 'Yes = only trashed items. Empty = active items.',
+ required: false,
+ }),
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'Maximum number of items to return. Defaults to 50.',
+ required: false,
+ defaultValue: 50,
+ }),
+ offset: Property.Number({
+ displayName: 'Offset',
+ description: 'Number of items to skip, for the next page. Defaults to 0.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const limit = propsValue.limit ?? 50;
+ if (limit < 1) {
+ throw new Error('Limit must be at least 1.');
+ }
+ return await metabaseApi.search({
+ auth,
+ q: propsValue.q,
+ models: propsValue.models,
+ collectionId: propsValue.collectionId,
+ archived: propsValue.archived,
+ limit,
+ offset: propsValue.offset,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/send-alert.ts b/packages/pieces/community/metabase/src/lib/actions/ai/send-alert.ts
new file mode 100644
index 00000000000..8be2e6a99fd
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/send-alert.ts
@@ -0,0 +1,31 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseSendAlertOutputSchema } from '../../output-schemas';
+
+export const sendAlertAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_send_alert',
+ outputSchema: metabaseSendAlertOutputSchema,
+ displayName: 'Send Alert',
+ description: 'Send a question alert now.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Sends an existing alert to its recipients immediately, regardless of its schedule and condition. Each call sends again.',
+ idempotent: false,
+ },
+ props: {
+ alertId: metabaseAiProps.alertId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ await metabaseApi.sendAlert({
+ auth,
+ alertId: propsValue.alertId,
+ body: {},
+ });
+ return { sent: true, alertId: propsValue.alertId };
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/sync-database-schema.ts b/packages/pieces/community/metabase/src/lib/actions/ai/sync-database-schema.ts
new file mode 100644
index 00000000000..fa9c027344f
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/sync-database-schema.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseMoveCardsOutputSchema } from '../../output-schemas';
+
+export const syncDatabaseSchemaAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_sync_database_schema',
+ outputSchema: metabaseMoveCardsOutputSchema,
+ displayName: 'Sync Database Schema',
+ description: 'Start a schema sync for a database.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Starts a background sync so Metabase picks up new or changed tables and columns; returns immediately, before the sync finishes. Needs an admin key.',
+ idempotent: true,
+ },
+ props: {
+ databaseId: metabaseAiProps.databaseId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.syncDatabaseSchema({
+ auth,
+ databaseId: propsValue.databaseId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/sync-table-schema.ts b/packages/pieces/community/metabase/src/lib/actions/ai/sync-table-schema.ts
new file mode 100644
index 00000000000..18483194a98
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/sync-table-schema.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseMoveCardsOutputSchema } from '../../output-schemas';
+
+export const syncTableSchemaAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_sync_table_schema',
+ outputSchema: metabaseMoveCardsOutputSchema,
+ displayName: 'Sync Table Schema',
+ description: 'Start a schema sync for one table.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Starts a background sync of one table so Metabase picks up new or changed columns; returns before it finishes. Needs an admin key.',
+ idempotent: true,
+ },
+ props: {
+ tableId: metabaseAiProps.tableId({ required: true }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.syncTableSchema({
+ auth,
+ tableId: propsValue.tableId,
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/update-action.ts b/packages/pieces/community/metabase/src/lib/actions/ai/update-action.ts
new file mode 100644
index 00000000000..bb1d0a7d22e
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/update-action.ts
@@ -0,0 +1,63 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseUpdateActionOutputSchema } from '../../output-schemas';
+
+export const updateActionAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_update_action',
+ outputSchema: metabaseUpdateActionOutputSchema,
+ displayName: 'Update Action',
+ description: 'Change or archive a Metabase action.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Changes only the fields you set on a Metabase action. Archived = Yes hides it (recoverable).',
+ idempotent: true,
+ },
+ props: {
+ actionId: metabaseAiProps.actionId({ required: true }),
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'New name. Empty = unchanged.',
+ required: false,
+ }),
+ description: Property.LongText({
+ displayName: 'Description',
+ description: 'New description. Empty = unchanged.',
+ required: false,
+ }),
+ datasetQuery: Property.Json({
+ displayName: 'Dataset Query',
+ description:
+ 'New SQL query definition (SQL actions only). Empty = unchanged.',
+ required: false,
+ }),
+ parameters: Property.Json({
+ displayName: 'Parameters',
+ description: 'Replaces the parameter list. Empty = unchanged.',
+ required: false,
+ }),
+ archived: metabaseAiProps.yesNo({
+ displayName: 'Archived',
+ description:
+ 'Yes archives the action, No restores it. Empty = unchanged.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.updateAction({
+ auth,
+ actionId: propsValue.actionId,
+ body: {
+ name: propsValue.name,
+ description: propsValue.description,
+ dataset_query: propsValue.datasetQuery,
+ parameters: propsValue.parameters,
+ archived: propsValue.archived,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/update-alert.ts b/packages/pieces/community/metabase/src/lib/actions/ai/update-alert.ts
new file mode 100644
index 00000000000..1afdb720117
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/update-alert.ts
@@ -0,0 +1,80 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseUpdateAlertOutputSchema } from '../../output-schemas';
+
+export const updateAlertAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_update_alert',
+ outputSchema: metabaseUpdateAlertOutputSchema,
+ displayName: 'Update Alert',
+ description: 'Change or archive a question alert.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Changes only the settings you set on an alert (active state, condition, send-once, schedule); everything else, including recipients, is kept. Archive with Active = No. Concurrent edits to the same alert can overwrite each other.',
+ idempotent: true,
+ },
+ props: {
+ alertId: metabaseAiProps.alertId({ required: true }),
+ active: metabaseAiProps.yesNo({
+ displayName: 'Active',
+ description: 'No archives the alert, Yes restores it. Empty = unchanged.',
+ required: false,
+ }),
+ sendCondition: Property.StaticDropdown({
+ displayName: 'Send When',
+ description: 'When the alert fires. Empty = unchanged.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'The question has results', value: 'has_result' },
+ { label: 'Results go above the goal', value: 'goal_above' },
+ { label: 'Results go below the goal', value: 'goal_below' },
+ ],
+ },
+ }),
+ sendOnce: metabaseAiProps.yesNo({
+ displayName: 'Send Once',
+ description: 'Stop after the first send. Empty = unchanged.',
+ required: false,
+ }),
+ cronSchedule: Property.ShortText({
+ displayName: 'Cron Schedule',
+ description:
+ 'New Quartz cron expression, e.g. "0 0 9 * * ?". Empty = unchanged.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ const current = await metabaseApi.getAlert({
+ auth,
+ alertId: propsValue.alertId,
+ });
+ const cronSchedule = propsValue.cronSchedule;
+ return await metabaseApi.updateAlert({
+ auth,
+ alertId: propsValue.alertId,
+ body: {
+ ...current,
+ active: propsValue.active ?? current.active,
+ payload: {
+ ...current.payload,
+ send_condition:
+ propsValue.sendCondition ?? current.payload?.['send_condition'],
+ send_once: propsValue.sendOnce ?? current.payload?.['send_once'],
+ },
+ subscriptions:
+ cronSchedule === undefined
+ ? current.subscriptions
+ : (current.subscriptions ?? []).map((subscription) => ({
+ ...subscription,
+ cron_schedule: cronSchedule,
+ })),
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/update-card.ts b/packages/pieces/community/metabase/src/lib/actions/ai/update-card.ts
new file mode 100644
index 00000000000..8fdac343a5d
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/update-card.ts
@@ -0,0 +1,96 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseUpdateCardOutputSchema } from '../../output-schemas';
+
+export const updateCardAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_update_card',
+ outputSchema: metabaseUpdateCardOutputSchema,
+ displayName: 'Update Card',
+ description: 'Update a saved question, model or metric.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Changes only the fields you set on a question (card): name, query, display, collection, archive state or static embedding. Archive (recoverable) is preferred over Delete Card. Embedding fields need an admin key and embedding enabled on the instance.',
+ idempotent: true,
+ },
+ props: {
+ cardId: metabaseAiProps.cardId({ required: true }),
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'New name. Empty = unchanged.',
+ required: false,
+ }),
+ description: Property.LongText({
+ displayName: 'Description',
+ description: 'New description. Empty = unchanged.',
+ required: false,
+ }),
+ datasetQuery: Property.Json({
+ displayName: 'Dataset Query',
+ description:
+ 'New query definition (same shape as in Create Card). Empty = unchanged.',
+ required: false,
+ }),
+ display: Property.ShortText({
+ displayName: 'Display',
+ description:
+ 'New visualization type, e.g. table, bar, line. Empty = unchanged.',
+ required: false,
+ }),
+ parameters: Property.Json({
+ displayName: 'Parameters',
+ description:
+ 'Replaces the filter widgets (same shape as in Create Card). Empty = unchanged.',
+ required: false,
+ }),
+ visualizationSettings: Property.Json({
+ displayName: 'Visualization Settings',
+ description: 'Replaces the visualization settings. Empty = unchanged.',
+ required: false,
+ }),
+ collectionId: metabaseAiProps.collectionId({
+ required: false,
+ description: 'Move to this collection. Empty = unchanged.',
+ }),
+ archived: metabaseAiProps.yesNo({
+ displayName: 'Archived',
+ description:
+ 'Yes moves the card to the trash, No restores it. Empty = unchanged.',
+ required: false,
+ }),
+ enableEmbedding: metabaseAiProps.yesNo({
+ displayName: 'Enable Embedding',
+ description: 'Turn static embedding on or off. Empty = unchanged.',
+ required: false,
+ }),
+ embeddingParams: Property.Json({
+ displayName: 'Embedding Params',
+ description:
+ 'How each filter is exposed in the embed, keyed by parameter slug: {"category": "enabled"}. Values: disabled, enabled (editable), locked. Empty = unchanged.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.updateCard({
+ auth,
+ cardId: propsValue.cardId,
+ body: {
+ name: propsValue.name,
+ description: propsValue.description,
+ dataset_query: propsValue.datasetQuery,
+ display: propsValue.display,
+ visualization_settings: propsValue.visualizationSettings,
+ parameters: propsValue.parameters,
+ collection_id: propsValue.collectionId,
+ archived: propsValue.archived,
+ enable_embedding: propsValue.enableEmbedding,
+ embedding_params: propsValue.embeddingParams,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/update-collection.ts b/packages/pieces/community/metabase/src/lib/actions/ai/update-collection.ts
new file mode 100644
index 00000000000..7e0dec40979
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/update-collection.ts
@@ -0,0 +1,61 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseUpdateCollectionOutputSchema } from '../../output-schemas';
+
+export const updateCollectionAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_update_collection',
+ outputSchema: metabaseUpdateCollectionOutputSchema,
+ displayName: 'Update Collection',
+ description: 'Rename, move or archive a collection.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Changes only the fields you set on a collection: name, description, parent (to move it) or archive state. Archiving moves it and its contents to the trash (recoverable).',
+ idempotent: true,
+ },
+ props: {
+ collectionId: metabaseAiProps.collectionId({
+ required: true,
+ description: 'Numeric ID of the collection, from List Collections.',
+ }),
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'New name. Empty = unchanged.',
+ required: false,
+ }),
+ description: Property.LongText({
+ displayName: 'Description',
+ description: 'New description. Empty = unchanged.',
+ required: false,
+ }),
+ parentId: Property.Number({
+ displayName: 'Parent Collection ID',
+ description:
+ 'Move it inside this collection, from List Collections. Empty = unchanged.',
+ required: false,
+ }),
+ archived: metabaseAiProps.yesNo({
+ displayName: 'Archived',
+ description:
+ 'Yes moves the collection to the trash, No restores it. Empty = unchanged.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.updateCollection({
+ auth,
+ collectionId: propsValue.collectionId,
+ body: {
+ name: propsValue.name,
+ description: propsValue.description,
+ parent_id: propsValue.parentId,
+ archived: propsValue.archived,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/update-dashboard-subscription.ts b/packages/pieces/community/metabase/src/lib/actions/ai/update-dashboard-subscription.ts
new file mode 100644
index 00000000000..ca2a7b13cc2
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/update-dashboard-subscription.ts
@@ -0,0 +1,57 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseUpdateDashboardSubscriptionOutputSchema } from '../../output-schemas';
+
+export const updateDashboardSubscriptionAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_update_dashboard_subscription',
+ outputSchema: metabaseUpdateDashboardSubscriptionOutputSchema,
+ displayName: 'Update Dashboard Subscription',
+ description: 'Rename, change or archive a dashboard subscription.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Changes only the fields you set on a dashboard subscription. Channels replaces the whole delivery configuration (schedule and recipients), so start from Get Dashboard Subscription. Archive with Archived = Yes.',
+ idempotent: true,
+ },
+ props: {
+ subscriptionId: metabaseAiProps.subscriptionId({ required: true }),
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'New name. Empty = unchanged.',
+ required: false,
+ }),
+ archived: metabaseAiProps.yesNo({
+ displayName: 'Archived',
+ description:
+ 'Yes stops and archives the subscription, No restores it. Empty = unchanged.',
+ required: false,
+ }),
+ skipIfEmpty: metabaseAiProps.yesNo({
+ displayName: 'Skip If Empty',
+ description: 'Do not send when every card is empty. Empty = unchanged.',
+ required: false,
+ }),
+ channels: Property.Json({
+ displayName: 'Channels',
+ description:
+ 'Replaces ALL channels (schedule + recipients), in the shape of `channels` from Get Dashboard Subscription. Empty = unchanged.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.updateDashboardSubscription({
+ auth,
+ subscriptionId: propsValue.subscriptionId,
+ body: {
+ name: propsValue.name,
+ archived: propsValue.archived,
+ skip_if_empty: propsValue.skipIfEmpty,
+ channels: propsValue.channels,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/update-dashboard.ts b/packages/pieces/community/metabase/src/lib/actions/ai/update-dashboard.ts
new file mode 100644
index 00000000000..e2531d20eae
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/update-dashboard.ts
@@ -0,0 +1,89 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseUpdateDashboardOutputSchema } from '../../output-schemas';
+
+export const updateDashboardAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_update_dashboard',
+ outputSchema: metabaseUpdateDashboardOutputSchema,
+ displayName: 'Update Dashboard',
+ description: 'Update a dashboard, including its cards and tabs.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Changes only the fields you set on a dashboard. Dashcards and Tabs each replace the whole list: cards or tabs you leave out are removed, so start from Get Dashboard; new dashcards need a negative id. Archive (recoverable) is preferred over Delete Dashboard; embedding fields need an admin key and embedding enabled.',
+ idempotent: true,
+ },
+ props: {
+ dashboardId: metabaseAiProps.dashboardId({ required: true }),
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'New name. Empty = unchanged.',
+ required: false,
+ }),
+ description: Property.LongText({
+ displayName: 'Description',
+ description: 'New description. Empty = unchanged.',
+ required: false,
+ }),
+ collectionId: metabaseAiProps.collectionId({
+ required: false,
+ description: 'Move to this collection. Empty = unchanged.',
+ }),
+ archived: metabaseAiProps.yesNo({
+ displayName: 'Archived',
+ description:
+ 'Yes moves the dashboard to the trash, No restores it. Empty = unchanged.',
+ required: false,
+ }),
+ dashcards: Property.Json({
+ displayName: 'Dashcards',
+ description:
+ 'Replaces ALL cards on the dashboard: [{"id": -1, "card_id": 12, "row": 0, "col": 0, "size_x": 12, "size_y": 6}]. Keep existing ones (with their ids) from Get Dashboard; new ones use negative ids. Empty = unchanged.',
+ required: false,
+ }),
+ tabs: Property.Json({
+ displayName: 'Tabs',
+ description:
+ 'Replaces ALL tabs: [{"id": -1, "name": "Overview"}]. Keep existing ones from Get Dashboard. Empty = unchanged.',
+ required: false,
+ }),
+ parameters: Property.Json({
+ displayName: 'Parameters',
+ description: 'Replaces the dashboard filters (array). Empty = unchanged.',
+ required: false,
+ }),
+ enableEmbedding: metabaseAiProps.yesNo({
+ displayName: 'Enable Embedding',
+ description: 'Turn static embedding on or off. Empty = unchanged.',
+ required: false,
+ }),
+ embeddingParams: Property.Json({
+ displayName: 'Embedding Params',
+ description:
+ 'How each filter is exposed in the embed, keyed by parameter slug: {"category": "enabled"}. Values: disabled, enabled, locked. Empty = unchanged.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.updateDashboard({
+ auth,
+ dashboardId: propsValue.dashboardId,
+ body: {
+ name: propsValue.name,
+ description: propsValue.description,
+ collection_id: propsValue.collectionId,
+ archived: propsValue.archived,
+ dashcards: propsValue.dashcards,
+ tabs: propsValue.tabs,
+ parameters: propsValue.parameters,
+ enable_embedding: propsValue.enableEmbedding,
+ embedding_params: propsValue.embeddingParams,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/update-database.ts b/packages/pieces/community/metabase/src/lib/actions/ai/update-database.ts
new file mode 100644
index 00000000000..7c516c9ba09
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/update-database.ts
@@ -0,0 +1,69 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseUpdateDatabaseOutputSchema } from '../../output-schemas';
+
+export const updateDatabaseAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_update_database',
+ outputSchema: metabaseUpdateDatabaseOutputSchema,
+ displayName: 'Update Database',
+ description: "Update a connected database's settings.",
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Changes only the fields you set on a connected database: display name, description, caveats, auto-run and cache settings. Connection credentials are not changed. Needs an admin key.',
+ idempotent: true,
+ },
+ props: {
+ databaseId: metabaseAiProps.databaseId({ required: true }),
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'New display name. Empty = unchanged.',
+ required: false,
+ }),
+ description: Property.LongText({
+ displayName: 'Description',
+ description: 'New description. Empty = unchanged.',
+ required: false,
+ }),
+ caveats: Property.LongText({
+ displayName: 'Caveats',
+ description:
+ 'Things users should know about this data. Empty = unchanged.',
+ required: false,
+ }),
+ pointsOfInterest: Property.LongText({
+ displayName: 'Points of Interest',
+ description: 'What is useful about this data. Empty = unchanged.',
+ required: false,
+ }),
+ autoRunQueries: metabaseAiProps.yesNo({
+ displayName: 'Auto-run Queries',
+ description:
+ 'Run query-builder questions automatically. Empty = unchanged.',
+ required: false,
+ }),
+ cacheTtl: Property.Number({
+ displayName: 'Cache TTL (hours)',
+ description: 'How long to cache query results. Empty = unchanged.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.updateDatabase({
+ auth,
+ databaseId: propsValue.databaseId,
+ body: {
+ name: propsValue.name,
+ description: propsValue.description,
+ caveats: propsValue.caveats,
+ points_of_interest: propsValue.pointsOfInterest,
+ auto_run_queries: propsValue.autoRunQueries,
+ cache_ttl: propsValue.cacheTtl,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/update-document.ts b/packages/pieces/community/metabase/src/lib/actions/ai/update-document.ts
new file mode 100644
index 00000000000..a3f07bbf3e1
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/update-document.ts
@@ -0,0 +1,75 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseCreateDocumentOutputSchema } from '../../output-schemas';
+
+export const updateDocumentAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_update_document',
+ outputSchema: metabaseCreateDocumentOutputSchema,
+ displayName: 'Update Document',
+ description: 'Rename, rewrite, move or archive a document.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Changes only the fields you set on a document. Text or Content replaces the whole body. Archived = Yes moves it to the trash (recoverable).',
+ idempotent: true,
+ },
+ props: {
+ documentId: metabaseAiProps.documentId({ required: true }),
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'New name. Empty = unchanged.',
+ required: false,
+ }),
+ text: Property.LongText({
+ displayName: 'Text',
+ description:
+ 'Plain-text content; blank lines separate paragraphs. Replaces the body. Set this or Content, not both.',
+ required: false,
+ }),
+ content: Property.Json({
+ displayName: 'Content',
+ description:
+ 'Rich content as a ProseMirror document, e.g. {"type": "doc", "content": [{"type": "paragraph", "content": [{"type": "text", "text": "Hello"}]}]}. Replaces the body. Set this or Text, not both.',
+ required: false,
+ }),
+ collectionId: metabaseAiProps.collectionId({
+ required: false,
+ description: 'Move to this collection. Empty = unchanged.',
+ }),
+ archived: metabaseAiProps.yesNo({
+ displayName: 'Archived',
+ description:
+ 'Yes moves the document to the trash, No restores it. Empty = unchanged.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ if (propsValue.text !== undefined && propsValue.content !== undefined) {
+ throw new Error('Set either Text or Content, not both.');
+ }
+ const document =
+ propsValue.text === undefined
+ ? propsValue.content
+ : {
+ type: 'doc',
+ content: propsValue.text.split(/\n\s*\n/).map((paragraph) => ({
+ type: 'paragraph',
+ content: [{ type: 'text', text: paragraph }],
+ })),
+ };
+ return await metabaseApi.updateDocument({
+ auth,
+ documentId: propsValue.documentId,
+ body: {
+ name: propsValue.name,
+ document,
+ collection_id: propsValue.collectionId,
+ archived: propsValue.archived,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/update-field-values.ts b/packages/pieces/community/metabase/src/lib/actions/ai/update-field-values.ts
new file mode 100644
index 00000000000..cd6e3df4350
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/update-field-values.ts
@@ -0,0 +1,36 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseMoveCardsOutputSchema } from '../../output-schemas';
+
+export const updateFieldValuesAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_update_field_values',
+ outputSchema: metabaseMoveCardsOutputSchema,
+ displayName: 'Update Field Values',
+ description: "Set custom display names for a field's values.",
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Replaces the custom display mapping of a field\'s values, e.g. 1 → "Active". Needs an admin key and the field\'s display set to custom mapping.',
+ idempotent: true,
+ },
+ props: {
+ fieldId: metabaseAiProps.fieldId({ required: true }),
+ values: Property.Json({
+ displayName: 'Values',
+ description:
+ 'Array of [value, "display name"] pairs, e.g. [[1, "Active"], [0, "Inactive"]].',
+ required: true,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.updateFieldValues({
+ auth,
+ fieldId: propsValue.fieldId,
+ body: { values: propsValue.values },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/update-field.ts b/packages/pieces/community/metabase/src/lib/actions/ai/update-field.ts
new file mode 100644
index 00000000000..d5793a7e6ee
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/update-field.ts
@@ -0,0 +1,95 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseUpdateFieldOutputSchema } from '../../output-schemas';
+
+export const updateFieldAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_update_field',
+ outputSchema: metabaseUpdateFieldOutputSchema,
+ displayName: 'Update Field',
+ description: "Update a field's data-model settings.",
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ "Changes only the fields you set on a column's data-model settings: display name, description, semantic type, visibility, foreign-key target, filter-values behaviour. Needs an admin key.",
+ idempotent: true,
+ },
+ props: {
+ fieldId: metabaseAiProps.fieldId({ required: true }),
+ displayName: Property.ShortText({
+ displayName: 'Display Name',
+ description: 'New display name. Empty = unchanged.',
+ required: false,
+ }),
+ description: Property.LongText({
+ displayName: 'Description',
+ description: 'New description. Empty = unchanged.',
+ required: false,
+ }),
+ semanticType: Property.ShortText({
+ displayName: 'Semantic Type',
+ description:
+ 'e.g. type/Category, type/Email, type/FK, type/PK, type/Currency. Empty = unchanged.',
+ required: false,
+ }),
+ visibilityType: Property.StaticDropdown({
+ displayName: 'Visibility',
+ description: 'Where the field shows. Empty = unchanged.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Everywhere', value: 'normal' },
+ { label: 'Only in detail views', value: 'details-only' },
+ { label: 'Do not include', value: 'sensitive' },
+ { label: 'Hidden', value: 'hidden' },
+ { label: 'Retired', value: 'retired' },
+ ],
+ },
+ }),
+ fkTargetFieldId: Property.Number({
+ displayName: 'Foreign Key Target Field ID',
+ description:
+ 'With semantic type type/FK: the field this column points to. Empty = unchanged.',
+ required: false,
+ }),
+ hasFieldValues: Property.StaticDropdown({
+ displayName: 'Filter Values',
+ description: 'How filters on this field offer values. Empty = unchanged.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'A list of all values', value: 'list' },
+ { label: 'Search box', value: 'search' },
+ { label: 'Plain input box', value: 'none' },
+ { label: 'Automatic', value: 'auto-list' },
+ ],
+ },
+ }),
+ settings: Property.Json({
+ displayName: 'Settings',
+ description:
+ 'Formatting settings object, e.g. {"currency": "EUR"}. Replaces the existing settings. Empty = unchanged.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.updateField({
+ auth,
+ fieldId: propsValue.fieldId,
+ body: {
+ display_name: propsValue.displayName,
+ description: propsValue.description,
+ semantic_type: propsValue.semanticType,
+ visibility_type: propsValue.visibilityType,
+ fk_target_field_id: propsValue.fkTargetFieldId,
+ has_field_values: propsValue.hasFieldValues,
+ settings: propsValue.settings,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/update-glossary-entry.ts b/packages/pieces/community/metabase/src/lib/actions/ai/update-glossary-entry.ts
new file mode 100644
index 00000000000..ac55b239797
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/update-glossary-entry.ts
@@ -0,0 +1,38 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseCreateGlossaryEntryOutputSchema } from '../../output-schemas';
+
+export const updateGlossaryEntryAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_update_glossary_entry',
+ outputSchema: metabaseCreateGlossaryEntryOutputSchema,
+ displayName: 'Update Glossary Entry',
+ description: 'Replace a glossary term and its definition.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ "Sets a glossary entry's term and definition; both are required because Metabase replaces the entry.",
+ idempotent: true,
+ },
+ props: {
+ glossaryId: metabaseAiProps.glossaryId({ required: true }),
+ term: Property.ShortText({
+ displayName: 'Term',
+ required: true,
+ }),
+ definition: Property.LongText({
+ displayName: 'Definition',
+ required: true,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.updateGlossaryEntry({
+ auth,
+ glossaryId: propsValue.glossaryId,
+ body: { term: propsValue.term, definition: propsValue.definition },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/update-segment.ts b/packages/pieces/community/metabase/src/lib/actions/ai/update-segment.ts
new file mode 100644
index 00000000000..101585f24c5
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/update-segment.ts
@@ -0,0 +1,64 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseGetSegmentOutputSchema } from '../../output-schemas';
+
+export const updateSegmentAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_update_segment',
+ outputSchema: metabaseGetSegmentOutputSchema,
+ displayName: 'Update Segment',
+ description: 'Change or archive a segment.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Changes only the fields you set on a segment, with a revision message kept in its history. Archived = Yes hides it (recoverable). Needs an admin key.',
+ idempotent: true,
+ },
+ props: {
+ segmentId: metabaseAiProps.segmentId({ required: true }),
+ revisionMessage: Property.ShortText({
+ displayName: 'Revision Message',
+ description:
+ 'Why the change was made, kept in the history. Required by Metabase.',
+ required: true,
+ }),
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'New name. Empty = unchanged.',
+ required: false,
+ }),
+ description: Property.LongText({
+ displayName: 'Description',
+ description: 'New description. Empty = unchanged.',
+ required: false,
+ }),
+ definition: Property.Json({
+ displayName: 'Definition',
+ description:
+ 'New filter definition (MBQL, same shape as Create Segment). Empty = unchanged.',
+ required: false,
+ }),
+ archived: metabaseAiProps.yesNo({
+ displayName: 'Archived',
+ description:
+ 'Yes archives the segment, No restores it. Empty = unchanged.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.updateSegment({
+ auth,
+ segmentId: propsValue.segmentId,
+ body: {
+ revision_message: propsValue.revisionMessage,
+ name: propsValue.name,
+ description: propsValue.description,
+ definition: propsValue.definition,
+ archived: propsValue.archived,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/update-snippet.ts b/packages/pieces/community/metabase/src/lib/actions/ai/update-snippet.ts
new file mode 100644
index 00000000000..b4a74032630
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/update-snippet.ts
@@ -0,0 +1,56 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseUpdateSnippetOutputSchema } from '../../output-schemas';
+
+export const updateSnippetAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_update_snippet',
+ outputSchema: metabaseUpdateSnippetOutputSchema,
+ displayName: 'Update Snippet',
+ description: 'Change or archive a SQL snippet.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Changes only the fields you set on a SQL snippet; renaming breaks questions that reference the old name. Archived = Yes hides it (recoverable).',
+ idempotent: true,
+ },
+ props: {
+ snippetId: metabaseAiProps.snippetId({ required: true }),
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'New name. Empty = unchanged.',
+ required: false,
+ }),
+ content: Property.LongText({
+ displayName: 'SQL',
+ description: 'New SQL fragment. Empty = unchanged.',
+ required: false,
+ }),
+ description: Property.LongText({
+ displayName: 'Description',
+ description: 'New description. Empty = unchanged.',
+ required: false,
+ }),
+ archived: metabaseAiProps.yesNo({
+ displayName: 'Archived',
+ description:
+ 'Yes archives the snippet, No restores it. Empty = unchanged.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.updateSnippet({
+ auth,
+ snippetId: propsValue.snippetId,
+ body: {
+ name: propsValue.name,
+ content: propsValue.content,
+ description: propsValue.description,
+ archived: propsValue.archived,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/update-table.ts b/packages/pieces/community/metabase/src/lib/actions/ai/update-table.ts
new file mode 100644
index 00000000000..58623a1abaf
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/update-table.ts
@@ -0,0 +1,85 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseUpdateTableOutputSchema } from '../../output-schemas';
+
+export const updateTableAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_update_table',
+ outputSchema: metabaseUpdateTableOutputSchema,
+ displayName: 'Update Table',
+ description: "Update a table's data-model settings.",
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ "Changes only the fields you set on a table's data-model settings: display name, description, visibility, caveats, field order. Needs an admin key.",
+ idempotent: true,
+ },
+ props: {
+ tableId: metabaseAiProps.tableId({ required: true }),
+ displayName: Property.ShortText({
+ displayName: 'Display Name',
+ description: 'New display name. Empty = unchanged.',
+ required: false,
+ }),
+ description: Property.LongText({
+ displayName: 'Description',
+ description: 'New description. Empty = unchanged.',
+ required: false,
+ }),
+ visibilityType: Property.StaticDropdown({
+ displayName: 'Visibility',
+ description: 'Hide the table from users. Empty = unchanged.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Hidden', value: 'hidden' },
+ { label: 'Technical', value: 'technical' },
+ { label: 'Cruft', value: 'cruft' },
+ ],
+ },
+ }),
+ caveats: Property.LongText({
+ displayName: 'Caveats',
+ description:
+ 'Things users should know about this table. Empty = unchanged.',
+ required: false,
+ }),
+ pointsOfInterest: Property.LongText({
+ displayName: 'Points of Interest',
+ description: 'What is useful about this table. Empty = unchanged.',
+ required: false,
+ }),
+ fieldOrder: Property.StaticDropdown({
+ displayName: 'Field Order',
+ description: 'How columns are ordered. Empty = unchanged.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Database', value: 'database' },
+ { label: 'Alphabetical', value: 'alphabetical' },
+ { label: 'Smart', value: 'smart' },
+ { label: 'Custom', value: 'custom' },
+ ],
+ },
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.updateTable({
+ auth,
+ tableId: propsValue.tableId,
+ body: {
+ display_name: propsValue.displayName,
+ description: propsValue.description,
+ visibility_type: propsValue.visibilityType,
+ caveats: propsValue.caveats,
+ points_of_interest: propsValue.pointsOfInterest,
+ field_order: propsValue.fieldOrder,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/update-timeline-event.ts b/packages/pieces/community/metabase/src/lib/actions/ai/update-timeline-event.ts
new file mode 100644
index 00000000000..aebc38cc51e
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/update-timeline-event.ts
@@ -0,0 +1,66 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseCreateTimelineEventOutputSchema } from '../../output-schemas';
+
+export const updateTimelineEventAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_update_timeline_event',
+ outputSchema: metabaseCreateTimelineEventOutputSchema,
+ displayName: 'Update Timeline Event',
+ description: 'Change, move or archive a timeline event.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Changes only the fields you set on a timeline event, including moving it to another timeline. Archived = Yes hides it (recoverable).',
+ idempotent: true,
+ },
+ props: {
+ eventId: metabaseAiProps.timelineEventId({ required: true }),
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'New name. Empty = unchanged.',
+ required: false,
+ }),
+ timestamp: Property.DateTime({
+ displayName: 'Timestamp',
+ description: 'New time, ISO 8601. Empty = unchanged.',
+ required: false,
+ }),
+ timezone: Property.ShortText({
+ displayName: 'Time Zone',
+ description: 'New IANA time zone. Empty = unchanged.',
+ required: false,
+ }),
+ description: Property.LongText({
+ displayName: 'Description',
+ description: 'New description. Empty = unchanged.',
+ required: false,
+ }),
+ timelineId: metabaseAiProps.timelineId({
+ required: false,
+ description: 'Move the event to this timeline. Empty = unchanged.',
+ }),
+ archived: metabaseAiProps.yesNo({
+ displayName: 'Archived',
+ description: 'Yes archives the event, No restores it. Empty = unchanged.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.updateTimelineEvent({
+ auth,
+ eventId: propsValue.eventId,
+ body: {
+ name: propsValue.name,
+ timestamp: propsValue.timestamp,
+ timezone: propsValue.timezone,
+ description: propsValue.description,
+ timeline_id: propsValue.timelineId,
+ archived: propsValue.archived,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/update-timeline.ts b/packages/pieces/community/metabase/src/lib/actions/ai/update-timeline.ts
new file mode 100644
index 00000000000..ab9c0ef88b6
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/update-timeline.ts
@@ -0,0 +1,72 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseUpdateTimelineOutputSchema } from '../../output-schemas';
+
+export const updateTimelineAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_update_timeline',
+ outputSchema: metabaseUpdateTimelineOutputSchema,
+ displayName: 'Update Timeline',
+ description: 'Rename, move or archive a timeline.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Changes only the fields you set on a timeline. Archived = Yes hides it and its events (recoverable).',
+ idempotent: true,
+ },
+ props: {
+ timelineId: metabaseAiProps.timelineId({ required: true }),
+ name: Property.ShortText({
+ displayName: 'Name',
+ description: 'New name. Empty = unchanged.',
+ required: false,
+ }),
+ description: Property.LongText({
+ displayName: 'Description',
+ description: 'New description. Empty = unchanged.',
+ required: false,
+ }),
+ collectionId: metabaseAiProps.collectionId({
+ required: false,
+ description: 'Move to this collection. Empty = unchanged.',
+ }),
+ archived: metabaseAiProps.yesNo({
+ displayName: 'Archived',
+ description:
+ 'Yes archives the timeline, No restores it. Empty = unchanged.',
+ required: false,
+ }),
+ icon: Property.StaticDropdown({
+ displayName: 'Icon',
+ description: 'Icon shown on charts. Empty = unchanged.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Star', value: 'star' },
+ { label: 'Cake', value: 'cake' },
+ { label: 'Mail', value: 'mail' },
+ { label: 'Warning', value: 'warning' },
+ { label: 'Bell', value: 'bell' },
+ { label: 'Cloud', value: 'cloud' },
+ ],
+ },
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.updateTimeline({
+ auth,
+ timelineId: propsValue.timelineId,
+ body: {
+ name: propsValue.name,
+ description: propsValue.description,
+ collection_id: propsValue.collectionId,
+ archived: propsValue.archived,
+ icon: propsValue.icon,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/ai/update-user.ts b/packages/pieces/community/metabase/src/lib/actions/ai/update-user.ts
new file mode 100644
index 00000000000..e64ba6b8db9
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/actions/ai/update-user.ts
@@ -0,0 +1,62 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { metabaseAiProps } from '../../ai-props';
+import { metabaseApi } from '../../api';
+import { metabaseAuth } from '../../auth';
+import { metabaseUpdateUserOutputSchema } from '../../output-schemas';
+
+export const updateUserAction = createAction({
+ auth: metabaseAuth,
+ name: 'metabase_update_user',
+ outputSchema: metabaseUpdateUserOutputSchema,
+ displayName: 'Update User',
+ description: "Update a user's name, email, locale or admin status.",
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description:
+ 'Changes only the fields you set on a user. Updating other users or admin status needs an admin key. Use Add Group Member / Remove Group Member for groups.',
+ idempotent: true,
+ },
+ props: {
+ userId: metabaseAiProps.userId({ required: true }),
+ firstName: Property.ShortText({
+ displayName: 'First Name',
+ description: 'New first name. Empty = unchanged.',
+ required: false,
+ }),
+ lastName: Property.ShortText({
+ displayName: 'Last Name',
+ description: 'New last name. Empty = unchanged.',
+ required: false,
+ }),
+ email: Property.ShortText({
+ displayName: 'Email',
+ description: 'New email. Empty = unchanged.',
+ required: false,
+ }),
+ locale: Property.ShortText({
+ displayName: 'Locale',
+ description: 'Language code such as en or de. Empty = unchanged.',
+ required: false,
+ }),
+ isSuperuser: metabaseAiProps.yesNo({
+ displayName: 'Admin',
+ description:
+ 'Yes makes the user an admin, No removes admin. Empty = unchanged.',
+ required: false,
+ }),
+ },
+ async run({ auth, propsValue }) {
+ return await metabaseApi.updateUser({
+ auth,
+ userId: propsValue.userId,
+ body: {
+ first_name: propsValue.firstName,
+ last_name: propsValue.lastName,
+ email: propsValue.email,
+ locale: propsValue.locale,
+ is_superuser: propsValue.isSuperuser,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/actions/embed-question.ts b/packages/pieces/community/metabase/src/lib/actions/embed-question.ts
index d940e43ab6f..2d12f18e3fb 100644
--- a/packages/pieces/community/metabase/src/lib/actions/embed-question.ts
+++ b/packages/pieces/community/metabase/src/lib/actions/embed-question.ts
@@ -2,6 +2,7 @@ import { createAction, Property } from '@activepieces/pieces-framework';
import { queryMetabaseApi } from '../common';
import { metabaseAuth } from '../..';
import { HttpMethod } from '@activepieces/pieces-common';
+import { embedQuestionOutputSchema } from '../output-schemas';
interface MetabaseParam {
id: string;
@@ -11,13 +12,14 @@ interface MetabaseParam {
export const embedQuestion = createAction({
name: 'embedQuestion',
+ outputSchema: embedQuestionOutputSchema,
classification: 'WRITE',
auth: metabaseAuth,
requireAuth: true,
displayName: 'Embed question',
description:
'Enable embedding for a Metabase question and configure parameters',
- audience: 'both',
+ audience: 'human',
aiMetadata: {
description:
"Updates a Metabase question (card) by its ID to toggle static embedding on or off and set how each parameter is exposed in the embed (disabled, editable, or locked). Use when configuring a question for external embedding. This mutates the card's settings, but is idempotent — re-running with the same inputs leaves the card in the same configured state.",
diff --git a/packages/pieces/community/metabase/src/lib/actions/get-dashboard.ts b/packages/pieces/community/metabase/src/lib/actions/get-dashboard.ts
index a32a2e31c2d..794fa43c43e 100644
--- a/packages/pieces/community/metabase/src/lib/actions/get-dashboard.ts
+++ b/packages/pieces/community/metabase/src/lib/actions/get-dashboard.ts
@@ -2,6 +2,7 @@ import { createAction, Property } from '@activepieces/pieces-framework';
import { queryMetabaseApi } from '../common';
import { metabaseAuth } from '../..';
import { HttpMethod } from '@activepieces/pieces-common';
+import { getDashboardQuestionsOutputSchema } from '../output-schemas';
interface MetabaseParam {
id: string;
@@ -33,6 +34,7 @@ interface DashboardResult {
export const getDashboardQuestions = createAction({
name: 'getDashboardQuestions',
+ outputSchema: getDashboardQuestionsOutputSchema,
classification: 'READ',
auth: metabaseAuth,
requireAuth: true,
diff --git a/packages/pieces/community/metabase/src/lib/actions/get-question.ts b/packages/pieces/community/metabase/src/lib/actions/get-question.ts
index cef621634fa..3683614e166 100644
--- a/packages/pieces/community/metabase/src/lib/actions/get-question.ts
+++ b/packages/pieces/community/metabase/src/lib/actions/get-question.ts
@@ -2,6 +2,7 @@ import { createAction, Property } from '@activepieces/pieces-framework';
import { queryMetabaseApi } from '../common';
import { metabaseAuth } from '../..';
import { HttpMethod } from '@activepieces/pieces-common';
+import { getQuestionOutputSchema } from '../output-schemas';
interface MetabaseParam {
id: string;
@@ -12,12 +13,13 @@ interface MetabaseParam {
export const getQuestion = createAction({
name: 'getQuestion',
+ outputSchema: getQuestionOutputSchema,
classification: 'READ',
auth: metabaseAuth,
requireAuth: true,
displayName: 'Get question',
description: 'Fetch the results of a Metabase question',
- audience: 'both',
+ audience: 'human',
aiMetadata: {
description:
'Runs a saved Metabase question (card) by its ID and returns the query result rows. Use to pull live data from an existing report rather than writing raw SQL. Optionally pass a parameters object (keyed by parameter slug) to filter the query; slugs not defined on the card are ignored. Read-only and idempotent — re-running with the same inputs re-executes the query without side effects.',
diff --git a/packages/pieces/community/metabase/src/lib/ai-props.ts b/packages/pieces/community/metabase/src/lib/ai-props.ts
new file mode 100644
index 00000000000..42b9ebb3480
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/ai-props.ts
@@ -0,0 +1,192 @@
+import { Property } from '@activepieces/pieces-framework';
+
+function cardId<R extends boolean>({
+ required,
+ displayName = 'Card ID',
+ description = 'Numeric ID of the question (card or model). Get it from List Cards or Search.',
+}: PropParams<R>) {
+ return Property.Number({ displayName, description, required });
+}
+
+function dashboardId<R extends boolean>({
+ required,
+ displayName = 'Dashboard ID',
+ description = 'Numeric ID of the dashboard. Get it from List Dashboards or Search.',
+}: PropParams<R>) {
+ return Property.Number({ displayName, description, required });
+}
+
+function collectionId<R extends boolean>({
+ required,
+ displayName = 'Collection ID',
+ description = 'Numeric ID of the collection. Get it from List Collections. Empty = the root collection ("Our analytics").',
+}: PropParams<R>) {
+ return Property.Number({ displayName, description, required });
+}
+
+function parameterId<R extends boolean>({
+ required,
+ displayName = 'Parameter ID',
+ description = "The filter parameter's `id` (not its slug), from the `parameters` list returned by Get Card or Get Dashboard.",
+}: PropParams<R>) {
+ return Property.ShortText({ displayName, description, required });
+}
+
+function databaseId<R extends boolean>({
+ required,
+ displayName = 'Database ID',
+ description = 'Numeric ID of the connected database. Get it from List Databases.',
+}: PropParams<R>) {
+ return Property.Number({ displayName, description, required });
+}
+
+function tableId<R extends boolean>({
+ required,
+ displayName = 'Table ID',
+ description = 'Numeric ID of the table. Get it from List Tables, List Schema Tables or Search.',
+}: PropParams<R>) {
+ return Property.Number({ displayName, description, required });
+}
+
+function fieldId<R extends boolean>({
+ required,
+ displayName = 'Field ID',
+ description = 'Numeric ID of the field (column). Get it from Get Table Metadata or List Database Fields.',
+}: PropParams<R>) {
+ return Property.Number({ displayName, description, required });
+}
+
+function userId<R extends boolean>({
+ required,
+ displayName = 'User ID',
+ description = 'Numeric ID of the Metabase user. Get it from List Users or Get Current User.',
+}: PropParams<R>) {
+ return Property.Number({ displayName, description, required });
+}
+
+function groupId<R extends boolean>({
+ required,
+ displayName = 'Group ID',
+ description = 'Numeric ID of the permission group. Get it from List Groups.',
+}: PropParams<R>) {
+ return Property.Number({ displayName, description, required });
+}
+
+function alertId<R extends boolean>({
+ required,
+ displayName = 'Alert ID',
+ description = 'Numeric ID of the alert (notification). Get it from List Alerts.',
+}: PropParams<R>) {
+ return Property.Number({ displayName, description, required });
+}
+
+function subscriptionId<R extends boolean>({
+ required,
+ displayName = 'Subscription ID',
+ description = 'Numeric ID of the dashboard subscription. Get it from List Dashboard Subscriptions.',
+}: PropParams<R>) {
+ return Property.Number({ displayName, description, required });
+}
+
+function timelineId<R extends boolean>({
+ required,
+ displayName = 'Timeline ID',
+ description = 'Numeric ID of the timeline. Get it from List Timelines.',
+}: PropParams<R>) {
+ return Property.Number({ displayName, description, required });
+}
+
+function timelineEventId<R extends boolean>({
+ required,
+ displayName = 'Event ID',
+ description = 'Numeric ID of the timeline event. Get it from Get Timeline (with events).',
+}: PropParams<R>) {
+ return Property.Number({ displayName, description, required });
+}
+
+function snippetId<R extends boolean>({
+ required,
+ displayName = 'Snippet ID',
+ description = 'Numeric ID of the SQL snippet. Get it from List Snippets.',
+}: PropParams<R>) {
+ return Property.Number({ displayName, description, required });
+}
+
+function segmentId<R extends boolean>({
+ required,
+ displayName = 'Segment ID',
+ description = 'Numeric ID of the segment. Get it from List Segments.',
+}: PropParams<R>) {
+ return Property.Number({ displayName, description, required });
+}
+
+function glossaryId<R extends boolean>({
+ required,
+ displayName = 'Glossary Entry ID',
+ description = 'Numeric ID of the glossary entry. Get it from List Glossary Entries.',
+}: PropParams<R>) {
+ return Property.Number({ displayName, description, required });
+}
+
+function documentId<R extends boolean>({
+ required,
+ displayName = 'Document ID',
+ description = 'Numeric ID of the document. Get it from List Documents or Search.',
+}: PropParams<R>) {
+ return Property.Number({ displayName, description, required });
+}
+
+function actionId<R extends boolean>({
+ required,
+ displayName = 'Action ID',
+ description = 'Numeric ID of the Metabase action. Get it from List Actions.',
+}: PropParams<R>) {
+ return Property.Number({ displayName, description, required });
+}
+
+function yesNo<R extends boolean>({
+ required,
+ displayName,
+ description,
+}: PropParams<R> & { displayName: string }) {
+ return Property.StaticDropdown<boolean, R>({
+ displayName,
+ description,
+ required,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Yes', value: true },
+ { label: 'No', value: false },
+ ],
+ },
+ });
+}
+
+export const metabaseAiProps = {
+ cardId,
+ dashboardId,
+ collectionId,
+ parameterId,
+ databaseId,
+ tableId,
+ fieldId,
+ userId,
+ groupId,
+ alertId,
+ subscriptionId,
+ timelineId,
+ timelineEventId,
+ snippetId,
+ segmentId,
+ glossaryId,
+ documentId,
+ actionId,
+ yesNo,
+};
+
+export type PropParams<R extends boolean> = {
+ required: R;
+ displayName?: string;
+ description?: string;
+};
diff --git a/packages/pieces/community/metabase/src/lib/api.ts b/packages/pieces/community/metabase/src/lib/api.ts
new file mode 100644
index 00000000000..f61eeead4da
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/api.ts
@@ -0,0 +1,2206 @@
+import { HttpMethod, QueryParams } from '@activepieces/pieces-common';
+import { AppConnectionValueForAuthProperty } from '@activepieces/pieces-framework';
+
+import { queryMetabaseApi } from './common';
+
+import type { metabaseAuth } from './auth';
+
+async function request<T>({
+ auth,
+ method,
+ path,
+ query,
+ body,
+}: RequestParams & { auth: MetabaseAuth }): Promise<T> {
+ return await queryMetabaseApi(
+ {
+ endpoint: path,
+ method,
+ queryParams: query ? toQueryParams({ params: query }) : undefined,
+ body,
+ },
+ auth
+ );
+}
+
+function toQueryParams({
+ params,
+}: {
+ params: Record<string, QueryValue>;
+}): QueryParams {
+ return Object.fromEntries(
+ Object.entries(params).flatMap(([key, value]) =>
+ value === undefined ? [] : [[key, String(value)]]
+ )
+ );
+}
+
+function assertQuerySucceeded({
+ result,
+}: {
+ result: MetabaseQueryResult;
+}): MetabaseQueryResult {
+ if (result.status === 'failed' || result.error) {
+ throw new Error(
+ `Metabase query failed: ${result.error ?? 'unknown error'}`
+ );
+ }
+ return result;
+}
+
+async function listCards({
+ auth,
+ filter,
+ modelId,
+}: {
+ auth: MetabaseAuth;
+ filter?: string;
+ modelId?: number;
+}): Promise<unknown[]> {
+ return await request<unknown[]>({
+ auth,
+ method: HttpMethod.GET,
+ path: 'card',
+ query: { f: filter, model_id: modelId },
+ });
+}
+
+async function getCard({
+ auth,
+ cardId,
+}: {
+ auth: MetabaseAuth;
+ cardId: number;
+}): Promise<MetabaseCard> {
+ return await request<MetabaseCard>({
+ auth,
+ method: HttpMethod.GET,
+ path: `card/${cardId}`,
+ });
+}
+
+async function createCard({
+ auth,
+ body,
+}: {
+ auth: MetabaseAuth;
+ body: Record<string, unknown>;
+}): Promise<MetabaseCard> {
+ return await request<MetabaseCard>({
+ auth,
+ method: HttpMethod.POST,
+ path: 'card',
+ body,
+ });
+}
+
+async function updateCard({
+ auth,
+ cardId,
+ body,
+}: {
+ auth: MetabaseAuth;
+ cardId: number;
+ body: Record<string, unknown>;
+}): Promise<MetabaseCard> {
+ return await request<MetabaseCard>({
+ auth,
+ method: HttpMethod.PUT,
+ path: `card/${cardId}`,
+ body,
+ });
+}
+
+async function deleteCard({
+ auth,
+ cardId,
+}: {
+ auth: MetabaseAuth;
+ cardId: number;
+}): Promise<void> {
+ await request<unknown>({
+ auth,
+ method: HttpMethod.DELETE,
+ path: `card/${cardId}`,
+ });
+}
+
+async function runCardQuery({
+ auth,
+ cardId,
+ parameters,
+ ignoreCache,
+}: {
+ auth: MetabaseAuth;
+ cardId: number;
+ parameters: unknown[];
+ ignoreCache: boolean;
+}): Promise<MetabaseQueryResult> {
+ const result = await request<MetabaseQueryResult>({
+ auth,
+ method: HttpMethod.POST,
+ path: `card/${cardId}/query`,
+ body: { parameters, ignore_cache: ignoreCache },
+ });
+ return assertQuerySucceeded({ result });
+}
+
+async function copyCard({
+ auth,
+ cardId,
+}: {
+ auth: MetabaseAuth;
+ cardId: number;
+}): Promise<MetabaseCard> {
+ return await request<MetabaseCard>({
+ auth,
+ method: HttpMethod.POST,
+ path: `card/${cardId}/copy`,
+ });
+}
+
+async function listCardDashboards({
+ auth,
+ cardId,
+}: {
+ auth: MetabaseAuth;
+ cardId: number;
+}): Promise<unknown[]> {
+ return await request<unknown[]>({
+ auth,
+ method: HttpMethod.GET,
+ path: `card/${cardId}/dashboards`,
+ });
+}
+
+async function getCardQueryMetadata({
+ auth,
+ cardId,
+}: {
+ auth: MetabaseAuth;
+ cardId: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `card/${cardId}/query_metadata`,
+ });
+}
+
+async function listCardParameterValues({
+ auth,
+ cardId,
+ parameterId,
+}: {
+ auth: MetabaseAuth;
+ cardId: number;
+ parameterId: string;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `card/${cardId}/params/${encodeURIComponent(parameterId)}/values`,
+ });
+}
+
+async function searchCardParameterValues({
+ auth,
+ cardId,
+ parameterId,
+ query,
+}: {
+ auth: MetabaseAuth;
+ cardId: number;
+ parameterId: string;
+ query: string;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `card/${cardId}/params/${encodeURIComponent(
+ parameterId
+ )}/search/${encodeURIComponent(query)}`,
+ });
+}
+
+async function moveCards({
+ auth,
+ cardIds,
+ collectionId,
+ dashboardId,
+}: {
+ auth: MetabaseAuth;
+ cardIds: number[];
+ collectionId?: number;
+ dashboardId?: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: 'cards/move',
+ body: {
+ card_ids: cardIds,
+ collection_id: collectionId,
+ dashboard_id: dashboardId,
+ },
+ });
+}
+
+async function createCardPublicLink({
+ auth,
+ cardId,
+}: {
+ auth: MetabaseAuth;
+ cardId: number;
+}): Promise<{ uuid: string }> {
+ return await request<{ uuid: string }>({
+ auth,
+ method: HttpMethod.POST,
+ path: `card/${cardId}/public_link`,
+ });
+}
+
+async function deleteCardPublicLink({
+ auth,
+ cardId,
+}: {
+ auth: MetabaseAuth;
+ cardId: number;
+}): Promise<void> {
+ await request<unknown>({
+ auth,
+ method: HttpMethod.DELETE,
+ path: `card/${cardId}/public_link`,
+ });
+}
+
+async function listDashboards({
+ auth,
+ filter,
+}: {
+ auth: MetabaseAuth;
+ filter?: string;
+}): Promise<unknown[]> {
+ return await request<unknown[]>({
+ auth,
+ method: HttpMethod.GET,
+ path: 'dashboard',
+ query: { f: filter },
+ });
+}
+
+async function getDashboard({
+ auth,
+ dashboardId,
+}: {
+ auth: MetabaseAuth;
+ dashboardId: number;
+}): Promise<MetabaseDashboard> {
+ return await request<MetabaseDashboard>({
+ auth,
+ method: HttpMethod.GET,
+ path: `dashboard/${dashboardId}`,
+ });
+}
+
+async function createDashboard({
+ auth,
+ body,
+}: {
+ auth: MetabaseAuth;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: 'dashboard',
+ body,
+ });
+}
+
+async function updateDashboard({
+ auth,
+ dashboardId,
+ body,
+}: {
+ auth: MetabaseAuth;
+ dashboardId: number;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.PUT,
+ path: `dashboard/${dashboardId}`,
+ body,
+ });
+}
+
+async function deleteDashboard({
+ auth,
+ dashboardId,
+}: {
+ auth: MetabaseAuth;
+ dashboardId: number;
+}): Promise<void> {
+ await request<unknown>({
+ auth,
+ method: HttpMethod.DELETE,
+ path: `dashboard/${dashboardId}`,
+ });
+}
+
+async function copyDashboard({
+ auth,
+ dashboardId,
+ body,
+}: {
+ auth: MetabaseAuth;
+ dashboardId: number;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: `dashboard/${dashboardId}/copy`,
+ body,
+ });
+}
+
+async function runDashboardCardQuery({
+ auth,
+ dashboardId,
+ dashcardId,
+ cardId,
+ parameters,
+}: {
+ auth: MetabaseAuth;
+ dashboardId: number;
+ dashcardId: number;
+ cardId: number;
+ parameters: unknown[];
+}): Promise<MetabaseQueryResult> {
+ const result = await request<MetabaseQueryResult>({
+ auth,
+ method: HttpMethod.POST,
+ path: `dashboard/${dashboardId}/dashcard/${dashcardId}/card/${cardId}/query`,
+ body: { parameters },
+ });
+ return assertQuerySucceeded({ result });
+}
+
+async function listDashboardParameterValues({
+ auth,
+ dashboardId,
+ parameterId,
+}: {
+ auth: MetabaseAuth;
+ dashboardId: number;
+ parameterId: string;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `dashboard/${dashboardId}/params/${encodeURIComponent(
+ parameterId
+ )}/values`,
+ });
+}
+
+async function searchDashboardParameterValues({
+ auth,
+ dashboardId,
+ parameterId,
+ query,
+}: {
+ auth: MetabaseAuth;
+ dashboardId: number;
+ parameterId: string;
+ query: string;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `dashboard/${dashboardId}/params/${encodeURIComponent(
+ parameterId
+ )}/search/${encodeURIComponent(query)}`,
+ });
+}
+
+async function createDashboardPublicLink({
+ auth,
+ dashboardId,
+}: {
+ auth: MetabaseAuth;
+ dashboardId: number;
+}): Promise<{ uuid: string }> {
+ return await request<{ uuid: string }>({
+ auth,
+ method: HttpMethod.POST,
+ path: `dashboard/${dashboardId}/public_link`,
+ });
+}
+
+async function deleteDashboardPublicLink({
+ auth,
+ dashboardId,
+}: {
+ auth: MetabaseAuth;
+ dashboardId: number;
+}): Promise<void> {
+ await request<unknown>({
+ auth,
+ method: HttpMethod.DELETE,
+ path: `dashboard/${dashboardId}/public_link`,
+ });
+}
+
+async function listCollections({
+ auth,
+ archived,
+ personalOnly,
+}: {
+ auth: MetabaseAuth;
+ archived?: boolean;
+ personalOnly?: boolean;
+}): Promise<unknown[]> {
+ return await request<unknown[]>({
+ auth,
+ method: HttpMethod.GET,
+ path: 'collection',
+ query: { archived, 'personal-only': personalOnly },
+ });
+}
+
+async function getCollection({
+ auth,
+ collectionId,
+}: {
+ auth: MetabaseAuth;
+ collectionId: CollectionRef;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `collection/${collectionId}`,
+ });
+}
+
+async function listCollectionItems({
+ auth,
+ collectionId,
+ models,
+ archived,
+ limit,
+ offset,
+}: {
+ auth: MetabaseAuth;
+ collectionId: CollectionRef;
+ models?: string;
+ archived?: boolean;
+ limit: number;
+ offset?: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `collection/${collectionId}/items`,
+ query: { models, archived, limit, offset },
+ });
+}
+
+async function getCollectionTree({
+ auth,
+ excludeArchived,
+}: {
+ auth: MetabaseAuth;
+ excludeArchived?: boolean;
+}): Promise<unknown[]> {
+ return await request<unknown[]>({
+ auth,
+ method: HttpMethod.GET,
+ path: 'collection/tree',
+ query: { 'exclude-archived': excludeArchived },
+ });
+}
+
+async function createCollection({
+ auth,
+ body,
+}: {
+ auth: MetabaseAuth;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: 'collection',
+ body,
+ });
+}
+
+async function updateCollection({
+ auth,
+ collectionId,
+ body,
+}: {
+ auth: MetabaseAuth;
+ collectionId: number;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.PUT,
+ path: `collection/${collectionId}`,
+ body,
+ });
+}
+
+async function deleteCollection({
+ auth,
+ collectionId,
+}: {
+ auth: MetabaseAuth;
+ collectionId: number;
+}): Promise<void> {
+ await request<unknown>({
+ auth,
+ method: HttpMethod.DELETE,
+ path: `collection/${collectionId}`,
+ });
+}
+
+async function runQuery({
+ auth,
+ datasetQuery,
+}: {
+ auth: MetabaseAuth;
+ datasetQuery: Record<string, unknown>;
+}): Promise<MetabaseQueryResult> {
+ const result = await request<MetabaseQueryResult>({
+ auth,
+ method: HttpMethod.POST,
+ path: 'dataset',
+ body: datasetQuery,
+ });
+ return assertQuerySucceeded({ result });
+}
+
+async function convertQueryToNative({
+ auth,
+ datasetQuery,
+}: {
+ auth: MetabaseAuth;
+ datasetQuery: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: 'dataset/native',
+ body: datasetQuery,
+ });
+}
+
+async function search({
+ auth,
+ q,
+ models,
+ collectionId,
+ archived,
+ limit,
+ offset,
+}: {
+ auth: MetabaseAuth;
+ q?: string;
+ models?: string;
+ collectionId?: number;
+ archived?: boolean;
+ limit: number;
+ offset?: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: 'search',
+ query: { q, models, collection: collectionId, archived, limit, offset },
+ });
+}
+
+async function listDatabases({
+ auth,
+ include,
+}: {
+ auth: MetabaseAuth;
+ include?: string;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `database`,
+ query: { include: include },
+ });
+}
+
+async function getDatabase({
+ auth,
+ databaseId,
+ include,
+}: {
+ auth: MetabaseAuth;
+ databaseId: number;
+ include?: string;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `database/${databaseId}`,
+ query: { include: include },
+ });
+}
+
+async function getDatabaseMetadata({
+ auth,
+ databaseId,
+}: {
+ auth: MetabaseAuth;
+ databaseId: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `database/${databaseId}/metadata`,
+ });
+}
+
+async function updateDatabase({
+ auth,
+ databaseId,
+ body,
+}: {
+ auth: MetabaseAuth;
+ databaseId: number;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.PUT,
+ path: `database/${databaseId}`,
+ body,
+ });
+}
+
+async function listDatabaseSchemas({
+ auth,
+ databaseId,
+}: {
+ auth: MetabaseAuth;
+ databaseId: number;
+}): Promise<unknown[]> {
+ return await request<unknown[]>({
+ auth,
+ method: HttpMethod.GET,
+ path: `database/${databaseId}/schemas`,
+ });
+}
+
+async function listSchemaTables({
+ auth,
+ databaseId,
+ schema,
+}: {
+ auth: MetabaseAuth;
+ databaseId: number;
+ schema: string;
+}): Promise<unknown[]> {
+ return await request<unknown[]>({
+ auth,
+ method: HttpMethod.GET,
+ path: `database/${databaseId}/schema/${schema}`,
+ });
+}
+
+async function listDatabaseFields({
+ auth,
+ databaseId,
+}: {
+ auth: MetabaseAuth;
+ databaseId: number;
+}): Promise<unknown[]> {
+ return await request<unknown[]>({
+ auth,
+ method: HttpMethod.GET,
+ path: `database/${databaseId}/fields`,
+ });
+}
+
+async function checkDatabaseHealth({
+ auth,
+ databaseId,
+}: {
+ auth: MetabaseAuth;
+ databaseId: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `database/${databaseId}/healthcheck`,
+ });
+}
+
+async function syncDatabaseSchema({
+ auth,
+ databaseId,
+}: {
+ auth: MetabaseAuth;
+ databaseId: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: `database/${databaseId}/sync_schema`,
+ });
+}
+
+async function rescanDatabaseFieldValues({
+ auth,
+ databaseId,
+}: {
+ auth: MetabaseAuth;
+ databaseId: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: `database/${databaseId}/rescan_values`,
+ });
+}
+
+async function discardDatabaseFieldValues({
+ auth,
+ databaseId,
+}: {
+ auth: MetabaseAuth;
+ databaseId: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: `database/${databaseId}/discard_values`,
+ });
+}
+
+async function listTables({
+ auth,
+ term,
+}: {
+ auth: MetabaseAuth;
+ term?: string;
+}): Promise<unknown[]> {
+ return await request<unknown[]>({
+ auth,
+ method: HttpMethod.GET,
+ path: `table`,
+ query: { term: term },
+ });
+}
+
+async function getTable({
+ auth,
+ tableId,
+}: {
+ auth: MetabaseAuth;
+ tableId: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `table/${tableId}`,
+ });
+}
+
+async function getTableMetadata({
+ auth,
+ tableId,
+ includeHiddenFields,
+ includeSensitiveFields,
+}: {
+ auth: MetabaseAuth;
+ tableId: number;
+ includeHiddenFields?: boolean;
+ includeSensitiveFields?: boolean;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `table/${tableId}/query_metadata`,
+ query: {
+ include_hidden_fields: includeHiddenFields,
+ include_sensitive_fields: includeSensitiveFields,
+ },
+ });
+}
+
+async function listTableForeignKeys({
+ auth,
+ tableId,
+}: {
+ auth: MetabaseAuth;
+ tableId: number;
+}): Promise<unknown[]> {
+ return await request<unknown[]>({
+ auth,
+ method: HttpMethod.GET,
+ path: `table/${tableId}/fks`,
+ });
+}
+
+async function getTableData({
+ auth,
+ tableId,
+}: {
+ auth: MetabaseAuth;
+ tableId: number;
+}): Promise<MetabaseQueryResult> {
+ return await request<MetabaseQueryResult>({
+ auth,
+ method: HttpMethod.GET,
+ path: `table/${tableId}/data`,
+ });
+}
+
+async function updateTable({
+ auth,
+ tableId,
+ body,
+}: {
+ auth: MetabaseAuth;
+ tableId: number;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.PUT,
+ path: `table/${tableId}`,
+ body,
+ });
+}
+
+async function syncTableSchema({
+ auth,
+ tableId,
+}: {
+ auth: MetabaseAuth;
+ tableId: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: `table/${tableId}/sync_schema`,
+ });
+}
+
+async function rescanTableFieldValues({
+ auth,
+ tableId,
+}: {
+ auth: MetabaseAuth;
+ tableId: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: `table/${tableId}/rescan_values`,
+ });
+}
+
+async function discardTableFieldValues({
+ auth,
+ tableId,
+}: {
+ auth: MetabaseAuth;
+ tableId: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: `table/${tableId}/discard_values`,
+ });
+}
+
+async function getField({
+ auth,
+ fieldId,
+}: {
+ auth: MetabaseAuth;
+ fieldId: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `field/${fieldId}`,
+ });
+}
+
+async function updateField({
+ auth,
+ fieldId,
+ body,
+}: {
+ auth: MetabaseAuth;
+ fieldId: number;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.PUT,
+ path: `field/${fieldId}`,
+ body,
+ });
+}
+
+async function listFieldValues({
+ auth,
+ fieldId,
+}: {
+ auth: MetabaseAuth;
+ fieldId: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `field/${fieldId}/values`,
+ });
+}
+
+async function updateFieldValues({
+ auth,
+ fieldId,
+ body,
+}: {
+ auth: MetabaseAuth;
+ fieldId: number;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: `field/${fieldId}/values`,
+ body,
+ });
+}
+
+async function searchFieldValues({
+ auth,
+ fieldId,
+ searchFieldId,
+ value,
+}: {
+ auth: MetabaseAuth;
+ fieldId: number;
+ searchFieldId: number;
+ value?: string;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `field/${fieldId}/search/${searchFieldId}`,
+ query: { value: value },
+ });
+}
+
+async function getFieldSummary({
+ auth,
+ fieldId,
+}: {
+ auth: MetabaseAuth;
+ fieldId: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `field/${fieldId}/summary`,
+ });
+}
+
+async function rescanFieldValues({
+ auth,
+ fieldId,
+}: {
+ auth: MetabaseAuth;
+ fieldId: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: `field/${fieldId}/rescan_values`,
+ });
+}
+
+async function discardFieldValues({
+ auth,
+ fieldId,
+}: {
+ auth: MetabaseAuth;
+ fieldId: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: `field/${fieldId}/discard_values`,
+ });
+}
+
+async function getCurrentUser({
+ auth,
+}: {
+ auth: MetabaseAuth;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `user/current`,
+ });
+}
+
+async function listUsers({
+ auth,
+ query,
+ groupId,
+ includeDeactivated,
+ limit,
+ offset,
+}: {
+ auth: MetabaseAuth;
+ query?: string;
+ groupId?: number;
+ includeDeactivated?: boolean;
+ limit?: number;
+ offset?: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `user`,
+ query: {
+ query: query,
+ group_id: groupId,
+ include_deactivated: includeDeactivated,
+ limit: limit,
+ offset: offset,
+ },
+ });
+}
+
+async function getUser({
+ auth,
+ userId,
+}: {
+ auth: MetabaseAuth;
+ userId: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `user/${userId}`,
+ });
+}
+
+async function createUser({
+ auth,
+ body,
+}: {
+ auth: MetabaseAuth;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: `user`,
+ body,
+ });
+}
+
+async function updateUser({
+ auth,
+ userId,
+ body,
+}: {
+ auth: MetabaseAuth;
+ userId: number;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.PUT,
+ path: `user/${userId}`,
+ body,
+ });
+}
+
+async function deactivateUser({
+ auth,
+ userId,
+}: {
+ auth: MetabaseAuth;
+ userId: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.DELETE,
+ path: `user/${userId}`,
+ });
+}
+
+async function reactivateUser({
+ auth,
+ userId,
+}: {
+ auth: MetabaseAuth;
+ userId: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.PUT,
+ path: `user/${userId}/reactivate`,
+ });
+}
+
+async function listGroups({
+ auth,
+}: {
+ auth: MetabaseAuth;
+}): Promise<MetabaseGroup[]> {
+ return await request<MetabaseGroup[]>({
+ auth,
+ method: HttpMethod.GET,
+ path: `permissions/group`,
+ });
+}
+
+async function getGroup({
+ auth,
+ groupId,
+}: {
+ auth: MetabaseAuth;
+ groupId: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `permissions/group/${groupId}`,
+ });
+}
+
+async function createGroup({
+ auth,
+ body,
+}: {
+ auth: MetabaseAuth;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: `permissions/group`,
+ body,
+ });
+}
+
+async function deleteGroup({
+ auth,
+ groupId,
+}: {
+ auth: MetabaseAuth;
+ groupId: number;
+}): Promise<void> {
+ await request<unknown>({
+ auth,
+ method: HttpMethod.DELETE,
+ path: `permissions/group/${groupId}`,
+ });
+}
+
+async function addGroupMember({
+ auth,
+ body,
+}: {
+ auth: MetabaseAuth;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: `permissions/membership`,
+ body,
+ });
+}
+
+async function removeGroupMember({
+ auth,
+ membershipId,
+}: {
+ auth: MetabaseAuth;
+ membershipId: number;
+}): Promise<void> {
+ await request<unknown>({
+ auth,
+ method: HttpMethod.DELETE,
+ path: `permissions/membership/${membershipId}`,
+ });
+}
+
+async function listAlerts({
+ auth,
+ payloadType,
+ cardId,
+ creatorId,
+ includeInactive,
+}: {
+ auth: MetabaseAuth;
+ payloadType?: string;
+ cardId?: number;
+ creatorId?: number;
+ includeInactive?: boolean;
+}): Promise<unknown[]> {
+ return await request<unknown[]>({
+ auth,
+ method: HttpMethod.GET,
+ path: `notification`,
+ query: {
+ payload_type: payloadType,
+ card_id: cardId,
+ creator_id: creatorId,
+ include_inactive: includeInactive,
+ },
+ });
+}
+
+async function getAlert({
+ auth,
+ alertId,
+}: {
+ auth: MetabaseAuth;
+ alertId: number;
+}): Promise<MetabaseNotification> {
+ return await request<MetabaseNotification>({
+ auth,
+ method: HttpMethod.GET,
+ path: `notification/${alertId}`,
+ });
+}
+
+async function createAlert({
+ auth,
+ body,
+}: {
+ auth: MetabaseAuth;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: `notification`,
+ body,
+ });
+}
+
+async function updateAlert({
+ auth,
+ alertId,
+ body,
+}: {
+ auth: MetabaseAuth;
+ alertId: number;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.PUT,
+ path: `notification/${alertId}`,
+ body,
+ });
+}
+
+async function sendAlert({
+ auth,
+ alertId,
+ body,
+}: {
+ auth: MetabaseAuth;
+ alertId: number;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: `notification/${alertId}/send`,
+ body,
+ });
+}
+
+async function listDashboardSubscriptions({
+ auth,
+ dashboardId,
+ archived,
+}: {
+ auth: MetabaseAuth;
+ dashboardId?: number;
+ archived?: boolean;
+}): Promise<unknown[]> {
+ return await request<unknown[]>({
+ auth,
+ method: HttpMethod.GET,
+ path: `pulse`,
+ query: { dashboard_id: dashboardId, archived: archived },
+ });
+}
+
+async function getDashboardSubscription({
+ auth,
+ subscriptionId,
+}: {
+ auth: MetabaseAuth;
+ subscriptionId: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `pulse/${subscriptionId}`,
+ });
+}
+
+async function createDashboardSubscription({
+ auth,
+ body,
+}: {
+ auth: MetabaseAuth;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: `pulse`,
+ body,
+ });
+}
+
+async function updateDashboardSubscription({
+ auth,
+ subscriptionId,
+ body,
+}: {
+ auth: MetabaseAuth;
+ subscriptionId: number;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.PUT,
+ path: `pulse/${subscriptionId}`,
+ body,
+ });
+}
+
+async function listTimelines({
+ auth,
+ include,
+ archived,
+}: {
+ auth: MetabaseAuth;
+ include?: string;
+ archived?: boolean;
+}): Promise<unknown[]> {
+ return await request<unknown[]>({
+ auth,
+ method: HttpMethod.GET,
+ path: `timeline`,
+ query: { include: include, archived: archived },
+ });
+}
+
+async function getTimeline({
+ auth,
+ timelineId,
+ include,
+ archived,
+}: {
+ auth: MetabaseAuth;
+ timelineId: number;
+ include?: string;
+ archived?: boolean;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `timeline/${timelineId}`,
+ query: { include: include, archived: archived },
+ });
+}
+
+async function createTimeline({
+ auth,
+ body,
+}: {
+ auth: MetabaseAuth;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: `timeline`,
+ body,
+ });
+}
+
+async function updateTimeline({
+ auth,
+ timelineId,
+ body,
+}: {
+ auth: MetabaseAuth;
+ timelineId: number;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.PUT,
+ path: `timeline/${timelineId}`,
+ body,
+ });
+}
+
+async function deleteTimeline({
+ auth,
+ timelineId,
+}: {
+ auth: MetabaseAuth;
+ timelineId: number;
+}): Promise<void> {
+ await request<unknown>({
+ auth,
+ method: HttpMethod.DELETE,
+ path: `timeline/${timelineId}`,
+ });
+}
+
+async function listCollectionTimelines({
+ auth,
+ collectionId,
+ include,
+ archived,
+}: {
+ auth: MetabaseAuth;
+ collectionId: CollectionRef;
+ include?: string;
+ archived?: boolean;
+}): Promise<unknown[]> {
+ return await request<unknown[]>({
+ auth,
+ method: HttpMethod.GET,
+ path: `timeline/collection/${collectionId}`,
+ query: { include: include, archived: archived },
+ });
+}
+
+async function createTimelineEvent({
+ auth,
+ body,
+}: {
+ auth: MetabaseAuth;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: `timeline-event`,
+ body,
+ });
+}
+
+async function getTimelineEvent({
+ auth,
+ eventId,
+}: {
+ auth: MetabaseAuth;
+ eventId: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `timeline-event/${eventId}`,
+ });
+}
+
+async function updateTimelineEvent({
+ auth,
+ eventId,
+ body,
+}: {
+ auth: MetabaseAuth;
+ eventId: number;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.PUT,
+ path: `timeline-event/${eventId}`,
+ body,
+ });
+}
+
+async function deleteTimelineEvent({
+ auth,
+ eventId,
+}: {
+ auth: MetabaseAuth;
+ eventId: number;
+}): Promise<void> {
+ await request<unknown>({
+ auth,
+ method: HttpMethod.DELETE,
+ path: `timeline-event/${eventId}`,
+ });
+}
+
+async function listSnippets({
+ auth,
+ archived,
+}: {
+ auth: MetabaseAuth;
+ archived?: boolean;
+}): Promise<unknown[]> {
+ return await request<unknown[]>({
+ auth,
+ method: HttpMethod.GET,
+ path: `native-query-snippet`,
+ query: { archived: archived },
+ });
+}
+
+async function getSnippet({
+ auth,
+ snippetId,
+}: {
+ auth: MetabaseAuth;
+ snippetId: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `native-query-snippet/${snippetId}`,
+ });
+}
+
+async function createSnippet({
+ auth,
+ body,
+}: {
+ auth: MetabaseAuth;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: `native-query-snippet`,
+ body,
+ });
+}
+
+async function updateSnippet({
+ auth,
+ snippetId,
+ body,
+}: {
+ auth: MetabaseAuth;
+ snippetId: number;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.PUT,
+ path: `native-query-snippet/${snippetId}`,
+ body,
+ });
+}
+
+async function listSegments({
+ auth,
+}: {
+ auth: MetabaseAuth;
+}): Promise<unknown[]> {
+ return await request<unknown[]>({
+ auth,
+ method: HttpMethod.GET,
+ path: `segment`,
+ });
+}
+
+async function getSegment({
+ auth,
+ segmentId,
+}: {
+ auth: MetabaseAuth;
+ segmentId: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `segment/${segmentId}`,
+ });
+}
+
+async function createSegment({
+ auth,
+ body,
+}: {
+ auth: MetabaseAuth;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: `segment`,
+ body,
+ });
+}
+
+async function updateSegment({
+ auth,
+ segmentId,
+ body,
+}: {
+ auth: MetabaseAuth;
+ segmentId: number;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.PUT,
+ path: `segment/${segmentId}`,
+ body,
+ });
+}
+
+async function deleteSegment({
+ auth,
+ segmentId,
+ revisionMessage,
+}: {
+ auth: MetabaseAuth;
+ segmentId: number;
+ revisionMessage?: string;
+}): Promise<void> {
+ await request<unknown>({
+ auth,
+ method: HttpMethod.DELETE,
+ path: `segment/${segmentId}`,
+ query: { revision_message: revisionMessage },
+ });
+}
+
+async function listGlossaryEntries({
+ auth,
+}: {
+ auth: MetabaseAuth;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `glossary`,
+ });
+}
+
+async function createGlossaryEntry({
+ auth,
+ body,
+}: {
+ auth: MetabaseAuth;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: `glossary`,
+ body,
+ });
+}
+
+async function updateGlossaryEntry({
+ auth,
+ glossaryId,
+ body,
+}: {
+ auth: MetabaseAuth;
+ glossaryId: number;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.PUT,
+ path: `glossary/${glossaryId}`,
+ body,
+ });
+}
+
+async function deleteGlossaryEntry({
+ auth,
+ glossaryId,
+}: {
+ auth: MetabaseAuth;
+ glossaryId: number;
+}): Promise<void> {
+ await request<unknown>({
+ auth,
+ method: HttpMethod.DELETE,
+ path: `glossary/${glossaryId}`,
+ });
+}
+
+async function listDocuments({
+ auth,
+}: {
+ auth: MetabaseAuth;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `document`,
+ });
+}
+
+async function getDocument({
+ auth,
+ documentId,
+}: {
+ auth: MetabaseAuth;
+ documentId: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `document/${documentId}`,
+ });
+}
+
+async function createDocument({
+ auth,
+ body,
+}: {
+ auth: MetabaseAuth;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: `document`,
+ body,
+ });
+}
+
+async function updateDocument({
+ auth,
+ documentId,
+ body,
+}: {
+ auth: MetabaseAuth;
+ documentId: number;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.PUT,
+ path: `document/${documentId}`,
+ body,
+ });
+}
+
+async function deleteDocument({
+ auth,
+ documentId,
+}: {
+ auth: MetabaseAuth;
+ documentId: number;
+}): Promise<void> {
+ await request<unknown>({
+ auth,
+ method: HttpMethod.DELETE,
+ path: `document/${documentId}`,
+ });
+}
+
+async function listBookmarks({
+ auth,
+}: {
+ auth: MetabaseAuth;
+}): Promise<unknown[]> {
+ return await request<unknown[]>({
+ auth,
+ method: HttpMethod.GET,
+ path: `bookmark`,
+ });
+}
+
+async function createBookmark({
+ auth,
+ model,
+ itemId,
+}: {
+ auth: MetabaseAuth;
+ model: string;
+ itemId: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: `bookmark/${model}/${itemId}`,
+ });
+}
+
+async function deleteBookmark({
+ auth,
+ model,
+ itemId,
+}: {
+ auth: MetabaseAuth;
+ model: string;
+ itemId: number;
+}): Promise<void> {
+ await request<unknown>({
+ auth,
+ method: HttpMethod.DELETE,
+ path: `bookmark/${model}/${itemId}`,
+ });
+}
+
+async function listRevisions({
+ auth,
+ entity,
+ entityId,
+}: {
+ auth: MetabaseAuth;
+ entity?: string;
+ entityId?: number;
+}): Promise<unknown[]> {
+ return await request<unknown[]>({
+ auth,
+ method: HttpMethod.GET,
+ path: `revision`,
+ query: { entity: entity, id: entityId },
+ });
+}
+
+async function revertRevision({
+ auth,
+ body,
+}: {
+ auth: MetabaseAuth;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: `revision/revert`,
+ body,
+ });
+}
+
+async function listPopularItems({
+ auth,
+}: {
+ auth: MetabaseAuth;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `activity/popular_items`,
+ });
+}
+
+async function listRecentViews({
+ auth,
+ context,
+}: {
+ auth: MetabaseAuth;
+ context?: string;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `activity/recents`,
+ query: { context: context },
+ });
+}
+
+async function listActions({
+ auth,
+ modelId,
+}: {
+ auth: MetabaseAuth;
+ modelId?: number;
+}): Promise<unknown[]> {
+ return await request<unknown[]>({
+ auth,
+ method: HttpMethod.GET,
+ path: `action`,
+ query: { 'model-id': modelId },
+ });
+}
+
+async function getAction({
+ auth,
+ actionId,
+}: {
+ auth: MetabaseAuth;
+ actionId: number;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.GET,
+ path: `action/${actionId}`,
+ });
+}
+
+async function createAction({
+ auth,
+ body,
+}: {
+ auth: MetabaseAuth;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: `action`,
+ body,
+ });
+}
+
+async function updateAction({
+ auth,
+ actionId,
+ body,
+}: {
+ auth: MetabaseAuth;
+ actionId: number;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.PUT,
+ path: `action/${actionId}`,
+ body,
+ });
+}
+
+async function deleteAction({
+ auth,
+ actionId,
+}: {
+ auth: MetabaseAuth;
+ actionId: number;
+}): Promise<void> {
+ await request<unknown>({
+ auth,
+ method: HttpMethod.DELETE,
+ path: `action/${actionId}`,
+ });
+}
+
+async function executeAction({
+ auth,
+ actionId,
+ body,
+}: {
+ auth: MetabaseAuth;
+ actionId: number;
+ body: Record<string, unknown>;
+}): Promise<unknown> {
+ return await request<unknown>({
+ auth,
+ method: HttpMethod.POST,
+ path: `action/${actionId}/execute`,
+ body,
+ });
+}
+
+export const metabaseApi = {
+ listCards,
+ getCard,
+ createCard,
+ updateCard,
+ deleteCard,
+ runCardQuery,
+ copyCard,
+ listCardDashboards,
+ getCardQueryMetadata,
+ listCardParameterValues,
+ searchCardParameterValues,
+ moveCards,
+ createCardPublicLink,
+ deleteCardPublicLink,
+ listDashboards,
+ getDashboard,
+ createDashboard,
+ updateDashboard,
+ deleteDashboard,
+ copyDashboard,
+ runDashboardCardQuery,
+ listDashboardParameterValues,
+ searchDashboardParameterValues,
+ createDashboardPublicLink,
+ deleteDashboardPublicLink,
+ listCollections,
+ getCollection,
+ listCollectionItems,
+ getCollectionTree,
+ createCollection,
+ updateCollection,
+ deleteCollection,
+ runQuery,
+ convertQueryToNative,
+ search,
+ listDatabases,
+ getDatabase,
+ getDatabaseMetadata,
+ updateDatabase,
+ listDatabaseSchemas,
+ listSchemaTables,
+ listDatabaseFields,
+ checkDatabaseHealth,
+ syncDatabaseSchema,
+ rescanDatabaseFieldValues,
+ discardDatabaseFieldValues,
+ listTables,
+ getTable,
+ getTableMetadata,
+ listTableForeignKeys,
+ getTableData,
+ updateTable,
+ syncTableSchema,
+ rescanTableFieldValues,
+ discardTableFieldValues,
+ getField,
+ updateField,
+ listFieldValues,
+ updateFieldValues,
+ searchFieldValues,
+ getFieldSummary,
+ rescanFieldValues,
+ discardFieldValues,
+ getCurrentUser,
+ listUsers,
+ getUser,
+ createUser,
+ updateUser,
+ deactivateUser,
+ reactivateUser,
+ listGroups,
+ getGroup,
+ createGroup,
+ deleteGroup,
+ addGroupMember,
+ removeGroupMember,
+ listAlerts,
+ getAlert,
+ createAlert,
+ updateAlert,
+ sendAlert,
+ listDashboardSubscriptions,
+ getDashboardSubscription,
+ createDashboardSubscription,
+ updateDashboardSubscription,
+ listTimelines,
+ getTimeline,
+ createTimeline,
+ updateTimeline,
+ deleteTimeline,
+ listCollectionTimelines,
+ createTimelineEvent,
+ getTimelineEvent,
+ updateTimelineEvent,
+ deleteTimelineEvent,
+ listSnippets,
+ getSnippet,
+ createSnippet,
+ updateSnippet,
+ listSegments,
+ getSegment,
+ createSegment,
+ updateSegment,
+ deleteSegment,
+ listGlossaryEntries,
+ createGlossaryEntry,
+ updateGlossaryEntry,
+ deleteGlossaryEntry,
+ listDocuments,
+ getDocument,
+ createDocument,
+ updateDocument,
+ deleteDocument,
+ listBookmarks,
+ createBookmark,
+ deleteBookmark,
+ listRevisions,
+ revertRevision,
+ listPopularItems,
+ listRecentViews,
+ listActions,
+ getAction,
+ createAction,
+ updateAction,
+ deleteAction,
+ executeAction,
+};
+
+type QueryValue = string | number | boolean | undefined;
+
+type CollectionRef = number | 'root';
+
+type RequestParams = {
+ method: HttpMethod;
+ path: string;
+ query?: Record<string, QueryValue>;
+ body?: object;
+};
+
+export type MetabaseAuth = AppConnectionValueForAuthProperty<
+ typeof metabaseAuth
+>;
+
+export type MetabaseParameter = {
+ id: string;
+ slug: string;
+ name?: string;
+ type?: string;
+ target?: unknown;
+};
+
+export type MetabaseCard = {
+ id: number;
+ name?: string;
+ parameters?: MetabaseParameter[];
+};
+
+export type MetabaseDashboard = {
+ id: number;
+ name?: string;
+ parameters?: MetabaseParameter[];
+ dashcards?: { id: number; card_id?: number | null }[];
+};
+
+export type MetabaseGroup = {
+ id: number;
+ name?: string;
+ magic_group_type?: string | null;
+};
+
+export type MetabaseNotification = {
+ id: number;
+ active?: boolean;
+ payload?: Record<string, unknown>;
+ subscriptions?: Record<string, unknown>[];
+};
+
+export type MetabaseQueryResult = {
+ status?: string;
+ error?: string;
+};
diff --git a/packages/pieces/community/metabase/src/lib/auth.ts b/packages/pieces/community/metabase/src/lib/auth.ts
new file mode 100644
index 00000000000..a0067072922
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/auth.ts
@@ -0,0 +1,62 @@
+import { HttpMethod, is_chromium_installed } from '@activepieces/pieces-common';
+import {
+ AppConnectionType,
+ PieceAuth,
+ Property,
+} from '@activepieces/pieces-framework';
+
+import { queryMetabaseApi } from './common';
+
+const baseProps = {
+ baseUrl: Property.ShortText({
+ displayName: 'Metabase API base URL',
+ required: true,
+ }),
+ apiKey: PieceAuth.SecretText({
+ displayName: 'API key',
+ description:
+ 'Generate one on your Metabase instance (settings -> authentication -> API keys)',
+ required: true,
+ }),
+};
+
+const authProps = is_chromium_installed()
+ ? {
+ ...baseProps,
+ embeddingKey: Property.ShortText({
+ displayName: 'Embedding key',
+ description:
+ 'Needed if you want to generate a graph of a question (settings -> embedding -> static embedding).',
+ required: false,
+ }),
+ }
+ : baseProps;
+
+export const metabaseAuth = PieceAuth.CustomAuth({
+ description: 'Metabase authentication requires a baseUrl and a password.',
+ required: true,
+ props: authProps,
+
+ validate: async ({ auth }) => {
+ try {
+ await queryMetabaseApi(
+ {
+ endpoint: 'login-history/current',
+ method: HttpMethod.GET,
+ },
+ {
+ type: AppConnectionType.CUSTOM_AUTH,
+ props: auth,
+ }
+ );
+ return {
+ valid: true,
+ };
+ } catch (e) {
+ return {
+ valid: false,
+ error: 'Invalid API Key or base URL',
+ };
+ }
+ },
+});
diff --git a/packages/pieces/community/metabase/src/lib/output-schemas.ts b/packages/pieces/community/metabase/src/lib/output-schemas.ts
new file mode 100644
index 00000000000..9b1ab4fb637
--- /dev/null
+++ b/packages/pieces/community/metabase/src/lib/output-schemas.ts
@@ -0,0 +1,3972 @@
+import { OutputSchema } from '@activepieces/pieces-framework';
+
+const parametersFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'slug', label: 'Slug' },
+ { key: 'type', label: 'Type' },
+];
+
+const dashboardFields: OutputSchema['fields'] = [
+ { key: 'name', label: 'Name' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'moderation_status', label: 'Moderation Status' },
+];
+
+const parameterMappingsFields: OutputSchema['fields'] = [
+ { key: 'target', label: 'Target' },
+ { key: 'card_id', label: 'Card ID', format: 'number' },
+ { key: 'parameter_id', label: 'Parameter ID' },
+];
+
+const parametersFields2: OutputSchema['fields'] = [
+ { key: 'id', label: 'ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'slug', label: 'Slug' },
+ { key: 'type', label: 'Type' },
+ { key: 'target', label: 'Target' },
+];
+
+const userFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'first_name', label: 'First Name' },
+ { key: 'last_name', label: 'Last Name' },
+ { key: 'common_name', label: 'Common Name' },
+];
+
+const creatorFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'first_name', label: 'First Name' },
+ { key: 'last_name', label: 'Last Name' },
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'common_name', label: 'Common Name' },
+];
+
+const metadataSyncFields: OutputSchema['fields'] = [
+ { key: 'schedule_minute', label: 'Schedule Minute', format: 'number' },
+ { key: 'schedule_day', label: 'Schedule Day' },
+ { key: 'schedule_frame', label: 'Schedule Frame' },
+ { key: 'schedule_hour', label: 'Schedule Hour' },
+ { key: 'schedule_type', label: 'Schedule Type' },
+];
+
+const parametersFields3: OutputSchema['fields'] = [
+ { key: 'id', label: 'ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'slug', label: 'Slug' },
+ { key: 'type', label: 'Type' },
+ { key: 'target', label: 'Target' },
+ { key: 'values_source_type', label: 'Values Source Type' },
+ { key: 'values_source_config', label: 'Values Source Config' },
+];
+
+const cacheFieldValuesFields: OutputSchema['fields'] = [
+ { key: 'schedule_minute', label: 'Schedule Minute', format: 'number' },
+ { key: 'schedule_day', label: 'Schedule Day' },
+ { key: 'schedule_frame', label: 'Schedule Frame' },
+ { key: 'schedule_hour', label: 'Schedule Hour', format: 'number' },
+ { key: 'schedule_type', label: 'Schedule Type' },
+];
+
+const subscriptionsFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'notification_id', label: 'Notification ID', format: 'number' },
+ { key: 'type', label: 'Type' },
+ { key: 'event_name', label: 'Event Name' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'cron_schedule', label: 'Cron Schedule' },
+ { key: 'ui_display_type', label: 'Ui Display Type' },
+];
+
+const collectionFields: OutputSchema['fields'] = [
+ { key: 'name', label: 'Name' },
+ { key: 'id', label: 'ID' },
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'slug', label: 'Slug' },
+ { key: 'personal_owner_id', label: 'Personal Owner ID' },
+ { key: 'type', label: 'Type' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'location', label: 'Location' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+];
+
+const collectionFields2: OutputSchema['fields'] = [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'slug', label: 'Slug' },
+ { key: 'name', label: 'Name' },
+ { key: 'personal_owner_id', label: 'Personal Owner ID' },
+ { key: 'type', label: 'Type' },
+ { key: 'id', label: 'ID' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'location', label: 'Location' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+];
+
+const collectionFields3: OutputSchema['fields'] = [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'slug', label: 'Slug' },
+ { key: 'name', label: 'Name' },
+ { key: 'personal_owner_id', label: 'Personal Owner ID' },
+ { key: 'type', label: 'Type' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'location', label: 'Location' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+];
+
+const creatorFields2: OutputSchema['fields'] = [
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'first_name', label: 'First Name' },
+ { key: 'is_data_analyst', label: 'Is Data Analyst', format: 'boolean' },
+ { key: 'last_login', label: 'Last Login' },
+ { key: 'is_superuser', label: 'Is Superuser', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'last_name', label: 'Last Name' },
+ { key: 'date_joined', label: 'Date Joined', format: 'datetime' },
+ { key: 'common_name', label: 'Common Name' },
+];
+
+const colsFields: OutputSchema['fields'] = [
+ { key: 'database_type', label: 'Database Type' },
+ { key: 'lib/deduplicated-name', label: 'Lib Deduplicated Name' },
+ { key: 'lib/original-name', label: 'Lib Original Name' },
+ { key: 'name', label: 'Name' },
+ { key: 'lib/source', label: 'Lib Source' },
+ { key: 'lib/source-column-alias', label: 'Lib Source Column Alias' },
+ { key: 'source', label: 'Source' },
+ { key: 'field_ref', label: 'Field Ref' },
+ { key: 'effective_type', label: 'Effective Type' },
+ { key: 'lib/desired-column-alias', label: 'Lib Desired Column Alias' },
+ { key: 'display_name', label: 'Display Name' },
+ { key: 'base_type', label: 'Base Type' },
+];
+
+const eventsFields: OutputSchema['fields'] = [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'timezone', label: 'Timezone' },
+ { key: 'creator', label: 'Creator' },
+ { key: 'time_matters', label: 'Time Matters', format: 'boolean' },
+ { key: 'name', label: 'Name' },
+ { key: 'timeline_id', label: 'Timeline ID', format: 'number' },
+ { key: 'icon', label: 'Icon' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'timestamp', label: 'Timestamp', format: 'datetime' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+];
+
+const cardsFields: OutputSchema['fields'] = [
+ { key: 'description', label: 'Description' },
+ { key: 'format_rows', label: 'Format Rows', format: 'boolean' },
+ { key: 'include_xls', label: 'Include XLS', format: 'boolean' },
+ { key: 'dashboard_card_id', label: 'Dashboard Card ID', format: 'number' },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'pivot_results', label: 'Pivot Results', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'parameter_mappings', label: 'Parameter Mappings' },
+ { key: 'include_csv', label: 'Include CSV', format: 'boolean' },
+ { key: 'display', label: 'Display' },
+ { key: 'dashboard_id', label: 'Dashboard ID', format: 'number' },
+];
+
+const channelsFields: OutputSchema['fields'] = [
+ { key: 'schedule_type', label: 'Schedule Type' },
+ { key: 'schedule_hour', label: 'Schedule Hour', format: 'number' },
+ { key: 'channel_type', label: 'Channel Type' },
+ { key: 'schedule_frame', label: 'Schedule Frame' },
+ {
+ key: 'recipients',
+ label: 'Recipients',
+ labelKey: 'email',
+ listItems: [{ key: 'email', label: 'Email', format: 'email' }],
+ },
+ { key: 'channel_id', label: 'Channel ID' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'pulse_id', label: 'Pulse ID', format: 'number' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'schedule_day', label: 'Schedule Day' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'enabled', label: 'Enabled', format: 'boolean' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+];
+
+const dbFields: OutputSchema['fields'] = [
+ { key: 'description', label: 'Description' },
+ { key: 'features', label: 'Features' },
+ { key: 'timezone', label: 'Timezone' },
+ { key: 'auto_run_queries', label: 'Auto Run Queries', format: 'boolean' },
+ { key: 'is_stub', label: 'Is Stub', format: 'boolean' },
+ { key: 'name', label: 'Name' },
+ { key: 'caveats', label: 'Caveats' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'provider_name', label: 'Provider Name' },
+ { key: 'cache_ttl', label: 'Cache TTL' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'engine', label: 'Engine' },
+ { key: 'refingerprint', label: 'Refingerprint' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+ { key: 'admin_details', label: 'Admin Details' },
+];
+
+const colsFields2: OutputSchema['fields'] = [
+ { key: 'description', label: 'Description' },
+ { key: 'database_type', label: 'Database Type' },
+ { key: 'semantic_type', label: 'Semantic Type' },
+ { key: 'table_id', label: 'Table ID', format: 'number' },
+ { key: 'lib/deduplicated-name', label: 'Lib Deduplicated Name' },
+ { key: 'lib/original-name', label: 'Lib Original Name' },
+ { key: 'name', label: 'Name' },
+ { key: 'lib/source', label: 'Lib Source' },
+ { key: 'lib/source-column-alias', label: 'Lib Source Column Alias' },
+ { key: 'lib/original-display-name', label: 'Lib Original Display Name' },
+ { key: 'source', label: 'Source' },
+ { key: 'field_ref', label: 'Field Ref' },
+ { key: 'effective_type', label: 'Effective Type' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'lib/desired-column-alias', label: 'Lib Desired Column Alias' },
+ { key: 'position', label: 'Position', format: 'number' },
+ { key: 'visibility_type', label: 'Visibility Type' },
+ { key: 'display_name', label: 'Display Name' },
+ { key: 'base_type', label: 'Base Type' },
+];
+
+const dataFields: OutputSchema['fields'] = [
+ { key: 'rows', label: 'Rows' },
+ { key: 'cols', label: 'Cols', labelKey: 'name', listItems: colsFields2 },
+ { key: 'native_form', label: 'Native Form' },
+ { key: 'results_timezone', label: 'Results Timezone' },
+];
+
+const metricsFields: OutputSchema['fields'] = [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'table_id', label: 'Table ID', format: 'number' },
+ { key: 'database_id', label: 'Database ID', format: 'number' },
+ { key: 'enable_embedding', label: 'Enable Embedding', format: 'boolean' },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'query_type', label: 'Query Type' },
+ { key: 'name', label: 'Name' },
+ { key: 'document_id', label: 'Document ID' },
+ { key: 'last_used_at', label: 'Last Used At', format: 'datetime' },
+ { key: 'type', label: 'Type' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'embedding_params', label: 'Embedding Params' },
+ { key: 'cache_ttl', label: 'Cache TTL' },
+ { key: 'dataset_query', label: 'Dataset Query' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'parameter_mappings', label: 'Parameter Mappings' },
+ { key: 'display', label: 'Display' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'parameters', label: 'Parameters' },
+ { key: 'dashboard_id', label: 'Dashboard ID' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'public_uuid', label: 'Public UUID' },
+];
+
+const fieldsFields: OutputSchema['fields'] = [
+ { key: 'description', label: 'Description' },
+ { key: 'database_type', label: 'Database Type' },
+ { key: 'semantic_type', label: 'Semantic Type' },
+ { key: 'table_id', label: 'Table ID', format: 'number' },
+ { key: 'coercion_strategy', label: 'Coercion Strategy' },
+ { key: 'database_indexed', label: 'Database Indexed' },
+ {
+ key: 'dimension_interestingness',
+ label: 'Dimension Interestingness',
+ format: 'number',
+ },
+ { key: 'name', label: 'Name' },
+ {
+ key: 'fingerprint_version',
+ label: 'Fingerprint Version',
+ format: 'number',
+ },
+ { key: 'has_field_values', label: 'Has Field Values' },
+ { key: 'database_is_pk', label: 'Database Is PK' },
+ { key: 'caveats', label: 'Caveats' },
+ { key: 'fk_target_field_id', label: 'FK Target Field ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'custom_position', label: 'Custom Position', format: 'number' },
+ { key: 'database_default', label: 'Database Default' },
+ { key: 'effective_type', label: 'Effective Type' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'parent_id', label: 'Parent ID' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'last_analyzed', label: 'Last Analyzed' },
+ { key: 'database_partitioned', label: 'Database Partitioned' },
+ {
+ key: 'database_is_auto_increment',
+ label: 'Database Is Auto Increment',
+ format: 'boolean',
+ },
+ { key: 'json_unfolding', label: 'JSON Unfolding', format: 'boolean' },
+ { key: 'position', label: 'Position', format: 'number' },
+ { key: 'visibility_type', label: 'Visibility Type' },
+ { key: 'target', label: 'Target' },
+ { key: 'preview_display', label: 'Preview Display', format: 'boolean' },
+ { key: 'database_is_generated', label: 'Database Is Generated' },
+ { key: 'data_sensitivity', label: 'Data Sensitivity' },
+ { key: 'display_name', label: 'Display Name' },
+ { key: 'database_position', label: 'Database Position', format: 'number' },
+ { key: 'database_required', label: 'Database Required', format: 'boolean' },
+ { key: 'database_is_nullable', label: 'Database Is Nullable' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'base_type', label: 'Base Type' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+];
+
+const tablesFields: OutputSchema['fields'] = [
+ { key: 'description', label: 'Description' },
+ { key: 'entity_type', label: 'Entity Type' },
+ { key: 'schema', label: 'Schema' },
+ { key: 'is_writable', label: 'Is Writable' },
+ { key: 'database_require_filter', label: 'Database Require Filter' },
+ { key: 'db', label: 'DB', children: dbFields },
+ { key: 'collection_id', label: 'Collection ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'transform_target', label: 'Transform Target', format: 'boolean' },
+ { key: 'caveats', label: 'Caveats' },
+ { key: 'owner_email', label: 'Owner Email' },
+ { key: 'transform_id', label: 'Transform ID' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'is_published', label: 'Is Published', format: 'boolean' },
+ { key: 'owner_user_id', label: 'Owner User ID' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'db_id', label: 'DB ID', format: 'number' },
+ { key: 'archived_at', label: 'Archived At' },
+ { key: 'data_source', label: 'Data Source' },
+ { key: 'visibility_type', label: 'Visibility Type' },
+ { key: 'deactivated_at', label: 'Deactivated At' },
+ { key: 'data_authority', label: 'Data Authority' },
+ { key: 'is_upload', label: 'Is Upload', format: 'boolean' },
+ { key: 'display_name', label: 'Display Name' },
+ { key: 'data_layer', label: 'Data Layer' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'estimated_row_count', label: 'Estimated Row Count' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+];
+
+export const embedQuestionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'success', label: 'Success', format: 'boolean' },
+ { key: 'message', label: 'Message' },
+ { key: 'embeddingParams', label: 'Embedding Params', dynamicKey: true },
+ ],
+};
+
+export const getDashboardQuestionsOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'dashboard_name', label: 'Dashboard Name' },
+ {
+ key: 'available_parameters',
+ label: 'Available Parameters',
+ labelKey: 'name',
+ listItems: [
+ { key: 'id', label: 'ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'slug', label: 'Slug' },
+ { key: 'type', label: 'Type' },
+ { key: 'possible_values', label: 'Possible Values' },
+ ],
+ },
+ {
+ key: 'cards_results',
+ label: 'Cards Results',
+ dynamicKey: true,
+ children: [
+ { key: 'name', label: 'Name' },
+ {
+ key: 'data',
+ label: 'Data',
+ listItems: [
+ { key: 'ID', label: 'ID', format: 'number' },
+ { key: 'Title', label: 'Title' },
+ { key: 'Category', label: 'Category' },
+ ],
+ },
+ ],
+ },
+ ],
+};
+
+export const getQuestionOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'data',
+ label: 'Data',
+ children: [
+ { key: 'rows', label: 'Rows' },
+ { key: 'cols', label: 'Cols', labelKey: 'name', listItems: colsFields },
+ { key: 'native_form', label: 'Native Form' },
+ { key: 'results_timezone', label: 'Results Timezone' },
+ {
+ key: 'results_metadata',
+ label: 'Results Metadata',
+ children: [{ key: 'columns', label: 'Columns' }],
+ },
+ { key: 'insights', label: 'Insights' },
+ ],
+ },
+ { key: 'cached', label: 'Cached' },
+ { key: 'database_id', label: 'Database ID', format: 'number' },
+ { key: 'started_at', label: 'Started At', format: 'datetime' },
+ {
+ key: 'json_query',
+ label: 'JSON Query',
+ children: [
+ {
+ key: 'constraints',
+ label: 'Constraints',
+ children: [
+ { key: 'max-results', label: 'Max Results', format: 'number' },
+ {
+ key: 'max-results-bare-rows',
+ label: 'Max Results Bare Rows',
+ format: 'number',
+ },
+ ],
+ },
+ { key: 'lib/type', label: 'Lib Type' },
+ {
+ key: 'stages',
+ label: 'Stages',
+ listItems: [
+ { key: 'template-tags', label: 'Template Tags' },
+ { key: 'lib/type', label: 'Lib Type' },
+ { key: 'native', label: 'Native' },
+ ],
+ },
+ { key: 'middleware', label: 'Middleware' },
+ { key: 'cache-strategy', label: 'Cache Strategy' },
+ { key: 'database', label: 'Database', format: 'number' },
+ {
+ key: 'parameters',
+ label: 'Parameters',
+ labelKey: 'id',
+ listItems: [
+ { key: 'id', label: 'ID' },
+ { key: 'type', label: 'Type' },
+ { key: 'value', label: 'Value' },
+ { key: 'target', label: 'Target' },
+ ],
+ },
+ ],
+ },
+ { key: 'average_execution_time', label: 'Average Execution Time' },
+ { key: 'status', label: 'Status' },
+ { key: 'context', label: 'Context' },
+ { key: 'tenant_id', label: 'Tenant ID' },
+ { key: 'row_count', label: 'Row Count', format: 'number' },
+ { key: 'running_time', label: 'Running Time', format: 'number' },
+ ],
+};
+
+export const metabaseAddGroupMemberOutputSchema: OutputSchema = {
+ itemLabel: '{email}',
+ fields: [
+ {
+ key: 'items',
+ label: 'Items',
+ value: '',
+ listItems: [
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'first_name', label: 'First Name' },
+ { key: 'type', label: 'Type' },
+ { key: 'membership_id', label: 'Membership ID', format: 'number' },
+ { key: 'group_id', label: 'Group ID', format: 'number' },
+ { key: 'is_superuser', label: 'Is Superuser', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'last_name', label: 'Last Name' },
+ { key: 'user_id', label: 'User ID', format: 'number' },
+ { key: 'common_name', label: 'Common Name' },
+ ],
+ },
+ ],
+};
+
+export const metabaseConvertQueryToNativeOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'query', label: 'Query' },
+ { key: 'params', label: 'Params' },
+ ],
+};
+
+export const metabaseCopyCardOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'table_id', label: 'Table ID' },
+ { key: 'creator', label: 'Creator', children: creatorFields },
+ { key: 'database_id', label: 'Database ID', format: 'number' },
+ { key: 'enable_embedding', label: 'Enable Embedding', format: 'boolean' },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'query_type', label: 'Query Type' },
+ { key: 'name', label: 'Name' },
+ { key: 'document_id', label: 'Document ID' },
+ { key: 'last_used_at', label: 'Last Used At', format: 'datetime' },
+ { key: 'dashboard', label: 'Dashboard' },
+ { key: 'type', label: 'Type' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'embedding_params', label: 'Embedding Params' },
+ { key: 'cache_ttl', label: 'Cache TTL' },
+ { key: 'dataset_query', label: 'Dataset Query' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'parameter_mappings', label: 'Parameter Mappings' },
+ { key: 'display', label: 'Display' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'collection', label: 'Collection', children: collectionFields3 },
+ { key: 'parameters', label: 'Parameters' },
+ { key: 'dashboard_id', label: 'Dashboard ID' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'public_uuid', label: 'Public UUID' },
+ ],
+};
+
+export const metabaseCopyDashboardOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'enable_embedding', label: 'Enable Embedding', format: 'boolean' },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'caveats', label: 'Caveats' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'embedding_params', label: 'Embedding Params' },
+ { key: 'cache_ttl', label: 'Cache TTL' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'last_viewed_at', label: 'Last Viewed At', format: 'datetime' },
+ { key: 'position', label: 'Position' },
+ { key: 'entity_id', label: 'Entity ID' },
+ {
+ key: 'parameters',
+ label: 'Parameters',
+ labelKey: 'name',
+ listItems: parametersFields,
+ },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'public_uuid', label: 'Public UUID' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+ ],
+};
+
+export const metabaseCreateActionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'database_id', label: 'Database ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'type', label: 'Type' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'model_id', label: 'Model ID', format: 'number' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'kind', label: 'Kind' },
+ { key: 'parameter_mappings', label: 'Parameter Mappings' },
+ { key: 'entity_id', label: 'Entity ID' },
+ {
+ key: 'parameters',
+ label: 'Parameters',
+ labelKey: 'name',
+ listItems: [
+ { key: 'id', label: 'ID' },
+ { key: 'display-name', label: 'Display Name' },
+ { key: 'target', label: 'Target' },
+ { key: 'type', label: 'Type' },
+ { key: 'required', label: 'Required', format: 'boolean' },
+ {
+ key: 'is-auto-increment',
+ label: 'Is Auto Increment',
+ format: 'boolean',
+ },
+ { key: 'name', label: 'Name' },
+ { key: 'slug', label: 'Slug' },
+ ],
+ },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'public_uuid', label: 'Public UUID' },
+ { key: 'dataset_query', label: 'Dataset Query' },
+ ],
+};
+
+export const metabaseCreateAlertOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'payload_id', label: 'Payload ID', format: 'number' },
+ {
+ key: 'payload',
+ label: 'Payload',
+ children: [
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'card_id', label: 'Card ID', format: 'number' },
+ { key: 'send_once', label: 'Send Once', format: 'boolean' },
+ { key: 'send_condition', label: 'Send Condition' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'disable_links', label: 'Disable Links', format: 'boolean' },
+ { key: 'card', label: 'Card', children: metricsFields },
+ ],
+ },
+ { key: 'creator', label: 'Creator', children: creatorFields2 },
+ { key: 'payload_type', label: 'Payload Type' },
+ {
+ key: 'handlers',
+ label: 'Handlers',
+ labelKey: 'id',
+ listItems: [
+ { key: 'template_id', label: 'Template ID' },
+ { key: 'channel_type', label: 'Channel Type' },
+ { key: 'channel', label: 'Channel' },
+ { key: 'template', label: 'Template' },
+ {
+ key: 'recipients',
+ label: 'Recipients',
+ labelKey: 'id',
+ listItems: [
+ { key: 'type', label: 'Type' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'permissions_group_id', label: 'Permissions Group ID' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'user_id', label: 'User ID', format: 'number' },
+ {
+ key: 'notification_handler_id',
+ label: 'Notification Handler ID',
+ format: 'number',
+ },
+ { key: 'user', label: 'User' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+ },
+ { key: 'channel_id', label: 'Channel ID' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'notification_id', label: 'Notification ID', format: 'number' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+ },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ {
+ key: 'subscriptions',
+ label: 'Subscriptions',
+ labelKey: 'id',
+ listItems: subscriptionsFields,
+ },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+};
+
+export const metabaseCreateBookmarkOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'user_id', label: 'User ID', format: 'number' },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'document_id', label: 'Document ID', format: 'number' },
+ { key: 'card_id', label: 'Card ID', format: 'number' },
+ { key: 'dashboard_id', label: 'Dashboard ID', format: 'number' },
+ ],
+};
+
+export const metabaseCreateCardOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'table_id', label: 'Table ID', format: 'number' },
+ { key: 'creator', label: 'Creator', children: creatorFields },
+ { key: 'database_id', label: 'Database ID', format: 'number' },
+ { key: 'enable_embedding', label: 'Enable Embedding', format: 'boolean' },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'query_type', label: 'Query Type' },
+ { key: 'name', label: 'Name' },
+ { key: 'document_id', label: 'Document ID' },
+ { key: 'last_used_at', label: 'Last Used At', format: 'datetime' },
+ { key: 'dashboard', label: 'Dashboard', children: dashboardFields },
+ { key: 'type', label: 'Type' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'embedding_params', label: 'Embedding Params' },
+ { key: 'cache_ttl', label: 'Cache TTL' },
+ { key: 'dataset_query', label: 'Dataset Query' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'parameter_mappings', label: 'Parameter Mappings' },
+ { key: 'display', label: 'Display' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'collection', label: 'Collection', children: collectionFields3 },
+ {
+ key: 'parameters',
+ label: 'Parameters',
+ labelKey: 'name',
+ listItems: parametersFields2,
+ },
+ { key: 'dashboard_id', label: 'Dashboard ID', format: 'number' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'public_uuid', label: 'Public UUID' },
+ { key: 'persisted', label: 'Persisted', format: 'boolean' },
+ ],
+};
+
+export const metabaseCreateCardPublicLinkOutputSchema: OutputSchema = {
+ fields: [{ key: 'uuid', label: 'UUID' }],
+};
+
+export const metabaseCreateCollectionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'slug', label: 'Slug' },
+ { key: 'name', label: 'Name' },
+ { key: 'personal_owner_id', label: 'Personal Owner ID' },
+ { key: 'type', label: 'Type' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'location', label: 'Location' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+};
+
+export const metabaseCreateDashboardOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'dashcards', label: 'Dashcards' },
+ {
+ key: 'can_set_cache_policy',
+ label: 'Can Set Cache Policy',
+ format: 'boolean',
+ },
+ { key: 'tabs', label: 'Tabs' },
+ { key: 'enable_embedding', label: 'Enable Embedding', format: 'boolean' },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'caveats', label: 'Caveats' },
+ { key: 'collection_authority_level', label: 'Collection Authority Level' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'embedding_params', label: 'Embedding Params' },
+ { key: 'cache_ttl', label: 'Cache TTL' },
+ { key: 'last_used_param_values', label: 'Last Used Param Values' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'last_viewed_at', label: 'Last Viewed At', format: 'datetime' },
+ { key: 'position', label: 'Position' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'collection', label: 'Collection', children: collectionFields },
+ {
+ key: 'parameters',
+ label: 'Parameters',
+ labelKey: 'name',
+ listItems: parametersFields,
+ },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'public_uuid', label: 'Public UUID' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+ ],
+};
+
+export const metabaseCreateDashboardSubscriptionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'creator', label: 'Creator', children: creatorFields2 },
+ {
+ key: 'channels',
+ label: 'Channels',
+ labelKey: 'id',
+ listItems: [
+ { key: 'schedule_type', label: 'Schedule Type' },
+ { key: 'schedule_hour', label: 'Schedule Hour', format: 'number' },
+ { key: 'channel_type', label: 'Channel Type' },
+ { key: 'schedule_frame', label: 'Schedule Frame' },
+ {
+ key: 'recipients',
+ label: 'Recipients',
+ labelKey: 'email',
+ listItems: [
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'first_name', label: 'First Name' },
+ { key: 'last_name', label: 'Last Name' },
+ { key: 'common_name', label: 'Common Name' },
+ { key: 'id', label: 'ID', format: 'number' },
+ ],
+ },
+ { key: 'channel_id', label: 'Channel ID' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'pulse_id', label: 'Pulse ID', format: 'number' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'schedule_day', label: 'Schedule Day' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'enabled', label: 'Enabled', format: 'boolean' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+ },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'cards', label: 'Cards', labelKey: 'name', listItems: cardsFields },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'skip_if_empty', label: 'Skip If Empty', format: 'boolean' },
+ { key: 'parameters', label: 'Parameters' },
+ { key: 'disable_links', label: 'Disable Links', format: 'boolean' },
+ { key: 'dashboard_id', label: 'Dashboard ID', format: 'number' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+};
+
+export const metabaseCreateDocumentOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'creator', label: 'Creator', children: creatorFields2 },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'content_type', label: 'Content Type' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ {
+ key: 'document',
+ label: 'Document',
+ children: [
+ { key: 'type', label: 'Type' },
+ { key: 'content', label: 'Content' },
+ ],
+ },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'is_placeholder', label: 'Is Placeholder', format: 'boolean' },
+ { key: 'last_viewed_at', label: 'Last Viewed At', format: 'datetime' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'exploration_id', label: 'Exploration ID' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'public_uuid', label: 'Public UUID' },
+ ],
+};
+
+export const metabaseCreateGlossaryEntryOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'term', label: 'Term' },
+ { key: 'definition', label: 'Definition' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'creator', label: 'Creator', children: creatorFields2 },
+ ],
+};
+
+export const metabaseCreateGroupOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'magic_group_type', label: 'Magic Group Type' },
+ ],
+};
+
+export const metabaseCreateSnippetOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'content', label: 'Content' },
+ { key: 'collection_id', label: 'Collection ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'template_tags', label: 'Template Tags' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+};
+
+export const metabaseCreateTimelineEventOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'timezone', label: 'Timezone' },
+ { key: 'time_matters', label: 'Time Matters', format: 'boolean' },
+ { key: 'name', label: 'Name' },
+ { key: 'timeline_id', label: 'Timeline ID', format: 'number' },
+ { key: 'icon', label: 'Icon' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'timestamp', label: 'Timestamp', format: 'datetime' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+};
+
+export const metabaseCreateTimelineOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'default', label: 'Default', format: 'boolean' },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'icon', label: 'Icon' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+};
+
+export const metabaseCreateUserOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'first_name', label: 'First Name' },
+ { key: 'is_data_analyst', label: 'Is Data Analyst', format: 'boolean' },
+ { key: 'locale', label: 'Locale' },
+ { key: 'last_login', label: 'Last Login' },
+ { key: 'is_active', label: 'Is Active', format: 'boolean' },
+ {
+ key: 'user_group_memberships',
+ label: 'User Group Memberships',
+ labelKey: 'id',
+ listItems: [{ key: 'id', label: 'ID', format: 'number' }],
+ },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'is_superuser', label: 'Is Superuser', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'last_name', label: 'Last Name' },
+ { key: 'date_joined', label: 'Date Joined', format: 'datetime' },
+ { key: 'common_name', label: 'Common Name' },
+ ],
+};
+
+export const metabaseDeactivateUserOutputSchema: OutputSchema = {
+ fields: [{ key: 'success', label: 'Success', format: 'boolean' }],
+};
+
+export const metabaseDeleteActionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'deleted', label: 'Deleted', format: 'boolean' },
+ { key: 'actionId', label: 'Action ID', format: 'number' },
+ ],
+};
+
+export const metabaseDeleteBookmarkOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'deleted', label: 'Deleted', format: 'boolean' },
+ { key: 'model', label: 'Model' },
+ { key: 'itemId', label: 'Item ID', format: 'number' },
+ ],
+};
+
+export const metabaseDeleteCardOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'deleted', label: 'Deleted', format: 'boolean' },
+ { key: 'cardId', label: 'Card ID', format: 'number' },
+ ],
+};
+
+export const metabaseDeleteCollectionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'deleted', label: 'Deleted', format: 'boolean' },
+ { key: 'collectionId', label: 'Collection ID', format: 'number' },
+ ],
+};
+
+export const metabaseDeleteDashboardOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'deleted', label: 'Deleted', format: 'boolean' },
+ { key: 'dashboardId', label: 'Dashboard ID', format: 'number' },
+ ],
+};
+
+export const metabaseDeleteDocumentOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'deleted', label: 'Deleted', format: 'boolean' },
+ { key: 'documentId', label: 'Document ID', format: 'number' },
+ ],
+};
+
+export const metabaseDeleteGlossaryEntryOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'deleted', label: 'Deleted', format: 'boolean' },
+ { key: 'glossaryId', label: 'Glossary ID', format: 'number' },
+ ],
+};
+
+export const metabaseDeleteGroupOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'deleted', label: 'Deleted', format: 'boolean' },
+ { key: 'groupId', label: 'Group ID', format: 'number' },
+ ],
+};
+
+export const metabaseDeleteSegmentOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'deleted', label: 'Deleted', format: 'boolean' },
+ { key: 'segmentId', label: 'Segment ID', format: 'number' },
+ ],
+};
+
+export const metabaseDeleteTimelineEventOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'deleted', label: 'Deleted', format: 'boolean' },
+ { key: 'eventId', label: 'Event ID', format: 'number' },
+ ],
+};
+
+export const metabaseDeleteTimelineOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'deleted', label: 'Deleted', format: 'boolean' },
+ { key: 'timelineId', label: 'Timeline ID', format: 'number' },
+ ],
+};
+
+export const metabaseExecuteActionOutputSchema: OutputSchema = {
+ fields: [{ key: 'rows-affected', label: 'Rows Affected', format: 'number' }],
+};
+
+export const metabaseGetActionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'creator', label: 'Creator', children: creatorFields2 },
+ { key: 'database_id', label: 'Database ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'type', label: 'Type' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'dataset_query', label: 'Dataset Query' },
+ { key: 'model_id', label: 'Model ID', format: 'number' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'parameter_mappings', label: 'Parameter Mappings' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'parameters', label: 'Parameters' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'public_uuid', label: 'Public UUID' },
+ ],
+};
+
+export const metabaseGetAlertOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'payload_id', label: 'Payload ID', format: 'number' },
+ {
+ key: 'payload',
+ label: 'Payload',
+ children: [
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'card_id', label: 'Card ID', format: 'number' },
+ { key: 'send_once', label: 'Send Once', format: 'boolean' },
+ { key: 'send_condition', label: 'Send Condition' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'disable_links', label: 'Disable Links', format: 'boolean' },
+ {
+ key: 'card',
+ label: 'Card',
+ children: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'table_id', label: 'Table ID', format: 'number' },
+ { key: 'database_id', label: 'Database ID', format: 'number' },
+ {
+ key: 'enable_embedding',
+ label: 'Enable Embedding',
+ format: 'boolean',
+ },
+ { key: 'collection_id', label: 'Collection ID' },
+ { key: 'query_type', label: 'Query Type' },
+ { key: 'name', label: 'Name' },
+ { key: 'document_id', label: 'Document ID' },
+ { key: 'last_used_at', label: 'Last Used At', format: 'datetime' },
+ { key: 'type', label: 'Type' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'embedding_params', label: 'Embedding Params' },
+ { key: 'cache_ttl', label: 'Cache TTL' },
+ { key: 'dataset_query', label: 'Dataset Query' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'parameter_mappings', label: 'Parameter Mappings' },
+ { key: 'display', label: 'Display' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'parameters', label: 'Parameters' },
+ { key: 'dashboard_id', label: 'Dashboard ID' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'public_uuid', label: 'Public UUID' },
+ ],
+ },
+ ],
+ },
+ { key: 'creator', label: 'Creator', children: creatorFields2 },
+ { key: 'payload_type', label: 'Payload Type' },
+ {
+ key: 'handlers',
+ label: 'Handlers',
+ labelKey: 'id',
+ listItems: [
+ { key: 'template_id', label: 'Template ID' },
+ { key: 'channel_type', label: 'Channel Type' },
+ { key: 'channel', label: 'Channel' },
+ { key: 'template', label: 'Template' },
+ {
+ key: 'recipients',
+ label: 'Recipients',
+ labelKey: 'id',
+ listItems: [
+ { key: 'id', label: 'ID', format: 'number' },
+ {
+ key: 'notification_handler_id',
+ label: 'Notification Handler ID',
+ format: 'number',
+ },
+ { key: 'type', label: 'Type' },
+ { key: 'user_id', label: 'User ID' },
+ { key: 'permissions_group_id', label: 'Permissions Group ID' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ ],
+ },
+ { key: 'channel_id', label: 'Channel ID' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'notification_id', label: 'Notification ID', format: 'number' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+ },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ {
+ key: 'subscriptions',
+ label: 'Subscriptions',
+ labelKey: 'id',
+ listItems: subscriptionsFields,
+ },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+};
+
+export const metabaseGetCardOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'table_id', label: 'Table ID', format: 'number' },
+ { key: 'creator', label: 'Creator', children: creatorFields },
+ { key: 'database_id', label: 'Database ID', format: 'number' },
+ { key: 'enable_embedding', label: 'Enable Embedding', format: 'boolean' },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'query_type', label: 'Query Type' },
+ { key: 'name', label: 'Name' },
+ { key: 'document_id', label: 'Document ID' },
+ { key: 'last_used_at', label: 'Last Used At', format: 'datetime' },
+ { key: 'dashboard', label: 'Dashboard' },
+ { key: 'type', label: 'Type' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'embedding_params', label: 'Embedding Params', dynamicKey: true },
+ { key: 'cache_ttl', label: 'Cache TTL' },
+ { key: 'dataset_query', label: 'Dataset Query' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'parameter_mappings', label: 'Parameter Mappings' },
+ { key: 'display', label: 'Display' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'collection', label: 'Collection', children: collectionFields2 },
+ {
+ key: 'parameters',
+ label: 'Parameters',
+ labelKey: 'name',
+ listItems: parametersFields3,
+ },
+ { key: 'dashboard_id', label: 'Dashboard ID' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'public_uuid', label: 'Public UUID' },
+ ],
+};
+
+export const metabaseGetCardQueryMetadataOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'databases',
+ label: 'Databases',
+ labelKey: 'name',
+ listItems: [
+ { key: 'description', label: 'Description' },
+ { key: 'features', label: 'Features' },
+ { key: 'timezone', label: 'Timezone' },
+ {
+ key: 'auto_run_queries',
+ label: 'Auto Run Queries',
+ format: 'boolean',
+ },
+ { key: 'is_stub', label: 'Is Stub', format: 'boolean' },
+ { key: 'name', label: 'Name' },
+ { key: 'caveats', label: 'Caveats' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'provider_name', label: 'Provider Name' },
+ { key: 'native_permissions', label: 'Native Permissions' },
+ { key: 'cache_ttl', label: 'Cache TTL' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'engine', label: 'Engine' },
+ { key: 'refingerprint', label: 'Refingerprint' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+ { key: 'admin_details', label: 'Admin Details' },
+ ],
+ },
+ {
+ key: 'tables',
+ label: 'Tables',
+ labelKey: 'display_name',
+ listItems: [
+ { key: 'description', label: 'Description' },
+ { key: 'schema', label: 'Schema' },
+ { key: 'fields', label: 'Fields' },
+ { key: 'type', label: 'Type' },
+ { key: 'moderated_status', label: 'Moderated Status' },
+ { key: 'id', label: 'ID' },
+ { key: 'db_id', label: 'DB ID', format: 'number' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'display_name', label: 'Display Name' },
+ { key: 'metrics', label: 'Metrics' },
+ ],
+ },
+ {
+ key: 'fields',
+ label: 'Fields',
+ labelKey: 'name',
+ listItems: [
+ { key: 'description', label: 'Description' },
+ { key: 'database_type', label: 'Database Type' },
+ { key: 'semantic_type', label: 'Semantic Type' },
+ { key: 'table_id', label: 'Table ID', format: 'number' },
+ { key: 'coercion_strategy', label: 'Coercion Strategy' },
+ { key: 'database_indexed', label: 'Database Indexed' },
+ {
+ key: 'dimension_interestingness',
+ label: 'Dimension Interestingness',
+ },
+ { key: 'name', label: 'Name' },
+ {
+ key: 'fingerprint_version',
+ label: 'Fingerprint Version',
+ format: 'number',
+ },
+ { key: 'has_field_values', label: 'Has Field Values' },
+ { key: 'database_is_pk', label: 'Database Is PK' },
+ { key: 'caveats', label: 'Caveats' },
+ { key: 'fk_target_field_id', label: 'FK Target Field ID' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'custom_position', label: 'Custom Position', format: 'number' },
+ { key: 'database_default', label: 'Database Default' },
+ { key: 'effective_type', label: 'Effective Type' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'parent_id', label: 'Parent ID' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'last_analyzed', label: 'Last Analyzed' },
+ { key: 'database_partitioned', label: 'Database Partitioned' },
+ {
+ key: 'database_is_auto_increment',
+ label: 'Database Is Auto Increment',
+ format: 'boolean',
+ },
+ { key: 'json_unfolding', label: 'JSON Unfolding', format: 'boolean' },
+ { key: 'position', label: 'Position', format: 'number' },
+ { key: 'visibility_type', label: 'Visibility Type' },
+ { key: 'preview_display', label: 'Preview Display', format: 'boolean' },
+ { key: 'database_is_generated', label: 'Database Is Generated' },
+ { key: 'data_sensitivity', label: 'Data Sensitivity' },
+ { key: 'display_name', label: 'Display Name' },
+ {
+ key: 'database_position',
+ label: 'Database Position',
+ format: 'number',
+ },
+ {
+ key: 'database_required',
+ label: 'Database Required',
+ format: 'boolean',
+ },
+ { key: 'database_is_nullable', label: 'Database Is Nullable' },
+ { key: 'name_field', label: 'Name Field' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'base_type', label: 'Base Type' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+ ],
+ },
+ { key: 'snippets', label: 'Snippets' },
+ ],
+};
+
+export const metabaseGetCollectionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'name', label: 'Name' },
+ { key: 'parent_id', label: 'Parent ID', format: 'number' },
+ { key: 'id', label: 'ID' },
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'slug', label: 'Slug' },
+ { key: 'personal_owner_id', label: 'Personal Owner ID' },
+ { key: 'type', label: 'Type' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'location', label: 'Location' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+};
+
+export const metabaseGetCollectionTreeOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'collections',
+ label: 'Collections',
+ labelKey: 'name',
+ listItems: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ {
+ key: 'children',
+ label: 'Children',
+ labelKey: 'name',
+ listItems: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'children', label: 'Children' },
+ { key: 'slug', label: 'Slug' },
+ { key: 'name', label: 'Name' },
+ { key: 'personal_owner_id', label: 'Personal Owner ID' },
+ { key: 'type', label: 'Type' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'location', label: 'Location' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+ },
+ { key: 'slug', label: 'Slug' },
+ { key: 'name', label: 'Name' },
+ {
+ key: 'personal_owner_id',
+ label: 'Personal Owner ID',
+ format: 'number',
+ },
+ { key: 'type', label: 'Type' },
+ { key: 'here', label: 'Here' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'location', label: 'Location' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const metabaseGetCurrentUserOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'first_name', label: 'First Name' },
+ { key: 'has_model', label: 'Has Model', format: 'boolean' },
+ { key: 'is_data_analyst', label: 'Is Data Analyst', format: 'boolean' },
+ { key: 'locale', label: 'Locale' },
+ { key: 'last_login', label: 'Last Login' },
+ { key: 'is_active', label: 'Is Active', format: 'boolean' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'group_ids', label: 'Group IDs' },
+ { key: 'is_superuser', label: 'Is Superuser', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'last_name', label: 'Last Name' },
+ { key: 'date_joined', label: 'Date Joined', format: 'datetime' },
+ {
+ key: 'can_write_any_collection',
+ label: 'Can Write Any Collection',
+ format: 'boolean',
+ },
+ { key: 'common_name', label: 'Common Name' },
+ { key: 'attributes', label: 'Attributes' },
+ ],
+};
+
+export const metabaseGetDashboardOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ {
+ key: 'dashcards',
+ label: 'Dashcards',
+ labelKey: 'id',
+ listItems: [
+ { key: 'size_x', label: 'Size X', format: 'number' },
+ {
+ key: 'collection_authority_level',
+ label: 'Collection Authority Level',
+ },
+ {
+ key: 'card',
+ label: 'Card',
+ children: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'table_id', label: 'Table ID' },
+ { key: 'database_id', label: 'Database ID', format: 'number' },
+ {
+ key: 'enable_embedding',
+ label: 'Enable Embedding',
+ format: 'boolean',
+ },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'query_type', label: 'Query Type' },
+ { key: 'download_perms', label: 'Download Perms' },
+ { key: 'name', label: 'Name' },
+ { key: 'document_id', label: 'Document ID' },
+ { key: 'last_used_at', label: 'Last Used At', format: 'datetime' },
+ { key: 'type', label: 'Type' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'embedding_params', label: 'Embedding Params' },
+ { key: 'cache_ttl', label: 'Cache TTL' },
+ { key: 'dataset_query', label: 'Dataset Query' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'parameter_mappings', label: 'Parameter Mappings' },
+ { key: 'display', label: 'Display' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'parameters', label: 'Parameters' },
+ { key: 'dashboard_id', label: 'Dashboard ID', format: 'number' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'public_uuid', label: 'Public UUID' },
+ ],
+ },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'col', label: 'Col', format: 'number' },
+ { key: 'id', label: 'ID', format: 'number' },
+ {
+ key: 'parameter_mappings',
+ label: 'Parameter Mappings',
+ listItems: parameterMappingsFields,
+ },
+ { key: 'card_id', label: 'Card ID', format: 'number' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'size_y', label: 'Size Y', format: 'number' },
+ { key: 'dashboard_id', label: 'Dashboard ID', format: 'number' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'row', label: 'Row', format: 'number' },
+ ],
+ },
+ {
+ key: 'can_set_cache_policy',
+ label: 'Can Set Cache Policy',
+ format: 'boolean',
+ },
+ { key: 'tabs', label: 'Tabs' },
+ { key: 'enable_embedding', label: 'Enable Embedding', format: 'boolean' },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'caveats', label: 'Caveats' },
+ { key: 'collection_authority_level', label: 'Collection Authority Level' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'embedding_params', label: 'Embedding Params' },
+ { key: 'cache_ttl', label: 'Cache TTL' },
+ {
+ key: 'last_used_param_values',
+ label: 'Last Used Param Values',
+ dynamicKey: true,
+ },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'last_viewed_at', label: 'Last Viewed At', format: 'datetime' },
+ { key: 'position', label: 'Position' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'collection', label: 'Collection', children: collectionFields3 },
+ {
+ key: 'parameters',
+ label: 'Parameters',
+ labelKey: 'name',
+ listItems: parametersFields,
+ },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'public_uuid', label: 'Public UUID' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+ ],
+};
+
+export const metabaseGetDashboardSubscriptionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'creator', label: 'Creator', children: creatorFields2 },
+ {
+ key: 'channels',
+ label: 'Channels',
+ labelKey: 'id',
+ listItems: channelsFields,
+ },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'cards', label: 'Cards', labelKey: 'name', listItems: cardsFields },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'skip_if_empty', label: 'Skip If Empty', format: 'boolean' },
+ { key: 'parameters', label: 'Parameters' },
+ { key: 'disable_links', label: 'Disable Links', format: 'boolean' },
+ { key: 'dashboard_id', label: 'Dashboard ID', format: 'number' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+};
+
+export const metabaseGetDatabaseMetadataOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'features', label: 'Features' },
+ { key: 'timezone', label: 'Timezone' },
+ { key: 'auto_run_queries', label: 'Auto Run Queries', format: 'boolean' },
+ { key: 'is_stub', label: 'Is Stub', format: 'boolean' },
+ { key: 'name', label: 'Name' },
+ { key: 'caveats', label: 'Caveats' },
+ {
+ key: 'tables',
+ label: 'Tables',
+ labelKey: 'name',
+ listItems: [
+ { key: 'description', label: 'Description' },
+ { key: 'entity_type', label: 'Entity Type' },
+ { key: 'schema', label: 'Schema' },
+ { key: 'is_writable', label: 'Is Writable' },
+ { key: 'database_require_filter', label: 'Database Require Filter' },
+ { key: 'collection_id', label: 'Collection ID' },
+ { key: 'name', label: 'Name' },
+ {
+ key: 'transform_target',
+ label: 'Transform Target',
+ format: 'boolean',
+ },
+ {
+ key: 'fields',
+ label: 'Fields',
+ labelKey: 'name',
+ listItems: fieldsFields,
+ },
+ { key: 'caveats', label: 'Caveats' },
+ { key: 'owner_email', label: 'Owner Email' },
+ { key: 'transform_id', label: 'Transform ID' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'is_published', label: 'Is Published', format: 'boolean' },
+ { key: 'owner_user_id', label: 'Owner User ID' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'db_id', label: 'DB ID', format: 'number' },
+ { key: 'archived_at', label: 'Archived At' },
+ { key: 'data_source', label: 'Data Source' },
+ { key: 'visibility_type', label: 'Visibility Type' },
+ { key: 'deactivated_at', label: 'Deactivated At' },
+ { key: 'data_authority', label: 'Data Authority' },
+ { key: 'is_upload', label: 'Is Upload', format: 'boolean' },
+ { key: 'display_name', label: 'Display Name' },
+ { key: 'data_layer', label: 'Data Layer' },
+ {
+ key: 'metrics',
+ label: 'Metrics',
+ labelKey: 'name',
+ listItems: metricsFields,
+ },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'estimated_row_count', label: 'Estimated Row Count' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+ ],
+ },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'provider_name', label: 'Provider Name' },
+ { key: 'cache_ttl', label: 'Cache TTL' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'engine', label: 'Engine' },
+ { key: 'refingerprint', label: 'Refingerprint' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+ { key: 'admin_details', label: 'Admin Details' },
+ ],
+};
+
+export const metabaseGetDatabaseOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'features', label: 'Features' },
+ { key: 'timezone', label: 'Timezone' },
+ { key: 'auto_run_queries', label: 'Auto Run Queries', format: 'boolean' },
+ { key: 'is_stub', label: 'Is Stub', format: 'boolean' },
+ { key: 'name', label: 'Name' },
+ { key: 'caveats', label: 'Caveats' },
+ {
+ key: 'tables',
+ label: 'Tables',
+ labelKey: 'name',
+ listItems: [
+ { key: 'description', label: 'Description' },
+ { key: 'entity_type', label: 'Entity Type' },
+ { key: 'schema', label: 'Schema' },
+ { key: 'is_writable', label: 'Is Writable' },
+ { key: 'database_require_filter', label: 'Database Require Filter' },
+ { key: 'collection_id', label: 'Collection ID' },
+ { key: 'name', label: 'Name' },
+ {
+ key: 'transform_target',
+ label: 'Transform Target',
+ format: 'boolean',
+ },
+ { key: 'caveats', label: 'Caveats' },
+ { key: 'owner_email', label: 'Owner Email' },
+ { key: 'transform_id', label: 'Transform ID' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'is_published', label: 'Is Published', format: 'boolean' },
+ { key: 'owner_user_id', label: 'Owner User ID' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'db_id', label: 'DB ID', format: 'number' },
+ { key: 'archived_at', label: 'Archived At' },
+ { key: 'data_source', label: 'Data Source' },
+ { key: 'visibility_type', label: 'Visibility Type' },
+ { key: 'deactivated_at', label: 'Deactivated At' },
+ { key: 'data_authority', label: 'Data Authority' },
+ { key: 'is_upload', label: 'Is Upload', format: 'boolean' },
+ { key: 'display_name', label: 'Display Name' },
+ { key: 'data_layer', label: 'Data Layer' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'estimated_row_count', label: 'Estimated Row Count' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+ {
+ key: 'fields',
+ label: 'Fields',
+ labelKey: 'name',
+ listItems: fieldsFields,
+ },
+ ],
+ },
+ { key: 'can-manage', label: 'Can Manage', format: 'boolean' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'provider_name', label: 'Provider Name' },
+ { key: 'cache_ttl', label: 'Cache TTL' },
+ { key: 'id', label: 'ID', format: 'number' },
+ {
+ key: 'schedules',
+ label: 'Schedules',
+ children: [
+ {
+ key: 'metadata_sync',
+ label: 'Metadata Sync',
+ children: metadataSyncFields,
+ },
+ {
+ key: 'cache_field_values',
+ label: 'Cache Field Values',
+ children: cacheFieldValuesFields,
+ },
+ ],
+ },
+ { key: 'engine', label: 'Engine' },
+ { key: 'refingerprint', label: 'Refingerprint' },
+ { key: 'router_user_attribute', label: 'Router User Attribute' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+ { key: 'admin_details', label: 'Admin Details' },
+ ],
+};
+
+export const metabaseGetFieldOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'database_type', label: 'Database Type' },
+ { key: 'semantic_type', label: 'Semantic Type' },
+ { key: 'table_id', label: 'Table ID', format: 'number' },
+ { key: 'coercion_strategy', label: 'Coercion Strategy' },
+ { key: 'table', label: 'Table', children: tablesFields },
+ { key: 'database_indexed', label: 'Database Indexed' },
+ { key: 'dimension_interestingness', label: 'Dimension Interestingness' },
+ { key: 'name', label: 'Name' },
+ {
+ key: 'fingerprint_version',
+ label: 'Fingerprint Version',
+ format: 'number',
+ },
+ { key: 'has_field_values', label: 'Has Field Values' },
+ { key: 'database_is_pk', label: 'Database Is PK' },
+ { key: 'caveats', label: 'Caveats' },
+ { key: 'fk_target_field_id', label: 'FK Target Field ID' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'custom_position', label: 'Custom Position', format: 'number' },
+ { key: 'database_default', label: 'Database Default' },
+ { key: 'effective_type', label: 'Effective Type' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'parent_id', label: 'Parent ID' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'last_analyzed', label: 'Last Analyzed' },
+ { key: 'database_partitioned', label: 'Database Partitioned' },
+ {
+ key: 'database_is_auto_increment',
+ label: 'Database Is Auto Increment',
+ format: 'boolean',
+ },
+ { key: 'json_unfolding', label: 'JSON Unfolding', format: 'boolean' },
+ { key: 'position', label: 'Position', format: 'number' },
+ { key: 'visibility_type', label: 'Visibility Type' },
+ { key: 'target', label: 'Target' },
+ { key: 'preview_display', label: 'Preview Display', format: 'boolean' },
+ { key: 'database_is_generated', label: 'Database Is Generated' },
+ { key: 'data_sensitivity', label: 'Data Sensitivity' },
+ { key: 'display_name', label: 'Display Name' },
+ { key: 'database_position', label: 'Database Position', format: 'number' },
+ { key: 'database_required', label: 'Database Required', format: 'boolean' },
+ { key: 'database_is_nullable', label: 'Database Is Nullable' },
+ { key: 'name_field', label: 'Name Field' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'base_type', label: 'Base Type' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+ ],
+};
+
+export const metabaseGetFieldSummaryOutputSchema: OutputSchema = {
+ fields: [{ key: 'items', label: 'Items', value: '' }],
+};
+
+export const metabaseGetGroupOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'magic_group_type', label: 'Magic Group Type' },
+ { key: 'members', label: 'Members' },
+ ],
+};
+
+export const metabaseGetSegmentOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'table_id', label: 'Table ID', format: 'number' },
+ { key: 'definition', label: 'Definition' },
+ { key: 'creator', label: 'Creator', children: creatorFields2 },
+ { key: 'name', label: 'Name' },
+ { key: 'caveats', label: 'Caveats' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+ ],
+};
+
+export const metabaseGetTableDataOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'data', label: 'Data', children: dataFields },
+ { key: 'database_id', label: 'Database ID', format: 'number' },
+ { key: 'started_at', label: 'Started At', format: 'datetime' },
+ { key: 'status', label: 'Status' },
+ { key: 'row_count', label: 'Row Count', format: 'number' },
+ { key: 'running_time', label: 'Running Time', format: 'number' },
+ ],
+};
+
+export const metabaseGetTableMetadataOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'entity_type', label: 'Entity Type' },
+ { key: 'schema', label: 'Schema' },
+ { key: 'is_writable', label: 'Is Writable' },
+ { key: 'database_require_filter', label: 'Database Require Filter' },
+ { key: 'db', label: 'DB', children: dbFields },
+ { key: 'collection_id', label: 'Collection ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'transform_target', label: 'Transform Target', format: 'boolean' },
+ {
+ key: 'fields',
+ label: 'Fields',
+ labelKey: 'name',
+ listItems: [
+ { key: 'description', label: 'Description' },
+ { key: 'database_type', label: 'Database Type' },
+ { key: 'semantic_type', label: 'Semantic Type' },
+ { key: 'table_id', label: 'Table ID', format: 'number' },
+ { key: 'coercion_strategy', label: 'Coercion Strategy' },
+ { key: 'database_indexed', label: 'Database Indexed' },
+ {
+ key: 'dimension_interestingness',
+ label: 'Dimension Interestingness',
+ format: 'number',
+ },
+ { key: 'name', label: 'Name' },
+ {
+ key: 'fingerprint_version',
+ label: 'Fingerprint Version',
+ format: 'number',
+ },
+ { key: 'has_field_values', label: 'Has Field Values' },
+ { key: 'database_is_pk', label: 'Database Is PK' },
+ { key: 'caveats', label: 'Caveats' },
+ {
+ key: 'fk_target_field_id',
+ label: 'FK Target Field ID',
+ format: 'number',
+ },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'custom_position', label: 'Custom Position', format: 'number' },
+ { key: 'database_default', label: 'Database Default' },
+ { key: 'effective_type', label: 'Effective Type' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'parent_id', label: 'Parent ID' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'last_analyzed', label: 'Last Analyzed' },
+ { key: 'database_partitioned', label: 'Database Partitioned' },
+ {
+ key: 'database_is_auto_increment',
+ label: 'Database Is Auto Increment',
+ format: 'boolean',
+ },
+ { key: 'json_unfolding', label: 'JSON Unfolding', format: 'boolean' },
+ { key: 'position', label: 'Position', format: 'number' },
+ { key: 'visibility_type', label: 'Visibility Type' },
+ {
+ key: 'target',
+ label: 'Target',
+ children: [
+ { key: 'description', label: 'Description' },
+ { key: 'database_type', label: 'Database Type' },
+ { key: 'semantic_type', label: 'Semantic Type' },
+ { key: 'table_id', label: 'Table ID', format: 'number' },
+ { key: 'coercion_strategy', label: 'Coercion Strategy' },
+ { key: 'database_indexed', label: 'Database Indexed' },
+ {
+ key: 'dimension_interestingness',
+ label: 'Dimension Interestingness',
+ format: 'number',
+ },
+ { key: 'name', label: 'Name' },
+ {
+ key: 'fingerprint_version',
+ label: 'Fingerprint Version',
+ format: 'number',
+ },
+ { key: 'has_field_values', label: 'Has Field Values' },
+ { key: 'database_is_pk', label: 'Database Is PK' },
+ { key: 'caveats', label: 'Caveats' },
+ { key: 'fk_target_field_id', label: 'FK Target Field ID' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ {
+ key: 'custom_position',
+ label: 'Custom Position',
+ format: 'number',
+ },
+ { key: 'database_default', label: 'Database Default' },
+ { key: 'effective_type', label: 'Effective Type' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'parent_id', label: 'Parent ID' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'last_analyzed', label: 'Last Analyzed' },
+ { key: 'database_partitioned', label: 'Database Partitioned' },
+ {
+ key: 'database_is_auto_increment',
+ label: 'Database Is Auto Increment',
+ format: 'boolean',
+ },
+ {
+ key: 'json_unfolding',
+ label: 'JSON Unfolding',
+ format: 'boolean',
+ },
+ { key: 'position', label: 'Position', format: 'number' },
+ { key: 'visibility_type', label: 'Visibility Type' },
+ {
+ key: 'preview_display',
+ label: 'Preview Display',
+ format: 'boolean',
+ },
+ { key: 'database_is_generated', label: 'Database Is Generated' },
+ { key: 'data_sensitivity', label: 'Data Sensitivity' },
+ { key: 'display_name', label: 'Display Name' },
+ {
+ key: 'database_position',
+ label: 'Database Position',
+ format: 'number',
+ },
+ {
+ key: 'database_required',
+ label: 'Database Required',
+ format: 'boolean',
+ },
+ { key: 'database_is_nullable', label: 'Database Is Nullable' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'base_type', label: 'Base Type' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+ ],
+ },
+ { key: 'preview_display', label: 'Preview Display', format: 'boolean' },
+ { key: 'database_is_generated', label: 'Database Is Generated' },
+ { key: 'data_sensitivity', label: 'Data Sensitivity' },
+ { key: 'display_name', label: 'Display Name' },
+ {
+ key: 'database_position',
+ label: 'Database Position',
+ format: 'number',
+ },
+ {
+ key: 'database_required',
+ label: 'Database Required',
+ format: 'boolean',
+ },
+ { key: 'database_is_nullable', label: 'Database Is Nullable' },
+ { key: 'name_field', label: 'Name Field' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'base_type', label: 'Base Type' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+ ],
+ },
+ { key: 'caveats', label: 'Caveats' },
+ { key: 'owner_email', label: 'Owner Email' },
+ { key: 'transform_id', label: 'Transform ID' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'is_published', label: 'Is Published', format: 'boolean' },
+ { key: 'owner_user_id', label: 'Owner User ID' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'db_id', label: 'DB ID', format: 'number' },
+ { key: 'archived_at', label: 'Archived At' },
+ { key: 'data_source', label: 'Data Source' },
+ { key: 'visibility_type', label: 'Visibility Type' },
+ { key: 'deactivated_at', label: 'Deactivated At' },
+ { key: 'data_authority', label: 'Data Authority' },
+ { key: 'is_upload', label: 'Is Upload', format: 'boolean' },
+ { key: 'display_name', label: 'Display Name' },
+ { key: 'data_layer', label: 'Data Layer' },
+ { key: 'collection', label: 'Collection' },
+ {
+ key: 'metrics',
+ label: 'Metrics',
+ labelKey: 'name',
+ listItems: metricsFields,
+ },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'estimated_row_count', label: 'Estimated Row Count' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+ ],
+};
+
+export const metabaseGetTableOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'entity_type', label: 'Entity Type' },
+ { key: 'schema', label: 'Schema' },
+ { key: 'is_writable', label: 'Is Writable' },
+ { key: 'database_require_filter', label: 'Database Require Filter' },
+ { key: 'db', label: 'DB', children: dbFields },
+ { key: 'collection_id', label: 'Collection ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'transform_target', label: 'Transform Target', format: 'boolean' },
+ { key: 'caveats', label: 'Caveats' },
+ { key: 'owner_email', label: 'Owner Email' },
+ { key: 'transform_id', label: 'Transform ID' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'pk_field', label: 'PK Field', format: 'number' },
+ { key: 'is_published', label: 'Is Published', format: 'boolean' },
+ { key: 'owner_user_id', label: 'Owner User ID' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'db_id', label: 'DB ID', format: 'number' },
+ { key: 'archived_at', label: 'Archived At' },
+ { key: 'data_source', label: 'Data Source' },
+ { key: 'visibility_type', label: 'Visibility Type' },
+ { key: 'deactivated_at', label: 'Deactivated At' },
+ { key: 'data_authority', label: 'Data Authority' },
+ { key: 'is_upload', label: 'Is Upload', format: 'boolean' },
+ { key: 'display_name', label: 'Display Name' },
+ { key: 'data_layer', label: 'Data Layer' },
+ { key: 'collection', label: 'Collection' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'estimated_row_count', label: 'Estimated Row Count' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+ ],
+};
+
+export const metabaseGetTimelineOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'creator', label: 'Creator', children: creatorFields2 },
+ { key: 'default', label: 'Default', format: 'boolean' },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ {
+ key: 'events',
+ label: 'Events',
+ labelKey: 'name',
+ listItems: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'timezone', label: 'Timezone' },
+ { key: 'creator', label: 'Creator', children: creatorFields2 },
+ { key: 'time_matters', label: 'Time Matters', format: 'boolean' },
+ { key: 'name', label: 'Name' },
+ { key: 'timeline_id', label: 'Timeline ID', format: 'number' },
+ { key: 'icon', label: 'Icon' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'timestamp', label: 'Timestamp', format: 'datetime' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+ },
+ { key: 'icon', label: 'Icon' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'collection', label: 'Collection', children: collectionFields3 },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+};
+
+export const metabaseGetUserOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'first_name', label: 'First Name' },
+ { key: 'is_data_analyst', label: 'Is Data Analyst', format: 'boolean' },
+ { key: 'locale', label: 'Locale' },
+ { key: 'last_login', label: 'Last Login' },
+ { key: 'is_active', label: 'Is Active', format: 'boolean' },
+ {
+ key: 'user_group_memberships',
+ label: 'User Group Memberships',
+ labelKey: 'id',
+ listItems: [{ key: 'id', label: 'ID', format: 'number' }],
+ },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'is_superuser', label: 'Is Superuser', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'last_name', label: 'Last Name' },
+ { key: 'date_joined', label: 'Date Joined', format: 'datetime' },
+ { key: 'common_name', label: 'Common Name' },
+ ],
+};
+
+export const metabaseListActionsOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'actions',
+ label: 'Actions',
+ labelKey: 'name',
+ listItems: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'creator', label: 'Creator', children: creatorFields2 },
+ { key: 'database_id', label: 'Database ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'type', label: 'Type' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'dataset_query', label: 'Dataset Query' },
+ { key: 'model_id', label: 'Model ID', format: 'number' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'parameter_mappings', label: 'Parameter Mappings' },
+ { key: 'entity_id', label: 'Entity ID' },
+ {
+ key: 'parameters',
+ label: 'Parameters',
+ labelKey: 'id',
+ listItems: [
+ { key: 'id', label: 'ID' },
+ { key: 'display-name', label: 'Display Name' },
+ { key: 'target', label: 'Target' },
+ { key: 'type', label: 'Type' },
+ { key: 'required', label: 'Required', format: 'boolean' },
+ {
+ key: 'is-auto-increment',
+ label: 'Is Auto Increment',
+ format: 'boolean',
+ },
+ ],
+ },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'public_uuid', label: 'Public UUID' },
+ { key: 'kind', label: 'Kind' },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const metabaseListAlertsOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'alerts',
+ label: 'Alerts',
+ labelKey: 'id',
+ listItems: [
+ { key: 'payload_id', label: 'Payload ID', format: 'number' },
+ {
+ key: 'payload',
+ label: 'Payload',
+ children: [
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'card_id', label: 'Card ID', format: 'number' },
+ { key: 'send_once', label: 'Send Once', format: 'boolean' },
+ { key: 'send_condition', label: 'Send Condition' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'disable_links', label: 'Disable Links', format: 'boolean' },
+ { key: 'card', label: 'Card' },
+ ],
+ },
+ { key: 'creator', label: 'Creator', children: creatorFields2 },
+ { key: 'payload_type', label: 'Payload Type' },
+ {
+ key: 'handlers',
+ label: 'Handlers',
+ labelKey: 'id',
+ listItems: [
+ { key: 'template_id', label: 'Template ID' },
+ { key: 'channel_type', label: 'Channel Type' },
+ { key: 'channel', label: 'Channel' },
+ { key: 'template', label: 'Template' },
+ { key: 'recipients', label: 'Recipients' },
+ { key: 'channel_id', label: 'Channel ID' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ {
+ key: 'notification_id',
+ label: 'Notification ID',
+ format: 'number',
+ },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+ },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ {
+ key: 'subscriptions',
+ label: 'Subscriptions',
+ labelKey: 'id',
+ listItems: subscriptionsFields,
+ },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const metabaseListBookmarksOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'bookmarks',
+ label: 'Bookmarks',
+ labelKey: 'name',
+ listItems: [
+ { key: 'item_id', label: 'Item ID', format: 'number' },
+ { key: 'type', label: 'Type' },
+ { key: 'name', label: 'Name' },
+ { key: 'id', label: 'ID' },
+ { key: 'description', label: 'Description' },
+ { key: 'card_type', label: 'Card Type' },
+ { key: 'display', label: 'Display' },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const metabaseListCardDashboardsOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'dashboards',
+ label: 'Dashboards',
+ labelKey: 'name',
+ listItems: [
+ { key: 'name', label: 'Name' },
+ { key: 'id', label: 'ID', format: 'number' },
+ {
+ key: 'enable_embedding',
+ label: 'Enable Embedding',
+ format: 'boolean',
+ },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const metabaseListCardsOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'cards',
+ label: 'Cards',
+ labelKey: 'name',
+ listItems: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'table_id', label: 'Table ID', format: 'number' },
+ { key: 'creator', label: 'Creator', children: creatorFields2 },
+ { key: 'database_id', label: 'Database ID', format: 'number' },
+ {
+ key: 'enable_embedding',
+ label: 'Enable Embedding',
+ format: 'boolean',
+ },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'query_type', label: 'Query Type' },
+ { key: 'name', label: 'Name' },
+ { key: 'document_id', label: 'Document ID' },
+ { key: 'last_used_at', label: 'Last Used At', format: 'datetime' },
+ { key: 'type', label: 'Type' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'embedding_params', label: 'Embedding Params' },
+ { key: 'cache_ttl', label: 'Cache TTL' },
+ { key: 'dataset_query', label: 'Dataset Query' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'parameter_mappings', label: 'Parameter Mappings' },
+ { key: 'display', label: 'Display' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'collection', label: 'Collection', children: collectionFields3 },
+ { key: 'parameters', label: 'Parameters' },
+ { key: 'dashboard_id', label: 'Dashboard ID' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'public_uuid', label: 'Public UUID' },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const metabaseListCollectionItemsOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'total', label: 'Total', format: 'number' },
+ {
+ key: 'data',
+ label: 'Data',
+ labelKey: 'name',
+ listItems: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ {
+ key: 'is_shared_tenant_collection',
+ label: 'Is Shared Tenant Collection',
+ format: 'boolean',
+ },
+ { key: 'database_id', label: 'Database ID', format: 'number' },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'last_used_at', label: 'Last Used At', format: 'datetime' },
+ { key: 'type', label: 'Type' },
+ { key: 'here', label: 'Here' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'location', label: 'Location' },
+ { key: 'dashboard_id', label: 'Dashboard ID' },
+ { key: 'model', label: 'Model' },
+ { key: 'below', label: 'Below' },
+ {
+ key: 'is_tenant_dashboard',
+ label: 'Is Tenant Dashboard',
+ format: 'boolean',
+ },
+ { key: 'moderated_status', label: 'Moderated Status' },
+ { key: 'collection_namespace', label: 'Collection Namespace' },
+ {
+ key: 'fully_parameterized',
+ label: 'Fully Parameterized',
+ format: 'boolean',
+ },
+ { key: 'dashboard', label: 'Dashboard' },
+ { key: 'display', label: 'Display' },
+ { key: 'table_id', label: 'Table ID' },
+ { key: 'query_type', label: 'Query Type' },
+ { key: 'personal_owner_id', label: 'Personal Owner ID' },
+ { key: 'icon', label: 'Icon' },
+ { key: 'dataset_query', label: 'Dataset Query' },
+ { key: 'is_upload', label: 'Is Upload' },
+ ],
+ },
+ { key: 'models', label: 'Models' },
+ { key: 'limit', label: 'Limit', format: 'number' },
+ { key: 'offset', label: 'Offset', format: 'number' },
+ ],
+};
+
+export const metabaseListCollectionTimelinesOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'timelines',
+ label: 'Timelines',
+ labelKey: 'name',
+ listItems: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'creator', label: 'Creator', children: creatorFields2 },
+ { key: 'default', label: 'Default', format: 'boolean' },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'icon', label: 'Icon' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'collection', label: 'Collection', children: collectionFields },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ {
+ key: 'events',
+ label: 'Events',
+ labelKey: 'name',
+ listItems: eventsFields,
+ },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const metabaseListCollectionsOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'collections',
+ label: 'Collections',
+ labelKey: 'name',
+ listItems: [
+ { key: 'name', label: 'Name' },
+ { key: 'parent_id', label: 'Parent ID', format: 'number' },
+ { key: 'id', label: 'ID' },
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'slug', label: 'Slug' },
+ {
+ key: 'personal_owner_id',
+ label: 'Personal Owner ID',
+ format: 'number',
+ },
+ { key: 'type', label: 'Type' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'location', label: 'Location' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const metabaseListDashboardSubscriptionsOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'subscriptions',
+ label: 'Subscriptions',
+ labelKey: 'name',
+ listItems: [
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'creator', label: 'Creator', children: creatorFields2 },
+ {
+ key: 'channels',
+ label: 'Channels',
+ labelKey: 'id',
+ listItems: [
+ { key: 'schedule_type', label: 'Schedule Type' },
+ { key: 'schedule_hour', label: 'Schedule Hour', format: 'number' },
+ { key: 'channel_type', label: 'Channel Type' },
+ { key: 'schedule_frame', label: 'Schedule Frame' },
+ { key: 'recipients', label: 'Recipients' },
+ { key: 'channel_id', label: 'Channel ID' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'pulse_id', label: 'Pulse ID', format: 'number' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'schedule_day', label: 'Schedule Day' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'enabled', label: 'Enabled', format: 'boolean' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+ },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'id', label: 'ID', format: 'number' },
+ {
+ key: 'cards',
+ label: 'Cards',
+ labelKey: 'name',
+ listItems: [
+ { key: 'description', label: 'Description' },
+ { key: 'format_rows', label: 'Format Rows', format: 'boolean' },
+ { key: 'include_xls', label: 'Include XLS', format: 'boolean' },
+ {
+ key: 'dashboard_card_id',
+ label: 'Dashboard Card ID',
+ format: 'number',
+ },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'download_perms', label: 'Download Perms' },
+ { key: 'name', label: 'Name' },
+ { key: 'pivot_results', label: 'Pivot Results', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'parameter_mappings', label: 'Parameter Mappings' },
+ { key: 'include_csv', label: 'Include CSV', format: 'boolean' },
+ { key: 'display', label: 'Display' },
+ { key: 'dashboard_id', label: 'Dashboard ID', format: 'number' },
+ ],
+ },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'skip_if_empty', label: 'Skip If Empty', format: 'boolean' },
+ { key: 'parameters', label: 'Parameters' },
+ { key: 'disable_links', label: 'Disable Links', format: 'boolean' },
+ { key: 'dashboard_id', label: 'Dashboard ID', format: 'number' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const metabaseListDashboardsOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'dashboards',
+ label: 'Dashboards',
+ labelKey: 'name',
+ listItems: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'creator', label: 'Creator', children: creatorFields2 },
+ {
+ key: 'enable_embedding',
+ label: 'Enable Embedding',
+ format: 'boolean',
+ },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'caveats', label: 'Caveats' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'embedding_params', label: 'Embedding Params' },
+ { key: 'cache_ttl', label: 'Cache TTL' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'last_viewed_at', label: 'Last Viewed At', format: 'datetime' },
+ { key: 'position', label: 'Position' },
+ { key: 'entity_id', label: 'Entity ID' },
+ {
+ key: 'parameters',
+ label: 'Parameters',
+ labelKey: 'name',
+ listItems: [
+ { key: 'id', label: 'ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'required', label: 'Required', format: 'boolean' },
+ { key: 'sectionId', label: 'Section ID' },
+ { key: 'slug', label: 'Slug' },
+ { key: 'type', label: 'Type' },
+ { key: 'default', label: 'Default' },
+ {
+ key: 'isMultiSelect',
+ label: 'Is Multi Select',
+ format: 'boolean',
+ },
+ ],
+ },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'public_uuid', label: 'Public UUID' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const metabaseListDatabaseFieldsOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'fields',
+ label: 'Fields',
+ labelKey: 'name',
+ listItems: [
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'display_name', label: 'Display Name' },
+ { key: 'base_type', label: 'Base Type' },
+ { key: 'semantic_type', label: 'Semantic Type' },
+ { key: 'table_name', label: 'Table Name' },
+ { key: 'table_id', label: 'Table ID', format: 'number' },
+ { key: 'schema', label: 'Schema' },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const metabaseListDatabaseSchemasOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'schemas', label: 'Schemas' },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const metabaseListDatabasesOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'data',
+ label: 'Data',
+ labelKey: 'name',
+ listItems: [
+ { key: 'description', label: 'Description' },
+ { key: 'features', label: 'Features' },
+ { key: 'timezone', label: 'Timezone' },
+ {
+ key: 'auto_run_queries',
+ label: 'Auto Run Queries',
+ format: 'boolean',
+ },
+ { key: 'is_stub', label: 'Is Stub', format: 'boolean' },
+ { key: 'transforms_permissions', label: 'Transforms Permissions' },
+ { key: 'name', label: 'Name' },
+ { key: 'caveats', label: 'Caveats' },
+ {
+ key: 'tables',
+ label: 'Tables',
+ labelKey: 'name',
+ listItems: [
+ { key: 'description', label: 'Description' },
+ { key: 'entity_type', label: 'Entity Type' },
+ { key: 'schema', label: 'Schema' },
+ { key: 'is_writable', label: 'Is Writable' },
+ {
+ key: 'database_require_filter',
+ label: 'Database Require Filter',
+ },
+ { key: 'collection_id', label: 'Collection ID' },
+ { key: 'name', label: 'Name' },
+ {
+ key: 'transform_target',
+ label: 'Transform Target',
+ format: 'boolean',
+ },
+ { key: 'caveats', label: 'Caveats' },
+ { key: 'owner_email', label: 'Owner Email' },
+ { key: 'transform_id', label: 'Transform ID' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'is_published', label: 'Is Published', format: 'boolean' },
+ { key: 'owner_user_id', label: 'Owner User ID' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'db_id', label: 'DB ID', format: 'number' },
+ { key: 'archived_at', label: 'Archived At' },
+ { key: 'data_source', label: 'Data Source' },
+ { key: 'visibility_type', label: 'Visibility Type' },
+ { key: 'deactivated_at', label: 'Deactivated At' },
+ { key: 'data_authority', label: 'Data Authority' },
+ { key: 'is_upload', label: 'Is Upload', format: 'boolean' },
+ { key: 'display_name', label: 'Display Name' },
+ { key: 'data_layer', label: 'Data Layer' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'estimated_row_count', label: 'Estimated Row Count' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+ ],
+ },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'provider_name', label: 'Provider Name' },
+ { key: 'native_permissions', label: 'Native Permissions' },
+ { key: 'cache_ttl', label: 'Cache TTL' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'engine', label: 'Engine' },
+ { key: 'refingerprint', label: 'Refingerprint' },
+ { key: 'router_user_attribute', label: 'Router User Attribute' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+ { key: 'admin_details', label: 'Admin Details' },
+ ],
+ },
+ { key: 'total', label: 'Total', format: 'number' },
+ ],
+};
+
+export const metabaseListDocumentsOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'items',
+ label: 'Items',
+ labelKey: 'name',
+ listItems: [
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'creator', label: 'Creator', children: creatorFields2 },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'content_type', label: 'Content Type' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ {
+ key: 'document',
+ label: 'Document',
+ children: [
+ { key: 'type', label: 'Type' },
+ { key: 'content', label: 'Content' },
+ ],
+ },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'is_placeholder', label: 'Is Placeholder', format: 'boolean' },
+ { key: 'last_viewed_at', label: 'Last Viewed At', format: 'datetime' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'exploration_id', label: 'Exploration ID' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'public_uuid', label: 'Public UUID' },
+ ],
+ },
+ ],
+};
+
+export const metabaseListFieldValuesOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'values', label: 'Values' },
+ { key: 'field_id', label: 'Field ID', format: 'number' },
+ { key: 'has_more_values', label: 'Has More Values', format: 'boolean' },
+ ],
+};
+
+export const metabaseListGlossaryEntriesOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'data',
+ label: 'Data',
+ labelKey: 'id',
+ listItems: [
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'term', label: 'Term' },
+ { key: 'definition', label: 'Definition' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'creator', label: 'Creator', children: creatorFields2 },
+ ],
+ },
+ ],
+};
+
+export const metabaseListGroupsOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'groups',
+ label: 'Groups',
+ labelKey: 'name',
+ listItems: [
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'magic_group_type', label: 'Magic Group Type' },
+ { key: 'member_count', label: 'Member Count', format: 'number' },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const metabaseListPopularItemsOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'popular_items',
+ label: 'Popular Items',
+ labelKey: 'name',
+ listItems: [
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'description', label: 'Description' },
+ { key: 'model', label: 'Model' },
+ { key: 'timestamp', label: 'Timestamp', format: 'datetime' },
+ { key: 'moderated_status', label: 'Moderated Status' },
+ {
+ key: 'parent_collection',
+ label: 'Parent Collection',
+ children: [
+ { key: 'id', label: 'ID' },
+ { key: 'name', label: 'Name' },
+ ],
+ },
+ { key: 'database_id', label: 'Database ID' },
+ { key: 'dashboard', label: 'Dashboard' },
+ { key: 'dataset_query', label: 'Dataset Query' },
+ { key: 'display', label: 'Display' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'table_schema', label: 'Table Schema' },
+ {
+ key: 'database',
+ label: 'Database',
+ children: [
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ ],
+ },
+ { key: 'display_name', label: 'Display Name' },
+ ],
+ },
+ ],
+};
+
+export const metabaseListRecentViewsOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'recents',
+ label: 'Recents',
+ labelKey: 'name',
+ listItems: [
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'description', label: 'Description' },
+ { key: 'model', label: 'Model' },
+ { key: 'timestamp', label: 'Timestamp', format: 'datetime' },
+ {
+ key: 'parent_collection',
+ label: 'Parent Collection',
+ children: [
+ { key: 'id', label: 'ID' },
+ { key: 'name', label: 'Name' },
+ ],
+ },
+ { key: 'moderated_status', label: 'Moderated Status' },
+ { key: 'database_id', label: 'Database ID', format: 'number' },
+ { key: 'dashboard', label: 'Dashboard' },
+ { key: 'dataset_query', label: 'Dataset Query' },
+ { key: 'display', label: 'Display' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'collection_type', label: 'Collection Type' },
+ { key: 'table_schema', label: 'Table Schema' },
+ {
+ key: 'database',
+ label: 'Database',
+ children: [
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ ],
+ },
+ { key: 'display_name', label: 'Display Name' },
+ ],
+ },
+ ],
+};
+
+export const metabaseListRevisionsOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'revisions',
+ label: 'Revisions',
+ labelKey: 'id',
+ listItems: [
+ { key: 'description', label: 'Description' },
+ { key: 'most_recent', label: 'Most Recent', format: 'boolean' },
+ { key: 'is_creation', label: 'Is Creation', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'is_reversion', label: 'Is Reversion', format: 'boolean' },
+ {
+ key: 'has_multiple_changes',
+ label: 'Has Multiple Changes',
+ format: 'boolean',
+ },
+ { key: 'timestamp', label: 'Timestamp', format: 'datetime' },
+ { key: 'user', label: 'User', children: userFields },
+ { key: 'message', label: 'Message' },
+ {
+ key: 'diff',
+ label: 'Diff',
+ children: [
+ { key: 'before', label: 'Before' },
+ { key: 'after', label: 'After' },
+ { key: 'definition', label: 'Definition' },
+ { key: 'description', label: 'Description' },
+ { key: 'name', label: 'Name' },
+ ],
+ },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const metabaseListSchemaTablesOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'tables',
+ label: 'Tables',
+ labelKey: 'name',
+ listItems: [
+ { key: 'description', label: 'Description' },
+ { key: 'entity_type', label: 'Entity Type' },
+ { key: 'schema', label: 'Schema' },
+ { key: 'is_writable', label: 'Is Writable', format: 'boolean' },
+ { key: 'database_require_filter', label: 'Database Require Filter' },
+ { key: 'collection_id', label: 'Collection ID' },
+ { key: 'name', label: 'Name' },
+ {
+ key: 'transform_target',
+ label: 'Transform Target',
+ format: 'boolean',
+ },
+ { key: 'caveats', label: 'Caveats' },
+ { key: 'owner_email', label: 'Owner Email' },
+ { key: 'transform_id', label: 'Transform ID' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'is_published', label: 'Is Published', format: 'boolean' },
+ { key: 'owner_user_id', label: 'Owner User ID' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'db_id', label: 'DB ID', format: 'number' },
+ { key: 'archived_at', label: 'Archived At' },
+ { key: 'data_source', label: 'Data Source' },
+ { key: 'visibility_type', label: 'Visibility Type' },
+ { key: 'deactivated_at', label: 'Deactivated At' },
+ { key: 'data_authority', label: 'Data Authority' },
+ { key: 'is_upload', label: 'Is Upload', format: 'boolean' },
+ { key: 'display_name', label: 'Display Name' },
+ { key: 'data_layer', label: 'Data Layer' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'estimated_row_count', label: 'Estimated Row Count' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const metabaseListSegmentsOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'segments',
+ label: 'Segments',
+ labelKey: 'name',
+ listItems: [
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'table_id', label: 'Table ID', format: 'number' },
+ { key: 'description', label: 'Description' },
+ { key: 'definition', label: 'Definition' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const metabaseListSnippetsOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'snippets',
+ label: 'Snippets',
+ labelKey: 'name',
+ listItems: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'creator', label: 'Creator', children: creatorFields2 },
+ { key: 'content', label: 'Content' },
+ { key: 'collection_id', label: 'Collection ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'template_tags', label: 'Template Tags' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const metabaseListTableForeignKeysOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'foreignKeys',
+ label: 'Foreign Keys',
+ listItems: [
+ { key: 'relationship', label: 'Relationship' },
+ { key: 'origin_id', label: 'Origin ID', format: 'number' },
+ {
+ key: 'origin',
+ label: 'Origin',
+ children: [
+ { key: 'description', label: 'Description' },
+ { key: 'database_type', label: 'Database Type' },
+ { key: 'semantic_type', label: 'Semantic Type' },
+ { key: 'table_id', label: 'Table ID', format: 'number' },
+ { key: 'coercion_strategy', label: 'Coercion Strategy' },
+ { key: 'table', label: 'Table' },
+ { key: 'database_indexed', label: 'Database Indexed' },
+ {
+ key: 'dimension_interestingness',
+ label: 'Dimension Interestingness',
+ },
+ { key: 'name', label: 'Name' },
+ {
+ key: 'fingerprint_version',
+ label: 'Fingerprint Version',
+ format: 'number',
+ },
+ { key: 'has_field_values', label: 'Has Field Values' },
+ { key: 'database_is_pk', label: 'Database Is PK' },
+ { key: 'caveats', label: 'Caveats' },
+ {
+ key: 'fk_target_field_id',
+ label: 'FK Target Field ID',
+ format: 'number',
+ },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ {
+ key: 'custom_position',
+ label: 'Custom Position',
+ format: 'number',
+ },
+ { key: 'database_default', label: 'Database Default' },
+ { key: 'effective_type', label: 'Effective Type' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'parent_id', label: 'Parent ID' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'last_analyzed', label: 'Last Analyzed' },
+ { key: 'database_partitioned', label: 'Database Partitioned' },
+ {
+ key: 'database_is_auto_increment',
+ label: 'Database Is Auto Increment',
+ format: 'boolean',
+ },
+ {
+ key: 'json_unfolding',
+ label: 'JSON Unfolding',
+ format: 'boolean',
+ },
+ { key: 'position', label: 'Position', format: 'number' },
+ { key: 'visibility_type', label: 'Visibility Type' },
+ {
+ key: 'preview_display',
+ label: 'Preview Display',
+ format: 'boolean',
+ },
+ { key: 'database_is_generated', label: 'Database Is Generated' },
+ { key: 'data_sensitivity', label: 'Data Sensitivity' },
+ { key: 'display_name', label: 'Display Name' },
+ {
+ key: 'database_position',
+ label: 'Database Position',
+ format: 'number',
+ },
+ {
+ key: 'database_required',
+ label: 'Database Required',
+ format: 'boolean',
+ },
+ { key: 'database_is_nullable', label: 'Database Is Nullable' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'base_type', label: 'Base Type' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+ ],
+ },
+ { key: 'destination_id', label: 'Destination ID', format: 'number' },
+ {
+ key: 'destination',
+ label: 'Destination',
+ children: [
+ { key: 'description', label: 'Description' },
+ { key: 'database_type', label: 'Database Type' },
+ { key: 'semantic_type', label: 'Semantic Type' },
+ { key: 'table_id', label: 'Table ID', format: 'number' },
+ { key: 'coercion_strategy', label: 'Coercion Strategy' },
+ { key: 'table', label: 'Table' },
+ { key: 'database_indexed', label: 'Database Indexed' },
+ {
+ key: 'dimension_interestingness',
+ label: 'Dimension Interestingness',
+ format: 'number',
+ },
+ { key: 'name', label: 'Name' },
+ {
+ key: 'fingerprint_version',
+ label: 'Fingerprint Version',
+ format: 'number',
+ },
+ { key: 'has_field_values', label: 'Has Field Values' },
+ { key: 'database_is_pk', label: 'Database Is PK' },
+ { key: 'caveats', label: 'Caveats' },
+ { key: 'fk_target_field_id', label: 'FK Target Field ID' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ {
+ key: 'custom_position',
+ label: 'Custom Position',
+ format: 'number',
+ },
+ { key: 'database_default', label: 'Database Default' },
+ { key: 'effective_type', label: 'Effective Type' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'parent_id', label: 'Parent ID' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'last_analyzed', label: 'Last Analyzed' },
+ { key: 'database_partitioned', label: 'Database Partitioned' },
+ {
+ key: 'database_is_auto_increment',
+ label: 'Database Is Auto Increment',
+ format: 'boolean',
+ },
+ {
+ key: 'json_unfolding',
+ label: 'JSON Unfolding',
+ format: 'boolean',
+ },
+ { key: 'position', label: 'Position', format: 'number' },
+ { key: 'visibility_type', label: 'Visibility Type' },
+ {
+ key: 'preview_display',
+ label: 'Preview Display',
+ format: 'boolean',
+ },
+ { key: 'database_is_generated', label: 'Database Is Generated' },
+ { key: 'data_sensitivity', label: 'Data Sensitivity' },
+ { key: 'display_name', label: 'Display Name' },
+ {
+ key: 'database_position',
+ label: 'Database Position',
+ format: 'number',
+ },
+ {
+ key: 'database_required',
+ label: 'Database Required',
+ format: 'boolean',
+ },
+ { key: 'database_is_nullable', label: 'Database Is Nullable' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'base_type', label: 'Base Type' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+ ],
+ },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const metabaseListTablesOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'tables',
+ label: 'Tables',
+ labelKey: 'name',
+ listItems: tablesFields,
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const metabaseListTimelinesOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'timelines',
+ label: 'Timelines',
+ labelKey: 'name',
+ listItems: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'creator', label: 'Creator', children: creatorFields2 },
+ { key: 'default', label: 'Default', format: 'boolean' },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'icon', label: 'Icon' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'collection', label: 'Collection', children: collectionFields2 },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ {
+ key: 'events',
+ label: 'Events',
+ labelKey: 'name',
+ listItems: eventsFields,
+ },
+ ],
+ },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+};
+
+export const metabaseListUsersOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'data',
+ label: 'Data',
+ labelKey: 'email',
+ listItems: [
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'first_name', label: 'First Name' },
+ { key: 'is_data_analyst', label: 'Is Data Analyst', format: 'boolean' },
+ { key: 'locale', label: 'Locale' },
+ { key: 'last_login', label: 'Last Login', format: 'datetime' },
+ { key: 'is_active', label: 'Is Active', format: 'boolean' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'group_ids', label: 'Group IDs' },
+ { key: 'is_superuser', label: 'Is Superuser', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'last_name', label: 'Last Name' },
+ { key: 'date_joined', label: 'Date Joined', format: 'datetime' },
+ { key: 'common_name', label: 'Common Name' },
+ ],
+ },
+ { key: 'total', label: 'Total', format: 'number' },
+ { key: 'limit', label: 'Limit', format: 'number' },
+ { key: 'offset', label: 'Offset', format: 'number' },
+ ],
+};
+
+export const metabaseMoveCardsOutputSchema: OutputSchema = {
+ fields: [{ key: 'status', label: 'Status' }],
+};
+
+export const metabaseReactivateUserOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'first_name', label: 'First Name' },
+ { key: 'is_data_analyst', label: 'Is Data Analyst', format: 'boolean' },
+ { key: 'locale', label: 'Locale' },
+ { key: 'last_login', label: 'Last Login' },
+ { key: 'is_active', label: 'Is Active', format: 'boolean' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'is_superuser', label: 'Is Superuser', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'last_name', label: 'Last Name' },
+ { key: 'date_joined', label: 'Date Joined', format: 'datetime' },
+ { key: 'common_name', label: 'Common Name' },
+ ],
+};
+
+export const metabaseRemoveGroupMemberOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'removed', label: 'Removed', format: 'boolean' },
+ { key: 'membershipId', label: 'Membership ID', format: 'number' },
+ ],
+};
+
+export const metabaseRevertRevisionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'most_recent', label: 'Most Recent', format: 'boolean' },
+ { key: 'is_creation', label: 'Is Creation', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'is_reversion', label: 'Is Reversion', format: 'boolean' },
+ {
+ key: 'has_multiple_changes',
+ label: 'Has Multiple Changes',
+ format: 'boolean',
+ },
+ { key: 'timestamp', label: 'Timestamp', format: 'datetime' },
+ { key: 'user', label: 'User', children: userFields },
+ { key: 'message', label: 'Message' },
+ {
+ key: 'diff',
+ label: 'Diff',
+ children: [
+ {
+ key: 'before',
+ label: 'Before',
+ children: [{ key: 'name', label: 'Name' }],
+ },
+ {
+ key: 'after',
+ label: 'After',
+ children: [{ key: 'name', label: 'Name' }],
+ },
+ ],
+ },
+ ],
+};
+
+export const metabaseRunCardQueryOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'data',
+ label: 'Data',
+ children: [
+ { key: 'rows', label: 'Rows' },
+ { key: 'cols', label: 'Cols', labelKey: 'name', listItems: colsFields },
+ { key: 'native_form', label: 'Native Form' },
+ { key: 'results_timezone', label: 'Results Timezone' },
+ ],
+ },
+ { key: 'cached', label: 'Cached' },
+ { key: 'database_id', label: 'Database ID', format: 'number' },
+ { key: 'started_at', label: 'Started At', format: 'datetime' },
+ { key: 'status', label: 'Status' },
+ { key: 'context', label: 'Context' },
+ { key: 'row_count', label: 'Row Count', format: 'number' },
+ { key: 'running_time', label: 'Running Time', format: 'number' },
+ ],
+};
+
+export const metabaseRunDashboardCardQueryOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'data', label: 'Data', children: dataFields },
+ { key: 'cached', label: 'Cached' },
+ { key: 'database_id', label: 'Database ID', format: 'number' },
+ { key: 'started_at', label: 'Started At', format: 'datetime' },
+ { key: 'status', label: 'Status' },
+ { key: 'context', label: 'Context' },
+ { key: 'row_count', label: 'Row Count', format: 'number' },
+ { key: 'running_time', label: 'Running Time', format: 'number' },
+ ],
+};
+
+export const metabaseRunQueryOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'data',
+ label: 'Data',
+ children: [
+ { key: 'rows', label: 'Rows' },
+ {
+ key: 'cols',
+ label: 'Cols',
+ labelKey: 'name',
+ listItems: [
+ { key: 'description', label: 'Description' },
+ { key: 'database_type', label: 'Database Type' },
+ { key: 'semantic_type', label: 'Semantic Type' },
+ { key: 'table_id', label: 'Table ID', format: 'number' },
+ { key: 'lib/deduplicated-name', label: 'Lib Deduplicated Name' },
+ { key: 'lib/original-name', label: 'Lib Original Name' },
+ { key: 'name', label: 'Name' },
+ { key: 'lib/source', label: 'Lib Source' },
+ {
+ key: 'lib/source-column-alias',
+ label: 'Lib Source Column Alias',
+ },
+ {
+ key: 'lib/original-display-name',
+ label: 'Lib Original Display Name',
+ },
+ { key: 'source', label: 'Source' },
+ { key: 'field_ref', label: 'Field Ref' },
+ { key: 'effective_type', label: 'Effective Type' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ {
+ key: 'lib/desired-column-alias',
+ label: 'Lib Desired Column Alias',
+ },
+ { key: 'position', label: 'Position', format: 'number' },
+ { key: 'visibility_type', label: 'Visibility Type' },
+ { key: 'display_name', label: 'Display Name' },
+ { key: 'base_type', label: 'Base Type' },
+ { key: 'lib/external-remap', label: 'Lib External Remap' },
+ {
+ key: 'fk_target_field_id',
+ label: 'FK Target Field ID',
+ format: 'number',
+ },
+ { key: 'remapped_to', label: 'Remapped To' },
+ { key: 'options', label: 'Options' },
+ { key: 'remapped_from', label: 'Remapped From' },
+ { key: 'fk_field_id', label: 'FK Field ID', format: 'number' },
+ ],
+ },
+ { key: 'native_form', label: 'Native Form' },
+ { key: 'results_timezone', label: 'Results Timezone' },
+ ],
+ },
+ { key: 'cached', label: 'Cached' },
+ { key: 'database_id', label: 'Database ID', format: 'number' },
+ { key: 'started_at', label: 'Started At', format: 'datetime' },
+ { key: 'status', label: 'Status' },
+ { key: 'context', label: 'Context' },
+ { key: 'row_count', label: 'Row Count', format: 'number' },
+ { key: 'running_time', label: 'Running Time', format: 'number' },
+ ],
+};
+
+export const metabaseSearchCardParameterValuesOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'values', label: 'Values' },
+ { key: 'has_more_values', label: 'Has More Values', format: 'boolean' },
+ ],
+};
+
+export const metabaseSearchFieldValuesOutputSchema: OutputSchema = {
+ fields: [{ key: 'items', label: 'Items', value: '' }],
+};
+
+export const metabaseSearchOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'data',
+ label: 'Data',
+ labelKey: 'name',
+ listItems: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'bookmark', label: 'Bookmark', format: 'boolean' },
+ { key: 'last_editor_common_name', label: 'Last Editor Common Name' },
+ { key: 'pk_ref', label: 'PK Ref' },
+ { key: 'official_collection', label: 'Official Collection' },
+ { key: 'name', label: 'Name' },
+ { key: 'curated', label: 'Curated', format: 'boolean' },
+ { key: 'creator_common_name', label: 'Creator Common Name' },
+ {
+ key: 'collection_authority_level',
+ label: 'Collection Authority Level',
+ },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'moderated_status', label: 'Moderated Status' },
+ { key: 'last_editor_id', label: 'Last Editor ID', format: 'number' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'last_edited_at', label: 'Last Edited At', format: 'datetime' },
+ { key: 'context', label: 'Context' },
+ {
+ key: 'scores',
+ label: 'Scores',
+ labelKey: 'name',
+ listItems: [
+ { key: 'score', label: 'Score', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'weight', label: 'Weight', format: 'number' },
+ { key: 'contribution', label: 'Contribution', format: 'number' },
+ ],
+ },
+ {
+ key: 'collection',
+ label: 'Collection',
+ children: [
+ { key: 'id', label: 'ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'type', label: 'Type' },
+ ],
+ },
+ { key: 'verified', label: 'Verified' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'model', label: 'Model' },
+ { key: 'display_type', label: 'Display Type' },
+ { key: 'database_id', label: 'Database ID', format: 'number' },
+ { key: 'query_type', label: 'Query Type' },
+ {
+ key: 'dashboardcard_count',
+ label: 'Dashboardcard Count',
+ format: 'number',
+ },
+ { key: 'display', label: 'Display' },
+ { key: 'document_name', label: 'Document Name' },
+ { key: 'type', label: 'Type' },
+ { key: 'location', label: 'Location' },
+ ],
+ },
+ { key: 'limit', label: 'Limit', format: 'number' },
+ { key: 'models', label: 'Models' },
+ { key: 'offset', label: 'Offset', format: 'number' },
+ { key: 'table_db_id', label: 'Table DB ID' },
+ { key: 'engine', label: 'Engine' },
+ { key: 'total', label: 'Total', format: 'number' },
+ ],
+};
+
+export const metabaseSendAlertOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'sent', label: 'Sent', format: 'boolean' },
+ { key: 'alertId', label: 'Alert ID', format: 'number' },
+ ],
+};
+
+export const metabaseUpdateActionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'database_id', label: 'Database ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'type', label: 'Type' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'dataset_query', label: 'Dataset Query' },
+ { key: 'model_id', label: 'Model ID', format: 'number' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'parameter_mappings', label: 'Parameter Mappings' },
+ { key: 'entity_id', label: 'Entity ID' },
+ {
+ key: 'parameters',
+ label: 'Parameters',
+ labelKey: 'name',
+ listItems: parametersFields2,
+ },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'public_uuid', label: 'Public UUID' },
+ ],
+};
+
+export const metabaseUpdateAlertOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'payload_id', label: 'Payload ID', format: 'number' },
+ {
+ key: 'payload',
+ label: 'Payload',
+ children: [
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'card_id', label: 'Card ID', format: 'number' },
+ { key: 'send_once', label: 'Send Once', format: 'boolean' },
+ { key: 'send_condition', label: 'Send Condition' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'disable_links', label: 'Disable Links', format: 'boolean' },
+ {
+ key: 'card',
+ label: 'Card',
+ children: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'table_id', label: 'Table ID', format: 'number' },
+ { key: 'database_id', label: 'Database ID', format: 'number' },
+ {
+ key: 'enable_embedding',
+ label: 'Enable Embedding',
+ format: 'boolean',
+ },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'query_type', label: 'Query Type' },
+ { key: 'name', label: 'Name' },
+ { key: 'document_id', label: 'Document ID' },
+ { key: 'last_used_at', label: 'Last Used At', format: 'datetime' },
+ { key: 'type', label: 'Type' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ {
+ key: 'embedding_params',
+ label: 'Embedding Params',
+ dynamicKey: true,
+ },
+ { key: 'cache_ttl', label: 'Cache TTL' },
+ { key: 'dataset_query', label: 'Dataset Query' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'parameter_mappings', label: 'Parameter Mappings' },
+ { key: 'display', label: 'Display' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'parameters', label: 'Parameters' },
+ { key: 'dashboard_id', label: 'Dashboard ID' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'public_uuid', label: 'Public UUID' },
+ ],
+ },
+ ],
+ },
+ { key: 'creator', label: 'Creator', children: creatorFields2 },
+ { key: 'payload_type', label: 'Payload Type' },
+ {
+ key: 'handlers',
+ label: 'Handlers',
+ labelKey: 'id',
+ listItems: [
+ { key: 'template_id', label: 'Template ID' },
+ { key: 'channel_type', label: 'Channel Type' },
+ { key: 'channel', label: 'Channel' },
+ { key: 'template', label: 'Template' },
+ {
+ key: 'recipients',
+ label: 'Recipients',
+ labelKey: 'id',
+ listItems: [
+ { key: 'id', label: 'ID', format: 'number' },
+ {
+ key: 'notification_handler_id',
+ label: 'Notification Handler ID',
+ format: 'number',
+ },
+ { key: 'type', label: 'Type' },
+ { key: 'user_id', label: 'User ID', format: 'number' },
+ { key: 'permissions_group_id', label: 'Permissions Group ID' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'user', label: 'User' },
+ ],
+ },
+ { key: 'channel_id', label: 'Channel ID' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'notification_id', label: 'Notification ID', format: 'number' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+ },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ {
+ key: 'subscriptions',
+ label: 'Subscriptions',
+ labelKey: 'id',
+ listItems: subscriptionsFields,
+ },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+};
+
+export const metabaseUpdateCardOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'table_id', label: 'Table ID', format: 'number' },
+ { key: 'creator', label: 'Creator', children: creatorFields },
+ { key: 'database_id', label: 'Database ID', format: 'number' },
+ { key: 'enable_embedding', label: 'Enable Embedding', format: 'boolean' },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'query_type', label: 'Query Type' },
+ { key: 'name', label: 'Name' },
+ { key: 'document_id', label: 'Document ID' },
+ { key: 'last_used_at', label: 'Last Used At', format: 'datetime' },
+ { key: 'dashboard', label: 'Dashboard', children: dashboardFields },
+ { key: 'type', label: 'Type' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'embedding_params', label: 'Embedding Params', dynamicKey: true },
+ { key: 'cache_ttl', label: 'Cache TTL' },
+ { key: 'dataset_query', label: 'Dataset Query' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'parameter_mappings', label: 'Parameter Mappings' },
+ { key: 'display', label: 'Display' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'collection', label: 'Collection', children: collectionFields3 },
+ {
+ key: 'parameters',
+ label: 'Parameters',
+ labelKey: 'name',
+ listItems: parametersFields3,
+ },
+ { key: 'dashboard_id', label: 'Dashboard ID', format: 'number' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'public_uuid', label: 'Public UUID' },
+ ],
+};
+
+export const metabaseUpdateCollectionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'slug', label: 'Slug' },
+ { key: 'name', label: 'Name' },
+ { key: 'personal_owner_id', label: 'Personal Owner ID' },
+ { key: 'type', label: 'Type' },
+ { key: 'parent_id', label: 'Parent ID', format: 'number' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'location', label: 'Location' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+};
+
+export const metabaseUpdateDashboardOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ {
+ key: 'dashcards',
+ label: 'Dashcards',
+ labelKey: 'id',
+ listItems: [
+ { key: 'size_x', label: 'Size X', format: 'number' },
+ {
+ key: 'collection_authority_level',
+ label: 'Collection Authority Level',
+ },
+ {
+ key: 'card',
+ label: 'Card',
+ children: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'table_id', label: 'Table ID', format: 'number' },
+ { key: 'database_id', label: 'Database ID', format: 'number' },
+ {
+ key: 'enable_embedding',
+ label: 'Enable Embedding',
+ format: 'boolean',
+ },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'query_type', label: 'Query Type' },
+ { key: 'download_perms', label: 'Download Perms' },
+ { key: 'name', label: 'Name' },
+ { key: 'document_id', label: 'Document ID' },
+ { key: 'last_used_at', label: 'Last Used At', format: 'datetime' },
+ { key: 'type', label: 'Type' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'embedding_params', label: 'Embedding Params' },
+ { key: 'cache_ttl', label: 'Cache TTL' },
+ { key: 'dataset_query', label: 'Dataset Query' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'parameter_mappings', label: 'Parameter Mappings' },
+ { key: 'display', label: 'Display' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'parameters', label: 'Parameters' },
+ { key: 'dashboard_id', label: 'Dashboard ID', format: 'number' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'public_uuid', label: 'Public UUID' },
+ ],
+ },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'col', label: 'Col', format: 'number' },
+ { key: 'id', label: 'ID', format: 'number' },
+ {
+ key: 'parameter_mappings',
+ label: 'Parameter Mappings',
+ listItems: parameterMappingsFields,
+ },
+ { key: 'card_id', label: 'Card ID', format: 'number' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'size_y', label: 'Size Y', format: 'number' },
+ { key: 'dashboard_id', label: 'Dashboard ID', format: 'number' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'row', label: 'Row', format: 'number' },
+ ],
+ },
+ {
+ key: 'can_set_cache_policy',
+ label: 'Can Set Cache Policy',
+ format: 'boolean',
+ },
+ {
+ key: 'tabs',
+ label: 'Tabs',
+ labelKey: 'name',
+ listItems: [
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'dashboard_id', label: 'Dashboard ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'position', label: 'Position', format: 'number' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ ],
+ },
+ { key: 'enable_embedding', label: 'Enable Embedding', format: 'boolean' },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'caveats', label: 'Caveats' },
+ { key: 'collection_authority_level', label: 'Collection Authority Level' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'embedding_params', label: 'Embedding Params', dynamicKey: true },
+ { key: 'cache_ttl', label: 'Cache TTL' },
+ {
+ key: 'last_used_param_values',
+ label: 'Last Used Param Values',
+ dynamicKey: true,
+ },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'last_viewed_at', label: 'Last Viewed At', format: 'datetime' },
+ { key: 'position', label: 'Position' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'collection', label: 'Collection', children: collectionFields3 },
+ {
+ key: 'parameters',
+ label: 'Parameters',
+ labelKey: 'name',
+ listItems: [
+ { key: 'id', label: 'ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'slug', label: 'Slug' },
+ { key: 'type', label: 'Type' },
+ { key: 'values_source_type', label: 'Values Source Type' },
+ { key: 'values_source_config', label: 'Values Source Config' },
+ ],
+ },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'public_uuid', label: 'Public UUID' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+ ],
+};
+
+export const metabaseUpdateDashboardSubscriptionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'creator', label: 'Creator', children: creatorFields2 },
+ {
+ key: 'channels',
+ label: 'Channels',
+ labelKey: 'id',
+ listItems: channelsFields,
+ },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'cards', label: 'Cards', labelKey: 'name', listItems: cardsFields },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'skip_if_empty', label: 'Skip If Empty', format: 'boolean' },
+ { key: 'parameters', label: 'Parameters' },
+ { key: 'disable_links', label: 'Disable Links', format: 'boolean' },
+ { key: 'dashboard_id', label: 'Dashboard ID', format: 'number' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+};
+
+export const metabaseUpdateDatabaseOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'features', label: 'Features' },
+ { key: 'timezone', label: 'Timezone' },
+ { key: 'auto_run_queries', label: 'Auto Run Queries', format: 'boolean' },
+ { key: 'is_stub', label: 'Is Stub', format: 'boolean' },
+ { key: 'name', label: 'Name' },
+ { key: 'caveats', label: 'Caveats' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'provider_name', label: 'Provider Name' },
+ { key: 'cache_ttl', label: 'Cache TTL' },
+ { key: 'id', label: 'ID', format: 'number' },
+ {
+ key: 'schedules',
+ label: 'Schedules',
+ children: [
+ {
+ key: 'metadata_sync',
+ label: 'Metadata Sync',
+ children: metadataSyncFields,
+ },
+ {
+ key: 'cache_field_values',
+ label: 'Cache Field Values',
+ children: cacheFieldValuesFields,
+ },
+ ],
+ },
+ { key: 'engine', label: 'Engine' },
+ { key: 'refingerprint', label: 'Refingerprint' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+ { key: 'admin_details', label: 'Admin Details' },
+ ],
+};
+
+export const metabaseUpdateFieldOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'database_type', label: 'Database Type' },
+ { key: 'semantic_type', label: 'Semantic Type' },
+ { key: 'table_id', label: 'Table ID', format: 'number' },
+ { key: 'coercion_strategy', label: 'Coercion Strategy' },
+ { key: 'database_indexed', label: 'Database Indexed' },
+ {
+ key: 'dimension_interestingness',
+ label: 'Dimension Interestingness',
+ format: 'number',
+ },
+ { key: 'name', label: 'Name' },
+ {
+ key: 'fingerprint_version',
+ label: 'Fingerprint Version',
+ format: 'number',
+ },
+ { key: 'has_field_values', label: 'Has Field Values' },
+ { key: 'database_is_pk', label: 'Database Is PK' },
+ { key: 'caveats', label: 'Caveats' },
+ { key: 'fk_target_field_id', label: 'FK Target Field ID' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'custom_position', label: 'Custom Position', format: 'number' },
+ { key: 'database_default', label: 'Database Default' },
+ { key: 'effective_type', label: 'Effective Type' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'parent_id', label: 'Parent ID' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'last_analyzed', label: 'Last Analyzed', format: 'datetime' },
+ { key: 'database_partitioned', label: 'Database Partitioned' },
+ {
+ key: 'database_is_auto_increment',
+ label: 'Database Is Auto Increment',
+ format: 'boolean',
+ },
+ { key: 'json_unfolding', label: 'JSON Unfolding', format: 'boolean' },
+ { key: 'position', label: 'Position', format: 'number' },
+ { key: 'visibility_type', label: 'Visibility Type' },
+ { key: 'target', label: 'Target' },
+ { key: 'preview_display', label: 'Preview Display', format: 'boolean' },
+ {
+ key: 'database_is_generated',
+ label: 'Database Is Generated',
+ format: 'boolean',
+ },
+ { key: 'data_sensitivity', label: 'Data Sensitivity' },
+ { key: 'display_name', label: 'Display Name' },
+ { key: 'database_position', label: 'Database Position', format: 'number' },
+ { key: 'database_required', label: 'Database Required', format: 'boolean' },
+ {
+ key: 'database_is_nullable',
+ label: 'Database Is Nullable',
+ format: 'boolean',
+ },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'base_type', label: 'Base Type' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+ ],
+};
+
+export const metabaseUpdateSnippetOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'creator', label: 'Creator', children: creatorFields2 },
+ { key: 'content', label: 'Content' },
+ { key: 'collection_id', label: 'Collection ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'template_tags', label: 'Template Tags' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+};
+
+export const metabaseUpdateTableOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'entity_type', label: 'Entity Type' },
+ { key: 'schema', label: 'Schema' },
+ { key: 'is_writable', label: 'Is Writable', format: 'boolean' },
+ { key: 'database_require_filter', label: 'Database Require Filter' },
+ { key: 'collection_id', label: 'Collection ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'transform_target', label: 'Transform Target', format: 'boolean' },
+ {
+ key: 'fields',
+ label: 'Fields',
+ labelKey: 'name',
+ listItems: [
+ { key: 'description', label: 'Description' },
+ { key: 'database_type', label: 'Database Type' },
+ { key: 'semantic_type', label: 'Semantic Type' },
+ { key: 'table_id', label: 'Table ID', format: 'number' },
+ { key: 'coercion_strategy', label: 'Coercion Strategy' },
+ { key: 'database_indexed', label: 'Database Indexed' },
+ {
+ key: 'dimension_interestingness',
+ label: 'Dimension Interestingness',
+ format: 'number',
+ },
+ { key: 'name', label: 'Name' },
+ {
+ key: 'fingerprint_version',
+ label: 'Fingerprint Version',
+ format: 'number',
+ },
+ { key: 'has_field_values', label: 'Has Field Values' },
+ { key: 'database_is_pk', label: 'Database Is PK', format: 'boolean' },
+ { key: 'caveats', label: 'Caveats' },
+ { key: 'fk_target_field_id', label: 'FK Target Field ID' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'custom_position', label: 'Custom Position', format: 'number' },
+ { key: 'database_default', label: 'Database Default' },
+ { key: 'effective_type', label: 'Effective Type' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'parent_id', label: 'Parent ID' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'last_analyzed', label: 'Last Analyzed' },
+ { key: 'database_partitioned', label: 'Database Partitioned' },
+ {
+ key: 'database_is_auto_increment',
+ label: 'Database Is Auto Increment',
+ format: 'boolean',
+ },
+ { key: 'json_unfolding', label: 'JSON Unfolding', format: 'boolean' },
+ { key: 'position', label: 'Position', format: 'number' },
+ { key: 'visibility_type', label: 'Visibility Type' },
+ { key: 'target', label: 'Target' },
+ { key: 'preview_display', label: 'Preview Display', format: 'boolean' },
+ {
+ key: 'database_is_generated',
+ label: 'Database Is Generated',
+ format: 'boolean',
+ },
+ { key: 'data_sensitivity', label: 'Data Sensitivity' },
+ { key: 'display_name', label: 'Display Name' },
+ {
+ key: 'database_position',
+ label: 'Database Position',
+ format: 'number',
+ },
+ {
+ key: 'database_required',
+ label: 'Database Required',
+ format: 'boolean',
+ },
+ {
+ key: 'database_is_nullable',
+ label: 'Database Is Nullable',
+ format: 'boolean',
+ },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'base_type', label: 'Base Type' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+ ],
+ },
+ { key: 'caveats', label: 'Caveats' },
+ { key: 'owner_email', label: 'Owner Email' },
+ { key: 'transform_id', label: 'Transform ID' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'is_published', label: 'Is Published', format: 'boolean' },
+ { key: 'owner_user_id', label: 'Owner User ID' },
+ { key: 'active', label: 'Active', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'db_id', label: 'DB ID', format: 'number' },
+ { key: 'archived_at', label: 'Archived At' },
+ { key: 'data_source', label: 'Data Source' },
+ { key: 'visibility_type', label: 'Visibility Type' },
+ { key: 'deactivated_at', label: 'Deactivated At' },
+ { key: 'data_authority', label: 'Data Authority' },
+ { key: 'is_upload', label: 'Is Upload', format: 'boolean' },
+ { key: 'display_name', label: 'Display Name' },
+ { key: 'data_layer', label: 'Data Layer' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'estimated_row_count', label: 'Estimated Row Count' },
+ { key: 'points_of_interest', label: 'Points Of Interest' },
+ ],
+};
+
+export const metabaseUpdateTimelineOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'description', label: 'Description' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'creator', label: 'Creator', children: creatorFields2 },
+ { key: 'default', label: 'Default', format: 'boolean' },
+ { key: 'collection_id', label: 'Collection ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'icon', label: 'Icon' },
+ { key: 'creator_id', label: 'Creator ID', format: 'number' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'entity_id', label: 'Entity ID' },
+ { key: 'collection', label: 'Collection', children: collectionFields3 },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+};
+
+export const metabaseUpdateUserOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'first_name', label: 'First Name' },
+ { key: 'is_data_analyst', label: 'Is Data Analyst', format: 'boolean' },
+ { key: 'locale', label: 'Locale' },
+ { key: 'last_login', label: 'Last Login' },
+ { key: 'is_active', label: 'Is Active', format: 'boolean' },
+ {
+ key: 'user_group_memberships',
+ label: 'User Group Memberships',
+ labelKey: 'id',
+ listItems: [{ key: 'id', label: 'ID', format: 'number' }],
+ },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'is_superuser', label: 'Is Superuser', format: 'boolean' },
+ { key: 'id', label: 'ID', format: 'number' },
+ { key: 'last_name', label: 'Last Name' },
+ { key: 'date_joined', label: 'Date Joined', format: 'datetime' },
+ { key: 'common_name', label: 'Common Name' },
+ ],
+};