Skip to main content
Glama
fourcolors

Omi MCP Server

by fourcolors

create_omi_conversation

Generate Omi conversations by inputting text, metadata, and optional geolocation. Designed for AI assistants to store and manage user interactions via the Omi MCP Server.

Instructions

Creates a new Omi conversation with text content and metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
finished_atNoWhen the conversation/event ended in ISO 8601 format. Optional.
geolocationNoLocation data for the conversation. Optional object containing latitude and longitude.
languageNoLanguage code (e.g., "en" for English). Optional, defaults to "en".en
started_atNoWhen the conversation/event started in ISO 8601 format. Optional.
textYesThe full text content of the conversation
text_sourceYesSource of the text content. Required. Options: "audio_transcript", "message", "other_text".
text_source_specNoAdditional specification about the source. Optional.
user_idYesThe user ID to create the conversation for

Implementation Reference

  • Handler function that constructs a POST request to the Omi API to create a new conversation with provided text and metadata.
    async ({ text, user_id, text_source, started_at, finished_at, language, geolocation, text_source_spec }) => {
    	try {
    		const url = `https://api.omi.me/v2/integrations/${APP_ID}/user/conversations?uid=${user_id}`;
    
    		// Construct the body with required parameters
    		const body: Record<string, any> = {
    			text,
    			text_source,
    			language,
    		};
    
    		// Add optional parameters only if they are defined
    		if (started_at) body.started_at = started_at;
    		if (finished_at) body.finished_at = finished_at;
    		if (geolocation) body.geolocation = geolocation;
    		if (text_source_spec) body.text_source_spec = text_source_spec;
    
    		log(`Creating conversation 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 conversation: ${response.status} ${response.statusText} - ${errorText}`);
    		}
    
    		return {
    			content: [{ type: 'text', text: '{}' }],
    		};
    	} catch (error) {
    		log(`Error creating conversation: ${error}`);
    		throw new Error(`Failed to create conversation: ${error instanceof Error ? error.message : String(error)}`);
    	}
    }
  • Zod input schema defining parameters for creating an Omi conversation, including text, user_id, text_source, optional timestamps, language, geolocation, and text_source_spec.
    	text: z.string().describe('The full text content of the conversation'),
    	user_id: z.string().describe('The user ID to create the conversation for'),
    	text_source: z
    		.enum(['audio_transcript', 'message', 'other_text'])
    		.describe('Source of the text content. Required. Options: "audio_transcript", "message", "other_text".'),
    	started_at: z.string().optional().describe('When the conversation/event started in ISO 8601 format. Optional.'),
    	finished_at: z.string().optional().describe('When the conversation/event ended in ISO 8601 format. Optional.'),
    	language: z.string().default('en').describe('Language code (e.g., "en" for English). Optional, defaults to "en".'),
    	geolocation: z
    		.object({
    			latitude: z.number().describe('Latitude coordinate. Required when geolocation is provided.'),
    			longitude: z.number().describe('Longitude coordinate. Required when geolocation is provided.'),
    		})
    		.optional()
    		.describe('Location data for the conversation. Optional object containing latitude and longitude.'),
    	text_source_spec: z.string().optional().describe('Additional specification about the source. Optional.'),
    },
  • src/index.ts:227-292 (registration)
    Registration of the 'create_omi_conversation' tool on the MCP server using server.tool(), including description, input schema, and inline handler.
    server.tool(
    	'create_omi_conversation',
    	'Creates a new Omi conversation with text content and metadata',
    	{
    		text: z.string().describe('The full text content of the conversation'),
    		user_id: z.string().describe('The user ID to create the conversation for'),
    		text_source: z
    			.enum(['audio_transcript', 'message', 'other_text'])
    			.describe('Source of the text content. Required. Options: "audio_transcript", "message", "other_text".'),
    		started_at: z.string().optional().describe('When the conversation/event started in ISO 8601 format. Optional.'),
    		finished_at: z.string().optional().describe('When the conversation/event ended in ISO 8601 format. Optional.'),
    		language: z.string().default('en').describe('Language code (e.g., "en" for English). Optional, defaults to "en".'),
    		geolocation: z
    			.object({
    				latitude: z.number().describe('Latitude coordinate. Required when geolocation is provided.'),
    				longitude: z.number().describe('Longitude coordinate. Required when geolocation is provided.'),
    			})
    			.optional()
    			.describe('Location data for the conversation. Optional object containing latitude and longitude.'),
    		text_source_spec: z.string().optional().describe('Additional specification about the source. Optional.'),
    	},
    	async ({ text, user_id, text_source, started_at, finished_at, language, geolocation, text_source_spec }) => {
    		try {
    			const url = `https://api.omi.me/v2/integrations/${APP_ID}/user/conversations?uid=${user_id}`;
    
    			// Construct the body with required parameters
    			const body: Record<string, any> = {
    				text,
    				text_source,
    				language,
    			};
    
    			// Add optional parameters only if they are defined
    			if (started_at) body.started_at = started_at;
    			if (finished_at) body.finished_at = finished_at;
    			if (geolocation) body.geolocation = geolocation;
    			if (text_source_spec) body.text_source_spec = text_source_spec;
    
    			log(`Creating conversation 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 conversation: ${response.status} ${response.statusText} - ${errorText}`);
    			}
    
    			return {
    				content: [{ type: 'text', text: '{}' }],
    			};
    		} catch (error) {
    			log(`Error creating conversation: ${error}`);
    			throw new Error(`Failed to create conversation: ${error instanceof Error ? error.message : String(error)}`);
    		}
    	}
    );

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

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