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
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
import { createAction } from '@activepieces/pieces-framework';
import { postgresAuth } from '../auth';
import { pgClient, postgresUtils } from '../common';
import { getTablesOutputSchema } from '../output-schemas';
export const getTables = createAction({
auth: postgresAuth,
name: 'get-tables',
classification: 'SEARCH',
displayName: 'Get Tables',
description: 'Returns the tables in the database',
audience: 'both',
outputSchema: getTablesOutputSchema,
aiMetadata: {
description: 'Lists every base table in the connected PostgreSQL database, each with its schema and table name. Use to discover the schema before reading or writing rows. Takes no input; read-only and idempotent.',
idempotent: true,
},
props: {},
async run(context) {
const client = await pgClient(context.auth);
try {
const tables = await postgresUtils.listTables(client);
return { tables };
} finally {
await client.end();
}
},
});