Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

1.2 KB
Raw Blame
import { Property, createAction } from '@activepieces/pieces-framework';
import { codaAuth } from '../auth';
import { codaClient } from '../common/types';
import { docIdDropdown, tableIdDropdown } from '../common/props';
import { getRowActionOutputSchema } from '../output-schemas';

export const getRowAction = createAction({
	auth: codaAuth,
	name: 'get-row',
	classification: 'READ',
	displayName: 'Get Row',
	description: 'Retrieves a single row by specified ID.',
	audience: 'human',
	aiMetadata: { description: 'Fetch one row from a Coda table by its row ID or unique row name, returning its cell values. Use when you already have a specific row identifier; use Find Row(s) instead to search by a column value. Read-only and idempotent.', idempotent: true },
	props: {
		docId: docIdDropdown,
		tableId: tableIdDropdown,
		rowIdOrName: Property.ShortText({
			displayName: 'Row ID or Name',
			required: true,
		}),
	},
	outputSchema: getRowActionOutputSchema,
	async run(context) {
		const { docId, tableId, rowIdOrName } = context.propsValue;
		const client = codaClient(context.auth);

		return await client.getRow(docId, tableId, rowIdOrName, {
			useColumnNames: true,
			valueFormat: 'simpleWithArrays',
		});
	},
});