memory_store_insight
Store and retrieve insights for LLMs to maintain knowledge continuity across sessions using the Model Context Protocol.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "memory_store_insight"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The main handler function for the 'memory_store_insight' tool. It extracts arguments, validates content, constructs a fact object, stores it using factStore, calculates quality score, and returns a formatted success or error response.
async handleStoreInsight(args) { try { const { content, type, domain, tags = [], context = {} } = args; if (!content || content.trim().length === 0) { throw new Error('Content is required and cannot be empty'); } const fact = { content: content.trim(), type, domain, tags, context, metadata: { source: 'manual_input', addedAt: new Date().toISOString(), }, }; const storedFact = await this.factStore.storeFact(fact); const qualityResult = this.qualityScorer.calculateQualityScore(storedFact); return { content: [ { type: 'text', text: `✅ Insight stored successfully!\n\n**ID:** ${storedFact.id}\n**Type:** ${storedFact.type}\n**Quality Score:** ${qualityResult.totalScore}/100\n**Domain:** ${storedFact.domain || 'general'}\n\n**Content:** ${storedFact.content}`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error storing insight: ${error.message}`, }, ], isError: true, }; } } - src/tools/modules/MemoryOperations.js:15-63 (registration)Registers the 'memory_store_insight' tool on the MCP server, including tool name, description, input schema, and the handler function reference.
registerStoreInsightTool(server) { server.registerTool( 'memory_store_insight', 'Store a new insight, pattern, or piece of knowledge in the memory system', { type: 'object', properties: { content: { type: 'string', description: 'The insight or knowledge content to store', }, type: { type: 'string', description: 'The type of fact (verified_pattern, anti_pattern, optimization, etc.)', enum: [ 'verified_pattern', 'anti_pattern', 'optimization', 'discovery', 'constraint', 'debugging_solution', 'tool_configuration', 'decision_rationale', 'experimental_approach', 'workflow_improvement', 'security_concern', ], }, domain: { type: 'string', description: 'The domain or area this applies to (e.g., web_development, data_science)', }, tags: { type: 'array', items: { type: 'string' }, description: 'Tags to categorize this insight', }, context: { type: 'object', description: 'Additional context about the technology, framework, or situation', }, }, required: ['content'], }, async (args) => { return await this.handleStoreInsight(args); } ); } - JSON schema defining the input parameters for the 'memory_store_insight' tool, including content (required), type (enum), domain, tags, and context.
type: 'object', properties: { content: { type: 'string', description: 'The insight or knowledge content to store', }, type: { type: 'string', description: 'The type of fact (verified_pattern, anti_pattern, optimization, etc.)', enum: [ 'verified_pattern', 'anti_pattern', 'optimization', 'discovery', 'constraint', 'debugging_solution', 'tool_configuration', 'decision_rationale', 'experimental_approach', 'workflow_improvement', 'security_concern', ], }, domain: { type: 'string', description: 'The domain or area this applies to (e.g., web_development, data_science)', }, tags: { type: 'array', items: { type: 'string' }, description: 'Tags to categorize this insight', }, context: { type: 'object', description: 'Additional context about the technology, framework, or situation', }, }, required: ['content'], },