import_knowledge
Import external knowledge sources into the MCP Self-Learning Server to enhance its autonomous learning capabilities through pattern recognition and machine learning.
Instructions
Import external knowledge
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source | Yes | ||
| merge | No |
Implementation Reference
- mcp-self-learning-server.js:1222-1247 (handler)The core handler function for the 'import_knowledge' tool. It reads a JSON file from the 'source' path, parses the knowledge data, and either merges patterns into the learning engine (if merge=true) or replaces the existing patterns entirely. Returns success status and import stats.async handleImportKnowledge(args) { const { source, merge = true } = args; try { const content = await fs.readFile(source, 'utf-8'); const knowledge = JSON.parse(content); if (merge) { await this.knowledgeSync.mergeKnowledge(); } else { // Replace existing knowledge this.learningEngine.patterns.clear(); for (const [key, pattern] of knowledge.patterns) { this.learningEngine.patterns.set(key, pattern); } } return { success: true, imported: knowledge.patterns.length, merged: merge }; } catch (error) { throw new Error(`Failed to import knowledge: ${error.message}`); } }
- mcp-self-learning-server.js:1005-1016 (registration)MCP tool registration in the ListTools response, including the tool name, description, and input schema specifying 'source' (required string path to knowledge file) and optional 'merge' boolean.{ name: 'import_knowledge', description: 'Import external knowledge', inputSchema: { type: 'object', properties: { source: { type: 'string' }, merge: { type: 'boolean', default: true } }, required: ['source'] } },
- Input schema definition for the import_knowledge tool, validating the arguments: required 'source' string and optional 'merge' boolean (defaults to true).inputSchema: { type: 'object', properties: { source: { type: 'string' }, merge: { type: 'boolean', default: true } }, required: ['source'] }