Skip to main content
Glama

create_omi_memories

Generate structured memories from text or explicit memory objects for a user using the Omi MCP Server. Ideal for organizing and extracting meaningful information from emails, social posts, or other sources.

Instructions

Creates Omi memories by extracting from text or using explicit memory objects

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
memoriesNoAn array of explicit memory objects to be created directly. Either this or text must be provided.
textNoThe text content from which memories will be extracted. Either this or memories must be provided.
text_sourceNoSource of the text content. Optional. Options: "email", "social_post", "other".
text_source_specNoAdditional specification about the source. Optional.
user_idYesThe user ID to create memories for

Implementation Reference

  • The handler function that executes the tool logic: validates input, constructs POST request to Omi API to create memories from provided text or explicit memories, handles errors.
    async ({ user_id, text, memories, text_source, text_source_spec }) => { try { // Runtime check if (!text && !memories) { throw new Error('Either text or memories must be provided'); } const url = `https://api.omi.me/v2/integrations/${APP_ID}/user/memories?uid=${user_id}`; // Construct the body, including only defined fields const body: Record<string, any> = {}; if (text) body.text = text; if (memories) body.memories = memories; if (text_source) body.text_source = text_source; if (text_source_spec) body.text_source_spec = text_source_spec; log(`Creating memories with URL: ${url}`); log(`Request body: ${JSON.stringify(body)}`); const response = await fetch(url, { method: 'POST', headers: { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify(body), }); log(`Response status: ${response.status}`); if (!response.ok) { const errorText = await response.text(); throw new Error(`Failed to create memory: ${response.status} ${response.statusText} - ${errorText}`); } return { content: [{ type: 'text', text: '{}' }], }; } catch (error) { log(`Error creating memory: ${error}`); throw new Error(`Failed to create memory: ${error instanceof Error ? error.message : String(error)}`); } }
  • Zod schema defining the input parameters: user_id, optional text or memories, text_source, text_source_spec.
    user_id: z.string().describe('The user ID to create memories for'), text: z.string().optional().describe('The text content from which memories will be extracted. Either this or memories must be provided.'), memories: z .array( z.object({ content: z.string().describe('The content of the memory. Required.'), tags: z.array(z.string().describe('A tag for the memory.')).optional().describe('Optional tags for the memory.'), }) ) .optional() .describe('An array of explicit memory objects to be created directly. Either this or text must be provided.'), text_source: z.enum(['email', 'social_post', 'other']).optional().describe('Source of the text content. Optional. Options: "email", "social_post", "other".'), text_source_spec: z.string().optional().describe('Additional specification about the source. Optional.'), },
  • src/index.ts:307-368 (registration)
    The server.tool registration call that defines and registers the create_omi_memories tool with MCP server.
    server.tool( 'create_omi_memories', 'Creates Omi memories by extracting from text or using explicit memory objects', { user_id: z.string().describe('The user ID to create memories for'), text: z.string().optional().describe('The text content from which memories will be extracted. Either this or memories must be provided.'), memories: z .array( z.object({ content: z.string().describe('The content of the memory. Required.'), tags: z.array(z.string().describe('A tag for the memory.')).optional().describe('Optional tags for the memory.'), }) ) .optional() .describe('An array of explicit memory objects to be created directly. Either this or text must be provided.'), text_source: z.enum(['email', 'social_post', 'other']).optional().describe('Source of the text content. Optional. Options: "email", "social_post", "other".'), text_source_spec: z.string().optional().describe('Additional specification about the source. Optional.'), }, async ({ user_id, text, memories, text_source, text_source_spec }) => { try { // Runtime check if (!text && !memories) { throw new Error('Either text or memories must be provided'); } const url = `https://api.omi.me/v2/integrations/${APP_ID}/user/memories?uid=${user_id}`; // Construct the body, including only defined fields const body: Record<string, any> = {}; if (text) body.text = text; if (memories) body.memories = memories; if (text_source) body.text_source = text_source; if (text_source_spec) body.text_source_spec = text_source_spec; log(`Creating memories with URL: ${url}`); log(`Request body: ${JSON.stringify(body)}`); const response = await fetch(url, { method: 'POST', headers: { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify(body), }); log(`Response status: ${response.status}`); if (!response.ok) { const errorText = await response.text(); throw new Error(`Failed to create memory: ${response.status} ${response.statusText} - ${errorText}`); } return { content: [{ type: 'text', text: '{}' }], }; } catch (error) { log(`Error creating memory: ${error}`); throw new Error(`Failed to create memory: ${error instanceof Error ? error.message : String(error)}`); } } );

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/fourcolors/omi-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server