Skip to main content
Glama

add_observations

Enhance entities with text observations and index them for full-text and semantic search on Memento, a local, offline MCP server.

Instructions

Add text observations to existing entities and index them for full-text and semantic search.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
observationsYesList of {entityName, contents} pairs.

Implementation Reference

  • Core implementation of addObservations: inserts observations for entities, generates embeddings using a transformer model, and stores vectors for semantic search.
    async addObservations(list) { const results = []; for (const { entityName, contents } of list) { const entityId = await this.#repository.getOrCreateEntityId(entityName, 'Unknown'); const inserted = []; for (const content of contents) { const { inserted: wasInserted, observationId } = await this.#repository.insertObservation(entityId, content); if (wasInserted && observationId !== null && observationId !== undefined) { inserted.push({ observationId, content }); } } if (inserted.length) { const embeddings = await this.embedTexts(inserted.map(row => row.content)); const vectorRows = inserted.map((row, index) => ({ observationId: row.observationId, entityId, embedding: embeddings[index] })); await this.#repository.insertObservationVectors(vectorRows); } results.push({ entityName, addedObservations: inserted.map(item => item.content) }); } return results; }
  • src/server.js:90-110 (registration)
    MCP tool registration for 'add_observations', defining input schema with Zod and thin handler that calls KnowledgeGraphManager.addObservations and returns JSON response.
    // Tool: add_observations this.tool( 'add_observations', 'Add text observations to existing entities and index them for full-text and semantic search.', { observations: z.array(z.object({ entityName: z.string().describe('Name of the entity to annotate.'), contents: z.array(z.string()).describe('List of text observations to add.') })).describe('List of {entityName, contents} pairs.') }, async ({ observations }) => ({ content: [{ type: 'text', text: JSON.stringify( await this.#knowledgeGraphManager.addObservations(observations), null, 2 ) }] }) );
  • Zod input schema for the add_observations tool: array of objects with entityName (string) and contents (array of strings).
    { observations: z.array(z.object({ entityName: z.string().describe('Name of the entity to annotate.'), contents: z.array(z.string()).describe('List of text observations to add.') })).describe('List of {entityName, contents} pairs.') },

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/iAchilles/memento'

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