set_importance
Assign importance levels (critical, important, normal, temporary, deprecated) to entities to manage and prioritize them effectively within the Memento MCP server.
Instructions
Set the importance level for an entity (critical, important, normal, temporary, deprecated).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entityName | Yes | Name of the entity. | |
| importance | Yes | Importance level for the entity. |
Implementation Reference
- src/server.js:222-240 (registration)Registers the MCP 'set_importance' tool, including Zod input schema (entityName: string, importance: enum), description, and async handler that resolves via KnowledgeGraphManager and returns formatted JSON response.this.tool( 'set_importance', 'Set the importance level for an entity (critical, important, normal, temporary, deprecated).', { entityName: z.string().describe('Name of the entity.'), importance: z.enum(['critical', 'important', 'normal', 'temporary', 'deprecated']) .describe('Importance level for the entity.') }, async ({ entityName, importance }) => ({ content: [{ type: 'text', text: JSON.stringify( await this.#knowledgeGraphManager.setImportance(entityName, importance), null, 2 ) }] }) );
- src/knowledge-graph-manager.js:326-348 (handler)Core business logic for setImportance: looks up entityId by name, delegates to ContextManager (searchContextManager), handles errors and formats success/error response.async setImportance(entityName, importance) { try { const entityId = await this.getEntityId(entityName); if (!entityId) { return { success: false, error: `Entity "${entityName}" not found` }; } const success = await this.#searchContextManager.setImportance(entityId, importance); return { success, entityName, importance, message: success ? `Importance set to '${importance}' for entity '${entityName}'` : `Failed to set importance for entity '${entityName}'` }; } catch (error) { return { success: false, error: error.message }; } }
- src/context-manager.js:587-595 (helper)Helper in ContextManager: validates importance against ImportanceLevel enum values, delegates to GraphRepository.setImportance.async setImportance(entityId, importance) { const validLevels = Object.values(ImportanceLevel); if (!validLevels.includes(importance)) { throw new Error(`Invalid importance level: ${importance}. Use ImportanceLevel enum values.`); } return this.#repository.setImportance(entityId, importance); }
- src/sqlite/graph-repo.js:471-478 (helper)SQLite GraphRepository implementation: SQL UPDATE on observations table to set importance for all observations of the entity.async setImportance(entityId, importance) { const result = await this.db.run( 'UPDATE observations SET importance = ? WHERE entity_id = ?', [importance, entityId] ); return result.changes > 0; }
- src/postgres/graph-repo.js:509-518 (helper)PostgreSQL GraphRepository implementation: SQL UPDATE on observations table to set importance for all observations of the entity.async setImportance(entityId, importance) { const rows = await this.#query( `UPDATE observations SET importance = $1 WHERE entity_id = $2 RETURNING id`, [ importance, entityId ] ); return rows.length > 0; }