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(nocodb): add AI actions and output schemas (#15865)

Kishan Parmarba93a93736ed
diff --git a/packages/pieces/community/nocodb/package.json b/packages/pieces/community/nocodb/package.json
index 60468100fe3..c91a279a7a8 100644
--- a/packages/pieces/community/nocodb/package.json
+++ b/packages/pieces/community/nocodb/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-nocodb",
- "version": "0.4.7",
+ "version": "0.5.0",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
diff --git a/packages/pieces/community/nocodb/src/index.ts b/packages/pieces/community/nocodb/src/index.ts
index 4b8a4d8271d..cf6a124fee3 100644
--- a/packages/pieces/community/nocodb/src/index.ts
+++ b/packages/pieces/community/nocodb/src/index.ts
@@ -4,12 +4,24 @@ import { deleteRecordAction } from './lib/actions/delete-record';
import { updateRecordAction } from './lib/actions/update-record';
import { getRecordAction } from './lib/actions/get-record';
import { searchRecordsAction } from './lib/actions/search-records';
+import { getCurrentUserAction } from './lib/actions/get-current-user';
+import { listWorkspacesAction } from './lib/actions/list-workspaces';
+import { listBasesAction } from './lib/actions/list-bases';
+import { getTableSchemaAction } from './lib/actions/get-table-schema';
+import { listViewSortsAction } from './lib/actions/list-view-sorts';
+import { createGridViewAction } from './lib/actions/create-grid-view';
+import { listViewColumnsAction } from './lib/actions/list-view-columns';
+import { updateViewColumnAction } from './lib/actions/update-view-column';
+import { deleteViewAction } from './lib/actions/delete-view';
+import { listNotificationsAction } from './lib/actions/list-notifications';
+import { getSharedViewGroupedDataAction } from './lib/actions/get-shared-view-grouped-data';
+import { uploadAttachmentByUrlAction } from './lib/actions/upload-attachment-by-url';
import { nocodbAuth } from './lib/auth';
export const nocodb = createPiece({
displayName: 'NocoDB',
auth: nocodbAuth,
- minimumSupportedRelease: '0.30.0',
+ minimumSupportedRelease: '0.88.2',
logoUrl: 'https://cdn.activepieces.com/pieces/nocodb.png',
authors: ['kishanprmr'],
actions: [
@@ -18,6 +30,18 @@ export const nocodb = createPiece({
updateRecordAction,
getRecordAction,
searchRecordsAction,
+ getCurrentUserAction,
+ listWorkspacesAction,
+ listBasesAction,
+ getTableSchemaAction,
+ listViewSortsAction,
+ createGridViewAction,
+ listViewColumnsAction,
+ updateViewColumnAction,
+ deleteViewAction,
+ listNotificationsAction,
+ getSharedViewGroupedDataAction,
+ uploadAttachmentByUrlAction,
],
triggers: [],
});
diff --git a/packages/pieces/community/nocodb/src/lib/actions/create-grid-view.ts b/packages/pieces/community/nocodb/src/lib/actions/create-grid-view.ts
new file mode 100644
index 00000000000..256c2a88a0f
--- /dev/null
+++ b/packages/pieces/community/nocodb/src/lib/actions/create-grid-view.ts
@@ -0,0 +1,34 @@
+import { nocodbAuth } from '../auth';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { makeClient } from '../common';
+import { nocodbCreateGridViewOutputSchema } from '../output-schemas';
+
+export const createGridViewAction = createAction({
+ auth: nocodbAuth,
+ name: 'nocodb-create-grid-view',
+ outputSchema: nocodbCreateGridViewOutputSchema,
+ classification: 'WRITE',
+ displayName: 'Create Grid View',
+ description: 'Creates a new grid view on the given table.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Creates a new grid view on a table with the given title. Use when an agent needs a dedicated view to configure (columns, sort) separately from the table\'s default view. Not idempotent: each call creates another view.',
+ idempotent: false,
+ },
+ props: {
+ tableId: Property.ShortText({
+ displayName: 'Table ID',
+ required: true,
+ }),
+ title: Property.ShortText({
+ displayName: 'Title',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { tableId, title } = context.propsValue;
+ const client = makeClient(context.auth);
+ return await client.createGridView(tableId, title);
+ },
+});
diff --git a/packages/pieces/community/nocodb/src/lib/actions/create-record.ts b/packages/pieces/community/nocodb/src/lib/actions/create-record.ts
index 077028df3b2..a16507116d3 100644
--- a/packages/pieces/community/nocodb/src/lib/actions/create-record.ts
+++ b/packages/pieces/community/nocodb/src/lib/actions/create-record.ts
@@ -1,10 +1,13 @@
import { nocodbAuth } from '../auth';
import { createAction, DynamicPropsValue } from '@activepieces/pieces-framework';
import { makeClient, nocodbCommon } from '../common';
+import { nocodbCreateRecordOutputSchema } from '../output-schemas';
export const createRecordAction = createAction({
auth: nocodbAuth,
name: 'nocodb-create-record',
+ classification: 'WRITE',
+ outputSchema: nocodbCreateRecordOutputSchema,
displayName: 'Create a Record',
description: 'Creates a new record in the given table.',
audience: 'both',
diff --git a/packages/pieces/community/nocodb/src/lib/actions/delete-record.ts b/packages/pieces/community/nocodb/src/lib/actions/delete-record.ts
index f52d8dd297b..19edd474026 100644
--- a/packages/pieces/community/nocodb/src/lib/actions/delete-record.ts
+++ b/packages/pieces/community/nocodb/src/lib/actions/delete-record.ts
@@ -1,10 +1,13 @@
import { nocodbAuth } from '../auth';
import { createAction, Property } from '@activepieces/pieces-framework';
import { makeClient, nocodbCommon } from '../common';
+import { nocodbCreateRecordOutputSchema } from '../output-schemas';
export const deleteRecordAction = createAction({
auth: nocodbAuth,
name: 'nocodb-delete-record',
+ classification: 'DESTRUCTIVE',
+ outputSchema: nocodbCreateRecordOutputSchema,
displayName: 'Delete a Record',
description: 'Deletes a record with the given Record ID.',
audience: 'both',
diff --git a/packages/pieces/community/nocodb/src/lib/actions/delete-view.ts b/packages/pieces/community/nocodb/src/lib/actions/delete-view.ts
new file mode 100644
index 00000000000..bc0cea573fd
--- /dev/null
+++ b/packages/pieces/community/nocodb/src/lib/actions/delete-view.ts
@@ -0,0 +1,30 @@
+import { nocodbAuth } from '../auth';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { makeClient } from '../common';
+import { nocodbResultOutputSchema } from '../output-schemas';
+
+export const deleteViewAction = createAction({
+ auth: nocodbAuth,
+ name: 'nocodb-delete-view',
+ outputSchema: nocodbResultOutputSchema,
+ classification: 'DESTRUCTIVE',
+ displayName: 'Delete View',
+ description: 'Deletes the given view.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Permanently deletes a view by its ID. Only removes the view itself, not the underlying table or its records. Not idempotent: deleting an already-deleted view fails.',
+ idempotent: false,
+ },
+ props: {
+ viewId: Property.ShortText({
+ displayName: 'View ID',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { viewId } = context.propsValue;
+ const client = makeClient(context.auth);
+ return await client.deleteView(viewId);
+ },
+});
diff --git a/packages/pieces/community/nocodb/src/lib/actions/get-current-user.ts b/packages/pieces/community/nocodb/src/lib/actions/get-current-user.ts
new file mode 100644
index 00000000000..e4c48b3bc39
--- /dev/null
+++ b/packages/pieces/community/nocodb/src/lib/actions/get-current-user.ts
@@ -0,0 +1,30 @@
+import { nocodbAuth } from '../auth';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { makeClient } from '../common';
+import { nocodbGetCurrentUserOutputSchema } from '../output-schemas';
+
+export const getCurrentUserAction = createAction({
+ auth: nocodbAuth,
+ name: 'nocodb-get-current-user',
+ outputSchema: nocodbGetCurrentUserOutputSchema,
+ classification: 'READ',
+ displayName: 'Get Current User',
+ description: 'Returns the profile and roles of the authenticated user.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns the identity, email, and roles of the account the connection belongs to, optionally scoped to a base. Use to confirm which account is authenticated or to check its role before a write. Idempotent read-only lookup.',
+ idempotent: true,
+ },
+ props: {
+ baseId: Property.ShortText({
+ displayName: 'Base ID',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { baseId } = context.propsValue;
+ const client = makeClient(context.auth);
+ return await client.getCurrentUser(baseId);
+ },
+});
diff --git a/packages/pieces/community/nocodb/src/lib/actions/get-record.ts b/packages/pieces/community/nocodb/src/lib/actions/get-record.ts
index 9c486e7626d..5d6ce30d89a 100644
--- a/packages/pieces/community/nocodb/src/lib/actions/get-record.ts
+++ b/packages/pieces/community/nocodb/src/lib/actions/get-record.ts
@@ -1,10 +1,13 @@
import { nocodbAuth } from '../auth';
import { createAction, Property } from '@activepieces/pieces-framework';
import { makeClient, nocodbCommon } from '../common';
+import { nocodbGetRecordOutputSchema } from '../output-schemas';
export const getRecordAction = createAction({
auth: nocodbAuth,
name: 'nocodb-get-record',
+ classification: 'READ',
+ outputSchema: nocodbGetRecordOutputSchema,
displayName: 'Get a Record',
description: 'Gets a record by the Record ID.',
audience: 'both',
diff --git a/packages/pieces/community/nocodb/src/lib/actions/get-shared-view-grouped-data.ts b/packages/pieces/community/nocodb/src/lib/actions/get-shared-view-grouped-data.ts
new file mode 100644
index 00000000000..4192aab86ba
--- /dev/null
+++ b/packages/pieces/community/nocodb/src/lib/actions/get-shared-view-grouped-data.ts
@@ -0,0 +1,41 @@
+import { nocodbAuth } from '../auth';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { makeClient } from '../common';
+import { nocodbGetSharedViewGroupedDataOutputSchema } from '../output-schemas';
+
+export const getSharedViewGroupedDataAction = createAction({
+ auth: nocodbAuth,
+ name: 'nocodb-get-shared-view-grouped-data',
+ outputSchema: nocodbGetSharedViewGroupedDataOutputSchema,
+ classification: 'SEARCH',
+ displayName: 'Get Shared View Grouped Data',
+ description: 'Returns the records of a public shared view, grouped by the given column.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Reads a public shared-view link\'s records grouped by a column, without requiring an authenticated connection to the base. Needs the shared view\'s UUID (from the view\'s share link) and the column ID to group by; pass the share password if the link is password-protected. Idempotent read-only query.',
+ idempotent: true,
+ },
+ props: {
+ sharedViewUuid: Property.ShortText({
+ displayName: 'Shared View UUID',
+ description: 'The UUID from the view\'s public share link.',
+ required: true,
+ }),
+ columnId: Property.ShortText({
+ displayName: 'Column ID',
+ description: 'The table column ID to group records by.',
+ required: true,
+ }),
+ password: Property.ShortText({
+ displayName: 'Share Password',
+ description: 'Only required if the shared view link is password-protected.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { sharedViewUuid, columnId, password } = context.propsValue;
+ const client = makeClient(context.auth);
+ return await client.getSharedViewGroupedData(sharedViewUuid, columnId, password);
+ },
+});
diff --git a/packages/pieces/community/nocodb/src/lib/actions/get-table-schema.ts b/packages/pieces/community/nocodb/src/lib/actions/get-table-schema.ts
new file mode 100644
index 00000000000..0d37fb92cf0
--- /dev/null
+++ b/packages/pieces/community/nocodb/src/lib/actions/get-table-schema.ts
@@ -0,0 +1,37 @@
+import { nocodbAuth } from '../auth';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { makeClient } from '../common';
+import { nocodbGetTableSchemaOutputSchema } from '../output-schemas';
+
+export const getTableSchemaAction = createAction({
+ auth: nocodbAuth,
+ name: 'nocodb-get-table-schema',
+ outputSchema: nocodbGetTableSchemaOutputSchema,
+ classification: 'READ',
+ displayName: 'Get Table Schema',
+ description: 'Returns the columns and metadata of the given table.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns a table\'s columns (name, id, type, and select options) and metadata. Use before creating or updating a record to see which fields exist and what values they accept, or to resolve a column ID for the view-column actions. Idempotent read-only lookup.',
+ idempotent: true,
+ },
+ props: {
+ baseId: Property.ShortText({
+ displayName: 'Base ID',
+ required: true,
+ }),
+ tableId: Property.ShortText({
+ displayName: 'Table ID',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { baseId, tableId } = context.propsValue;
+ const client = makeClient(context.auth);
+ const version = context.auth.props.version || 3;
+ return version === 4
+ ? await client.getTableV3(baseId, tableId, version)
+ : await client.getTable(baseId, tableId, version);
+ },
+});
diff --git a/packages/pieces/community/nocodb/src/lib/actions/list-bases.ts b/packages/pieces/community/nocodb/src/lib/actions/list-bases.ts
new file mode 100644
index 00000000000..3be5c16c9b5
--- /dev/null
+++ b/packages/pieces/community/nocodb/src/lib/actions/list-bases.ts
@@ -0,0 +1,31 @@
+import { nocodbAuth } from '../auth';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { makeClient } from '../common';
+import { nocodbListBasesOutputSchema } from '../output-schemas';
+
+export const listBasesAction = createAction({
+ auth: nocodbAuth,
+ name: 'nocodb-list-bases',
+ outputSchema: nocodbListBasesOutputSchema,
+ classification: 'READ',
+ displayName: 'List Bases',
+ description: 'Returns the bases within the given workspace (or the instance, on self-hosted).',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists bases (projects), used to resolve a Base ID before listing its tables. Pass a workspace ID from List Workspaces, or leave it unset on self-hosted instances. Idempotent read-only query.',
+ idempotent: true,
+ },
+ props: {
+ workspaceId: Property.ShortText({
+ displayName: 'Workspace ID',
+ description: 'Leave unset on self-hosted instances.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { workspaceId } = context.propsValue;
+ const client = makeClient(context.auth);
+ return await client.listBases(workspaceId, context.auth.props.version || 3);
+ },
+});
diff --git a/packages/pieces/community/nocodb/src/lib/actions/list-notifications.ts b/packages/pieces/community/nocodb/src/lib/actions/list-notifications.ts
new file mode 100644
index 00000000000..9478d7f09aa
--- /dev/null
+++ b/packages/pieces/community/nocodb/src/lib/actions/list-notifications.ts
@@ -0,0 +1,41 @@
+import { nocodbAuth } from '../auth';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { makeClient } from '../common';
+import { nocodbListNotificationsOutputSchema } from '../output-schemas';
+
+export const listNotificationsAction = createAction({
+ auth: nocodbAuth,
+ name: 'nocodb-list-notifications',
+ outputSchema: nocodbListNotificationsOutputSchema,
+ classification: 'SEARCH',
+ displayName: 'List Notifications',
+ description: 'Returns the authenticated user\'s notifications.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists the authenticated account\'s notifications. Leave Read Only unset to return all notifications regardless of read state, or check it to return only already-read ones; there is no unread-only filter. Use to check for recent activity across bases the account has access to. Idempotent read-only query.',
+ idempotent: true,
+ },
+ props: {
+ isRead: Property.Checkbox({
+ displayName: 'Read Only',
+ description: 'When checked, returns only already-read notifications. Leave unchecked to return all notifications (read and unread) — there is no unread-only filter.',
+ required: false,
+ }),
+ limit: Property.Number({
+ displayName: 'Limit',
+ required: false,
+ defaultValue: 25,
+ }),
+ offset: Property.Number({
+ displayName: 'Offset',
+ required: false,
+ defaultValue: 0,
+ }),
+ },
+ async run(context) {
+ const { isRead, limit, offset } = context.propsValue;
+ const client = makeClient(context.auth);
+ return await client.listNotifications(isRead, limit, offset);
+ },
+});
diff --git a/packages/pieces/community/nocodb/src/lib/actions/list-view-columns.ts b/packages/pieces/community/nocodb/src/lib/actions/list-view-columns.ts
new file mode 100644
index 00000000000..7772674f3cb
--- /dev/null
+++ b/packages/pieces/community/nocodb/src/lib/actions/list-view-columns.ts
@@ -0,0 +1,30 @@
+import { nocodbAuth } from '../auth';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { makeClient } from '../common';
+import { nocodbListViewColumnsOutputSchema } from '../output-schemas';
+
+export const listViewColumnsAction = createAction({
+ auth: nocodbAuth,
+ name: 'nocodb-list-view-columns',
+ outputSchema: nocodbListViewColumnsOutputSchema,
+ classification: 'READ',
+ displayName: 'List View Columns',
+ description: 'Returns the columns configured on the given view, with their view-scoped column IDs.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists a view\'s columns along with their visibility, order, and view-scoped column ID. That ID is required by Update View Column and is different from the table column ID returned by Get Table Schema. Idempotent read-only query.',
+ idempotent: true,
+ },
+ props: {
+ viewId: Property.ShortText({
+ displayName: 'View ID',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { viewId } = context.propsValue;
+ const client = makeClient(context.auth);
+ return await client.listViewColumns(viewId);
+ },
+});
diff --git a/packages/pieces/community/nocodb/src/lib/actions/list-view-sorts.ts b/packages/pieces/community/nocodb/src/lib/actions/list-view-sorts.ts
new file mode 100644
index 00000000000..7e211fa243b
--- /dev/null
+++ b/packages/pieces/community/nocodb/src/lib/actions/list-view-sorts.ts
@@ -0,0 +1,30 @@
+import { nocodbAuth } from '../auth';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { makeClient } from '../common';
+import { nocodbListViewSortsOutputSchema } from '../output-schemas';
+
+export const listViewSortsAction = createAction({
+ auth: nocodbAuth,
+ name: 'nocodb-list-view-sorts',
+ outputSchema: nocodbListViewSortsOutputSchema,
+ classification: 'READ',
+ displayName: 'List View Sorts',
+ description: 'Returns the sort rules configured on the given view.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists the field/direction sort rules applied to a view. Use to inspect a view\'s current ordering before changing it. Idempotent read-only query.',
+ idempotent: true,
+ },
+ props: {
+ viewId: Property.ShortText({
+ displayName: 'View ID',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { viewId } = context.propsValue;
+ const client = makeClient(context.auth);
+ return await client.listViewSorts(viewId);
+ },
+});
diff --git a/packages/pieces/community/nocodb/src/lib/actions/list-workspaces.ts b/packages/pieces/community/nocodb/src/lib/actions/list-workspaces.ts
new file mode 100644
index 00000000000..2b729bdc9ce
--- /dev/null
+++ b/packages/pieces/community/nocodb/src/lib/actions/list-workspaces.ts
@@ -0,0 +1,43 @@
+import { nocodbAuth } from '../auth';
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpError } from '@activepieces/pieces-common';
+import { makeClient } from '../common';
+import { ListAPIResponse, WorkspaceResponse } from '../common/types';
+import { nocodbListWorkspacesOutputSchema } from '../output-schemas';
+
+export const listWorkspacesAction = createAction({
+ auth: nocodbAuth,
+ name: 'nocodb-list-workspaces',
+ outputSchema: nocodbListWorkspacesOutputSchema,
+ classification: 'READ',
+ displayName: 'List Workspaces',
+ description: 'Returns the workspaces visible to the authenticated account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Lists the Cloud/Enterprise workspaces the account belongs to, used to resolve a workspace ID before listing its bases. On self-hosted Community Edition, workspaces do not exist and this returns an empty list rather than an error. Idempotent read-only query.',
+ idempotent: true,
+ },
+ props: {},
+ async run(context) {
+ const client = makeClient(context.auth);
+ try {
+ return await client.listWorkspaces();
+ } catch (error) {
+ if (error instanceof HttpError && error.response.status === 404) {
+ const emptyList: ListAPIResponse<WorkspaceResponse> = {
+ list: [],
+ pageInfo: {
+ totalRows: 0,
+ page: 1,
+ pageSize: 0,
+ isFirstPage: true,
+ isLastPage: true,
+ },
+ };
+ return emptyList;
+ }
+ throw error;
+ }
+ },
+});
diff --git a/packages/pieces/community/nocodb/src/lib/actions/search-records.ts b/packages/pieces/community/nocodb/src/lib/actions/search-records.ts
index ca43aa804be..0f6f5292bae 100644
--- a/packages/pieces/community/nocodb/src/lib/actions/search-records.ts
+++ b/packages/pieces/community/nocodb/src/lib/actions/search-records.ts
@@ -2,10 +2,13 @@ import { nocodbAuth } from '../auth';
import { createAction, Property } from '@activepieces/pieces-framework';
import { makeClient, nocodbCommon } from '../common';
import { ListAPIResponse, ListAPIV3Response } from '../common/types';
+import { nocodbSearchRecordsOutputSchema } from '../output-schemas';
export const searchRecordsAction = createAction({
auth: nocodbAuth,
name: 'nocodb-search-records',
+ classification: 'SEARCH',
+ outputSchema: nocodbSearchRecordsOutputSchema,
displayName: 'Search Records',
description: 'Returns a list of records matching the where condition.',
audience: 'both',
diff --git a/packages/pieces/community/nocodb/src/lib/actions/update-record.ts b/packages/pieces/community/nocodb/src/lib/actions/update-record.ts
index 613219786fa..d425fef4fec 100644
--- a/packages/pieces/community/nocodb/src/lib/actions/update-record.ts
+++ b/packages/pieces/community/nocodb/src/lib/actions/update-record.ts
@@ -5,10 +5,13 @@ import {
Property,
} from '@activepieces/pieces-framework';
import { makeClient, nocodbCommon } from '../common';
+import { nocodbCreateRecordOutputSchema } from '../output-schemas';
export const updateRecordAction = createAction({
auth: nocodbAuth,
name: 'nocodb-update-record',
+ classification: 'WRITE',
+ outputSchema: nocodbCreateRecordOutputSchema,
displayName: 'Update a Record',
description: 'Updates an existing record with the given Record ID.',
audience: 'both',
diff --git a/packages/pieces/community/nocodb/src/lib/actions/update-view-column.ts b/packages/pieces/community/nocodb/src/lib/actions/update-view-column.ts
new file mode 100644
index 00000000000..4314f7558e1
--- /dev/null
+++ b/packages/pieces/community/nocodb/src/lib/actions/update-view-column.ts
@@ -0,0 +1,43 @@
+import { nocodbAuth } from '../auth';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { makeClient } from '../common';
+import { nocodbResultOutputSchema } from '../output-schemas';
+
+export const updateViewColumnAction = createAction({
+ auth: nocodbAuth,
+ name: 'nocodb-update-view-column',
+ outputSchema: nocodbResultOutputSchema,
+ classification: 'WRITE',
+ displayName: 'Update View Column',
+ description: 'Shows, hides, or reorders a column within a view.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Updates a column\'s visibility and/or order within a specific view, identified by the view-scoped column ID from List View Columns (not the table column ID). Use to curate what an agent or user sees in a view. Idempotent: re-applying the same show/order state yields the same result.',
+ idempotent: true,
+ },
+ props: {
+ viewId: Property.ShortText({
+ displayName: 'View ID',
+ required: true,
+ }),
+ columnId: Property.ShortText({
+ displayName: 'View Column ID',
+ description: 'The view-scoped column ID from List View Columns, not the table column ID.',
+ required: true,
+ }),
+ show: Property.Checkbox({
+ displayName: 'Show',
+ required: false,
+ }),
+ order: Property.Number({
+ displayName: 'Order',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { viewId, columnId, show, order } = context.propsValue;
+ const client = makeClient(context.auth);
+ return await client.updateViewColumn(viewId, columnId, { show, order });
+ },
+});
diff --git a/packages/pieces/community/nocodb/src/lib/actions/upload-attachment-by-url.ts b/packages/pieces/community/nocodb/src/lib/actions/upload-attachment-by-url.ts
new file mode 100644
index 00000000000..dbd284f4b23
--- /dev/null
+++ b/packages/pieces/community/nocodb/src/lib/actions/upload-attachment-by-url.ts
@@ -0,0 +1,44 @@
+import { nocodbAuth } from '../auth';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { makeClient } from '../common';
+import { nocodbUploadAttachmentByUrlOutputSchema } from '../output-schemas';
+
+export const uploadAttachmentByUrlAction = createAction({
+ auth: nocodbAuth,
+ name: 'nocodb-upload-attachment-by-url',
+ outputSchema: nocodbUploadAttachmentByUrlOutputSchema,
+ classification: 'WRITE',
+ displayName: 'Upload Attachment By URL',
+ description: 'Uploads a file to NocoDB storage from a public URL, for use in an attachment column.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Fetches a file from a public URL and stores it in NocoDB storage, returning the attachment metadata to place into an attachment column value on a subsequent create/update record call. Not idempotent: each call stores another copy of the file.',
+ idempotent: false,
+ },
+ props: {
+ url: Property.ShortText({
+ displayName: 'File URL',
+ required: true,
+ }),
+ path: Property.ShortText({
+ displayName: 'Target Path',
+ description: 'The storage path to upload to, e.g. download/noco/<base>/<table>/attachment.',
+ required: true,
+ }),
+ title: Property.ShortText({
+ displayName: 'Title',
+ description: 'Display name for the attachment.',
+ required: false,
+ }),
+ mimetype: Property.ShortText({
+ displayName: 'MIME Type',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { url, path, title, mimetype } = context.propsValue;
+ const client = makeClient(context.auth);
+ return await client.uploadAttachmentByUrl(path, { url, title, mimetype });
+ },
+});
diff --git a/packages/pieces/community/nocodb/src/lib/common/client.ts b/packages/pieces/community/nocodb/src/lib/common/client.ts
index d53cb8059ab..1e4b5ac3d13 100644
--- a/packages/pieces/community/nocodb/src/lib/common/client.ts
+++ b/packages/pieces/community/nocodb/src/lib/common/client.ts
@@ -6,7 +6,9 @@ import {
HttpRequest,
} from '@activepieces/pieces-common';
import {
+ AttachmentUploadReq,
BaseResponse,
+ CurrentUserResponse,
DataOperationResponse,
DataOperationV3Response,
GetTableResponse,
@@ -14,7 +16,12 @@ import {
ListAPIResponse,
ListAPIV3Response,
ListRecordsParams,
+ NotificationResponse,
+ SharedViewGroupedDataItem,
TableResponse,
+ ViewColumnResponse,
+ ViewResponse,
+ ViewSortResponse,
WorkspaceResponse,
} from './types';
@@ -263,4 +270,94 @@ export class NocoDBClient {
return makeRequest<ListAPIResponse<Record<string, unknown>>>();
}
}
+
+ async getCurrentUser(baseId?: string): Promise<CurrentUserResponse> {
+ return await this.makeRequest<CurrentUserResponse>(
+ HttpMethod.GET,
+ '/v1/auth/user/me',
+ baseId ? { base_id: baseId } : undefined
+ );
+ }
+
+ async listNotifications(
+ isRead?: boolean,
+ limit?: number,
+ offset?: number
+ ): Promise<ListAPIResponse<NotificationResponse>> {
+ return await this.makeRequest<ListAPIResponse<NotificationResponse>>(
+ HttpMethod.GET,
+ '/v1/notifications',
+ { is_read: isRead === undefined ? undefined : String(isRead), limit, offset }
+ );
+ }
+
+ async listViewSorts(viewId: string): Promise<ListAPIResponse<ViewSortResponse>> {
+ return await this.makeRequest<ListAPIResponse<ViewSortResponse>>(
+ HttpMethod.GET,
+ `/v1/db/meta/views/${viewId}/sorts`
+ );
+ }
+
+ async listViewColumns(viewId: string): Promise<ListAPIResponse<ViewColumnResponse>> {
+ return await this.makeRequest<ListAPIResponse<ViewColumnResponse>>(
+ HttpMethod.GET,
+ `/v1/db/meta/views/${viewId}/columns`
+ );
+ }
+
+ async updateViewColumn(
+ viewId: string,
+ columnId: string,
+ input: { show?: boolean; order?: number }
+ ) {
+ return await this.makeRequest(
+ HttpMethod.PATCH,
+ `/v1/db/meta/views/${viewId}/columns/${columnId}`,
+ undefined,
+ input
+ );
+ }
+
+ async createGridView(tableId: string, title: string): Promise<ViewResponse> {
+ return await this.makeRequest<ViewResponse>(
+ HttpMethod.POST,
+ `/v1/db/meta/tables/${tableId}/grids`,
+ undefined,
+ { title }
+ );
+ }
+
+ async deleteView(viewId: string) {
+ return await this.makeRequest(HttpMethod.DELETE, `/v1/db/meta/views/${viewId}`);
+ }
+
+ async getSharedViewGroupedData(
+ sharedViewUuid: string,
+ columnId: string,
+ password?: string
+ ): Promise<SharedViewGroupedDataItem[]> {
+ const baseUrl = this.hostUrl.replace(/\/$/, '');
+ const request: HttpRequest = {
+ method: HttpMethod.GET,
+ url: `${baseUrl}/api/v1/db/public/shared-view/${sharedViewUuid}/group/${columnId}`,
+ headers: password ? { 'xc-password': password } : undefined,
+ };
+ const response = await httpClient.sendRequest<SharedViewGroupedDataItem[]>(request);
+ return response.body;
+ }
+
+ async uploadAttachmentByUrl(path: string, attachment: AttachmentUploadReq) {
+ const baseUrl = this.hostUrl.replace(/\/$/, '');
+ const request: HttpRequest = {
+ method: HttpMethod.POST,
+ url: `${baseUrl}/api/v1/db/storage/upload-by-url`,
+ headers: {
+ 'xc-token': this.apiToken,
+ },
+ queryParams: { path },
+ body: [attachment],
+ };
+ const response = await httpClient.sendRequest(request);
+ return response.body;
+ }
}
diff --git a/packages/pieces/community/nocodb/src/lib/common/types.ts b/packages/pieces/community/nocodb/src/lib/common/types.ts
index 6343ada9437..c8451fbe71a 100644
--- a/packages/pieces/community/nocodb/src/lib/common/types.ts
+++ b/packages/pieces/community/nocodb/src/lib/common/types.ts
@@ -148,3 +148,60 @@ export interface DataOperationV3Response {
export type DataOperationResponse =
| Record<string, unknown>
| DataOperationV3Response;
+
+export interface CurrentUserResponse {
+ id: string;
+ email: string;
+ email_verified: boolean;
+ firstname: string | null;
+ lastname: string | null;
+ roles: Record<string, boolean>;
+ base_roles?: Record<string, boolean>;
+ workspace_roles?: Record<string, boolean>;
+}
+
+export interface NotificationResponse {
+ id: string;
+ type: string;
+ body: Record<string, unknown>;
+ is_read: boolean;
+ is_deleted: boolean;
+ created_at: string;
+ updated_at: string;
+}
+
+export interface ViewSortResponse {
+ id: string;
+ fk_view_id: string;
+ fk_column_id: string;
+ direction: string;
+}
+
+export interface ViewColumnResponse {
+ id: string;
+ fk_view_id: string;
+ fk_column_id: string;
+ show: boolean;
+ order: number;
+}
+
+export interface ViewResponse {
+ id: string;
+ title: string;
+ type: number;
+ fk_model_id: string;
+ base_id: string;
+ uuid: string | null;
+ show: boolean;
+}
+
+export interface SharedViewGroupedDataItem {
+ key: string;
+ value: Record<string, unknown>[];
+}
+
+export interface AttachmentUploadReq {
+ url: string;
+ title?: string;
+ mimetype?: string;
+}
diff --git a/packages/pieces/community/nocodb/src/lib/output-schemas.ts b/packages/pieces/community/nocodb/src/lib/output-schemas.ts
new file mode 100644
index 00000000000..88219cafeee
--- /dev/null
+++ b/packages/pieces/community/nocodb/src/lib/output-schemas.ts
@@ -0,0 +1,275 @@
+import { OutputSchema } from '@activepieces/pieces-framework';
+
+const nocodbPageInfoFields: OutputSchema['fields'] = [
+ { key: 'totalRows', label: 'Total Rows', format: 'number' },
+ { key: 'page', label: 'Page', format: 'number' },
+ { key: 'pageSize', label: 'Page Size', format: 'number' },
+ { key: 'isFirstPage', label: 'Is First Page', format: 'boolean' },
+ { key: 'isLastPage', label: 'Is Last Page', format: 'boolean' },
+];
+
+const nocodbViewFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'View ID' },
+ { key: 'title', label: 'Title' },
+ { key: 'type', label: 'Type', format: 'number' },
+ { key: 'is_default', label: 'Is Default', format: 'boolean' },
+ { key: 'show_system_fields', label: 'Show System Fields', format: 'boolean' },
+ { key: 'order', label: 'Order', format: 'number' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'description', label: 'Description' },
+];
+
+const nocodbColumnFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Column ID' },
+ { key: 'title', label: 'Title' },
+ { key: 'column_name', label: 'Column Name' },
+ { key: 'uidt', label: 'UI Data Type' },
+ { key: 'pk', label: 'Primary Key', format: 'boolean' },
+ { key: 'pv', label: 'Primary Value', format: 'boolean' },
+ { key: 'rqd', label: 'Required', format: 'boolean' },
+ { key: 'system', label: 'System', format: 'boolean' },
+ { key: 'readonly', label: 'Readonly', format: 'boolean' },
+ { key: 'order', label: 'Order', format: 'number' },
+ { key: 'description', label: 'Description' },
+];
+
+const nocodbColumnV3Fields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Column ID' },
+ { key: 'title', label: 'Title' },
+ { key: 'type', label: 'Type' },
+];
+
+const nocodbRecordV4Fields: OutputSchema['fields'] = [
+ { key: 'id', label: 'ID (API v4)' },
+ { key: 'fields', label: 'Fields (API v4)', dynamicKey: true },
+];
+
+export const nocodbCreateGridViewOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'base_id', label: 'Base ID' },
+ { key: 'fk_model_id', label: 'Table ID' },
+ ...nocodbViewFields,
+ ],
+};
+
+export const nocodbResultOutputSchema: OutputSchema = {
+ fields: [{ key: 'result', label: 'Result', value: '' }],
+};
+
+export const nocodbGetCurrentUserOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'id', label: 'ID' },
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'display_name', label: 'Display Name' },
+ { key: 'is_api_token', label: 'Is API Token', format: 'boolean' },
+ { key: 'is_new_user', label: 'Is New User', format: 'boolean' },
+ { key: 'isAuthorized', label: 'Is Authorized', format: 'boolean' },
+ { key: 'roles', label: 'Roles', dynamicKey: true },
+ ],
+};
+
+export const nocodbGetRecordOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'Id', label: 'ID', format: 'number' },
+ { key: 'Title', label: 'Title' },
+ { key: 'CreatedAt', label: 'Created At', format: 'datetime' },
+ { key: 'UpdatedAt', label: 'Updated At', format: 'datetime' },
+ ...nocodbRecordV4Fields,
+ ],
+};
+
+export const nocodbCreateRecordOutputSchema: OutputSchema = {
+ fields: [{ key: 'Id', label: 'ID', format: 'number' }, ...nocodbRecordV4Fields],
+};
+
+export const nocodbGetTableSchemaOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'id', label: 'Table ID' },
+ { key: 'base_id', label: 'Base ID' },
+ { key: 'table_name', label: 'Table Name' },
+ { key: 'title', label: 'Title' },
+ { key: 'enabled', label: 'Enabled', format: 'boolean' },
+ { key: 'order', label: 'Order', format: 'number' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'description', label: 'Description' },
+ {
+ key: 'views',
+ label: 'Views',
+ labelKey: 'title',
+ listItems: nocodbViewFields,
+ },
+ {
+ key: 'columns',
+ label: 'Columns',
+ labelKey: 'title',
+ listItems: nocodbColumnFields,
+ },
+ {
+ key: 'fields',
+ label: 'Fields (API v4)',
+ labelKey: 'title',
+ listItems: nocodbColumnV3Fields,
+ },
+ ],
+};
+
+export const nocodbListBasesOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'list',
+ label: 'List',
+ labelKey: 'title',
+ listItems: [
+ { key: 'id', label: 'ID' },
+ { key: 'title', label: 'Title' },
+ { key: 'prefix', label: 'Prefix' },
+ { key: 'status', label: 'Status' },
+ { key: 'description', label: 'Description' },
+ { key: 'color', label: 'Color' },
+ { key: 'type', label: 'Type' },
+ { key: 'default_role', label: 'Default Role' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'last_accessed', label: 'Last Accessed', format: 'datetime' },
+ ],
+ },
+ { key: 'pageInfo', label: 'Page Info', children: nocodbPageInfoFields },
+ ],
+};
+
+export const nocodbListNotificationsOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'list',
+ label: 'List',
+ labelKey: 'id',
+ listItems: [
+ { key: 'id', label: 'ID' },
+ { key: 'type', label: 'Type' },
+ { key: 'body', label: 'Body' },
+ { key: 'is_read', label: 'Is Read', format: 'boolean' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ ],
+ },
+ { key: 'pageInfo', label: 'Page Info', children: nocodbPageInfoFields },
+ { key: 'unreadCount', label: 'Unread Count', format: 'number' },
+ ],
+};
+
+export const nocodbListViewColumnsOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'list',
+ label: 'List',
+ labelKey: 'id',
+ listItems: [
+ { key: 'id', label: 'View Column ID' },
+ { key: 'fk_column_id', label: 'Column ID' },
+ { key: 'label', label: 'Label' },
+ { key: 'show', label: 'Show', format: 'boolean' },
+ { key: 'order', label: 'Order', format: 'number' },
+ ],
+ },
+ ],
+};
+
+export const nocodbListViewSortsOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'list',
+ label: 'List',
+ labelKey: 'fk_column_id',
+ listItems: [
+ { key: 'id', label: 'Sort ID' },
+ { key: 'fk_column_id', label: 'Column ID' },
+ { key: 'direction', label: 'Direction' },
+ ],
+ },
+ ],
+};
+
+export const nocodbListWorkspacesOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'list',
+ label: 'List',
+ labelKey: 'title',
+ listItems: [
+ { key: 'id', label: 'ID' },
+ { key: 'title', label: 'Title' },
+ { key: 'description', label: 'Description' },
+ { key: 'status', label: 'Status', format: 'number' },
+ ],
+ },
+ { key: 'pageInfo', label: 'Page Info', children: nocodbPageInfoFields },
+ ],
+};
+
+export const nocodbSearchRecordsOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'items',
+ label: 'Found Records',
+ value: '',
+ listItems: [
+ { key: 'Id', label: 'ID', format: 'number' },
+ { key: 'Title', label: 'Title' },
+ { key: 'CreatedAt', label: 'Created At', format: 'datetime' },
+ { key: 'UpdatedAt', label: 'Updated At', format: 'datetime' },
+ ...nocodbRecordV4Fields,
+ ],
+ },
+ ],
+ itemLabel: 'Record {Id}',
+};
+
+export const nocodbGetSharedViewGroupedDataOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'items',
+ label: 'Groups',
+ value: '',
+ listItems: [
+ { key: 'key', label: 'Key' },
+ {
+ key: 'value',
+ label: 'Value',
+ children: [
+ {
+ key: 'list',
+ label: 'List',
+ listItems: [
+ { key: 'Id', label: 'ID', format: 'number' },
+ { key: 'Title', label: 'Title' },
+ ],
+ },
+ { key: 'pageInfo', label: 'Page Info', children: nocodbPageInfoFields },
+ ],
+ },
+ ],
+ },
+ ],
+ itemLabel: '{key}',
+};
+
+export const nocodbUploadAttachmentByUrlOutputSchema: OutputSchema = {
+ fields: [
+ {
+ key: 'items',
+ label: 'Uploaded Files',
+ value: '',
+ listItems: [
+ { key: 'url', label: 'URL', format: 'image' },
+ { key: 'title', label: 'Title' },
+ { key: 'mimetype', label: 'Mimetype' },
+ { key: 'size', label: 'Size', format: 'filesize' },
+ { key: 'width', label: 'Width', format: 'number' },
+ { key: 'height', label: 'Height', format: 'number' },
+ { key: 'signedUrl', label: 'Signed URL', format: 'image' },
+ ],
+ },
+ ],
+ itemLabel: '{title}',
+};