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 { docsCommon } from '../common';
import { googleDocsAuth, getAccessToken } from '../auth';
import { createDocumentActionOutputSchema } from '../output-schemas';
export const createDocument = createAction({
auth: googleDocsAuth,
name: 'create_document',
classification: 'WRITE',
description: 'Create a document on Google Docs.',
audience: 'human',
aiMetadata: {
description:
'Creates a brand-new Google Docs document with the given title and writes the provided text into it. Use when an agent needs to generate a fresh document from content it has produced; to add to an existing document use Append Text instead. Not idempotent: every call creates a separate new document.',
idempotent: false,
},
displayName: 'Create Document',
propertyGroups: [
{
key: 'document',
display: 'section',
label: 'Document',
icon: 'file',
props: ['title'],
},
{
key: 'content',
display: 'section',
label: 'Content',
icon: 'text',
props: ['body'],
},
],
props: {
title: docsCommon.title,
body: docsCommon.body,
},
outputSchema: createDocumentActionOutputSchema,
async run(context) {
const accessToken = await getAccessToken(context.auth);
const document = await docsCommon.createDocument(
context.propsValue.title,
accessToken
);
const response = await docsCommon.writeToDocument(
document.documentId,
context.propsValue.body,
accessToken
);
return response;
},
});