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.9 KB
Raw Blame
import { HttpMethod } from '@activepieces/pieces-common';
import { createAction, Property } from '@activepieces/pieces-framework';
import { memAuth } from '../auth';
import { makeRequest } from '../common';

export const createMemAction = createAction({
  auth: memAuth,
  name: 'create_mem',
  classification: 'WRITE',
  displayName: 'Create Mem',
  description: 'Save any content to Mem.ai for intelligent processing and future reference.',
  audience: 'both',
  aiMetadata: {
    description: 'Sends raw content (HTML, emails, transcripts, or plain notes) to Mem.ai\'s "mem-it" endpoint, where it is intelligently processed and filed into the knowledge base; optionally accepts processing instructions and background context. Use to capture unstructured material and let Mem decide how to organize it, rather than writing a specific note. Not idempotent: each call ingests the content anew.',
    idempotent: false,
  },
  props: {
    input: Property.LongText({
      displayName: 'Input',
      required: true,
      description: 'Raw content you want to remember - HTML, emails, transcripts, or simple notes.',
    }),
    instructions: Property.LongText({
      displayName: 'Instructions',
      required: false,
      description: 'Optional guidance on how you want this content processed or remembered.',
    }),
    context: Property.LongText({
      displayName: 'Context',
      required: false,
      description: 'Additional background information to relate this to your existing knowledge.',
    }),
  },
  async run(context) {
    const { input, instructions, context: contextInfo } = context.propsValue;
    const apiKey = context.auth.secret_text;

    const body = {
      input,
      ...(instructions ? { instructions } : {}),
      ...(contextInfo ? { context: contextInfo } : {}),
    };

    const result = await makeRequest(
      apiKey,
      HttpMethod.POST,
      `/mem-it`,
      body
    );

    return result;
  },
});